From ac4cb5d0fe341a402f364f9355794f5701149c35 Mon Sep 17 00:00:00 2001 From: HausdorffHimself Date: Mon, 5 Aug 2013 18:31:04 +0200 Subject: [PATCH 1/8] New Feature: Themen/Informationen --- app/assets/javascripts/attachments.js.coffee | 3 + app/assets/javascripts/fragen.js.coffee | 3 + app/assets/javascripts/themen.js.coffee | 3 + .../javascripts/themengruppen.js.coffee | 3 + app/assets/stylesheets/attachments.css.scss | 3 + app/assets/stylesheets/fragen.css.scss | 3 + app/assets/stylesheets/themen.css.scss | 3 + app/assets/stylesheets/themengruppen.css.scss | 3 + app/controllers/attachments_controller.rb | 83 +++++++++ app/controllers/fragen_controller.rb | 83 +++++++++ app/controllers/themen_controller.rb | 83 +++++++++ app/controllers/themengruppen_controller.rb | 83 +++++++++ app/helpers/attachments_helper.rb | 2 + app/helpers/fragen_helper.rb | 2 + app/helpers/themen_helper.rb | 2 + app/helpers/themengruppen_helper.rb | 2 + app/models/attachment.rb | 8 + app/models/attachment.rb~ | 4 + app/models/frage.rb | 10 ++ app/models/frage.rb~ | 3 + app/models/lva.rb~ | 52 ++++++ app/models/modulgruppe.rb~ | 28 +++ app/models/thema.rb | 10 ++ app/models/thema.rb~ | 5 + app/models/themengruppe.rb | 8 + app/models/themengruppe.rb~ | 3 + app/views/attachments/_form.html.erb | 9 + app/views/attachments/edit.html.erb | 6 + app/views/attachments/index.html.erb | 23 +++ app/views/attachments/new.html.erb | 5 + app/views/attachments/show.html.erb | 10 ++ app/views/fragen/_form.html.erb | 10 ++ app/views/fragen/edit.html.erb | 6 + app/views/fragen/index.html.erb | 25 +++ app/views/fragen/new.html.erb | 5 + app/views/fragen/show.html.erb | 15 ++ app/views/themen/_form.html.erb | 10 ++ app/views/themen/edit.html.erb | 6 + app/views/themen/index.html.erb | 25 +++ app/views/themen/new.html.erb | 5 + app/views/themen/show.html.erb | 15 ++ app/views/themengruppen/_form.html.erb | 10 ++ app/views/themengruppen/edit.html.erb | 6 + app/views/themengruppen/index.html.erb | 25 +++ app/views/themengruppen/new.html.erb | 5 + app/views/themengruppen/show.html.erb | 15 ++ config/environments/development.rb~ | 37 ++++ config/initializers/inflections.rb | 6 + config/initializers/inflections.rb~ | 35 ++++ config/routes.rb | 12 ++ ...9085446_create_lva_semester_join_table.rb~ | 21 +++ .../20130805143616_create_themengruppen.rb | 10 ++ db/migrate/20130805143719_create_themen.rb | 10 ++ .../20130805143839_create_attachments.rb | 9 + db/migrate/20130805143919_create_fragen.rb | 10 ++ .../attachments_controller_spec.rb | 160 ++++++++++++++++++ spec/controllers/fragen_controller_spec.rb | 160 ++++++++++++++++++ spec/controllers/themen_controller_spec.rb | 160 ++++++++++++++++++ .../themengruppen_controller_spec.rb | 160 ++++++++++++++++++ spec/factories/attachments.rb | 7 + spec/factories/fragen.rb | 8 + spec/factories/studien.rb~ | 12 ++ spec/factories/themen.rb | 8 + spec/factories/themengruppen.rb | 8 + spec/helpers/attachments_helper_spec.rb | 15 ++ spec/helpers/fragen_helper_spec.rb | 15 ++ spec/helpers/themen_helper_spec.rb | 15 ++ spec/helpers/themengruppen_helper_spec.rb | 15 ++ spec/models/attachment_spec.rb | 5 + spec/models/frage_spec.rb | 5 + spec/models/thema_spec.rb | 5 + spec/models/themengruppe_spec.rb | 5 + spec/requests/attachments_spec.rb | 11 ++ spec/requests/fragen_spec.rb | 11 ++ spec/requests/themen_spec.rb | 11 ++ spec/requests/themengruppen_spec.rb | 11 ++ spec/routing/attachments_routing_spec.rb | 35 ++++ spec/routing/fragen_routing_spec.rb | 35 ++++ spec/routing/themen_routing_spec.rb | 35 ++++ spec/routing/themengruppen_routing_spec.rb | 35 ++++ spec/views/attachments/edit.html.erb_spec.rb | 18 ++ spec/views/attachments/index.html.erb_spec.rb | 20 +++ spec/views/attachments/new.html.erb_spec.rb | 18 ++ spec/views/attachments/show.html.erb_spec.rb | 15 ++ spec/views/fragen/edit.html.erb_spec.rb | 20 +++ spec/views/fragen/index.html.erb_spec.rb | 23 +++ spec/views/fragen/new.html.erb_spec.rb | 20 +++ spec/views/fragen/show.html.erb_spec.rb | 17 ++ spec/views/themen/edit.html.erb_spec.rb | 20 +++ spec/views/themen/index.html.erb_spec.rb | 23 +++ spec/views/themen/new.html.erb_spec.rb | 20 +++ spec/views/themen/show.html.erb_spec.rb | 17 ++ .../views/themengruppen/edit.html.erb_spec.rb | 20 +++ .../themengruppen/index.html.erb_spec.rb | 23 +++ spec/views/themengruppen/new.html.erb_spec.rb | 20 +++ .../views/themengruppen/show.html.erb_spec.rb | 17 ++ 96 files changed, 2139 insertions(+) create mode 100644 app/assets/javascripts/attachments.js.coffee create mode 100644 app/assets/javascripts/fragen.js.coffee create mode 100644 app/assets/javascripts/themen.js.coffee create mode 100644 app/assets/javascripts/themengruppen.js.coffee create mode 100644 app/assets/stylesheets/attachments.css.scss create mode 100644 app/assets/stylesheets/fragen.css.scss create mode 100644 app/assets/stylesheets/themen.css.scss create mode 100644 app/assets/stylesheets/themengruppen.css.scss create mode 100644 app/controllers/attachments_controller.rb create mode 100644 app/controllers/fragen_controller.rb create mode 100644 app/controllers/themen_controller.rb create mode 100644 app/controllers/themengruppen_controller.rb create mode 100644 app/helpers/attachments_helper.rb create mode 100644 app/helpers/fragen_helper.rb create mode 100644 app/helpers/themen_helper.rb create mode 100644 app/helpers/themengruppen_helper.rb create mode 100644 app/models/attachment.rb create mode 100644 app/models/attachment.rb~ create mode 100644 app/models/frage.rb create mode 100644 app/models/frage.rb~ create mode 100755 app/models/lva.rb~ create mode 100755 app/models/modulgruppe.rb~ create mode 100644 app/models/thema.rb create mode 100644 app/models/thema.rb~ create mode 100644 app/models/themengruppe.rb create mode 100644 app/models/themengruppe.rb~ create mode 100644 app/views/attachments/_form.html.erb create mode 100644 app/views/attachments/edit.html.erb create mode 100644 app/views/attachments/index.html.erb create mode 100644 app/views/attachments/new.html.erb create mode 100644 app/views/attachments/show.html.erb create mode 100644 app/views/fragen/_form.html.erb create mode 100644 app/views/fragen/edit.html.erb create mode 100644 app/views/fragen/index.html.erb create mode 100644 app/views/fragen/new.html.erb create mode 100644 app/views/fragen/show.html.erb create mode 100644 app/views/themen/_form.html.erb create mode 100644 app/views/themen/edit.html.erb create mode 100644 app/views/themen/index.html.erb create mode 100644 app/views/themen/new.html.erb create mode 100644 app/views/themen/show.html.erb create mode 100644 app/views/themengruppen/_form.html.erb create mode 100644 app/views/themengruppen/edit.html.erb create mode 100644 app/views/themengruppen/index.html.erb create mode 100644 app/views/themengruppen/new.html.erb create mode 100644 app/views/themengruppen/show.html.erb create mode 100644 config/environments/development.rb~ create mode 100755 config/initializers/inflections.rb~ create mode 100644 db/migrate/20130729085446_create_lva_semester_join_table.rb~ create mode 100644 db/migrate/20130805143616_create_themengruppen.rb create mode 100644 db/migrate/20130805143719_create_themen.rb create mode 100644 db/migrate/20130805143839_create_attachments.rb create mode 100644 db/migrate/20130805143919_create_fragen.rb create mode 100644 spec/controllers/attachments_controller_spec.rb create mode 100644 spec/controllers/fragen_controller_spec.rb create mode 100644 spec/controllers/themen_controller_spec.rb create mode 100644 spec/controllers/themengruppen_controller_spec.rb create mode 100644 spec/factories/attachments.rb create mode 100644 spec/factories/fragen.rb create mode 100644 spec/factories/studien.rb~ create mode 100644 spec/factories/themen.rb create mode 100644 spec/factories/themengruppen.rb create mode 100644 spec/helpers/attachments_helper_spec.rb create mode 100644 spec/helpers/fragen_helper_spec.rb create mode 100644 spec/helpers/themen_helper_spec.rb create mode 100644 spec/helpers/themengruppen_helper_spec.rb create mode 100644 spec/models/attachment_spec.rb create mode 100644 spec/models/frage_spec.rb create mode 100644 spec/models/thema_spec.rb create mode 100644 spec/models/themengruppe_spec.rb create mode 100644 spec/requests/attachments_spec.rb create mode 100644 spec/requests/fragen_spec.rb create mode 100644 spec/requests/themen_spec.rb create mode 100644 spec/requests/themengruppen_spec.rb create mode 100644 spec/routing/attachments_routing_spec.rb create mode 100644 spec/routing/fragen_routing_spec.rb create mode 100644 spec/routing/themen_routing_spec.rb create mode 100644 spec/routing/themengruppen_routing_spec.rb create mode 100644 spec/views/attachments/edit.html.erb_spec.rb create mode 100644 spec/views/attachments/index.html.erb_spec.rb create mode 100644 spec/views/attachments/new.html.erb_spec.rb create mode 100644 spec/views/attachments/show.html.erb_spec.rb create mode 100644 spec/views/fragen/edit.html.erb_spec.rb create mode 100644 spec/views/fragen/index.html.erb_spec.rb create mode 100644 spec/views/fragen/new.html.erb_spec.rb create mode 100644 spec/views/fragen/show.html.erb_spec.rb create mode 100644 spec/views/themen/edit.html.erb_spec.rb create mode 100644 spec/views/themen/index.html.erb_spec.rb create mode 100644 spec/views/themen/new.html.erb_spec.rb create mode 100644 spec/views/themen/show.html.erb_spec.rb create mode 100644 spec/views/themengruppen/edit.html.erb_spec.rb create mode 100644 spec/views/themengruppen/index.html.erb_spec.rb create mode 100644 spec/views/themengruppen/new.html.erb_spec.rb create mode 100644 spec/views/themengruppen/show.html.erb_spec.rb diff --git a/app/assets/javascripts/attachments.js.coffee b/app/assets/javascripts/attachments.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/attachments.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/fragen.js.coffee b/app/assets/javascripts/fragen.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/fragen.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/themen.js.coffee b/app/assets/javascripts/themen.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/themen.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/themengruppen.js.coffee b/app/assets/javascripts/themengruppen.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/themengruppen.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/attachments.css.scss b/app/assets/stylesheets/attachments.css.scss new file mode 100644 index 0000000..544b428 --- /dev/null +++ b/app/assets/stylesheets/attachments.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the attachments controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/fragen.css.scss b/app/assets/stylesheets/fragen.css.scss new file mode 100644 index 0000000..cb8ec54 --- /dev/null +++ b/app/assets/stylesheets/fragen.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the fragen controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/themen.css.scss b/app/assets/stylesheets/themen.css.scss new file mode 100644 index 0000000..daecefa --- /dev/null +++ b/app/assets/stylesheets/themen.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the themen controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/themengruppen.css.scss b/app/assets/stylesheets/themengruppen.css.scss new file mode 100644 index 0000000..074b60a --- /dev/null +++ b/app/assets/stylesheets/themengruppen.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the themengruppen controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb new file mode 100644 index 0000000..aa8ec7c --- /dev/null +++ b/app/controllers/attachments_controller.rb @@ -0,0 +1,83 @@ +class AttachmentsController < ApplicationController + # GET /attachments + # GET /attachments.json + def index + @attachments = Attachment.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @attachments } + end + end + + # GET /attachments/1 + # GET /attachments/1.json + def show + @attachment = Attachment.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @attachment } + end + end + + # GET /attachments/new + # GET /attachments/new.json + def new + @attachment = Attachment.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @attachment } + end + end + + # GET /attachments/1/edit + def edit + @attachment = Attachment.find(params[:id]) + end + + # POST /attachments + # POST /attachments.json + def create + @attachment = Attachment.new(params[:attachment]) + + respond_to do |format| + if @attachment.save + format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' } + format.json { render json: @attachment, status: :created, location: @attachment } + else + format.html { render action: "new" } + format.json { render json: @attachment.errors, status: :unprocessable_entity } + end + end + end + + # PUT /attachments/1 + # PUT /attachments/1.json + def update + @attachment = Attachment.find(params[:id]) + + respond_to do |format| + if @attachment.update_attributes(params[:attachment]) + format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @attachment.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /attachments/1 + # DELETE /attachments/1.json + def destroy + @attachment = Attachment.find(params[:id]) + @attachment.destroy + + respond_to do |format| + format.html { redirect_to attachments_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/fragen_controller.rb b/app/controllers/fragen_controller.rb new file mode 100644 index 0000000..7f3ac25 --- /dev/null +++ b/app/controllers/fragen_controller.rb @@ -0,0 +1,83 @@ +class FragenController < ApplicationController + # GET /fragen + # GET /fragen.json + def index + @fragen = Frage.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @fragen } + end + end + + # GET /fragen/1 + # GET /fragen/1.json + def show + @frage = Frage.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @frage } + end + end + + # GET /fragen/new + # GET /fragen/new.json + def new + @frage = Frage.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @frage } + end + end + + # GET /fragen/1/edit + def edit + @frage = Frage.find(params[:id]) + end + + # POST /fragen + # POST /fragen.json + def create + @frage = Frage.new(params[:frage]) + + respond_to do |format| + if @frage.save + format.html { redirect_to @frage, notice: 'Frage was successfully created.' } + format.json { render json: @frage, status: :created, location: @frage } + else + format.html { render action: "new" } + format.json { render json: @frage.errors, status: :unprocessable_entity } + end + end + end + + # PUT /fragen/1 + # PUT /fragen/1.json + def update + @frage = Frage.find(params[:id]) + + respond_to do |format| + if @frage.update_attributes(params[:frage]) + format.html { redirect_to @frage, notice: 'Frage was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @frage.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /fragen/1 + # DELETE /fragen/1.json + def destroy + @frage = Frage.find(params[:id]) + @frage.destroy + + respond_to do |format| + format.html { redirect_to fragen_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/themen_controller.rb b/app/controllers/themen_controller.rb new file mode 100644 index 0000000..bb9235e --- /dev/null +++ b/app/controllers/themen_controller.rb @@ -0,0 +1,83 @@ +class ThemenController < ApplicationController + # GET /themen + # GET /themen.json + def index + @themen = Thema.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @themen } + end + end + + # GET /themen/1 + # GET /themen/1.json + def show + @thema = Thema.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @thema } + end + end + + # GET /themen/new + # GET /themen/new.json + def new + @thema = Thema.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @thema } + end + end + + # GET /themen/1/edit + def edit + @thema = Thema.find(params[:id]) + end + + # POST /themen + # POST /themen.json + def create + @thema = Thema.new(params[:thema]) + + respond_to do |format| + if @thema.save + format.html { redirect_to @thema, notice: 'Thema was successfully created.' } + format.json { render json: @thema, status: :created, location: @thema } + else + format.html { render action: "new" } + format.json { render json: @thema.errors, status: :unprocessable_entity } + end + end + end + + # PUT /themen/1 + # PUT /themen/1.json + def update + @thema = Thema.find(params[:id]) + + respond_to do |format| + if @thema.update_attributes(params[:thema]) + format.html { redirect_to @thema, notice: 'Thema was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @thema.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /themen/1 + # DELETE /themen/1.json + def destroy + @thema = Thema.find(params[:id]) + @thema.destroy + + respond_to do |format| + format.html { redirect_to themen_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/themengruppen_controller.rb b/app/controllers/themengruppen_controller.rb new file mode 100644 index 0000000..46fa1d4 --- /dev/null +++ b/app/controllers/themengruppen_controller.rb @@ -0,0 +1,83 @@ +class ThemengruppenController < ApplicationController + # GET /themengruppen + # GET /themengruppen.json + def index + @themengruppen = Themengruppe.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @themengruppen } + end + end + + # GET /themengruppen/1 + # GET /themengruppen/1.json + def show + @themagruppen = Themengruppe.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @themagruppen } + end + end + + # GET /themengruppen/new + # GET /themengruppen/new.json + def new + @themagruppen = Themengruppe.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @themagruppen } + end + end + + # GET /themengruppen/1/edit + def edit + @themagruppen = Themengruppe.find(params[:id]) + end + + # POST /themengruppen + # POST /themengruppen.json + def create + @themagruppen = Themengruppe.new(params[:themagruppen]) + + respond_to do |format| + if @themagruppen.save + format.html { redirect_to @themagruppen, notice: 'Themengruppe was successfully created.' } + format.json { render json: @themagruppen, status: :created, location: @themagruppen } + else + format.html { render action: "new" } + format.json { render json: @themagruppen.errors, status: :unprocessable_entity } + end + end + end + + # PUT /themengruppen/1 + # PUT /themengruppen/1.json + def update + @themagruppen = Themengruppe.find(params[:id]) + + respond_to do |format| + if @themagruppen.update_attributes(params[:themagruppen]) + format.html { redirect_to @themagruppen, notice: 'Themengruppe was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @themagruppen.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /themengruppen/1 + # DELETE /themengruppen/1.json + def destroy + @themagruppen = Themengruppe.find(params[:id]) + @themagruppen.destroy + + respond_to do |format| + format.html { redirect_to themengruppen_url } + format.json { head :no_content } + end + end +end diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb new file mode 100644 index 0000000..3c961c9 --- /dev/null +++ b/app/helpers/attachments_helper.rb @@ -0,0 +1,2 @@ +module AttachmentsHelper +end diff --git a/app/helpers/fragen_helper.rb b/app/helpers/fragen_helper.rb new file mode 100644 index 0000000..062e2a8 --- /dev/null +++ b/app/helpers/fragen_helper.rb @@ -0,0 +1,2 @@ +module FragenHelper +end diff --git a/app/helpers/themen_helper.rb b/app/helpers/themen_helper.rb new file mode 100644 index 0000000..4a30030 --- /dev/null +++ b/app/helpers/themen_helper.rb @@ -0,0 +1,2 @@ +module ThemenHelper +end diff --git a/app/helpers/themengruppen_helper.rb b/app/helpers/themengruppen_helper.rb new file mode 100644 index 0000000..c9eab59 --- /dev/null +++ b/app/helpers/themengruppen_helper.rb @@ -0,0 +1,2 @@ +module ThemengruppenHelper +end diff --git a/app/models/attachment.rb b/app/models/attachment.rb new file mode 100644 index 0000000..fe3d597 --- /dev/null +++ b/app/models/attachment.rb @@ -0,0 +1,8 @@ +class Attachment < ActiveRecord::Base + has_paper_trail + attr_accessible :name + belongs_to :thema + + validates :thema, :presence => true + validates :name, :presence => true +end diff --git a/app/models/attachment.rb~ b/app/models/attachment.rb~ new file mode 100644 index 0000000..f433a3b --- /dev/null +++ b/app/models/attachment.rb~ @@ -0,0 +1,4 @@ +class Attachment < ActiveRecord::Base + attr_accessible :name + belongs_to :thema +end diff --git a/app/models/frage.rb b/app/models/frage.rb new file mode 100644 index 0000000..8a47df4 --- /dev/null +++ b/app/models/frage.rb @@ -0,0 +1,10 @@ +class Frage < ActiveRecord::Base + has_paper_trail + attr_accessible :text, :title + belongs_to :thema + + validates :thema, :presence => true + validates :title, :prescece => true + + translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true +end diff --git a/app/models/frage.rb~ b/app/models/frage.rb~ new file mode 100644 index 0000000..27bc8c4 --- /dev/null +++ b/app/models/frage.rb~ @@ -0,0 +1,3 @@ +class Frage < ActiveRecord::Base + attr_accessible :text, :title +end diff --git a/app/models/lva.rb~ b/app/models/lva.rb~ new file mode 100755 index 0000000..f4668a9 --- /dev/null +++ b/app/models/lva.rb~ @@ -0,0 +1,52 @@ +## +# Author:: Andreas Stephanides +# License:: GPL +# Dieses Model repräsentiert eine LVA. Die notwendigen Informationen können mit TISS (dem Online System der TU Wien) synchronisiert werden + +class Lva < ActiveRecord::Base + has_paper_trail # Versionsver + attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids + has_and_belongs_to_many :moduls + has_and_belongs_to_many :semester + translates :desc, :fallbacks_for_empty_translations => true + has_many :beispiele , :class_name => "Beispiel" + after_initialize :load_tissdata +## +# Lade den Hash aus TISS und speichere diesen in @hash +# + def hash + url= "https://tiss.tuwien.ac.at/api/course/"+ self.lvanr.to_s+"-2012W" + @hash=Hash.from_xml(open(url).read) + end + + def objective + @hash["course"]["objective"][I18n.locale.to_s] + end + def techingContent + @hash["course"]["teachingContent"][I18n.locale.to_s] + end + def person +@person +end + +private + +def load_tissdata + url= "https://tiss.tuwien.ac.at/api/course/"+ self.lvanr.to_s+"-2012W" + begin + @hash=Hash.from_xml(open(url).read)["tuvienna"] + @person=[] + if @hash["course"]["lecturers"]["oid"].is_a? String + @person = @hash["course"]["lecturers"]["oid"] + else + @hash["course"]["lecturers"]["oid"].each do |pid| + @person << Hash.from_xml(open("https://tiss.tuwien.ac.at/adressbuch/adressbuch/person_via_oid/" + pid.to_s + ".xml").read)["tuvienna"]["person"] + end + end + rescue OpenURI::HTTPError => e + end +end + + + +end diff --git a/app/models/modulgruppe.rb~ b/app/models/modulgruppe.rb~ new file mode 100755 index 0000000..2c06647 --- /dev/null +++ b/app/models/modulgruppe.rb~ @@ -0,0 +1,28 @@ +# == Schema Information +# +# Table name: modulgruppen +# +# id :integer not null, primary key +# typ :string(255) +# phase :integer +# name :string(255) +# desc :text +# studium_id :integer +# created_at :datetime not null +# updated_at :datetime not null +# + +class Modulgruppe < ActiveRecord::Base + attr_accessible :name, :phase, :typ,:desc, :studium_id + belongs_to :studium, :foreign_key => "studium_id" + has_and_belongs_to_many :moduls + + resourcify + + validates :studium_id, :presence => true # Bei der Abfrage ist student_id entscheidend + #validates :studium, :presence => true # Wird gesetzt, um das richtige Feld zu melden bei Fehlern + validates :name, :uniqueness =>{:scope => :studium_id}, :presence=>true # Pro Studium darf ein Name nur einmal vorkommen + validates :phase, :inclusion => {:in => [1, 2, 3, 4]} + validates :typ, :inclusion => {:in => ["Pflicht","Vertiefungspflicht","Wahl"] } + translates :desc, :versioning =>true,:fallbacks_for_empty_translations => true +end diff --git a/app/models/thema.rb b/app/models/thema.rb new file mode 100644 index 0000000..71edf91 --- /dev/null +++ b/app/models/thema.rb @@ -0,0 +1,10 @@ +class Thema < ActiveRecord::Base + has_paper_trail + attr_accessible :text, :title + has_many :fragen + has_many :attachments + belongs_to :themengruppe + + validates :themengruppe, :presence => true + validates :title, :presence => true +end diff --git a/app/models/thema.rb~ b/app/models/thema.rb~ new file mode 100644 index 0000000..fd3bc93 --- /dev/null +++ b/app/models/thema.rb~ @@ -0,0 +1,5 @@ +class Thema < ActiveRecord::Base + attr_accessible :text, :title + has_many :fragen + belongs_to :themengruppe +end diff --git a/app/models/themengruppe.rb b/app/models/themengruppe.rb new file mode 100644 index 0000000..95cf797 --- /dev/null +++ b/app/models/themengruppe.rb @@ -0,0 +1,8 @@ +class Themengruppe < ActiveRecord::Base + has_paper_trail + attr_accessible :text, :title + has_many :themen + has_many :fragen, through: :themen + + validates :title, :presence => true +end diff --git a/app/models/themengruppe.rb~ b/app/models/themengruppe.rb~ new file mode 100644 index 0000000..c96a7c5 --- /dev/null +++ b/app/models/themengruppe.rb~ @@ -0,0 +1,3 @@ +class Themengruppe < ActiveRecord::Base + attr_accessible :text, :title +end diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb new file mode 100644 index 0000000..75bc493 --- /dev/null +++ b/app/views/attachments/_form.html.erb @@ -0,0 +1,9 @@ +<%= semantic_form_for @attachment do |f| %> + <%= f.inputs do %> + <%= f.input :name %> + <% end %> + + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> diff --git a/app/views/attachments/edit.html.erb b/app/views/attachments/edit.html.erb new file mode 100644 index 0000000..b2a2cfe --- /dev/null +++ b/app/views/attachments/edit.html.erb @@ -0,0 +1,6 @@ +

Editing attachment

+ +<%= render 'form' %> + +<%= link_to 'Show', @attachment %> | +<%= link_to 'Back', attachments_path %> diff --git a/app/views/attachments/index.html.erb b/app/views/attachments/index.html.erb new file mode 100644 index 0000000..579b4dc --- /dev/null +++ b/app/views/attachments/index.html.erb @@ -0,0 +1,23 @@ +

Listing attachments

+ + + + + + + + + +<% @attachments.each do |attachment| %> + + + + + + +<% end %> +
Name
<%= attachment.name %><%= link_to 'Show', attachment %><%= link_to 'Edit', edit_attachment_path(attachment) %><%= link_to 'Destroy', attachment, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Attachment', new_attachment_path %> diff --git a/app/views/attachments/new.html.erb b/app/views/attachments/new.html.erb new file mode 100644 index 0000000..b7a66aa --- /dev/null +++ b/app/views/attachments/new.html.erb @@ -0,0 +1,5 @@ +

New attachment

+ +<%= render 'form' %> + +<%= link_to 'Back', attachments_path %> diff --git a/app/views/attachments/show.html.erb b/app/views/attachments/show.html.erb new file mode 100644 index 0000000..b43b363 --- /dev/null +++ b/app/views/attachments/show.html.erb @@ -0,0 +1,10 @@ +

<%= notice %>

+ +

+ Name: + <%= @attachment.name %> +

+ + +<%= link_to 'Edit', edit_attachment_path(@attachment) %> | +<%= link_to 'Back', attachments_path %> diff --git a/app/views/fragen/_form.html.erb b/app/views/fragen/_form.html.erb new file mode 100644 index 0000000..bd59b87 --- /dev/null +++ b/app/views/fragen/_form.html.erb @@ -0,0 +1,10 @@ +<%= semantic_form_for @frage do |f| %> + <%= f.inputs do %> + <%= f.input :title %> + <%= f.input :text %> + <% end %> + + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> diff --git a/app/views/fragen/edit.html.erb b/app/views/fragen/edit.html.erb new file mode 100644 index 0000000..e754df9 --- /dev/null +++ b/app/views/fragen/edit.html.erb @@ -0,0 +1,6 @@ +

Editing frage

+ +<%= render 'form' %> + +<%= link_to 'Show', @frage %> | +<%= link_to 'Back', fragen_path %> diff --git a/app/views/fragen/index.html.erb b/app/views/fragen/index.html.erb new file mode 100644 index 0000000..79fbe0d --- /dev/null +++ b/app/views/fragen/index.html.erb @@ -0,0 +1,25 @@ +

Listing fragen

+ + + + + + + + + + +<% @fragen.each do |frage| %> + + + + + + + +<% end %> +
TitleText
<%= frage.title %><%= frage.text %><%= link_to 'Show', frage %><%= link_to 'Edit', edit_frage_path(frage) %><%= link_to 'Destroy', frage, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Frage', new_frage_path %> diff --git a/app/views/fragen/new.html.erb b/app/views/fragen/new.html.erb new file mode 100644 index 0000000..b883819 --- /dev/null +++ b/app/views/fragen/new.html.erb @@ -0,0 +1,5 @@ +

New frage

+ +<%= render 'form' %> + +<%= link_to 'Back', fragen_path %> diff --git a/app/views/fragen/show.html.erb b/app/views/fragen/show.html.erb new file mode 100644 index 0000000..4718b83 --- /dev/null +++ b/app/views/fragen/show.html.erb @@ -0,0 +1,15 @@ +

<%= notice %>

+ +

+ Title: + <%= @frage.title %> +

+ +

+ Text: + <%= @frage.text %> +

+ + +<%= link_to 'Edit', edit_frage_path(@frage) %> | +<%= link_to 'Back', fragen_path %> diff --git a/app/views/themen/_form.html.erb b/app/views/themen/_form.html.erb new file mode 100644 index 0000000..060b29b --- /dev/null +++ b/app/views/themen/_form.html.erb @@ -0,0 +1,10 @@ +<%= semantic_form_for @thema do |f| %> + <%= f.inputs do %> + <%= f.input :title %> + <%= f.input :text %> + <% end %> + + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> diff --git a/app/views/themen/edit.html.erb b/app/views/themen/edit.html.erb new file mode 100644 index 0000000..9230c28 --- /dev/null +++ b/app/views/themen/edit.html.erb @@ -0,0 +1,6 @@ +

Editing thema

+ +<%= render 'form' %> + +<%= link_to 'Show', @thema %> | +<%= link_to 'Back', themen_path %> diff --git a/app/views/themen/index.html.erb b/app/views/themen/index.html.erb new file mode 100644 index 0000000..3c9e293 --- /dev/null +++ b/app/views/themen/index.html.erb @@ -0,0 +1,25 @@ +

Listing themen

+ + + + + + + + + + +<% @themen.each do |thema| %> + + + + + + + +<% end %> +
TitleText
<%= thema.title %><%= thema.text %><%= link_to 'Show', thema %><%= link_to 'Edit', edit_thema_path(thema) %><%= link_to 'Destroy', thema, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Thema', new_thema_path %> diff --git a/app/views/themen/new.html.erb b/app/views/themen/new.html.erb new file mode 100644 index 0000000..5a0ff02 --- /dev/null +++ b/app/views/themen/new.html.erb @@ -0,0 +1,5 @@ +

New thema

+ +<%= render 'form' %> + +<%= link_to 'Back', themen_path %> diff --git a/app/views/themen/show.html.erb b/app/views/themen/show.html.erb new file mode 100644 index 0000000..8dd7605 --- /dev/null +++ b/app/views/themen/show.html.erb @@ -0,0 +1,15 @@ +

<%= notice %>

+ +

+ Title: + <%= @thema.title %> +

+ +

+ Text: + <%= @thema.text %> +

+ + +<%= link_to 'Edit', edit_thema_path(@thema) %> | +<%= link_to 'Back', themen_path %> diff --git a/app/views/themengruppen/_form.html.erb b/app/views/themengruppen/_form.html.erb new file mode 100644 index 0000000..c81d3ff --- /dev/null +++ b/app/views/themengruppen/_form.html.erb @@ -0,0 +1,10 @@ +<%= semantic_form_for @themengruppe do |f| %> + <%= f.inputs do %> + <%= f.input :title %> + <%= f.input :text %> + <% end %> + + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> diff --git a/app/views/themengruppen/edit.html.erb b/app/views/themengruppen/edit.html.erb new file mode 100644 index 0000000..8247722 --- /dev/null +++ b/app/views/themengruppen/edit.html.erb @@ -0,0 +1,6 @@ +

Editing themagruppen

+ +<%= render 'form' %> + +<%= link_to 'Show', @themagruppen %> | +<%= link_to 'Back', themengruppen_path %> diff --git a/app/views/themengruppen/index.html.erb b/app/views/themengruppen/index.html.erb new file mode 100644 index 0000000..f4655e1 --- /dev/null +++ b/app/views/themengruppen/index.html.erb @@ -0,0 +1,25 @@ +

Listing themengruppen

+ + + + + + + + + + +<% @themengruppen.each do |themagruppen| %> + + + + + + + +<% end %> +
TitleText
<%= themagruppen.title %><%= themagruppen.text %><%= link_to 'Show', themagruppen %><%= link_to 'Edit', edit_themagruppen_path(themagruppen) %><%= link_to 'Destroy', themagruppen, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Themengruppe', new_themagruppen_path %> diff --git a/app/views/themengruppen/new.html.erb b/app/views/themengruppen/new.html.erb new file mode 100644 index 0000000..add5cb1 --- /dev/null +++ b/app/views/themengruppen/new.html.erb @@ -0,0 +1,5 @@ +

New themagruppen

+ +<%= render 'form' %> + +<%= link_to 'Back', themengruppen_path %> diff --git a/app/views/themengruppen/show.html.erb b/app/views/themengruppen/show.html.erb new file mode 100644 index 0000000..3bf3ae4 --- /dev/null +++ b/app/views/themengruppen/show.html.erb @@ -0,0 +1,15 @@ +

<%= notice %>

+ +

+ Title: + <%= @themagruppen.title %> +

+ +

+ Text: + <%= @themagruppen.text %> +

+ + +<%= link_to 'Edit', edit_themagruppen_path(@themagruppen) %> | +<%= link_to 'Back', themengruppen_path %> diff --git a/config/environments/development.rb~ b/config/environments/development.rb~ new file mode 100644 index 0000000..583fc8b --- /dev/null +++ b/config/environments/development.rb~ @@ -0,0 +1,37 @@ +Fetsite::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false +config.action_mailer.default_url_options = { :host => 'glonass.htu.tuwien.ac.at' } + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + config.active_record.auto_explain_threshold_in_seconds = 0.5 + + # Do not compress assets + config.assets.compress = false + + # Expands the lines which load the assets + config.assets.debug = true +end diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 33683aa..f8522e4 100755 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -25,4 +25,10 @@ inflect.plural 'rubrik', 'rubriken' inflect.singular 'rubriken', 'rubrik' inflect.plural 'beispiel', 'beispiele' inflect.singular 'beispiele', 'beispiel' +inflect.plural 'themengruppe', 'themengruppen' +inflect.singular 'themengruppen', 'themengruppe' +inflect.plural 'thema', 'themen' +inflect.singular 'themen', 'thema' +inflect.plural 'frage', 'fragen' +inflect.singular 'fragen', 'frage' end diff --git a/config/initializers/inflections.rb~ b/config/initializers/inflections.rb~ new file mode 100755 index 0000000..da3eb47 --- /dev/null +++ b/config/initializers/inflections.rb~ @@ -0,0 +1,35 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format +# (all these examples are active by default): +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end +# +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.acronym 'RESTful' +# end +ActiveSupport::Inflector.inflections do |inflect| +inflect.plural 'studium', 'studien' +inflect.singular 'studien', 'studium' +inflect.plural 'neuigkeit', 'neuigkeiten' +inflect.singular 'neuigkeiten', 'neuigkeit' +inflect.plural 'modulgruppe', 'modulgruppen' +inflect.singular 'modulgruppen', 'modulgruppe' +inflect.irregular 'modulgruppe', 'modulgruppen' +inflect.plural 'rubrik', 'rubriken' +inflect.singular 'rubriken', 'rubrik' +inflect.plural 'beispiel', 'beispiele' +inflect.singular 'beispiele', 'beispiel' +inflect.plural 'themengruppe', 'themengruppen' +inflect.singular 'themengruppen', 'themengruppe' +inflect.plural 'thema', 'themen' +inflect.singular 'themen', 'thema' +inflect.plural 'frage', 'fragen' +inflect.singular 'fragen', 'frage' + +end diff --git a/config/routes.rb b/config/routes.rb index 2603420..fea68e1 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,17 @@ Fetsite::Application.routes.draw do + resources :fragen + + + resources :attachments + + + resources :themen + + + resources :themengruppen + + devise_for :users resources :home, :only=>[:index] #get 'home',:controller=>home,:action=>:index,:as=>"home_index" diff --git a/db/migrate/20130729085446_create_lva_semester_join_table.rb~ b/db/migrate/20130729085446_create_lva_semester_join_table.rb~ new file mode 100644 index 0000000..c4f8ea4 --- /dev/null +++ b/db/migrate/20130729085446_create_lva_semester_join_table.rb~ @@ -0,0 +1,21 @@ +class CreateLvaSemesterJoinTable < ActiveRecord::Migration + def self.up + create_table :lvas_semesters, :id=>false do |t| + t.integer :lva_id + t.integer :semester_id + end + add_index :lva_semesters, [:lva_id, :semester_id] + add_index :lva_semesters, :semester_id + end + def change + create_table :lvas_semesters, :id=>false do |t| + t.integer :lva_id + t.integer :semester_id + end + add_index :lva_semesters, [:lva_id, :semester_id] + add_index :lva_semesters, :semester_id + end + def self.down + drop_table :lva_semesters + end +end diff --git a/db/migrate/20130805143616_create_themengruppen.rb b/db/migrate/20130805143616_create_themengruppen.rb new file mode 100644 index 0000000..d4a737e --- /dev/null +++ b/db/migrate/20130805143616_create_themengruppen.rb @@ -0,0 +1,10 @@ +class CreateThemengruppen < ActiveRecord::Migration + def change + create_table :themengruppen do |t| + t.string :title + t.text :text + + t.timestamps + end + end +end diff --git a/db/migrate/20130805143719_create_themen.rb b/db/migrate/20130805143719_create_themen.rb new file mode 100644 index 0000000..b2fbaac --- /dev/null +++ b/db/migrate/20130805143719_create_themen.rb @@ -0,0 +1,10 @@ +class CreateThemen < ActiveRecord::Migration + def change + create_table :themen do |t| + t.string :title + t.text :text + + t.timestamps + end + end +end diff --git a/db/migrate/20130805143839_create_attachments.rb b/db/migrate/20130805143839_create_attachments.rb new file mode 100644 index 0000000..dbead07 --- /dev/null +++ b/db/migrate/20130805143839_create_attachments.rb @@ -0,0 +1,9 @@ +class CreateAttachments < ActiveRecord::Migration + def change + create_table :attachments do |t| + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20130805143919_create_fragen.rb b/db/migrate/20130805143919_create_fragen.rb new file mode 100644 index 0000000..5697dc4 --- /dev/null +++ b/db/migrate/20130805143919_create_fragen.rb @@ -0,0 +1,10 @@ +class CreateFragen < ActiveRecord::Migration + def change + create_table :fragen do |t| + t.string :title + t.text :text + + t.timestamps + end + end +end diff --git a/spec/controllers/attachments_controller_spec.rb b/spec/controllers/attachments_controller_spec.rb new file mode 100644 index 0000000..412c78b --- /dev/null +++ b/spec/controllers/attachments_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe AttachmentsController do + + # This should return the minimal set of attributes required to create a valid + # Attachment. As you add validations to Attachment, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "name" => "MyString" } } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # AttachmentsController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all attachments as @attachments" do + attachment = Attachment.create! valid_attributes + get :index, {}, valid_session + assigns(:attachments).should eq([attachment]) + end + end + + describe "GET show" do + it "assigns the requested attachment as @attachment" do + attachment = Attachment.create! valid_attributes + get :show, {:id => attachment.to_param}, valid_session + assigns(:attachment).should eq(attachment) + end + end + + describe "GET new" do + it "assigns a new attachment as @attachment" do + get :new, {}, valid_session + assigns(:attachment).should be_a_new(Attachment) + end + end + + describe "GET edit" do + it "assigns the requested attachment as @attachment" do + attachment = Attachment.create! valid_attributes + get :edit, {:id => attachment.to_param}, valid_session + assigns(:attachment).should eq(attachment) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Attachment" do + expect { + post :create, {:attachment => valid_attributes}, valid_session + }.to change(Attachment, :count).by(1) + end + + it "assigns a newly created attachment as @attachment" do + post :create, {:attachment => valid_attributes}, valid_session + assigns(:attachment).should be_a(Attachment) + assigns(:attachment).should be_persisted + end + + it "redirects to the created attachment" do + post :create, {:attachment => valid_attributes}, valid_session + response.should redirect_to(Attachment.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved attachment as @attachment" do + # Trigger the behavior that occurs when invalid params are submitted + Attachment.any_instance.stub(:save).and_return(false) + post :create, {:attachment => { "name" => "invalid value" }}, valid_session + assigns(:attachment).should be_a_new(Attachment) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Attachment.any_instance.stub(:save).and_return(false) + post :create, {:attachment => { "name" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested attachment" do + attachment = Attachment.create! valid_attributes + # Assuming there are no other attachments in the database, this + # specifies that the Attachment created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Attachment.any_instance.should_receive(:update_attributes).with({ "name" => "MyString" }) + put :update, {:id => attachment.to_param, :attachment => { "name" => "MyString" }}, valid_session + end + + it "assigns the requested attachment as @attachment" do + attachment = Attachment.create! valid_attributes + put :update, {:id => attachment.to_param, :attachment => valid_attributes}, valid_session + assigns(:attachment).should eq(attachment) + end + + it "redirects to the attachment" do + attachment = Attachment.create! valid_attributes + put :update, {:id => attachment.to_param, :attachment => valid_attributes}, valid_session + response.should redirect_to(attachment) + end + end + + describe "with invalid params" do + it "assigns the attachment as @attachment" do + attachment = Attachment.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Attachment.any_instance.stub(:save).and_return(false) + put :update, {:id => attachment.to_param, :attachment => { "name" => "invalid value" }}, valid_session + assigns(:attachment).should eq(attachment) + end + + it "re-renders the 'edit' template" do + attachment = Attachment.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Attachment.any_instance.stub(:save).and_return(false) + put :update, {:id => attachment.to_param, :attachment => { "name" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested attachment" do + attachment = Attachment.create! valid_attributes + expect { + delete :destroy, {:id => attachment.to_param}, valid_session + }.to change(Attachment, :count).by(-1) + end + + it "redirects to the attachments list" do + attachment = Attachment.create! valid_attributes + delete :destroy, {:id => attachment.to_param}, valid_session + response.should redirect_to(attachments_url) + end + end + +end diff --git a/spec/controllers/fragen_controller_spec.rb b/spec/controllers/fragen_controller_spec.rb new file mode 100644 index 0000000..f69659a --- /dev/null +++ b/spec/controllers/fragen_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe FragenController do + + # This should return the minimal set of attributes required to create a valid + # Frage. As you add validations to Frage, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "title" => "MyString" } } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # FragenController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all fragenn as @fragenn" do + frage = Frage.create! valid_attributes + get :index, {}, valid_session + assigns(:fragen).should eq([frage]) + end + end + + describe "GET show" do + it "assigns the requested frage as @frage" do + frage = Frage.create! valid_attributes + get :show, {:id => frage.to_param}, valid_session + assigns(:frage).should eq(frage) + end + end + + describe "GET new" do + it "assigns a new frage as @frage" do + get :new, {}, valid_session + assigns(:frage).should be_a_new(Frage) + end + end + + describe "GET edit" do + it "assigns the requested frage as @frage" do + frage = Frage.create! valid_attributes + get :edit, {:id => frage.to_param}, valid_session + assigns(:frage).should eq(frage) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Frage" do + expect { + post :create, {:frage => valid_attributes}, valid_session + }.to change(Frage, :count).by(1) + end + + it "assigns a newly created frage as @frage" do + post :create, {:frage => valid_attributes}, valid_session + assigns(:frage).should be_a(Frage) + assigns(:frage).should be_persisted + end + + it "redirects to the created frage" do + post :create, {:frage => valid_attributes}, valid_session + response.should redirect_to(Frage.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved frage as @frage" do + # Trigger the behavior that occurs when invalid params are submitted + Frage.any_instance.stub(:save).and_return(false) + post :create, {:frage => { "title" => "invalid value" }}, valid_session + assigns(:frage).should be_a_new(Frage) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Frage.any_instance.stub(:save).and_return(false) + post :create, {:frage => { "title" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested frage" do + frage = Frage.create! valid_attributes + # Assuming there are no other fragen in the database, this + # specifies that the Frage created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Frage.any_instance.should_receive(:update_attributes).with({ "title" => "MyString" }) + put :update, {:id => frage.to_param, :frage => { "title" => "MyString" }}, valid_session + end + + it "assigns the requested frage as @frage" do + frage = Frage.create! valid_attributes + put :update, {:id => frage.to_param, :frage => valid_attributes}, valid_session + assigns(:frage).should eq(frage) + end + + it "redirects to the frage" do + frage = Frage.create! valid_attributes + put :update, {:id => frage.to_param, :frage => valid_attributes}, valid_session + response.should redirect_to(frage) + end + end + + describe "with invalid params" do + it "assigns the frage as @frage" do + frage = Frage.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Frage.any_instance.stub(:save).and_return(false) + put :update, {:id => frage.to_param, :frage => { "title" => "invalid value" }}, valid_session + assigns(:frage).should eq(frage) + end + + it "re-renders the 'edit' template" do + frage = Frage.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Frage.any_instance.stub(:save).and_return(false) + put :update, {:id => frage.to_param, :frage => { "title" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested frage" do + frage = Frage.create! valid_attributes + expect { + delete :destroy, {:id => frage.to_param}, valid_session + }.to change(Frage, :count).by(-1) + end + + it "redirects to the fragen list" do + frage = Frage.create! valid_attributes + delete :destroy, {:id => frage.to_param}, valid_session + response.should redirect_to(fragen_url) + end + end + +end diff --git a/spec/controllers/themen_controller_spec.rb b/spec/controllers/themen_controller_spec.rb new file mode 100644 index 0000000..534e17e --- /dev/null +++ b/spec/controllers/themen_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe ThemenController do + + # This should return the minimal set of attributes required to create a valid + # Thema. As you add validations to Thema, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "title" => "MyString" } } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # ThemenController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all themen as @themen" do + thema = Thema.create! valid_attributes + get :index, {}, valid_session + assigns(:themen).should eq([thema]) + end + end + + describe "GET show" do + it "assigns the requested thema as @thema" do + thema = Thema.create! valid_attributes + get :show, {:id => thema.to_param}, valid_session + assigns(:thema).should eq(thema) + end + end + + describe "GET new" do + it "assigns a new thema as @thema" do + get :new, {}, valid_session + assigns(:thema).should be_a_new(Thema) + end + end + + describe "GET edit" do + it "assigns the requested thema as @thema" do + thema = Thema.create! valid_attributes + get :edit, {:id => thema.to_param}, valid_session + assigns(:thema).should eq(thema) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Thema" do + expect { + post :create, {:thema => valid_attributes}, valid_session + }.to change(Thema, :count).by(1) + end + + it "assigns a newly created thema as @thema" do + post :create, {:thema => valid_attributes}, valid_session + assigns(:thema).should be_a(Thema) + assigns(:thema).should be_persisted + end + + it "redirects to the created thema" do + post :create, {:thema => valid_attributes}, valid_session + response.should redirect_to(Thema.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved thema as @thema" do + # Trigger the behavior that occurs when invalid params are submitted + Thema.any_instance.stub(:save).and_return(false) + post :create, {:thema => { "title" => "invalid value" }}, valid_session + assigns(:thema).should be_a_new(Thema) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Thema.any_instance.stub(:save).and_return(false) + post :create, {:thema => { "title" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested thema" do + thema = Thema.create! valid_attributes + # Assuming there are no other themen in the database, this + # specifies that the Thema created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Thema.any_instance.should_receive(:update_attributes).with({ "title" => "MyString" }) + put :update, {:id => thema.to_param, :thema => { "title" => "MyString" }}, valid_session + end + + it "assigns the requested thema as @thema" do + thema = Thema.create! valid_attributes + put :update, {:id => thema.to_param, :thema => valid_attributes}, valid_session + assigns(:thema).should eq(thema) + end + + it "redirects to the thema" do + thema = Thema.create! valid_attributes + put :update, {:id => thema.to_param, :thema => valid_attributes}, valid_session + response.should redirect_to(thema) + end + end + + describe "with invalid params" do + it "assigns the thema as @thema" do + thema = Thema.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Thema.any_instance.stub(:save).and_return(false) + put :update, {:id => thema.to_param, :thema => { "title" => "invalid value" }}, valid_session + assigns(:thema).should eq(thema) + end + + it "re-renders the 'edit' template" do + thema = Thema.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Thema.any_instance.stub(:save).and_return(false) + put :update, {:id => thema.to_param, :thema => { "title" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested thema" do + thema = Thema.create! valid_attributes + expect { + delete :destroy, {:id => thema.to_param}, valid_session + }.to change(Thema, :count).by(-1) + end + + it "redirects to the themen list" do + thema = Thema.create! valid_attributes + delete :destroy, {:id => thema.to_param}, valid_session + response.should redirect_to(themen_url) + end + end + +end diff --git a/spec/controllers/themengruppen_controller_spec.rb b/spec/controllers/themengruppen_controller_spec.rb new file mode 100644 index 0000000..5619bdf --- /dev/null +++ b/spec/controllers/themengruppen_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe ThemengruppenController do + + # This should return the minimal set of attributes required to create a valid + # Themengruppe. As you add validations to Themengruppe, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "title" => "MyString" } } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # ThemengruppenController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all themengruppenn as @themengruppenn" do + themengruppe = Themengruppe.create! valid_attributes + get :index, {}, valid_session + assigns(:themengruppen).should eq([themengruppe]) + end + end + + describe "GET show" do + it "assigns the requested themengruppe as @themengruppe" do + themengruppe = Themengruppe.create! valid_attributes + get :show, {:id => themengruppe.to_param}, valid_session + assigns(:themengruppe).should eq(themengruppe) + end + end + + describe "GET new" do + it "assigns a new themengruppe as @themengruppe" do + get :new, {}, valid_session + assigns(:themengruppe).should be_a_new(Themengruppe) + end + end + + describe "GET edit" do + it "assigns the requested themengruppe as @themengruppe" do + themengruppe = Themengruppe.create! valid_attributes + get :edit, {:id => themengruppe.to_param}, valid_session + assigns(:themengruppe).should eq(themengruppe) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Themengruppe" do + expect { + post :create, {:themengruppe => valid_attributes}, valid_session + }.to change(Themengruppe, :count).by(1) + end + + it "assigns a newly created themengruppe as @themengruppe" do + post :create, {:themengruppe => valid_attributes}, valid_session + assigns(:themengruppe).should be_a(Themengruppe) + assigns(:themengruppe).should be_persisted + end + + it "redirects to the created themengruppe" do + post :create, {:themengruppe => valid_attributes}, valid_session + response.should redirect_to(Themengruppe.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved themengruppe as @themengruppe" do + # Trigger the behavior that occurs when invalid params are submitted + Themengruppe.any_instance.stub(:save).and_return(false) + post :create, {:themengruppe => { "title" => "invalid value" }}, valid_session + assigns(:themengruppe).should be_a_new(Themengruppe) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Themengruppe.any_instance.stub(:save).and_return(false) + post :create, {:themengruppe => { "title" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested themengruppe" do + themengruppe = Themengruppe.create! valid_attributes + # Assuming there are no other themengruppen in the database, this + # specifies that the Themengruppe created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Themengruppe.any_instance.should_receive(:update_attributes).with({ "title" => "MyString" }) + put :update, {:id => themengruppe.to_param, :themengruppe => { "title" => "MyString" }}, valid_session + end + + it "assigns the requested themengruppe as @themengruppe" do + themengruppe = Themengruppe.create! valid_attributes + put :update, {:id => themengruppe.to_param, :themengruppe => valid_attributes}, valid_session + assigns(:themengruppe).should eq(themengruppe) + end + + it "redirects to the themengruppe" do + themengruppe = Themengruppe.create! valid_attributes + put :update, {:id => themengruppe.to_param, :themengruppe => valid_attributes}, valid_session + response.should redirect_to(themengruppe) + end + end + + describe "with invalid params" do + it "assigns the themengruppe as @themengruppe" do + themengruppe = Themengruppe.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Themengruppe.any_instance.stub(:save).and_return(false) + put :update, {:id => themengruppe.to_param, :themengruppe => { "title" => "invalid value" }}, valid_session + assigns(:themengruppe).should eq(themengruppe) + end + + it "re-renders the 'edit' template" do + themengruppe = Themengruppe.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Themengruppe.any_instance.stub(:save).and_return(false) + put :update, {:id => themengruppe.to_param, :themengruppe => { "title" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested themengruppe" do + themengruppe = Themengruppe.create! valid_attributes + expect { + delete :destroy, {:id => themengruppe.to_param}, valid_session + }.to change(Themengruppe, :count).by(-1) + end + + it "redirects to the themengruppen list" do + themengruppe = Themengruppe.create! valid_attributes + delete :destroy, {:id => themengruppe.to_param}, valid_session + response.should redirect_to(themengruppen_url) + end + end + +end diff --git a/spec/factories/attachments.rb b/spec/factories/attachments.rb new file mode 100644 index 0000000..9c31968 --- /dev/null +++ b/spec/factories/attachments.rb @@ -0,0 +1,7 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :attachment do + name "MyString" + end +end diff --git a/spec/factories/fragen.rb b/spec/factories/fragen.rb new file mode 100644 index 0000000..eedcbcc --- /dev/null +++ b/spec/factories/fragen.rb @@ -0,0 +1,8 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :frage do + title "MyString" + text "MyText" + end +end diff --git a/spec/factories/studien.rb~ b/spec/factories/studien.rb~ new file mode 100644 index 0000000..071a60e --- /dev/null +++ b/spec/factories/studien.rb~ @@ -0,0 +1,12 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + + +FactoryGirl.define do + factory :studium do + zahl "066.506" + name "Automatisierung" + desc "TEST DESC" + typ "Master" + end + +end diff --git a/spec/factories/themen.rb b/spec/factories/themen.rb new file mode 100644 index 0000000..30c74c4 --- /dev/null +++ b/spec/factories/themen.rb @@ -0,0 +1,8 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :thema do + title "MyString" + text "MyText" + end +end diff --git a/spec/factories/themengruppen.rb b/spec/factories/themengruppen.rb new file mode 100644 index 0000000..868dca7 --- /dev/null +++ b/spec/factories/themengruppen.rb @@ -0,0 +1,8 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :themagruppen, :class => 'Themengruppe' do + title "MyString" + text "MyText" + end +end diff --git a/spec/helpers/attachments_helper_spec.rb b/spec/helpers/attachments_helper_spec.rb new file mode 100644 index 0000000..38799ea --- /dev/null +++ b/spec/helpers/attachments_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the AttachmentsHelper. For example: +# +# describe AttachmentsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +describe AttachmentsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/fragen_helper_spec.rb b/spec/helpers/fragen_helper_spec.rb new file mode 100644 index 0000000..d74ca7b --- /dev/null +++ b/spec/helpers/fragen_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the FragenHelper. For example: +# +# describe FragenHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +describe FragenHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/themen_helper_spec.rb b/spec/helpers/themen_helper_spec.rb new file mode 100644 index 0000000..db8890f --- /dev/null +++ b/spec/helpers/themen_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the ThemenHelper. For example: +# +# describe ThemenHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +describe ThemenHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/themengruppen_helper_spec.rb b/spec/helpers/themengruppen_helper_spec.rb new file mode 100644 index 0000000..bf60a8c --- /dev/null +++ b/spec/helpers/themengruppen_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the ThemengruppenHelper. For example: +# +# describe ThemengruppenHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +describe ThemengruppenHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/attachment_spec.rb b/spec/models/attachment_spec.rb new file mode 100644 index 0000000..9981316 --- /dev/null +++ b/spec/models/attachment_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Attachment do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/frage_spec.rb b/spec/models/frage_spec.rb new file mode 100644 index 0000000..101f7ce --- /dev/null +++ b/spec/models/frage_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Frage do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/thema_spec.rb b/spec/models/thema_spec.rb new file mode 100644 index 0000000..b006262 --- /dev/null +++ b/spec/models/thema_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Thema do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/themengruppe_spec.rb b/spec/models/themengruppe_spec.rb new file mode 100644 index 0000000..cf5341f --- /dev/null +++ b/spec/models/themengruppe_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Themengruppe do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/requests/attachments_spec.rb b/spec/requests/attachments_spec.rb new file mode 100644 index 0000000..725ca17 --- /dev/null +++ b/spec/requests/attachments_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Attachments" do + describe "GET /attachments" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get attachments_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/fragen_spec.rb b/spec/requests/fragen_spec.rb new file mode 100644 index 0000000..33a136e --- /dev/null +++ b/spec/requests/fragen_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Frages" do + describe "GET /fragen" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get fragen_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/themen_spec.rb b/spec/requests/themen_spec.rb new file mode 100644 index 0000000..698db99 --- /dev/null +++ b/spec/requests/themen_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Themas" do + describe "GET /themen" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get themen_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/themengruppen_spec.rb b/spec/requests/themengruppen_spec.rb new file mode 100644 index 0000000..f7416d9 --- /dev/null +++ b/spec/requests/themengruppen_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Themengruppes" do + describe "GET /themengruppen" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get themengruppen_path + response.status.should be(200) + end + end +end diff --git a/spec/routing/attachments_routing_spec.rb b/spec/routing/attachments_routing_spec.rb new file mode 100644 index 0000000..8827b56 --- /dev/null +++ b/spec/routing/attachments_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe AttachmentsController do + describe "routing" do + + it "routes to #index" do + get("/attachments").should route_to("attachments#index") + end + + it "routes to #new" do + get("/attachments/new").should route_to("attachments#new") + end + + it "routes to #show" do + get("/attachments/1").should route_to("attachments#show", :id => "1") + end + + it "routes to #edit" do + get("/attachments/1/edit").should route_to("attachments#edit", :id => "1") + end + + it "routes to #create" do + post("/attachments").should route_to("attachments#create") + end + + it "routes to #update" do + put("/attachments/1").should route_to("attachments#update", :id => "1") + end + + it "routes to #destroy" do + delete("/attachments/1").should route_to("attachments#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/fragen_routing_spec.rb b/spec/routing/fragen_routing_spec.rb new file mode 100644 index 0000000..aadd707 --- /dev/null +++ b/spec/routing/fragen_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe FragenController do + describe "routing" do + + it "routes to #index" do + get("/fragen").should route_to("fragen#index") + end + + it "routes to #new" do + get("/fragen/new").should route_to("fragen#new") + end + + it "routes to #show" do + get("/fragen/1").should route_to("fragen#show", :id => "1") + end + + it "routes to #edit" do + get("/fragen/1/edit").should route_to("fragen#edit", :id => "1") + end + + it "routes to #create" do + post("/fragen").should route_to("fragen#create") + end + + it "routes to #update" do + put("/fragen/1").should route_to("fragen#update", :id => "1") + end + + it "routes to #destroy" do + delete("/fragen/1").should route_to("fragen#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/themen_routing_spec.rb b/spec/routing/themen_routing_spec.rb new file mode 100644 index 0000000..e0ee364 --- /dev/null +++ b/spec/routing/themen_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe ThemenController do + describe "routing" do + + it "routes to #index" do + get("/themen").should route_to("themen#index") + end + + it "routes to #new" do + get("/themen/new").should route_to("themen#new") + end + + it "routes to #show" do + get("/themen/1").should route_to("themen#show", :id => "1") + end + + it "routes to #edit" do + get("/themen/1/edit").should route_to("themen#edit", :id => "1") + end + + it "routes to #create" do + post("/themen").should route_to("themen#create") + end + + it "routes to #update" do + put("/themen/1").should route_to("themen#update", :id => "1") + end + + it "routes to #destroy" do + delete("/themen/1").should route_to("themen#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/themengruppen_routing_spec.rb b/spec/routing/themengruppen_routing_spec.rb new file mode 100644 index 0000000..3ccfa91 --- /dev/null +++ b/spec/routing/themengruppen_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe ThemengruppenController do + describe "routing" do + + it "routes to #index" do + get("/themengruppen").should route_to("themengruppen#index") + end + + it "routes to #new" do + get("/themengruppen/new").should route_to("themengruppen#new") + end + + it "routes to #show" do + get("/themengruppen/1").should route_to("themengruppen#show", :id => "1") + end + + it "routes to #edit" do + get("/themengruppen/1/edit").should route_to("themengruppen#edit", :id => "1") + end + + it "routes to #create" do + post("/themengruppen").should route_to("themengruppen#create") + end + + it "routes to #update" do + put("/themengruppen/1").should route_to("themengruppen#update", :id => "1") + end + + it "routes to #destroy" do + delete("/themengruppen/1").should route_to("themengruppen#destroy", :id => "1") + end + + end +end diff --git a/spec/views/attachments/edit.html.erb_spec.rb b/spec/views/attachments/edit.html.erb_spec.rb new file mode 100644 index 0000000..d1edac7 --- /dev/null +++ b/spec/views/attachments/edit.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "attachments/edit" do + before(:each) do + @attachment = assign(:attachment, stub_model(Attachment, + :name => "MyString" + )) + end + + it "renders the edit attachment form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", attachment_path(@attachment), "post" do + assert_select "input#attachment_name[name=?]", "attachment[name]" + end + end +end diff --git a/spec/views/attachments/index.html.erb_spec.rb b/spec/views/attachments/index.html.erb_spec.rb new file mode 100644 index 0000000..22fab49 --- /dev/null +++ b/spec/views/attachments/index.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "attachments/index" do + before(:each) do + assign(:attachments, [ + stub_model(Attachment, + :name => "Name" + ), + stub_model(Attachment, + :name => "Name" + ) + ]) + end + + it "renders a list of attachments" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Name".to_s, :count => 2 + end +end diff --git a/spec/views/attachments/new.html.erb_spec.rb b/spec/views/attachments/new.html.erb_spec.rb new file mode 100644 index 0000000..4e88f23 --- /dev/null +++ b/spec/views/attachments/new.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "attachments/new" do + before(:each) do + assign(:attachment, stub_model(Attachment, + :name => "MyString" + ).as_new_record) + end + + it "renders new attachment form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", attachments_path, "post" do + assert_select "input#attachment_name[name=?]", "attachment[name]" + end + end +end diff --git a/spec/views/attachments/show.html.erb_spec.rb b/spec/views/attachments/show.html.erb_spec.rb new file mode 100644 index 0000000..6b97687 --- /dev/null +++ b/spec/views/attachments/show.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "attachments/show" do + before(:each) do + @attachment = assign(:attachment, stub_model(Attachment, + :name => "Name" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Name/) + end +end diff --git a/spec/views/fragen/edit.html.erb_spec.rb b/spec/views/fragen/edit.html.erb_spec.rb new file mode 100644 index 0000000..098b318 --- /dev/null +++ b/spec/views/fragen/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "fragen/edit" do + before(:each) do + @frage = assign(:frage, stub_model(Frage, + :title => "MyString", + :text => "MyText" + )) + end + + it "renders the edit frage form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", frage_path(@frage), "post" do + assert_select "input#frage_title[name=?]", "frage[title]" + assert_select "textarea#frage_text[name=?]", "frage[text]" + end + end +end diff --git a/spec/views/fragen/index.html.erb_spec.rb b/spec/views/fragen/index.html.erb_spec.rb new file mode 100644 index 0000000..5bb8475 --- /dev/null +++ b/spec/views/fragen/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "fragen/index" do + before(:each) do + assign(:fragen, [ + stub_model(Frage, + :title => "Title", + :text => "MyText" + ), + stub_model(Frage, + :title => "Title", + :text => "MyText" + ) + ]) + end + + it "renders a list of fragen" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Title".to_s, :count => 2 + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + end +end diff --git a/spec/views/fragen/new.html.erb_spec.rb b/spec/views/fragen/new.html.erb_spec.rb new file mode 100644 index 0000000..6e1a25c --- /dev/null +++ b/spec/views/fragen/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "fragen/new" do + before(:each) do + assign(:frage, stub_model(Frage, + :title => "MyString", + :text => "MyText" + ).as_new_record) + end + + it "renders new frage form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", fragen_path, "post" do + assert_select "input#frage_title[name=?]", "frage[title]" + assert_select "textarea#frage_text[name=?]", "frage[text]" + end + end +end diff --git a/spec/views/fragen/show.html.erb_spec.rb b/spec/views/fragen/show.html.erb_spec.rb new file mode 100644 index 0000000..fd93018 --- /dev/null +++ b/spec/views/fragen/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "fragen/show" do + before(:each) do + @frage = assign(:frage, stub_model(Frage, + :title => "Title", + :text => "MyText" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Title/) + rendered.should match(/MyText/) + end +end diff --git a/spec/views/themen/edit.html.erb_spec.rb b/spec/views/themen/edit.html.erb_spec.rb new file mode 100644 index 0000000..eb389ac --- /dev/null +++ b/spec/views/themen/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "themen/edit" do + before(:each) do + @thema = assign(:thema, stub_model(Thema, + :title => "MyString", + :text => "MyText" + )) + end + + it "renders the edit thema form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", thema_path(@thema), "post" do + assert_select "input#thema_title[name=?]", "thema[title]" + assert_select "textarea#thema_text[name=?]", "thema[text]" + end + end +end diff --git a/spec/views/themen/index.html.erb_spec.rb b/spec/views/themen/index.html.erb_spec.rb new file mode 100644 index 0000000..587c0c7 --- /dev/null +++ b/spec/views/themen/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "themen/index" do + before(:each) do + assign(:themen, [ + stub_model(Thema, + :title => "Title", + :text => "MyText" + ), + stub_model(Thema, + :title => "Title", + :text => "MyText" + ) + ]) + end + + it "renders a list of themen" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Title".to_s, :count => 2 + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + end +end diff --git a/spec/views/themen/new.html.erb_spec.rb b/spec/views/themen/new.html.erb_spec.rb new file mode 100644 index 0000000..531b5a0 --- /dev/null +++ b/spec/views/themen/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "themen/new" do + before(:each) do + assign(:thema, stub_model(Thema, + :title => "MyString", + :text => "MyText" + ).as_new_record) + end + + it "renders new thema form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", themen_path, "post" do + assert_select "input#thema_title[name=?]", "thema[title]" + assert_select "textarea#thema_text[name=?]", "thema[text]" + end + end +end diff --git a/spec/views/themen/show.html.erb_spec.rb b/spec/views/themen/show.html.erb_spec.rb new file mode 100644 index 0000000..2eedcc9 --- /dev/null +++ b/spec/views/themen/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "themen/show" do + before(:each) do + @thema = assign(:thema, stub_model(Thema, + :title => "Title", + :text => "MyText" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Title/) + rendered.should match(/MyText/) + end +end diff --git a/spec/views/themengruppen/edit.html.erb_spec.rb b/spec/views/themengruppen/edit.html.erb_spec.rb new file mode 100644 index 0000000..6fbf646 --- /dev/null +++ b/spec/views/themengruppen/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "themengruppen/edit" do + before(:each) do + @themengruppe = assign(:themengruppe, stub_model(Themengruppe, + :title => "MyString", + :text => "MyText" + )) + end + + it "renders the edit themengruppe form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", themengruppe_path(@themengruppe), "post" do + assert_select "input#themengruppe_title[name=?]", "themengruppe[title]" + assert_select "textarea#themengruppe_text[name=?]", "themengruppe[text]" + end + end +end diff --git a/spec/views/themengruppen/index.html.erb_spec.rb b/spec/views/themengruppen/index.html.erb_spec.rb new file mode 100644 index 0000000..524c49a --- /dev/null +++ b/spec/views/themengruppen/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "themengruppen/index" do + before(:each) do + assign(:themengruppen, [ + stub_model(Themengruppe, + :title => "Title", + :text => "MyText" + ), + stub_model(Themengruppe, + :title => "Title", + :text => "MyText" + ) + ]) + end + + it "renders a list of themengruppen" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Title".to_s, :count => 2 + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + end +end diff --git a/spec/views/themengruppen/new.html.erb_spec.rb b/spec/views/themengruppen/new.html.erb_spec.rb new file mode 100644 index 0000000..d73fbf3 --- /dev/null +++ b/spec/views/themengruppen/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "themengruppen/new" do + before(:each) do + assign(:themengruppe, stub_model(Themengruppe, + :title => "MyString", + :text => "MyText" + ).as_new_record) + end + + it "renders new themengruppe form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", themengruppen_path, "post" do + assert_select "input#themengruppe_title[name=?]", "themengruppe[title]" + assert_select "textarea#themengruppe_text[name=?]", "themengruppe[text]" + end + end +end diff --git a/spec/views/themengruppen/show.html.erb_spec.rb b/spec/views/themengruppen/show.html.erb_spec.rb new file mode 100644 index 0000000..14d2e3b --- /dev/null +++ b/spec/views/themengruppen/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "themengruppen/show" do + before(:each) do + @themengruppe = assign(:themengruppe, stub_model(Themengruppe, + :title => "Title", + :text => "MyText" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Title/) + rendered.should match(/MyText/) + end +end From 3be95d2edec3eb69b2c8a783f4a11138792bd235 Mon Sep 17 00:00:00 2001 From: HausdorffHimself Date: Tue, 6 Aug 2013 02:06:48 +0200 Subject: [PATCH 2/8] =?UTF-8?q?FIXES:=20=20=20*=20Inflections=20f=C3=BCr?= =?UTF-8?q?=20Thema/Themen=20etc.=20=20=20*=20Korrigierte=20Views?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/frage.rb | 3 +- app/models/frage.rb~ | 7 ++++ app/models/thema.rb | 5 ++- app/models/thema.rb~ | 6 +++ app/models/themengruppe.rb | 3 +- app/models/themengruppe.rb~ | 5 +++ app/views/fragen/show.html.erb | 6 +-- app/views/fragen/show.html.erb~ | 15 ++++++++ app/views/themengruppen/index.html.erb | 14 +++---- app/views/themengruppen/index.html.erb~ | 25 ++++++++++++ config/initializers/inflections.rb | 4 +- config/initializers/inflections.rb~ | 5 +-- db/migrate/20130805170517_add_id_to_themen.rb | 7 ++++ .../20130805170517_add_id_to_themen.rb~ | 7 ++++ db/migrate/20130805171433_translate_themen.rb | 38 +++++++++++++++++++ .../20130805171433_translate_themen.rb~ | 38 +++++++++++++++++++ 16 files changed, 167 insertions(+), 21 deletions(-) create mode 100644 app/views/fragen/show.html.erb~ create mode 100644 app/views/themengruppen/index.html.erb~ create mode 100644 db/migrate/20130805170517_add_id_to_themen.rb create mode 100644 db/migrate/20130805170517_add_id_to_themen.rb~ create mode 100644 db/migrate/20130805171433_translate_themen.rb create mode 100644 db/migrate/20130805171433_translate_themen.rb~ diff --git a/app/models/frage.rb b/app/models/frage.rb index 8a47df4..0d26178 100644 --- a/app/models/frage.rb +++ b/app/models/frage.rb @@ -1,10 +1,9 @@ class Frage < ActiveRecord::Base - has_paper_trail attr_accessible :text, :title belongs_to :thema validates :thema, :presence => true - validates :title, :prescece => true + validates :title, :presence => true translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true end diff --git a/app/models/frage.rb~ b/app/models/frage.rb~ index 27bc8c4..630e3b8 100644 --- a/app/models/frage.rb~ +++ b/app/models/frage.rb~ @@ -1,3 +1,10 @@ class Frage < ActiveRecord::Base + has_paper_trail attr_accessible :text, :title + belongs_to :thema + + validates :thema, :presence => true + validates :title, :presence => true + + translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true end diff --git a/app/models/thema.rb b/app/models/thema.rb index 71edf91..44be678 100644 --- a/app/models/thema.rb +++ b/app/models/thema.rb @@ -1,10 +1,11 @@ class Thema < ActiveRecord::Base - has_paper_trail attr_accessible :text, :title has_many :fragen has_many :attachments - belongs_to :themengruppe + belongs_to :themengruppe, :foreign_key => "themengruppe_id" validates :themengruppe, :presence => true validates :title, :presence => true + + translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true end diff --git a/app/models/thema.rb~ b/app/models/thema.rb~ index fd3bc93..9167351 100644 --- a/app/models/thema.rb~ +++ b/app/models/thema.rb~ @@ -1,5 +1,11 @@ class Thema < ActiveRecord::Base attr_accessible :text, :title has_many :fragen + has_many :attachments belongs_to :themengruppe + + validates :themengruppe, :presence => true + validates :title, :presence => true + + translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true end diff --git a/app/models/themengruppe.rb b/app/models/themengruppe.rb index 95cf797..f73289d 100644 --- a/app/models/themengruppe.rb +++ b/app/models/themengruppe.rb @@ -1,8 +1,9 @@ class Themengruppe < ActiveRecord::Base - has_paper_trail attr_accessible :text, :title has_many :themen has_many :fragen, through: :themen validates :title, :presence => true + + translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true end diff --git a/app/models/themengruppe.rb~ b/app/models/themengruppe.rb~ index c96a7c5..95cf797 100644 --- a/app/models/themengruppe.rb~ +++ b/app/models/themengruppe.rb~ @@ -1,3 +1,8 @@ class Themengruppe < ActiveRecord::Base + has_paper_trail attr_accessible :text, :title + has_many :themen + has_many :fragen, through: :themen + + validates :title, :presence => true end diff --git a/app/views/fragen/show.html.erb b/app/views/fragen/show.html.erb index 4718b83..64cd962 100644 --- a/app/views/fragen/show.html.erb +++ b/app/views/fragen/show.html.erb @@ -1,12 +1,10 @@

<%= notice %>

-

- Title: +

<%= @frage.title %> -

+

- Text: <%= @frage.text %>

diff --git a/app/views/fragen/show.html.erb~ b/app/views/fragen/show.html.erb~ new file mode 100644 index 0000000..4718b83 --- /dev/null +++ b/app/views/fragen/show.html.erb~ @@ -0,0 +1,15 @@ +

<%= notice %>

+ +

+ Title: + <%= @frage.title %> +

+ +

+ Text: + <%= @frage.text %> +

+ + +<%= link_to 'Edit', edit_frage_path(@frage) %> | +<%= link_to 'Back', fragen_path %> diff --git a/app/views/themengruppen/index.html.erb b/app/views/themengruppen/index.html.erb index f4655e1..6cd7fe6 100644 --- a/app/views/themengruppen/index.html.erb +++ b/app/views/themengruppen/index.html.erb @@ -9,17 +9,17 @@ -<% @themengruppen.each do |themagruppen| %> +<% @themengruppen.each do |themengruppe| %> - <%= themagruppen.title %> - <%= themagruppen.text %> - <%= link_to 'Show', themagruppen %> - <%= link_to 'Edit', edit_themagruppen_path(themagruppen) %> - <%= link_to 'Destroy', themagruppen, method: :delete, data: { confirm: 'Are you sure?' } %> + <%= themengruppe.title %> + <%= themengruppe.text %> + <%= link_to 'Show', themengruppe %> + <%= link_to 'Edit', edit_themengruppe_path(themengruppe) %> + <%= link_to 'Destroy', themengruppe, method: :delete, data: { confirm: 'Are you sure?' } %> <% end %>
-<%= link_to 'New Themengruppe', new_themagruppen_path %> +<%= link_to 'New Themengruppe', new_themengruppe_path %> diff --git a/app/views/themengruppen/index.html.erb~ b/app/views/themengruppen/index.html.erb~ new file mode 100644 index 0000000..f4655e1 --- /dev/null +++ b/app/views/themengruppen/index.html.erb~ @@ -0,0 +1,25 @@ +

Listing themengruppen

+ + + + + + + + + + +<% @themengruppen.each do |themagruppen| %> + + + + + + + +<% end %> +
TitleText
<%= themagruppen.title %><%= themagruppen.text %><%= link_to 'Show', themagruppen %><%= link_to 'Edit', edit_themagruppen_path(themagruppen) %><%= link_to 'Destroy', themagruppen, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Themengruppe', new_themagruppen_path %> diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index f8522e4..680a5bf 100755 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -27,8 +27,8 @@ inflect.plural 'beispiel', 'beispiele' inflect.singular 'beispiele', 'beispiel' inflect.plural 'themengruppe', 'themengruppen' inflect.singular 'themengruppen', 'themengruppe' -inflect.plural 'thema', 'themen' -inflect.singular 'themen', 'thema' +inflect.plural /thema$/, 'themen' +inflect.singular /themen$/, 'thema' inflect.plural 'frage', 'fragen' inflect.singular 'fragen', 'frage' end diff --git a/config/initializers/inflections.rb~ b/config/initializers/inflections.rb~ index da3eb47..8bb31db 100755 --- a/config/initializers/inflections.rb~ +++ b/config/initializers/inflections.rb~ @@ -27,9 +27,8 @@ inflect.plural 'beispiel', 'beispiele' inflect.singular 'beispiele', 'beispiel' inflect.plural 'themengruppe', 'themengruppen' inflect.singular 'themengruppen', 'themengruppe' -inflect.plural 'thema', 'themen' -inflect.singular 'themen', 'thema' +inflect.plural /thema$/, 'themen' +inflect.singular /^themen$/, 'thema' inflect.plural 'frage', 'fragen' inflect.singular 'fragen', 'frage' - end diff --git a/db/migrate/20130805170517_add_id_to_themen.rb b/db/migrate/20130805170517_add_id_to_themen.rb new file mode 100644 index 0000000..b6799ae --- /dev/null +++ b/db/migrate/20130805170517_add_id_to_themen.rb @@ -0,0 +1,7 @@ +class AddIdToThemen < ActiveRecord::Migration + def change + add_column :themen, :themengruppe_id, :integer + add_column :attachments, :thema_id, :integer + add_column :fragen, :thema_id, :integer + end +end diff --git a/db/migrate/20130805170517_add_id_to_themen.rb~ b/db/migrate/20130805170517_add_id_to_themen.rb~ new file mode 100644 index 0000000..b6799ae --- /dev/null +++ b/db/migrate/20130805170517_add_id_to_themen.rb~ @@ -0,0 +1,7 @@ +class AddIdToThemen < ActiveRecord::Migration + def change + add_column :themen, :themengruppe_id, :integer + add_column :attachments, :thema_id, :integer + add_column :fragen, :thema_id, :integer + end +end diff --git a/db/migrate/20130805171433_translate_themen.rb b/db/migrate/20130805171433_translate_themen.rb new file mode 100644 index 0000000..6f5db97 --- /dev/null +++ b/db/migrate/20130805171433_translate_themen.rb @@ -0,0 +1,38 @@ +class TranslateThemen < ActiveRecord::Migration + def up + Thema.create_translation_table!({ + :title => :string, + :text => :text + }, { + #:migrate_data => true + }) + add_column :thema_translations, :themen_id, :integer + remove_column :thema_translations, :thema_id + + Themengruppe.create_translation_table!({ + :title => :string, + :text => :text + }, { + #:migrate_data => true + }) + add_column :themengruppe_translations, :themengruppen_id, :integer + remove_column :themengruppe_translations, :themengruppe_id + + + Frage.create_translation_table!({ + :title => :string, + :text => :text + }, { + #:migrate_data => true + }) + add_column :frage_translations, :fragen_id, :integer + remove_column :frage_translations, :frage_id + + end + + def down + Thema.drop_translation_table! #:migrate_data => true + Themengruppe.drop_translation_table! #:migrate_data => true + Frage.drop_translation_table! #:migrate_data => true + end +end diff --git a/db/migrate/20130805171433_translate_themen.rb~ b/db/migrate/20130805171433_translate_themen.rb~ new file mode 100644 index 0000000..147fb02 --- /dev/null +++ b/db/migrate/20130805171433_translate_themen.rb~ @@ -0,0 +1,38 @@ +class TranslateThemen < ActiveRecord::Migration + def up + Thema.create_translation_table!({ + :title => :string, + :text => :text + }, { + #:migrate_data => true + }) + add_column :thema_translations, :themen_id, :integer + remove_column :themagruppe_translations, :thema_id + + Themengruppe.create_translation_table!({ + :title => :string, + :text => :text + }, { + #:migrate_data => true + }) + add_column :themengruppe_translations, :themengruppen_id, :integer + remove_column :themengruppe_translations, :themengruppe_id + + + Frage.create_translation_table!({ + :title => :string, + :text => :text + }, { + #:migrate_data => true + }) + add_column :frage_translations, :fragen_id, :integer + remove_column :frage_translations, :frage_id + + end + + def down + Thema.drop_translation_table! #:migrate_data => true + Themengruppe.drop_translation_table! #:migrate_data => true + Frage.drop_translation_table! #:migrate_data => true + end +end From 675a8eb71e62e940acb4577d9d1e1bedf56af99f Mon Sep 17 00:00:00 2001 From: HausdorffHimself Date: Tue, 13 Aug 2013 18:28:36 +0200 Subject: [PATCH 3/8] =?UTF-8?q?ADD:=20Link=20f=C3=BCr=20Informationsseite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/menu.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/menu.html.erb b/app/views/layouts/menu.html.erb index bc71698..033a319 100755 --- a/app/views/layouts/menu.html.erb +++ b/app/views/layouts/menu.html.erb @@ -3,7 +3,7 @@
  • <%= link_to I18n.t(:home,:scope=>'home' ), home_index_path %>
  • <%= link_to I18n.t(:news,:scope=>'home' ),rubriken_path %>
  • -
  • <%= link_to I18n.t(:info,:scope=>'home' ) %>
  • +
  • <%= link_to I18n.t(:info,:scope=>'home' ),themengruppen_path %>
  • <%= link_to I18n.t(:studien,:scope=>'home' ), studien_path %>
  • <%= link_to "wiki intern", page_path(1) %> From a2b35d3d60fa9670377a0240104128d329f80f1b Mon Sep 17 00:00:00 2001 From: HausdorffHimself Date: Tue, 13 Aug 2013 18:29:06 +0200 Subject: [PATCH 4/8] ADD: jquery-ui --- app/assets/javascripts/application.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index f261299..68c0b94 100755 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -12,6 +12,8 @@ // //= require jquery //= require jquery_ujs +//= require jquery-ui //= require_tree . //= require tinymce-jquery -//= require bootstrap \ No newline at end of file +//= require bootstrap + From e055b60a53d4e7813935f103ebe1b9ee18c18cf0 Mon Sep 17 00:00:00 2001 From: HausdorffHimself Date: Tue, 13 Aug 2013 18:31:22 +0200 Subject: [PATCH 5/8] =?UTF-8?q?ADD:=20Informationsseite:=20Models=20f?= =?UTF-8?q?=C3=BCr=20Themengruppen/Themen/FAQs/Attachments=20Views=20f?= =?UTF-8?q?=C3=BCr=20Themengruppen/Themen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../javascripts/themengruppen.js.coffee | 3 -- app/assets/stylesheets/themengruppen.css.scss | 8 ++++ app/controllers/themen_controller.rb | 2 +- app/controllers/themengruppen_controller.rb | 32 +++++++-------- app/models/thema.rb | 2 +- app/models/themengruppe.rb | 2 +- app/views/themen/_form.html.erb | 5 ++- app/views/themen/_small.html.erb | 3 ++ app/views/themen/_thema.html.erb | 2 + app/views/themen/show.html.erb | 11 ++---- .../themengruppen/_themengruppe.html.erb | 12 ++++++ app/views/themengruppen/edit.html.erb | 4 +- app/views/themengruppen/index.html.erb | 39 +++++++++---------- app/views/themengruppen/show.html.erb | 30 ++++++++++---- db/migrate/20130805171433_translate_themen.rb | 2 +- ...70437_add_themaid_to_thema_translations.rb | 6 +++ 16 files changed, 101 insertions(+), 62 deletions(-) delete mode 100644 app/assets/javascripts/themengruppen.js.coffee create mode 100644 app/views/themen/_small.html.erb create mode 100644 app/views/themen/_thema.html.erb create mode 100644 app/views/themengruppen/_themengruppe.html.erb create mode 100644 db/migrate/20130812170437_add_themaid_to_thema_translations.rb diff --git a/app/assets/javascripts/themengruppen.js.coffee b/app/assets/javascripts/themengruppen.js.coffee deleted file mode 100644 index 7615679..0000000 --- a/app/assets/javascripts/themengruppen.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/themengruppen.css.scss b/app/assets/stylesheets/themengruppen.css.scss index 074b60a..5ea80bc 100644 --- a/app/assets/stylesheets/themengruppen.css.scss +++ b/app/assets/stylesheets/themengruppen.css.scss @@ -1,3 +1,11 @@ // Place all the styles related to the themengruppen controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ +div.themengruppe +{padding:10px; +margin:2px; +border-radius:10px; +min-width:13em; +border: #91B4FF solid 2px; +height: 90% +} diff --git a/app/controllers/themen_controller.rb b/app/controllers/themen_controller.rb index bb9235e..bc3bcb6 100644 --- a/app/controllers/themen_controller.rb +++ b/app/controllers/themen_controller.rb @@ -25,7 +25,7 @@ class ThemenController < ApplicationController # GET /themen/new.json def new @thema = Thema.new - + @thema.themengruppe = Themengruppe.find(params[:themengruppe_id]) unless params[:themengruppe_id].nil? respond_to do |format| format.html # new.html.erb format.json { render json: @thema } diff --git a/app/controllers/themengruppen_controller.rb b/app/controllers/themengruppen_controller.rb index 46fa1d4..a366078 100644 --- a/app/controllers/themengruppen_controller.rb +++ b/app/controllers/themengruppen_controller.rb @@ -13,42 +13,42 @@ class ThemengruppenController < ApplicationController # GET /themengruppen/1 # GET /themengruppen/1.json def show - @themagruppen = Themengruppe.find(params[:id]) + @themengruppe = Themengruppe.find(params[:id]) respond_to do |format| format.html # show.html.erb - format.json { render json: @themagruppen } + format.json { render json: @themengruppe } end end # GET /themengruppen/new # GET /themengruppen/new.json def new - @themagruppen = Themengruppe.new + @themengruppe = Themengruppe.new respond_to do |format| format.html # new.html.erb - format.json { render json: @themagruppen } + format.json { render json: @themengruppe } end end # GET /themengruppen/1/edit def edit - @themagruppen = Themengruppe.find(params[:id]) + @themengruppe = Themengruppe.find(params[:id]) end # POST /themengruppen # POST /themengruppen.json def create - @themagruppen = Themengruppe.new(params[:themagruppen]) + @themengruppe = Themengruppe.new(params[:themengruppe]) respond_to do |format| - if @themagruppen.save - format.html { redirect_to @themagruppen, notice: 'Themengruppe was successfully created.' } - format.json { render json: @themagruppen, status: :created, location: @themagruppen } + if @themengruppe.save + format.html { redirect_to @themengruppe, notice: 'Themengruppe was successfully created.' } + format.json { render json: @themengruppe, status: :created, location: @themengruppe } else format.html { render action: "new" } - format.json { render json: @themagruppen.errors, status: :unprocessable_entity } + format.json { render json: @themengruppe.errors, status: :unprocessable_entity } end end end @@ -56,15 +56,15 @@ class ThemengruppenController < ApplicationController # PUT /themengruppen/1 # PUT /themengruppen/1.json def update - @themagruppen = Themengruppe.find(params[:id]) + @themengruppe = Themengruppe.find(params[:id]) respond_to do |format| - if @themagruppen.update_attributes(params[:themagruppen]) - format.html { redirect_to @themagruppen, notice: 'Themengruppe was successfully updated.' } + if @themengruppe.update_attributes(params[:themengruppe]) + format.html { redirect_to @themengruppe, notice: 'Themengruppe was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } - format.json { render json: @themagruppen.errors, status: :unprocessable_entity } + format.json { render json: @themengruppe.errors, status: :unprocessable_entity } end end end @@ -72,8 +72,8 @@ class ThemengruppenController < ApplicationController # DELETE /themengruppen/1 # DELETE /themengruppen/1.json def destroy - @themagruppen = Themengruppe.find(params[:id]) - @themagruppen.destroy + @themengruppe = Themengruppe.find(params[:id]) + @themengruppe.destroy respond_to do |format| format.html { redirect_to themengruppen_url } diff --git a/app/models/thema.rb b/app/models/thema.rb index 44be678..64bdea9 100644 --- a/app/models/thema.rb +++ b/app/models/thema.rb @@ -1,5 +1,5 @@ class Thema < ActiveRecord::Base - attr_accessible :text, :title + attr_accessible :text, :title, :themengruppe_id has_many :fragen has_many :attachments belongs_to :themengruppe, :foreign_key => "themengruppe_id" diff --git a/app/models/themengruppe.rb b/app/models/themengruppe.rb index f73289d..034558f 100644 --- a/app/models/themengruppe.rb +++ b/app/models/themengruppe.rb @@ -1,6 +1,6 @@ class Themengruppe < ActiveRecord::Base attr_accessible :text, :title - has_many :themen + has_many :themen, class_name: 'Thema' has_many :fragen, through: :themen validates :title, :presence => true diff --git a/app/views/themen/_form.html.erb b/app/views/themen/_form.html.erb index 060b29b..0444d68 100644 --- a/app/views/themen/_form.html.erb +++ b/app/views/themen/_form.html.erb @@ -1,8 +1,11 @@ +<%= tinymce_assets %> <%= semantic_form_for @thema do |f| %> <%= f.inputs do %> <%= f.input :title %> - <%= f.input :text %> + <%= f.input :themengruppe %> + <%= f.input :text, :as=>:tinymce_text%> <% end %> +<%= tinymce %> <%= f.actions do %> <%= f.action :submit, :as => :input %> diff --git a/app/views/themen/_small.html.erb b/app/views/themen/_small.html.erb new file mode 100644 index 0000000..49205ad --- /dev/null +++ b/app/views/themen/_small.html.erb @@ -0,0 +1,3 @@ +<%= raw(small.text) %> +
    +<%= link_to 'Edit', edit_thema_path(small) %> diff --git a/app/views/themen/_thema.html.erb b/app/views/themen/_thema.html.erb new file mode 100644 index 0000000..50cbe00 --- /dev/null +++ b/app/views/themen/_thema.html.erb @@ -0,0 +1,2 @@ + <%= link_to thema.title,themengruppe_thema_path(thema.themengruppe,thema)%> + diff --git a/app/views/themen/show.html.erb b/app/views/themen/show.html.erb index 8dd7605..31c2c49 100644 --- a/app/views/themen/show.html.erb +++ b/app/views/themen/show.html.erb @@ -1,15 +1,10 @@

    <%= notice %>

    +

    <%= @thema.title %>

    - Title: - <%= @thema.title %> -

    - -

    - Text: - <%= @thema.text %> + <%= raw(@thema.text) %>

    <%= link_to 'Edit', edit_thema_path(@thema) %> | -<%= link_to 'Back', themen_path %> +<%= link_to 'Back', themengruppe_path(@thema.themengruppe) %> diff --git a/app/views/themengruppen/_themengruppe.html.erb b/app/views/themengruppen/_themengruppe.html.erb new file mode 100644 index 0000000..9fe5849 --- /dev/null +++ b/app/views/themengruppen/_themengruppe.html.erb @@ -0,0 +1,12 @@ + +

    <%= link_to themengruppe.title, themengruppe %>

    +

    + <%=themengruppe.text %> +

    +
      + <% themengruppe.themen.each do |t| %> +
    • + <%= render t %> +
    • + <% end %> +
    diff --git a/app/views/themengruppen/edit.html.erb b/app/views/themengruppen/edit.html.erb index 8247722..68f8332 100644 --- a/app/views/themengruppen/edit.html.erb +++ b/app/views/themengruppen/edit.html.erb @@ -1,6 +1,6 @@ -

    Editing themagruppen

    +

    Editing themengruppen

    <%= render 'form' %> -<%= link_to 'Show', @themagruppen %> | +<%= link_to 'Show', @themengruppe %> | <%= link_to 'Back', themengruppen_path %> diff --git a/app/views/themengruppen/index.html.erb b/app/views/themengruppen/index.html.erb index 6cd7fe6..9976ad2 100644 --- a/app/views/themengruppen/index.html.erb +++ b/app/views/themengruppen/index.html.erb @@ -1,25 +1,24 @@ -

    Listing themengruppen

    +
    - - - - - - - - - -<% @themengruppen.each do |themengruppe| %> - - - - - - - +<% @themengruppen.each_slice(2) do |row| %> +
    + <% row.each do |themengruppe| %> +
    +
    + <%= render themengruppe %> +

    + <%= link_to 'Edit', edit_themengruppe_path(themengruppe) %> +

    +
    +
    + <% end %> +
    <% end %> -
    TitleText
    <%= themengruppe.title %><%= themengruppe.text %><%= link_to 'Show', themengruppe %><%= link_to 'Edit', edit_themengruppe_path(themengruppe) %><%= link_to 'Destroy', themengruppe, method: :delete, data: { confirm: 'Are you sure?' } %>
    - +

    + + <%= link_to 'New Themengruppe', new_themengruppe_path %> diff --git a/app/views/themengruppen/show.html.erb b/app/views/themengruppen/show.html.erb index 3bf3ae4..374958f 100644 --- a/app/views/themengruppen/show.html.erb +++ b/app/views/themengruppen/show.html.erb @@ -1,15 +1,29 @@ -

    <%= notice %>

    +

    <%= @themengruppe.title %>

    - Title: - <%= @themagruppen.title %> + <%= @themengruppe.text %>

    -

    - Text: - <%= @themagruppen.text %> -

    +
    + <% @themengruppe.themen.each do |thema| %> +
    + +
    +
    + <%= render partial: "themen/small", object: thema %> +
    +
    +
    + <% end %> +
    +<%= link_to 'Add Thema', new_themengruppe_thema_path(@themengruppe) %> -<%= link_to 'Edit', edit_themagruppen_path(@themagruppen) %> | +

    + +<%= link_to 'Edit', edit_themengruppe_path(@themengruppe) %> | <%= link_to 'Back', themengruppen_path %> diff --git a/db/migrate/20130805171433_translate_themen.rb b/db/migrate/20130805171433_translate_themen.rb index 6f5db97..1c53d38 100644 --- a/db/migrate/20130805171433_translate_themen.rb +++ b/db/migrate/20130805171433_translate_themen.rb @@ -6,7 +6,7 @@ class TranslateThemen < ActiveRecord::Migration }, { #:migrate_data => true }) - add_column :thema_translations, :themen_id, :integer + add_column :thema_translations, :theman_id, :integer remove_column :thema_translations, :thema_id Themengruppe.create_translation_table!({ diff --git a/db/migrate/20130812170437_add_themaid_to_thema_translations.rb b/db/migrate/20130812170437_add_themaid_to_thema_translations.rb new file mode 100644 index 0000000..acd6173 --- /dev/null +++ b/db/migrate/20130812170437_add_themaid_to_thema_translations.rb @@ -0,0 +1,6 @@ +class AddThemaidToThemaTranslations < ActiveRecord::Migration + def change + add_column :thema_translations, :theman_id, :integer + remove_column :thema_translations, :themen_id, :integer + end +end From 098f6b0a5595f7dd4018bcbcd307025363dee3f9 Mon Sep 17 00:00:00 2001 From: HausdorffHimself Date: Tue, 13 Aug 2013 18:32:09 +0200 Subject: [PATCH 6/8] =?UTF-8?q?FIX:=20Fallback=20f=C3=BCr=20Lokalisation?= =?UTF-8?q?=20+=20Fallback-Ordnung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/application.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 60ec0ec..9ff3309 100755 --- a/config/application.rb +++ b/config/application.rb @@ -31,7 +31,8 @@ module Fetsite # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de + config.i18n.default_locale = :de + config.i18n.fallbacks = [:en, :de] # Configure the default encoding used in templates for Ruby 1.9. config.encoding = "utf-8" From 273078d0067f221e02de6ac8e2bd5cf5425cfa9f Mon Sep 17 00:00:00 2001 From: HausdorffHimself Date: Tue, 13 Aug 2013 18:32:45 +0200 Subject: [PATCH 7/8] =?UTF-8?q?ADD:=20Nested=20Ressources=20f=C3=BCr=20The?= =?UTF-8?q?mengruppen=20und=20Themen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 49a9c15..530ace4 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,10 +6,10 @@ resources :attachments - resources :themen + - resources :themengruppen + devise_for :users @@ -57,6 +57,10 @@ get 'rubriken/:id/verwalten',:controller=>:rubriken,:action=>:verwalten, :as=>'v resources :home, :only=>[:index] get 'home/dev', :controller=>:home, :action=>:dev, :as=>'home_dev' resources :beispiele +resources :themen +resources :themengruppen do +resources :themen, :only=>[:new, :show] +end end From c73984e81d3eb896fddc5e38654c142ab9d6e02f Mon Sep 17 00:00:00 2001 From: HausdorffHimself Date: Tue, 13 Aug 2013 18:34:05 +0200 Subject: [PATCH 8/8] =?UTF-8?q?ADD:=20JavaScript=20zur=20Angleichung=20der?= =?UTF-8?q?=20H=C3=B6he=20innerhalb=20einer=20"row-fluid"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/javascripts/themengruppen.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 app/assets/javascripts/themengruppen.js diff --git a/app/assets/javascripts/themengruppen.js b/app/assets/javascripts/themengruppen.js new file mode 100644 index 0000000..b850377 --- /dev/null +++ b/app/assets/javascripts/themengruppen.js @@ -0,0 +1,3 @@ +var make_equal_height = function() { + $('.equalheight').height(function() {return ($(this).closest(".row-fluid").height())}) +}