Date: Tue, 6 Aug 2013 00:48:45 +0200
Subject: [PATCH 03/53] calendar feature generiert
---
app/assets/javascripts/calendars.js.coffee | 3 +
app/assets/javascripts/calentries.js.coffee | 3 +
app/assets/stylesheets/calendars.css.scss | 3 +
app/assets/stylesheets/calentries.css.scss | 3 +
app/controllers/calendars_controller.rb | 83 +++++++++
app/controllers/calentries_controller.rb | 84 +++++++++
app/helpers/calendars_helper.rb | 2 +
app/helpers/calentries_helper.rb | 2 +
app/models/calendar.rb | 3 +
app/models/calentry.rb | 4 +
app/views/calendars/_form.html.erb | 10 ++
app/views/calendars/edit.html.erb | 6 +
app/views/calendars/index.html.erb | 25 +++
app/views/calendars/new.html.erb | 5 +
app/views/calendars/show.html.erb | 15 ++
app/views/calentries/_form.html.erb | 12 ++
app/views/calentries/edit.html.erb | 6 +
app/views/calentries/index.html.erb | 29 ++++
app/views/calentries/new.html.erb | 5 +
app/views/calentries/show.html.erb | 25 +++
app/views/calentries/show.ics.erb | 25 +++
config/routes.rb | 6 +
.../20130805191709_create_calentries.rb | 12 ++
db/migrate/20130805191817_create_calendars.rb | 10 ++
spec/controllers/calendars_controller_spec.rb | 160 ++++++++++++++++++
.../controllers/calentries_controller_spec.rb | 160 ++++++++++++++++++
spec/factories/calendars.rb | 8 +
spec/factories/calentries.rb | 10 ++
spec/helpers/calendars_helper_spec.rb | 15 ++
spec/helpers/calentries_helper_spec.rb | 15 ++
spec/models/calendar_spec.rb | 5 +
spec/models/calentry_spec.rb | 5 +
spec/requests/calendars_spec.rb | 11 ++
spec/requests/calentries_spec.rb | 11 ++
spec/routing/calendars_routing_spec.rb | 35 ++++
spec/routing/calentries_routing_spec.rb | 35 ++++
spec/views/calendars/edit.html.erb_spec.rb | 20 +++
spec/views/calendars/index.html.erb_spec.rb | 23 +++
spec/views/calendars/new.html.erb_spec.rb | 20 +++
spec/views/calendars/show.html.erb_spec.rb | 17 ++
spec/views/calentries/edit.html.erb_spec.rb | 20 +++
spec/views/calentries/index.html.erb_spec.rb | 23 +++
spec/views/calentries/new.html.erb_spec.rb | 20 +++
spec/views/calentries/show.html.erb_spec.rb | 17 ++
44 files changed, 1011 insertions(+)
create mode 100644 app/assets/javascripts/calendars.js.coffee
create mode 100644 app/assets/javascripts/calentries.js.coffee
create mode 100644 app/assets/stylesheets/calendars.css.scss
create mode 100644 app/assets/stylesheets/calentries.css.scss
create mode 100644 app/controllers/calendars_controller.rb
create mode 100644 app/controllers/calentries_controller.rb
create mode 100644 app/helpers/calendars_helper.rb
create mode 100644 app/helpers/calentries_helper.rb
create mode 100644 app/models/calendar.rb
create mode 100644 app/models/calentry.rb
create mode 100644 app/views/calendars/_form.html.erb
create mode 100644 app/views/calendars/edit.html.erb
create mode 100644 app/views/calendars/index.html.erb
create mode 100644 app/views/calendars/new.html.erb
create mode 100644 app/views/calendars/show.html.erb
create mode 100644 app/views/calentries/_form.html.erb
create mode 100644 app/views/calentries/edit.html.erb
create mode 100644 app/views/calentries/index.html.erb
create mode 100644 app/views/calentries/new.html.erb
create mode 100644 app/views/calentries/show.html.erb
create mode 100644 app/views/calentries/show.ics.erb
create mode 100644 db/migrate/20130805191709_create_calentries.rb
create mode 100644 db/migrate/20130805191817_create_calendars.rb
create mode 100644 spec/controllers/calendars_controller_spec.rb
create mode 100644 spec/controllers/calentries_controller_spec.rb
create mode 100644 spec/factories/calendars.rb
create mode 100644 spec/factories/calentries.rb
create mode 100644 spec/helpers/calendars_helper_spec.rb
create mode 100644 spec/helpers/calentries_helper_spec.rb
create mode 100644 spec/models/calendar_spec.rb
create mode 100644 spec/models/calentry_spec.rb
create mode 100644 spec/requests/calendars_spec.rb
create mode 100644 spec/requests/calentries_spec.rb
create mode 100644 spec/routing/calendars_routing_spec.rb
create mode 100644 spec/routing/calentries_routing_spec.rb
create mode 100644 spec/views/calendars/edit.html.erb_spec.rb
create mode 100644 spec/views/calendars/index.html.erb_spec.rb
create mode 100644 spec/views/calendars/new.html.erb_spec.rb
create mode 100644 spec/views/calendars/show.html.erb_spec.rb
create mode 100644 spec/views/calentries/edit.html.erb_spec.rb
create mode 100644 spec/views/calentries/index.html.erb_spec.rb
create mode 100644 spec/views/calentries/new.html.erb_spec.rb
create mode 100644 spec/views/calentries/show.html.erb_spec.rb
diff --git a/app/assets/javascripts/calendars.js.coffee b/app/assets/javascripts/calendars.js.coffee
new file mode 100644
index 0000000..7615679
--- /dev/null
+++ b/app/assets/javascripts/calendars.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/calentries.js.coffee b/app/assets/javascripts/calentries.js.coffee
new file mode 100644
index 0000000..7615679
--- /dev/null
+++ b/app/assets/javascripts/calentries.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/calendars.css.scss b/app/assets/stylesheets/calendars.css.scss
new file mode 100644
index 0000000..0efb58b
--- /dev/null
+++ b/app/assets/stylesheets/calendars.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the calendars 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/calentries.css.scss b/app/assets/stylesheets/calentries.css.scss
new file mode 100644
index 0000000..47a2dcd
--- /dev/null
+++ b/app/assets/stylesheets/calentries.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the calentries 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/calendars_controller.rb b/app/controllers/calendars_controller.rb
new file mode 100644
index 0000000..b3631aa
--- /dev/null
+++ b/app/controllers/calendars_controller.rb
@@ -0,0 +1,83 @@
+class CalendarsController < ApplicationController
+ # GET /calendars
+ # GET /calendars.json
+ def index
+ @calendars = Calendar.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @calendars }
+ end
+ end
+
+ # GET /calendars/1
+ # GET /calendars/1.json
+ def show
+ @calendar = Calendar.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @calendar }
+ end
+ end
+
+ # GET /calendars/new
+ # GET /calendars/new.json
+ def new
+ @calendar = Calendar.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @calendar }
+ end
+ end
+
+ # GET /calendars/1/edit
+ def edit
+ @calendar = Calendar.find(params[:id])
+ end
+
+ # POST /calendars
+ # POST /calendars.json
+ def create
+ @calendar = Calendar.new(params[:calendar])
+
+ respond_to do |format|
+ if @calendar.save
+ format.html { redirect_to @calendar, notice: 'Calendar was successfully created.' }
+ format.json { render json: @calendar, status: :created, location: @calendar }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @calendar.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /calendars/1
+ # PUT /calendars/1.json
+ def update
+ @calendar = Calendar.find(params[:id])
+
+ respond_to do |format|
+ if @calendar.update_attributes(params[:calendar])
+ format.html { redirect_to @calendar, notice: 'Calendar was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @calendar.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /calendars/1
+ # DELETE /calendars/1.json
+ def destroy
+ @calendar = Calendar.find(params[:id])
+ @calendar.destroy
+
+ respond_to do |format|
+ format.html { redirect_to calendars_url }
+ format.json { head :no_content }
+ end
+ end
+end
diff --git a/app/controllers/calentries_controller.rb b/app/controllers/calentries_controller.rb
new file mode 100644
index 0000000..89990cd
--- /dev/null
+++ b/app/controllers/calentries_controller.rb
@@ -0,0 +1,84 @@
+class CalentriesController < ApplicationController
+ # GET /calentries
+ # GET /calentries.json
+ def index
+ @calentries = Calentry.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @calentries }
+ end
+ end
+
+ # GET /calentries/1
+ # GET /calentries/1.json
+ def show
+ @calentry = Calentry.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @calentry }
+ format.ics { render 'show.ics.erb',}
+ end
+ end
+
+ # GET /calentries/new
+ # GET /calentries/new.json
+ def new
+ @calentry = Calentry.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @calentry }
+ end
+ end
+
+ # GET /calentries/1/edit
+ def edit
+ @calentry = Calentry.find(params[:id])
+ end
+
+ # POST /calentries
+ # POST /calentries.json
+ def create
+ @calentry = Calentry.new(params[:calentry])
+
+ respond_to do |format|
+ if @calentry.save
+ format.html { redirect_to @calentry, notice: 'Calentry was successfully created.' }
+ format.json { render json: @calentry, status: :created, location: @calentry }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @calentry.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /calentries/1
+ # PUT /calentries/1.json
+ def update
+ @calentry = Calentry.find(params[:id])
+
+ respond_to do |format|
+ if @calentry.update_attributes(params[:calentry])
+ format.html { redirect_to @calentry, notice: 'Calentry was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @calentry.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /calentries/1
+ # DELETE /calentries/1.json
+ def destroy
+ @calentry = Calentry.find(params[:id])
+ @calentry.destroy
+
+ respond_to do |format|
+ format.html { redirect_to calentries_url }
+ format.json { head :no_content }
+ end
+ end
+end
diff --git a/app/helpers/calendars_helper.rb b/app/helpers/calendars_helper.rb
new file mode 100644
index 0000000..9712f62
--- /dev/null
+++ b/app/helpers/calendars_helper.rb
@@ -0,0 +1,2 @@
+module CalendarsHelper
+end
diff --git a/app/helpers/calentries_helper.rb b/app/helpers/calentries_helper.rb
new file mode 100644
index 0000000..b46fa94
--- /dev/null
+++ b/app/helpers/calentries_helper.rb
@@ -0,0 +1,2 @@
+module CalentriesHelper
+end
diff --git a/app/models/calendar.rb b/app/models/calendar.rb
new file mode 100644
index 0000000..5b55280
--- /dev/null
+++ b/app/models/calendar.rb
@@ -0,0 +1,3 @@
+class Calendar < ActiveRecord::Base
+ attr_accessible :name, :public
+end
diff --git a/app/models/calentry.rb b/app/models/calentry.rb
new file mode 100644
index 0000000..6e892ad
--- /dev/null
+++ b/app/models/calentry.rb
@@ -0,0 +1,4 @@
+class Calentry < ActiveRecord::Base
+ attr_accessible :ende, :start, :summary, :typ
+
+end
diff --git a/app/views/calendars/_form.html.erb b/app/views/calendars/_form.html.erb
new file mode 100644
index 0000000..dc6e021
--- /dev/null
+++ b/app/views/calendars/_form.html.erb
@@ -0,0 +1,10 @@
+<%= semantic_form_for @calendar do |f| %>
+ <%= f.inputs do %>
+ <%= f.input :name %>
+ <%= f.input :public %>
+ <% end %>
+
+ <%= f.actions do %>
+ <%= f.action :submit, :as => :input %>
+ <% end %>
+<% end %>
diff --git a/app/views/calendars/edit.html.erb b/app/views/calendars/edit.html.erb
new file mode 100644
index 0000000..e882347
--- /dev/null
+++ b/app/views/calendars/edit.html.erb
@@ -0,0 +1,6 @@
+Editing calendar
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @calendar %> |
+<%= link_to 'Back', calendars_path %>
diff --git a/app/views/calendars/index.html.erb b/app/views/calendars/index.html.erb
new file mode 100644
index 0000000..402c093
--- /dev/null
+++ b/app/views/calendars/index.html.erb
@@ -0,0 +1,25 @@
+Listing calendars
+
+
+
+ | Name |
+ Public |
+ |
+ |
+ |
+
+
+<% @calendars.each do |calendar| %>
+
+ | <%= calendar.name %> |
+ <%= calendar.public %> |
+ <%= link_to 'Show', calendar %> |
+ <%= link_to 'Edit', edit_calendar_path(calendar) %> |
+ <%= link_to 'Destroy', calendar, method: :delete, data: { confirm: 'Are you sure?' } %> |
+
+<% end %>
+
+
+
+
+<%= link_to 'New Calendar', new_calendar_path %>
diff --git a/app/views/calendars/new.html.erb b/app/views/calendars/new.html.erb
new file mode 100644
index 0000000..0d60f9a
--- /dev/null
+++ b/app/views/calendars/new.html.erb
@@ -0,0 +1,5 @@
+New calendar
+
+<%= render 'form' %>
+
+<%= link_to 'Back', calendars_path %>
diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb
new file mode 100644
index 0000000..efadc5a
--- /dev/null
+++ b/app/views/calendars/show.html.erb
@@ -0,0 +1,15 @@
+<%= notice %>
+
+
+ Name:
+ <%= @calendar.name %>
+
+
+
+ Public:
+ <%= @calendar.public %>
+
+
+
+<%= link_to 'Edit', edit_calendar_path(@calendar) %> |
+<%= link_to 'Back', calendars_path %>
diff --git a/app/views/calentries/_form.html.erb b/app/views/calentries/_form.html.erb
new file mode 100644
index 0000000..bd74e58
--- /dev/null
+++ b/app/views/calentries/_form.html.erb
@@ -0,0 +1,12 @@
+<%= semantic_form_for @calentry do |f| %>
+ <%= f.inputs do %>
+ <%= f.input :start %>
+ <%= f.input :ende %>
+ <%= f.input :summary %>
+ <%= f.input :typ %>
+ <% end %>
+
+ <%= f.actions do %>
+ <%= f.action :submit, :as => :input %>
+ <% end %>
+<% end %>
diff --git a/app/views/calentries/edit.html.erb b/app/views/calentries/edit.html.erb
new file mode 100644
index 0000000..2d1c180
--- /dev/null
+++ b/app/views/calentries/edit.html.erb
@@ -0,0 +1,6 @@
+Editing calentry
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @calentry %> |
+<%= link_to 'Back', calentries_path %>
diff --git a/app/views/calentries/index.html.erb b/app/views/calentries/index.html.erb
new file mode 100644
index 0000000..a54afda
--- /dev/null
+++ b/app/views/calentries/index.html.erb
@@ -0,0 +1,29 @@
+Listing calentries
+
+
+
+ | Start |
+ Ende |
+ Summary |
+ Typ |
+ |
+ |
+ |
+
+
+<% @calentries.each do |calentry| %>
+
+ | <%= calentry.start %> |
+ <%= calentry.ende %> |
+ <%= calentry.summary %> |
+ <%= calentry.typ %> |
+ <%= link_to 'Show', calentry %> |
+ <%= link_to 'Edit', edit_calentry_path(calentry) %> |
+ <%= link_to 'Destroy', calentry, method: :delete, data: { confirm: 'Are you sure?' } %> |
+
+<% end %>
+
+
+
+
+<%= link_to 'New Calentry', new_calentry_path %>
diff --git a/app/views/calentries/new.html.erb b/app/views/calentries/new.html.erb
new file mode 100644
index 0000000..022d6f8
--- /dev/null
+++ b/app/views/calentries/new.html.erb
@@ -0,0 +1,5 @@
+New calentry
+
+<%= render 'form' %>
+
+<%= link_to 'Back', calentries_path %>
diff --git a/app/views/calentries/show.html.erb b/app/views/calentries/show.html.erb
new file mode 100644
index 0000000..908d8dc
--- /dev/null
+++ b/app/views/calentries/show.html.erb
@@ -0,0 +1,25 @@
+<%= notice %>
+
+
+ Start:
+ <%= @calentry.start %>
+
+
+
+ Ende:
+ <%= @calentry.ende %>
+
+
+
+ Summary:
+ <%= @calentry.summary %>
+
+
+
+ Typ:
+ <%= @calentry.typ %>
+
+
+
+<%= link_to 'Edit', edit_calentry_path(@calentry) %> |
+<%= link_to 'Back', calentries_path %>
diff --git a/app/views/calentries/show.ics.erb b/app/views/calentries/show.ics.erb
new file mode 100644
index 0000000..908d8dc
--- /dev/null
+++ b/app/views/calentries/show.ics.erb
@@ -0,0 +1,25 @@
+<%= notice %>
+
+
+ Start:
+ <%= @calentry.start %>
+
+
+
+ Ende:
+ <%= @calentry.ende %>
+
+
+
+ Summary:
+ <%= @calentry.summary %>
+
+
+
+ Typ:
+ <%= @calentry.typ %>
+
+
+
+<%= link_to 'Edit', edit_calentry_path(@calentry) %> |
+<%= link_to 'Back', calentries_path %>
diff --git a/config/routes.rb b/config/routes.rb
index 2603420..696aeb1 100755
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,11 @@
Fetsite::Application.routes.draw do
+ resources :calendars
+
+
+ resources :calentries
+
+
devise_for :users
resources :home, :only=>[:index]
#get 'home',:controller=>home,:action=>:index,:as=>"home_index"
diff --git a/db/migrate/20130805191709_create_calentries.rb b/db/migrate/20130805191709_create_calentries.rb
new file mode 100644
index 0000000..c4ece84
--- /dev/null
+++ b/db/migrate/20130805191709_create_calentries.rb
@@ -0,0 +1,12 @@
+class CreateCalentries < ActiveRecord::Migration
+ def change
+ create_table :calentries do |t|
+ t.timestamp :start
+ t.timestamp :ende
+ t.string :summary
+ t.integer :typ
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20130805191817_create_calendars.rb b/db/migrate/20130805191817_create_calendars.rb
new file mode 100644
index 0000000..bc12669
--- /dev/null
+++ b/db/migrate/20130805191817_create_calendars.rb
@@ -0,0 +1,10 @@
+class CreateCalendars < ActiveRecord::Migration
+ def change
+ create_table :calendars do |t|
+ t.string :name
+ t.boolean :public
+
+ t.timestamps
+ end
+ end
+end
diff --git a/spec/controllers/calendars_controller_spec.rb b/spec/controllers/calendars_controller_spec.rb
new file mode 100644
index 0000000..65fc3e7
--- /dev/null
+++ b/spec/controllers/calendars_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 CalendarsController do
+
+ # This should return the minimal set of attributes required to create a valid
+ # Calendar. As you add validations to Calendar, 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
+ # CalendarsController. Be sure to keep this updated too.
+ let(:valid_session) { {} }
+
+ describe "GET index" do
+ it "assigns all calendars as @calendars" do
+ calendar = Calendar.create! valid_attributes
+ get :index, {}, valid_session
+ assigns(:calendars).should eq([calendar])
+ end
+ end
+
+ describe "GET show" do
+ it "assigns the requested calendar as @calendar" do
+ calendar = Calendar.create! valid_attributes
+ get :show, {:id => calendar.to_param}, valid_session
+ assigns(:calendar).should eq(calendar)
+ end
+ end
+
+ describe "GET new" do
+ it "assigns a new calendar as @calendar" do
+ get :new, {}, valid_session
+ assigns(:calendar).should be_a_new(Calendar)
+ end
+ end
+
+ describe "GET edit" do
+ it "assigns the requested calendar as @calendar" do
+ calendar = Calendar.create! valid_attributes
+ get :edit, {:id => calendar.to_param}, valid_session
+ assigns(:calendar).should eq(calendar)
+ end
+ end
+
+ describe "POST create" do
+ describe "with valid params" do
+ it "creates a new Calendar" do
+ expect {
+ post :create, {:calendar => valid_attributes}, valid_session
+ }.to change(Calendar, :count).by(1)
+ end
+
+ it "assigns a newly created calendar as @calendar" do
+ post :create, {:calendar => valid_attributes}, valid_session
+ assigns(:calendar).should be_a(Calendar)
+ assigns(:calendar).should be_persisted
+ end
+
+ it "redirects to the created calendar" do
+ post :create, {:calendar => valid_attributes}, valid_session
+ response.should redirect_to(Calendar.last)
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns a newly created but unsaved calendar as @calendar" do
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calendar.any_instance.stub(:save).and_return(false)
+ post :create, {:calendar => { "name" => "invalid value" }}, valid_session
+ assigns(:calendar).should be_a_new(Calendar)
+ end
+
+ it "re-renders the 'new' template" do
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calendar.any_instance.stub(:save).and_return(false)
+ post :create, {:calendar => { "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 calendar" do
+ calendar = Calendar.create! valid_attributes
+ # Assuming there are no other calendars in the database, this
+ # specifies that the Calendar created on the previous line
+ # receives the :update_attributes message with whatever params are
+ # submitted in the request.
+ Calendar.any_instance.should_receive(:update_attributes).with({ "name" => "MyString" })
+ put :update, {:id => calendar.to_param, :calendar => { "name" => "MyString" }}, valid_session
+ end
+
+ it "assigns the requested calendar as @calendar" do
+ calendar = Calendar.create! valid_attributes
+ put :update, {:id => calendar.to_param, :calendar => valid_attributes}, valid_session
+ assigns(:calendar).should eq(calendar)
+ end
+
+ it "redirects to the calendar" do
+ calendar = Calendar.create! valid_attributes
+ put :update, {:id => calendar.to_param, :calendar => valid_attributes}, valid_session
+ response.should redirect_to(calendar)
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns the calendar as @calendar" do
+ calendar = Calendar.create! valid_attributes
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calendar.any_instance.stub(:save).and_return(false)
+ put :update, {:id => calendar.to_param, :calendar => { "name" => "invalid value" }}, valid_session
+ assigns(:calendar).should eq(calendar)
+ end
+
+ it "re-renders the 'edit' template" do
+ calendar = Calendar.create! valid_attributes
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calendar.any_instance.stub(:save).and_return(false)
+ put :update, {:id => calendar.to_param, :calendar => { "name" => "invalid value" }}, valid_session
+ response.should render_template("edit")
+ end
+ end
+ end
+
+ describe "DELETE destroy" do
+ it "destroys the requested calendar" do
+ calendar = Calendar.create! valid_attributes
+ expect {
+ delete :destroy, {:id => calendar.to_param}, valid_session
+ }.to change(Calendar, :count).by(-1)
+ end
+
+ it "redirects to the calendars list" do
+ calendar = Calendar.create! valid_attributes
+ delete :destroy, {:id => calendar.to_param}, valid_session
+ response.should redirect_to(calendars_url)
+ end
+ end
+
+end
diff --git a/spec/controllers/calentries_controller_spec.rb b/spec/controllers/calentries_controller_spec.rb
new file mode 100644
index 0000000..63605e7
--- /dev/null
+++ b/spec/controllers/calentries_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 CalentriesController do
+
+ # This should return the minimal set of attributes required to create a valid
+ # Calentry. As you add validations to Calentry, be sure to
+ # adjust the attributes here as well.
+ let(:valid_attributes) { { "start" => "2013-08-05 21:17:10" } }
+
+ # 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
+ # CalentriesController. Be sure to keep this updated too.
+ let(:valid_session) { {} }
+
+ describe "GET index" do
+ it "assigns all calentries as @calentries" do
+ calentry = Calentry.create! valid_attributes
+ get :index, {}, valid_session
+ assigns(:calentries).should eq([calentry])
+ end
+ end
+
+ describe "GET show" do
+ it "assigns the requested calentry as @calentry" do
+ calentry = Calentry.create! valid_attributes
+ get :show, {:id => calentry.to_param}, valid_session
+ assigns(:calentry).should eq(calentry)
+ end
+ end
+
+ describe "GET new" do
+ it "assigns a new calentry as @calentry" do
+ get :new, {}, valid_session
+ assigns(:calentry).should be_a_new(Calentry)
+ end
+ end
+
+ describe "GET edit" do
+ it "assigns the requested calentry as @calentry" do
+ calentry = Calentry.create! valid_attributes
+ get :edit, {:id => calentry.to_param}, valid_session
+ assigns(:calentry).should eq(calentry)
+ end
+ end
+
+ describe "POST create" do
+ describe "with valid params" do
+ it "creates a new Calentry" do
+ expect {
+ post :create, {:calentry => valid_attributes}, valid_session
+ }.to change(Calentry, :count).by(1)
+ end
+
+ it "assigns a newly created calentry as @calentry" do
+ post :create, {:calentry => valid_attributes}, valid_session
+ assigns(:calentry).should be_a(Calentry)
+ assigns(:calentry).should be_persisted
+ end
+
+ it "redirects to the created calentry" do
+ post :create, {:calentry => valid_attributes}, valid_session
+ response.should redirect_to(Calentry.last)
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns a newly created but unsaved calentry as @calentry" do
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calentry.any_instance.stub(:save).and_return(false)
+ post :create, {:calentry => { "start" => "invalid value" }}, valid_session
+ assigns(:calentry).should be_a_new(Calentry)
+ end
+
+ it "re-renders the 'new' template" do
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calentry.any_instance.stub(:save).and_return(false)
+ post :create, {:calentry => { "start" => "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 calentry" do
+ calentry = Calentry.create! valid_attributes
+ # Assuming there are no other calentries in the database, this
+ # specifies that the Calentry created on the previous line
+ # receives the :update_attributes message with whatever params are
+ # submitted in the request.
+ Calentry.any_instance.should_receive(:update_attributes).with({ "start" => "2013-08-05 21:17:10" })
+ put :update, {:id => calentry.to_param, :calentry => { "start" => "2013-08-05 21:17:10" }}, valid_session
+ end
+
+ it "assigns the requested calentry as @calentry" do
+ calentry = Calentry.create! valid_attributes
+ put :update, {:id => calentry.to_param, :calentry => valid_attributes}, valid_session
+ assigns(:calentry).should eq(calentry)
+ end
+
+ it "redirects to the calentry" do
+ calentry = Calentry.create! valid_attributes
+ put :update, {:id => calentry.to_param, :calentry => valid_attributes}, valid_session
+ response.should redirect_to(calentry)
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns the calentry as @calentry" do
+ calentry = Calentry.create! valid_attributes
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calentry.any_instance.stub(:save).and_return(false)
+ put :update, {:id => calentry.to_param, :calentry => { "start" => "invalid value" }}, valid_session
+ assigns(:calentry).should eq(calentry)
+ end
+
+ it "re-renders the 'edit' template" do
+ calentry = Calentry.create! valid_attributes
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calentry.any_instance.stub(:save).and_return(false)
+ put :update, {:id => calentry.to_param, :calentry => { "start" => "invalid value" }}, valid_session
+ response.should render_template("edit")
+ end
+ end
+ end
+
+ describe "DELETE destroy" do
+ it "destroys the requested calentry" do
+ calentry = Calentry.create! valid_attributes
+ expect {
+ delete :destroy, {:id => calentry.to_param}, valid_session
+ }.to change(Calentry, :count).by(-1)
+ end
+
+ it "redirects to the calentries list" do
+ calentry = Calentry.create! valid_attributes
+ delete :destroy, {:id => calentry.to_param}, valid_session
+ response.should redirect_to(calentries_url)
+ end
+ end
+
+end
diff --git a/spec/factories/calendars.rb b/spec/factories/calendars.rb
new file mode 100644
index 0000000..f5cafa0
--- /dev/null
+++ b/spec/factories/calendars.rb
@@ -0,0 +1,8 @@
+# Read about factories at https://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :calendar do
+ name "MyString"
+ public false
+ end
+end
diff --git a/spec/factories/calentries.rb b/spec/factories/calentries.rb
new file mode 100644
index 0000000..3e2d9b9
--- /dev/null
+++ b/spec/factories/calentries.rb
@@ -0,0 +1,10 @@
+# Read about factories at https://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :calentry do
+ start "2013-08-05 21:17:10"
+ ende "2013-08-05 21:17:10"
+ summary "MyString"
+ typ 1
+ end
+end
diff --git a/spec/helpers/calendars_helper_spec.rb b/spec/helpers/calendars_helper_spec.rb
new file mode 100644
index 0000000..67df5e7
--- /dev/null
+++ b/spec/helpers/calendars_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the CalendarsHelper. For example:
+#
+# describe CalendarsHelper 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 CalendarsHelper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/helpers/calentries_helper_spec.rb b/spec/helpers/calentries_helper_spec.rb
new file mode 100644
index 0000000..b496788
--- /dev/null
+++ b/spec/helpers/calentries_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the CalentriesHelper. For example:
+#
+# describe CalentriesHelper 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 CalentriesHelper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/calendar_spec.rb b/spec/models/calendar_spec.rb
new file mode 100644
index 0000000..f4477ee
--- /dev/null
+++ b/spec/models/calendar_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Calendar do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/calentry_spec.rb b/spec/models/calentry_spec.rb
new file mode 100644
index 0000000..0e3a169
--- /dev/null
+++ b/spec/models/calentry_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Calentry do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/requests/calendars_spec.rb b/spec/requests/calendars_spec.rb
new file mode 100644
index 0000000..b3ab70b
--- /dev/null
+++ b/spec/requests/calendars_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe "Calendars" do
+ describe "GET /calendars" 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 calendars_path
+ response.status.should be(200)
+ end
+ end
+end
diff --git a/spec/requests/calentries_spec.rb b/spec/requests/calentries_spec.rb
new file mode 100644
index 0000000..8f33562
--- /dev/null
+++ b/spec/requests/calentries_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe "Calentries" do
+ describe "GET /calentries" 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 calentries_path
+ response.status.should be(200)
+ end
+ end
+end
diff --git a/spec/routing/calendars_routing_spec.rb b/spec/routing/calendars_routing_spec.rb
new file mode 100644
index 0000000..3aba097
--- /dev/null
+++ b/spec/routing/calendars_routing_spec.rb
@@ -0,0 +1,35 @@
+require "spec_helper"
+
+describe CalendarsController do
+ describe "routing" do
+
+ it "routes to #index" do
+ get("/calendars").should route_to("calendars#index")
+ end
+
+ it "routes to #new" do
+ get("/calendars/new").should route_to("calendars#new")
+ end
+
+ it "routes to #show" do
+ get("/calendars/1").should route_to("calendars#show", :id => "1")
+ end
+
+ it "routes to #edit" do
+ get("/calendars/1/edit").should route_to("calendars#edit", :id => "1")
+ end
+
+ it "routes to #create" do
+ post("/calendars").should route_to("calendars#create")
+ end
+
+ it "routes to #update" do
+ put("/calendars/1").should route_to("calendars#update", :id => "1")
+ end
+
+ it "routes to #destroy" do
+ delete("/calendars/1").should route_to("calendars#destroy", :id => "1")
+ end
+
+ end
+end
diff --git a/spec/routing/calentries_routing_spec.rb b/spec/routing/calentries_routing_spec.rb
new file mode 100644
index 0000000..214c524
--- /dev/null
+++ b/spec/routing/calentries_routing_spec.rb
@@ -0,0 +1,35 @@
+require "spec_helper"
+
+describe CalentriesController do
+ describe "routing" do
+
+ it "routes to #index" do
+ get("/calentries").should route_to("calentries#index")
+ end
+
+ it "routes to #new" do
+ get("/calentries/new").should route_to("calentries#new")
+ end
+
+ it "routes to #show" do
+ get("/calentries/1").should route_to("calentries#show", :id => "1")
+ end
+
+ it "routes to #edit" do
+ get("/calentries/1/edit").should route_to("calentries#edit", :id => "1")
+ end
+
+ it "routes to #create" do
+ post("/calentries").should route_to("calentries#create")
+ end
+
+ it "routes to #update" do
+ put("/calentries/1").should route_to("calentries#update", :id => "1")
+ end
+
+ it "routes to #destroy" do
+ delete("/calentries/1").should route_to("calentries#destroy", :id => "1")
+ end
+
+ end
+end
diff --git a/spec/views/calendars/edit.html.erb_spec.rb b/spec/views/calendars/edit.html.erb_spec.rb
new file mode 100644
index 0000000..1332e40
--- /dev/null
+++ b/spec/views/calendars/edit.html.erb_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe "calendars/edit" do
+ before(:each) do
+ @calendar = assign(:calendar, stub_model(Calendar,
+ :name => "MyString",
+ :public => false
+ ))
+ end
+
+ it "renders the edit calendar form" do
+ render
+
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ assert_select "form[action=?][method=?]", calendar_path(@calendar), "post" do
+ assert_select "input#calendar_name[name=?]", "calendar[name]"
+ assert_select "input#calendar_public[name=?]", "calendar[public]"
+ end
+ end
+end
diff --git a/spec/views/calendars/index.html.erb_spec.rb b/spec/views/calendars/index.html.erb_spec.rb
new file mode 100644
index 0000000..2d35f2d
--- /dev/null
+++ b/spec/views/calendars/index.html.erb_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe "calendars/index" do
+ before(:each) do
+ assign(:calendars, [
+ stub_model(Calendar,
+ :name => "Name",
+ :public => false
+ ),
+ stub_model(Calendar,
+ :name => "Name",
+ :public => false
+ )
+ ])
+ end
+
+ it "renders a list of calendars" 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
+ assert_select "tr>td", :text => false.to_s, :count => 2
+ end
+end
diff --git a/spec/views/calendars/new.html.erb_spec.rb b/spec/views/calendars/new.html.erb_spec.rb
new file mode 100644
index 0000000..026c0fd
--- /dev/null
+++ b/spec/views/calendars/new.html.erb_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe "calendars/new" do
+ before(:each) do
+ assign(:calendar, stub_model(Calendar,
+ :name => "MyString",
+ :public => false
+ ).as_new_record)
+ end
+
+ it "renders new calendar form" do
+ render
+
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ assert_select "form[action=?][method=?]", calendars_path, "post" do
+ assert_select "input#calendar_name[name=?]", "calendar[name]"
+ assert_select "input#calendar_public[name=?]", "calendar[public]"
+ end
+ end
+end
diff --git a/spec/views/calendars/show.html.erb_spec.rb b/spec/views/calendars/show.html.erb_spec.rb
new file mode 100644
index 0000000..53cecc6
--- /dev/null
+++ b/spec/views/calendars/show.html.erb_spec.rb
@@ -0,0 +1,17 @@
+require 'spec_helper'
+
+describe "calendars/show" do
+ before(:each) do
+ @calendar = assign(:calendar, stub_model(Calendar,
+ :name => "Name",
+ :public => false
+ ))
+ 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/)
+ rendered.should match(/false/)
+ end
+end
diff --git a/spec/views/calentries/edit.html.erb_spec.rb b/spec/views/calentries/edit.html.erb_spec.rb
new file mode 100644
index 0000000..72b00fd
--- /dev/null
+++ b/spec/views/calentries/edit.html.erb_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe "calentries/edit" do
+ before(:each) do
+ @calentry = assign(:calentry, stub_model(Calentry,
+ :summary => "MyString",
+ :typ => 1
+ ))
+ end
+
+ it "renders the edit calentry form" do
+ render
+
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ assert_select "form[action=?][method=?]", calentry_path(@calentry), "post" do
+ assert_select "input#calentry_summary[name=?]", "calentry[summary]"
+ assert_select "input#calentry_typ[name=?]", "calentry[typ]"
+ end
+ end
+end
diff --git a/spec/views/calentries/index.html.erb_spec.rb b/spec/views/calentries/index.html.erb_spec.rb
new file mode 100644
index 0000000..cd488a9
--- /dev/null
+++ b/spec/views/calentries/index.html.erb_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe "calentries/index" do
+ before(:each) do
+ assign(:calentries, [
+ stub_model(Calentry,
+ :summary => "Summary",
+ :typ => 1
+ ),
+ stub_model(Calentry,
+ :summary => "Summary",
+ :typ => 1
+ )
+ ])
+ end
+
+ it "renders a list of calentries" do
+ render
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ assert_select "tr>td", :text => "Summary".to_s, :count => 2
+ assert_select "tr>td", :text => 1.to_s, :count => 2
+ end
+end
diff --git a/spec/views/calentries/new.html.erb_spec.rb b/spec/views/calentries/new.html.erb_spec.rb
new file mode 100644
index 0000000..32e477b
--- /dev/null
+++ b/spec/views/calentries/new.html.erb_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe "calentries/new" do
+ before(:each) do
+ assign(:calentry, stub_model(Calentry,
+ :summary => "MyString",
+ :typ => 1
+ ).as_new_record)
+ end
+
+ it "renders new calentry form" do
+ render
+
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ assert_select "form[action=?][method=?]", calentries_path, "post" do
+ assert_select "input#calentry_summary[name=?]", "calentry[summary]"
+ assert_select "input#calentry_typ[name=?]", "calentry[typ]"
+ end
+ end
+end
diff --git a/spec/views/calentries/show.html.erb_spec.rb b/spec/views/calentries/show.html.erb_spec.rb
new file mode 100644
index 0000000..588baec
--- /dev/null
+++ b/spec/views/calentries/show.html.erb_spec.rb
@@ -0,0 +1,17 @@
+require 'spec_helper'
+
+describe "calentries/show" do
+ before(:each) do
+ @calentry = assign(:calentry, stub_model(Calentry,
+ :summary => "Summary",
+ :typ => 1
+ ))
+ 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(/Summary/)
+ rendered.should match(/1/)
+ end
+end
From 4ffc8fbea1f821c6687894172dc44ae22962010d Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Wed, 7 Aug 2013 12:17:05 +0200
Subject: [PATCH 04/53] Studienverwaltung
---
app/controllers/studien_controller.rb | 34 ++++++++++++++++-
app/views/studien/_tabs.html.erb | 32 +++++++++-------
app/views/studien/verwalten.html.erb | 55 +++++++++++++++++++++++++++
config/routes.rb | 2 +-
4 files changed, 108 insertions(+), 15 deletions(-)
create mode 100644 app/views/studien/verwalten.html.erb
diff --git a/app/controllers/studien_controller.rb b/app/controllers/studien_controller.rb
index fb0ae58..6f82f38 100755
--- a/app/controllers/studien_controller.rb
+++ b/app/controllers/studien_controller.rb
@@ -42,7 +42,7 @@ class StudienController < ApplicationController
if params[:ansicht] == 'semesteransicht'
@text = 'Zu Modulansicht wechseln'
@flip = 'modulgruppenansicht'
- render 'semesteransicht'
+ render 'semesteransicht'
else
@text = 'Zu Semesteransicht wechseln'
@flip = 'semesteransicht'
@@ -93,4 +93,36 @@ class StudienController < ApplicationController
def default_url_options
{ansicht: params[:ansicht]}.merge(super)
end
+
+ def verwalten
+
+ if !(params[:modul]).nil?
+ modul = Modul.find(params[:modul])
+ @modulgruppen = modul.modulgruppen
+ @studien = @modulgruppen.map{|x| x.studium}.flatten.uniq
+ @module = [modul]
+ @lvas = @module.map{|x| x.lvas}.flatten.uniq
+ @beispiele = @lvas.map{|x| x.beispiele}.flatten.uniq
+ @title = 'Modul: ' + modul.name
+ elsif !(params[:studium]).nil?
+ studium = Studium.find(params[:studium])
+ @studien = [studium]
+ @modulgruppen = studium.modulgruppen.uniq
+ @module = studium.modulgruppen.map{|x| x.moduls}.flatten.uniq
+ @lvas = @module.map{|x| x.lvas}.flatten.uniq
+ @beispiele = @lvas.map{|x| x.beispiele}.flatten
+ @title = 'Studium: ' + studium.name
+ elsif !(params[:lva]).nil?
+
+ elsif !(params[:beispiel]).nil?
+
+ else
+ @studien = Studium.all
+ @modulgruppen = Modulgruppe.all
+ @module = Modul.all
+ @lvas = Lva.all
+ @beispiele = Beispiel.all
+ end
+ render 'studien/verwalten'
+ end
end
diff --git a/app/views/studien/_tabs.html.erb b/app/views/studien/_tabs.html.erb
index 5bb202f..2760f1b 100644
--- a/app/views/studien/_tabs.html.erb
+++ b/app/views/studien/_tabs.html.erb
@@ -1,18 +1,24 @@
- <% if @studium.nil? %>
+ <% if request.fullpath == studien_path%>
-
- <% else %>
-
-
- <% end %>
- <%= link_to "Alle Studien", studien_path %>
- <% for s in Studium.all %>
- <% if !@studium.nil? && s == @studium %>
- -
- <%= link_to s.name, studium_path(s) %>
-
<% else %>
- - <%= link_to s.name, studium_path(s) %>
- <% end %>
+ -
<% end %>
-
+ <%= link_to "Alle Studien", studien_path %>
+<% for s in Studium.all %>
+ <% if !@studium.nil? && s == @studium %>
+ -
+ <%= link_to s.name, s %>
+
+ <% else %>
+ - <%= link_to s.name, s %>
+ <% end %>
+<% end %>
+<% if request.fullpath == studien_verwalten_path %>
+ -
+ <% else %>
+
-
+<% end %>
+<%= link_to "Verwaltung", studien_verwalten_path %>
+
diff --git a/app/views/studien/verwalten.html.erb b/app/views/studien/verwalten.html.erb
new file mode 100644
index 0000000..b6a121c
--- /dev/null
+++ b/app/views/studien/verwalten.html.erb
@@ -0,0 +1,55 @@
+
+
+ <%= render 'studien/tabs'%>
+
Verwaltung <%=@title%>
+
+
+
Studien
+ <% @studien.each do |s| %>
+ <%= link_to s.name, s %> <%= (s.valid?) ? "Gültig" : "Problemfall" %> <%= link_to "Show", studien_verwalten_path(:studium=>s)%>
+ <% end %>
+
+
+
Modulgruppen
+ <% @modulgruppen.each do |mg| %>
+ <%= link_to mg.name, mg %><%=' ('+mg.studium.name.to_s+')' unless mg.studium.nil? %> <%= (mg.valid?) ? "Gültig" : "Problemfall" %>
+ <% end %>
+
+
+
+
+
Module
+ <% @module.each do |m| %>
+ <%= link_to m.name, m %> (
+ <% m.modulgruppen.each do |mg| %>
+ <%=mg.name.to_s+ ' ' %>
+ <% end %>
+ )<%= (m.valid?) ? "Gültig" : "Problemfall" %>
+ <%=link_to "show", studien_verwalten_path(:modul=>m)%>
+ <% end %>
+
+
+
+
LVas
+ <% @lvas.each do |lva| %>
+ <%= link_to lva.name, lva %> |
+ <% lva.modul.each do |m| %>
+ <%=m.name.to_s+ ' | ' %>
+ <% end %>
+ <%= (lva.valid?) ? "Gültig" : "Problemfall" %>
+
+ <% end %>
+
+
+
Beispiele
+ <% @beispiele.each do |b| %>
+ <%= link_to b.name, b %>
+ <% end %>
+
+
+
+
+
+
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 0cfe9b4..13ffe86 100755
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -30,7 +30,7 @@ resources :studien,:except=>[:show,:new,:edit,:update,:destroy], :shallow=>true
resources :modulgruppen, :path => "(:locale)/modulgruppen"
end
-# get 'studien/(:ansicht)/:id', :controller=>:studien, :action=>:show, :as=>'studium_ansicht'
+ get 'verwalten/studien', :controller=>:studien, :action=>:verwalten, :as=>'studien_verwalten'
resources :semesters
resources :moduls
resources :lvas
From 78f7a685b1c7a3a752eadd5c19a73d19010819f0 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Wed, 7 Aug 2013 16:24:19 +0200
Subject: [PATCH 05/53] Verwaltung
---
app/controllers/studien_controller.rb | 60 ++++---
app/views/lvas/show.html.erb | 2 +-
app/views/studien/_verwalten_menu.html.erb | 67 ++++++++
app/views/studien/verwalten.html.erb | 46 +++---
config/routes.rb | 180 ++++++++++-----------
5 files changed, 218 insertions(+), 137 deletions(-)
create mode 100644 app/views/studien/_verwalten_menu.html.erb
diff --git a/app/controllers/studien_controller.rb b/app/controllers/studien_controller.rb
index 6f82f38..ff017ac 100755
--- a/app/controllers/studien_controller.rb
+++ b/app/controllers/studien_controller.rb
@@ -1,6 +1,6 @@
class StudienController < ApplicationController
before_filter {@toolbar_elements =[]}
-
+ # before_filter :authorize, :only => :verwalten
def index
@studien = Studium.all
@@ -39,7 +39,7 @@ class StudienController < ApplicationController
@toolbar_modulgruppen =[ {:hicon=>'icon-plus-sign', :text=> I18n.t('modulgruppe.new'), :path=>new_studium_modulgruppe_path(@studium)},
{:hicon=>'icon-list', :text => I18n.t('modulgruppe.list'), :path=>modulgruppen_path}]
- if params[:ansicht] == 'semesteransicht'
+ if params[:ansicht] != 'modulgruppenansicht'
@text = 'Zu Modulansicht wechseln'
@flip = 'modulgruppenansicht'
render 'semesteransicht'
@@ -90,39 +90,47 @@ class StudienController < ApplicationController
@studium.destroy
redirect_to studien_url
end
- def default_url_options
- {ansicht: params[:ansicht]}.merge(super)
- end
def verwalten
-
- if !(params[:modul]).nil?
- modul = Modul.find(params[:modul])
- @modulgruppen = modul.modulgruppen
- @studien = @modulgruppen.map{|x| x.studium}.flatten.uniq
- @module = [modul]
- @lvas = @module.map{|x| x.lvas}.flatten.uniq
- @beispiele = @lvas.map{|x| x.beispiele}.flatten.uniq
- @title = 'Modul: ' + modul.name
- elsif !(params[:studium]).nil?
- studium = Studium.find(params[:studium])
- @studien = [studium]
- @modulgruppen = studium.modulgruppen.uniq
- @module = studium.modulgruppen.map{|x| x.moduls}.flatten.uniq
- @lvas = @module.map{|x| x.lvas}.flatten.uniq
- @beispiele = @lvas.map{|x| x.beispiele}.flatten
- @title = 'Studium: ' + studium.name
- elsif !(params[:lva]).nil?
-
- elsif !(params[:beispiel]).nil?
-
+ @new_params={:studium=>params[:studium], :modulgruppe=>params[:modulgruppe], :modul=>params[:modul], :lva=>params[:lva], :beispiel=>params[:beispiel]}
+
+ if !@new_params[:studium].nil?
+ @studien = [Studium.find(@new_params[:studium])]
else
@studien = Studium.all
+ end
+ if !@new_params[:modulgruppe].nil?
+ @modulgruppen = [Modulgruppe.find(@new_params[:modulgruppe])]
+
+ else
@modulgruppen = Modulgruppe.all
+ end
+ if !@new_params[:modul].nil?
+ @module = [Modul.find(@new_params[:modul])]
+ else
@module = Modul.all
+ end
+ if !@new_params[:lva].nil?
+ @lvas = [Lva.find(@new_params[:lva])]
+ else
@lvas = Lva.all
+ end
+ if !@new_params[:beispiel].nil?
+ @beispiele = [Beispiel.find(@new_params[:beispiel])]
+ else
@beispiele = Beispiel.all
end
+
render 'studien/verwalten'
end
+
+ def default_url_options
+ {:ansicht=> params[:ansicht],
+ :studium=> params[:studium],
+ :modulgruppe=> params[:modulgruppe],
+ :modul=>params[:modul],
+ :lva=>params[:lva],
+ :beispiel=>params[:beispiel]}.merge(super)
+
+ end
end
diff --git a/app/views/lvas/show.html.erb b/app/views/lvas/show.html.erb
index 204c3e4..ce41a44 100755
--- a/app/views/lvas/show.html.erb
+++ b/app/views/lvas/show.html.erb
@@ -25,7 +25,7 @@
<% modul.modulgruppen.each do |g| %>
- - <%= link_to g.studium.name , studium_semesteransicht_path(g.studium)%> (<%=link_to g.name, modulgruppe_path(g)%>)
+ - <%= link_to g.studium.name , studium_path(g.studium)%> (<%=link_to g.name, modulgruppe_path(g)%>)
<% end %>
diff --git a/app/views/studien/_verwalten_menu.html.erb b/app/views/studien/_verwalten_menu.html.erb
new file mode 100644
index 0000000..9c626d6
--- /dev/null
+++ b/app/views/studien/_verwalten_menu.html.erb
@@ -0,0 +1,67 @@
+
+
diff --git a/app/views/studien/verwalten.html.erb b/app/views/studien/verwalten.html.erb
index b6a121c..74e8ee6 100644
--- a/app/views/studien/verwalten.html.erb
+++ b/app/views/studien/verwalten.html.erb
@@ -1,16 +1,22 @@
-
<%= render 'studien/tabs'%>
-
Verwaltung <%=@title%>
+
+
+
Verwaltung <%=@title%>
+
+
+
<%= render 'studien/verwalten_menu'%>
+
+
Studien
<% @studien.each do |s| %>
- <%= link_to s.name, s %> <%= (s.valid?) ? "Gültig" : "Problemfall" %> <%= link_to "Show", studien_verwalten_path(:studium=>s)%>
+ <%= link_to s.name, s %> <%= (s.valid?) ? "Gültig" : "Problemfall" %> <%= link_to "Show", studien_verwalten_path( :studium=>params[:studium], :modul=>params[:modul],:lva=>params[:lva], :modulgruppe=>params[:modulgruppe], :beispiel=>params[:beispiel], :studium=>s) %>
<% end %>
-
Modulgruppen
+ Modulgruppen
<% @modulgruppen.each do |mg| %>
<%= link_to mg.name, mg %><%=' ('+mg.studium.name.to_s+')' unless mg.studium.nil? %> <%= (mg.valid?) ? "Gültig" : "Problemfall" %>
<% end %>
@@ -21,32 +27,32 @@
Module
<% @module.each do |m| %>
<%= link_to m.name, m %> (
- <% m.modulgruppen.each do |mg| %>
+ <% m.modulgruppen.each do |mg| %>
<%=mg.name.to_s+ ' ' %>
<% end %>
)<%= (m.valid?) ? "Gültig" : "Problemfall" %>
<%=link_to "show", studien_verwalten_path(:modul=>m)%>
<% end %>
-
-
-
-
LVas
- <% @lvas.each do |lva| %>
- <%= link_to lva.name, lva %> |
- <% lva.modul.each do |m| %>
+
+
+
+
LVas
+ <% @lvas.each do |lva| %>
+ <%= link_to lva.name, lva %> |
+ <% lva.modul.each do |m| %>
<%=m.name.to_s+ ' | ' %>
<% end %>
<%= (lva.valid?) ? "Gültig" : "Problemfall" %>
-
- <% end %>
-
-
-
Beispiele
- <% @beispiele.each do |b| %>
- <%= link_to b.name, b %>
+
<% end %>
+
+
+
Beispiele
+ <% @beispiele.each do |b| %>
+ <%= link_to b.name, b %>
+ <% end %>
+
-
diff --git a/config/routes.rb b/config/routes.rb
index 13ffe86..61b6b42 100755
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,108 +1,108 @@
Fetsite::Application.routes.draw do
-
- devise_for :users
- resources :home, :only=>[:index]
- #get 'home',:controller=>home,:action=>:index,:as=>"home_index"
- scope '(:locale)/admin' do
- resources :users
- get 'config',:controller=>:config,:action=>:index , :as => 'config'
- get 'config/get_git_update',:controller=>:config,:action=>:get_git_update, :as=>'config_getgitupdate'
- get 'config/get_git_update',:controller=>:config,:action=>:get_git_update
- end
+
+ devise_for :users
+ resources :home, :only=>[:index]
+ #get 'home',:controller=>home,:action=>:index,:as=>"home_index"
+ scope '(:locale)/admin' do
+ resources :users
+ get 'config',:controller=>:config,:action=>:index , :as => 'config'
+ get 'config/get_git_update',:controller=>:config,:action=>:get_git_update, :as=>'config_getgitupdate'
+ get 'config/get_git_update',:controller=>:config,:action=>:get_git_update
+ end
- devise_for :users
+ devise_for :users
- resources :pages, :except => [:index] do
- member do
- post 'preview'
- end
- end
- get 'pages', :to =>'pages#show'
- scope '(:locale)' do
-
- resources :studien, :only=>[:new,:edit,:update,:destroy]
- scope '(:ansicht)' do
- resources :studien, :only=>[:show]
-end
-resources :modulgruppen,:only =>[:create,:index]
+ resources :pages, :except => [:index] do
+ member do
+ post 'preview'
+ end
+ end
+ get 'pages', :to =>'pages#show'
+ scope '(:locale)' do
+
+ resources :studien, :only=>[:new,:edit,:update,:destroy]
+ scope '(:ansicht)' do
+ resources :studien, :only=>[:show]
+ end
+ resources :modulgruppen,:only =>[:create,:index]
-resources :studien,:except=>[:show,:new,:edit,:update,:destroy], :shallow=>true do
- resources :modulgruppen, :path => "(:locale)/modulgruppen"
-
-end
- get 'verwalten/studien', :controller=>:studien, :action=>:verwalten, :as=>'studien_verwalten'
-resources :semesters
-resources :moduls
-resources :lvas
-resources :neuigkeiten
-get 'rubriken/verwalten', :controller=>:rubriken, :action=>:alle_verwalten, :as=>'alle_verwalten_rubrik'
+ resources :studien,:except=>[:show,:new,:edit,:update,:destroy], :shallow=>true do
+ resources :modulgruppen, :path => "(:locale)/modulgruppen"
+
+ end
+ get 'verwalten/studien', :controller=>:studien, :action=>:verwalten, :as=>'studien_verwalten'
+ resources :semesters
+ resources :moduls
+ resources :lvas
+ resources :neuigkeiten
+ get 'rubriken/verwalten', :controller=>:rubriken, :action=>:alle_verwalten, :as=>'alle_verwalten_rubrik'
-resources :rubriken do
- resources :neuigkeiten, :only=>[:new, :show]
-end
-put 'rubriken/(:id)/addmoderator',:controller=>:rubriken,:action=>:addmoderator
-get 'rubriken/:id/verwalten',:controller=>:rubriken,:action=>:verwalten, :as=>'verwalten_rubrik'
-resources :home, :only=>[:index]
-get 'home/dev', :controller=>:home, :action=>:dev, :as=>'home_dev'
-resources :beispiele
+ resources :rubriken do
+ resources :neuigkeiten, :only=>[:new, :show]
+ end
+ put 'rubriken/(:id)/addmoderator',:controller=>:rubriken,:action=>:addmoderator
+ get 'rubriken/:id/verwalten',:controller=>:rubriken,:action=>:verwalten, :as=>'verwalten_rubrik'
+ resources :home, :only=>[:index]
+ get 'home/dev', :controller=>:home, :action=>:dev, :as=>'home_dev'
+ resources :beispiele
- end
+ end
- # The priority is based upon order of creation:
- # first created -> highest priority.
+ # The priority is based upon order of creation:
+ # first created -> highest priority.
- # Sample of regular route:
- # match 'products/:id' => 'catalog#view'
- # Keep in mind you can assign values other than :controller and :action
+ # Sample of regular route:
+ # match 'products/:id' => 'catalog#view'
+ # Keep in mind you can assign values other than :controller and :action
- # Sample of named route:
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
- # This route can be invoked with purchase_url(:id => product.id)
+ # Sample of named route:
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
+ # This route can be invoked with purchase_url(:id => product.id)
- # Sample resource route (maps HTTP verbs to controller actions automatically):
- # resources :products
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
+ # resources :products
- # Sample resource route with options:
- # resources :products do
- # member do
- # get 'short'
- # post 'toggle'
- # end
- #
- # collection do
- # get 'sold'
- # end
- # end
+ # Sample resource route with options:
+ # resources :products do
+ # member do
+ # get 'short'
+ # post 'toggle'
+ # end
+ #
+ # collection do
+ # get 'sold'
+ # end
+ # end
- # Sample resource route with sub-resources:
- # resources :products do
- # resources :comments, :sales
- # resource :seller
- # end
+ # Sample resource route with sub-resources:
+ # resources :products do
+ # resources :comments, :sales
+ # resource :seller
+ # end
- # Sample resource route with more complex sub-resources
- # resources :products do
- # resources :comments
- # resources :sales do
- # get 'recent', :on => :collection
- # end
- # end
+ # Sample resource route with more complex sub-resources
+ # resources :products do
+ # resources :comments
+ # resources :sales do
+ # get 'recent', :on => :collection
+ # end
+ # end
- # Sample resource route within a namespace:
- # namespace :admin do
- # # Directs /admin/products/* to Admin::ProductsController
- # # (app/controllers/admin/products_controller.rb)
- # resources :products
- # end
+ # Sample resource route within a namespace:
+ # namespace :admin do
+ # # Directs /admin/products/* to Admin::ProductsController
+ # # (app/controllers/admin/products_controller.rb)
+ # resources :products
+ # end
- # You can have the root of your site routed with "root"
- # just remember to delete public/index.html.
+ # You can have the root of your site routed with "root"
+ # just remember to delete public/index.html.
- root :to => 'home#index'
+ root :to => 'home#index'
- # See how all your routes lay out with "rake routes"
+ # See how all your routes lay out with "rake routes"
- # This is a legacy wild controller route that's not recommended for RESTful applications.
- # Note: This route will make all actions in every controller accessible via GET requests.
- # match ':controller(/:action(/:id))(.:format)'
-end
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
+ # Note: This route will make all actions in every controller accessible via GET requests.
+ # match ':controller(/:action(/:id))(.:format)'
+ end
From a92ff607183eb3c6762edc92fedb9fc9773a0a3f Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Wed, 7 Aug 2013 17:51:48 +0200
Subject: [PATCH 06/53] Verwaltung erste interessante version
---
app/controllers/studien_controller.rb | 101 +++++++++++++++++++--
app/views/studien/_verwalten_menu.html.erb | 16 ++--
app/views/studien/verwalten.html.erb | 24 ++---
3 files changed, 114 insertions(+), 27 deletions(-)
diff --git a/app/controllers/studien_controller.rb b/app/controllers/studien_controller.rb
index ff017ac..a438c9f 100755
--- a/app/controllers/studien_controller.rb
+++ b/app/controllers/studien_controller.rb
@@ -93,7 +93,13 @@ class StudienController < ApplicationController
def verwalten
@new_params={:studium=>params[:studium], :modulgruppe=>params[:modulgruppe], :modul=>params[:modul], :lva=>params[:lva], :beispiel=>params[:beispiel]}
-
+ if @new_params.values.compact.empty?
+ @studien=Studium.all
+ @modulgruppen=Modulgruppe.all
+ @module=Modul.all
+ @lvas=Lva.all
+ @beispiele=Beispiel.all
+ else
if !@new_params[:studium].nil?
@studien = [Studium.find(@new_params[:studium])]
else
@@ -101,36 +107,115 @@ class StudienController < ApplicationController
end
if !@new_params[:modulgruppe].nil?
@modulgruppen = [Modulgruppe.find(@new_params[:modulgruppe])]
-
+ temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
+ @studien=@studien.select{|k| temp.include?(k)}
+
else
@modulgruppen = Modulgruppe.all
+ temp = @studien.map{|x| x.modulgruppen}.flatten.uniq # Studien forcen Modulgruppen
+ @modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
end
if !@new_params[:modul].nil?
@module = [Modul.find(@new_params[:modul])]
+ temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
+ @modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
+ temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
+ @studien=@studien.select{|k| temp.include?(k)}
+
else
@module = Modul.all
+ temp = @modulgruppen.map{|x| x.moduls}.flatten.uniq
+ @module=@module.select{|k| temp.include?(k)}
end
if !@new_params[:lva].nil?
@lvas = [Lva.find(@new_params[:lva])]
+ temp = @lvas.map{|x| x.modul}.flatten.uniq
+ @module=@module.select{|k| temp.include?(k)}
+ temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
+ @modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
+ temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
+ @studien=@studien.select{|k| temp.include?(k)}
else
@lvas = Lva.all
+ temp = @module.map{|x| x.lvas}.flatten.uniq #Force Module
+ @lvas=@lvas.select{|k| temp.include?(k)}
end
if !@new_params[:beispiel].nil?
@beispiele = [Beispiel.find(@new_params[:beispiel])]
+ temp = @lvas.map{|x| x.beispiele}.flatten.uniq #Force Force Lvas
+ @lvas=@lvas.select{|k| temp.include?(k)}
+ temp = @module.map{|x| x.lvas}.flatten.uniq #Force Module
+ @module=@module.select{|k| temp.include?(k)}
+ temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
+ @modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
+ temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
+ @studien=@studien.select{|k| temp.include?(k)}
+
+
else
@beispiele = Beispiel.all
+ temp = @lvas.map{|x| x.beispiele}.flatten.uniq # Force beispiel
+ @beispiele=@beispiele.select{|k| temp.include?(k)}
+ end
+end
+
+ @messages = []
+ for s in @studien
+
+ if s.valid?
+ @messages << s.name + ' hat keine Modulgruppe' if s.modulgruppen.count == 0
+ else
+ @messages << s.name + ': '
+ @messages << s.errors.full_messages
+ end
+ end
+ for mg in @modulgruppen
+
+ if mg.valid?
+ @messages << mg.name + ' hat kein Modul' if mg.moduls.count == 0
+ else
+ @messages << mg.name + ': '
+ @messages << mg.errors.full_messages
+ end
+ end
+ for m in @module
+
+ if m.valid?
+ @messages << m.name + ' hat keine Modulgruppe' if m.modulgruppen.count == 0
+ @messages << m.name + ' hat keine Lvas' if m.lvas.count == 0
+ else
+ @messages << m.name + ': '
+ @messages << m.errors.full_messages
+ end
+ end
+ for lva in @lvas
+
+ if lva.valid?
+ @messages << lva.name + ' hat keine Module' if lva.modul.count == 0
+
+ else
+ @messages << lva.name + ': '
+ @messages << lva.errors.full_messages
+ end
+ end
+ for b in @beispiele
+ if b.valid?
+ @messages << b.name + ' hat keine Lva' if lva.moduls
+ else
+ @messages << b.name + ': '
+ @messages << b.errors.full_messages
+ end
end
-
render 'studien/verwalten'
end
def default_url_options
{:ansicht=> params[:ansicht],
- :studium=> params[:studium],
- :modulgruppe=> params[:modulgruppe],
- :modul=>params[:modul],
- :lva=>params[:lva],
- :beispiel=>params[:beispiel]}.merge(super)
+ :studium=> params[:studium],
+ :modulgruppe=> params[:modulgruppe],
+ :modul=>params[:modul],
+ :lva=>params[:lva],
+ :beispiel=>params[:beispiel]}.merge(super)
end
end
diff --git a/app/views/studien/_verwalten_menu.html.erb b/app/views/studien/_verwalten_menu.html.erb
index 9c626d6..a646743 100644
--- a/app/views/studien/_verwalten_menu.html.erb
+++ b/app/views/studien/_verwalten_menu.html.erb
@@ -39,26 +39,26 @@
diff --git a/app/views/studien/verwalten.html.erb b/app/views/studien/verwalten.html.erb
index 74e8ee6..9674023 100644
--- a/app/views/studien/verwalten.html.erb
+++ b/app/views/studien/verwalten.html.erb
@@ -8,15 +8,21 @@
<%= render 'studien/verwalten_menu'%>
+
+
+ <% @messages.flatten.each do |m| %>
+ <%= m.to_s %>
+ <% end %>
+
-
Studien
+ Studien <%= link_to "new", new_studium_path %>
<% @studien.each do |s| %>
- <%= link_to s.name, s %> <%= (s.valid?) ? "Gültig" : "Problemfall" %> <%= link_to "Show", studien_verwalten_path( :studium=>params[:studium], :modul=>params[:modul],:lva=>params[:lva], :modulgruppe=>params[:modulgruppe], :beispiel=>params[:beispiel], :studium=>s) %>
+ <%= link_to s.name, s %> <%= (s.valid?) ? "Gültig" : "Problemfall" %>
<% end %>
-
Modulgruppen
+ Modulgruppen <%= link_to 'new', new_studium_modulgruppe_path(Studium.first) unless Studium.first.nil? %>
<% @modulgruppen.each do |mg| %>
<%= link_to mg.name, mg %><%=' ('+mg.studium.name.to_s+')' unless mg.studium.nil? %> <%= (mg.valid?) ? "Gültig" : "Problemfall" %>
<% end %>
@@ -24,30 +30,26 @@
-
Module
+ Module <%= link_to "new", new_modul_path %>
<% @module.each do |m| %>
<%= link_to m.name, m %> (
<% m.modulgruppen.each do |mg| %>
<%=mg.name.to_s+ ' ' %>
<% end %>
- )<%= (m.valid?) ? "Gültig" : "Problemfall" %>
- <%=link_to "show", studien_verwalten_path(:modul=>m)%>
+ ) | <%= (m.valid?) ? "Gültig" : "Problemfall" %>
<% end %>
-
LVas
+ LVas <%= link_to "new", new_lva_path %>
<% @lvas.each do |lva| %>
<%= link_to lva.name, lva %> |
- <% lva.modul.each do |m| %>
- <%=m.name.to_s+ ' | ' %>
- <% end %>
<%= (lva.valid?) ? "Gültig" : "Problemfall" %>
<% end %>
-
Beispiele
+
Beispiele <%= link_to "new", new_beispiel_path %>
<% @beispiele.each do |b| %>
<%= link_to b.name, b %>
<% end %>
From 5c36eb55a3ac90732247fb660e088afcf2a47f8c Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Wed, 7 Aug 2013 22:07:08 +0200
Subject: [PATCH 07/53] =?UTF-8?q?Verwaltungs=C3=BCbersicht?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/studien_controller.rb | 141 ++++++++++++---------
app/models/studium.rb | 2 +-
app/views/studien/_verwalten_menu.html.erb | 15 ++-
app/views/studien/verwalten.html.erb | 138 ++++++++++++--------
config/locales/de.yml | 18 ++-
5 files changed, 185 insertions(+), 129 deletions(-)
diff --git a/app/controllers/studien_controller.rb b/app/controllers/studien_controller.rb
index a438c9f..4d0a0b3 100755
--- a/app/controllers/studien_controller.rb
+++ b/app/controllers/studien_controller.rb
@@ -99,74 +99,76 @@ class StudienController < ApplicationController
@module=Modul.all
@lvas=Lva.all
@beispiele=Beispiel.all
+ else
+ if !@new_params[:studium].nil?
+ @studien = [Studium.find(@new_params[:studium])]
else
- if !@new_params[:studium].nil?
- @studien = [Studium.find(@new_params[:studium])]
- else
- @studien = Studium.all
- end
- if !@new_params[:modulgruppe].nil?
- @modulgruppen = [Modulgruppe.find(@new_params[:modulgruppe])]
- temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
- @studien=@studien.select{|k| temp.include?(k)}
+ @studien = Studium.all
+ end
+ if !@new_params[:modulgruppe].nil?
+ @modulgruppen = [Modulgruppe.find(@new_params[:modulgruppe])]
+ temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
+ @studien=@studien.select{|k| temp.include?(k)}
- else
- @modulgruppen = Modulgruppe.all
- temp = @studien.map{|x| x.modulgruppen}.flatten.uniq # Studien forcen Modulgruppen
- @modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
+ else
+ @modulgruppen = Modulgruppe.all
+ temp = @studien.map{|x| x.modulgruppen}.flatten.uniq # Studien forcen Modulgruppen
+ @modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
+ end
+ if !@new_params[:modul].nil?
+ @module = [Modul.find(@new_params[:modul])]
+ temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
+ @modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
+ temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
+ @studien=@studien.select{|k| temp.include?(k)}
+
+ else
+ @module = Modul.all
+ temp = @modulgruppen.map{|x| x.moduls}.flatten.uniq
+ @module=@module.select{|k| temp.include?(k)}
+ end
+ if !@new_params[:lva].nil?
+ @lvas = [Lva.find(@new_params[:lva])]
+ temp = @lvas.map{|x| x.modul}.flatten.uniq
+ @module=@module.select{|k| temp.include?(k)}
+ temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
+ @modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
+ temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
+ @studien=@studien.select{|k| temp.include?(k)}
+ else
+ @lvas = Lva.all
+ temp = @module.map{|x| x.lvas}.flatten.uniq #Force Module
+ @lvas=@lvas.select{|k| temp.include?(k)}
+ end
+ if !@new_params[:beispiel].nil?
+ @beispiele = [Beispiel.find(@new_params[:beispiel])]
+ temp = @lvas.map{|x| x.beispiele}.flatten.uniq #Force Force Lvas
+ @lvas=@lvas.select{|k| temp.include?(k)}
+ temp = @module.map{|x| x.lvas}.flatten.uniq #Force Module
+ @module=@module.select{|k| temp.include?(k)}
+ temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
+ @modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
+ temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
+ @studien=@studien.select{|k| temp.include?(k)}
+
+
+ else
+ @beispiele = Beispiel.all
+ temp = @lvas.map{|x| x.beispiele}.flatten.uniq # Force beispiel
+ @beispiele=@beispiele.select{|k| temp.include?(k)}
+ end
end
- if !@new_params[:modul].nil?
- @module = [Modul.find(@new_params[:modul])]
- temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
- @modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
- temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
- @studien=@studien.select{|k| temp.include?(k)}
-
- else
- @module = Modul.all
- temp = @modulgruppen.map{|x| x.moduls}.flatten.uniq
- @module=@module.select{|k| temp.include?(k)}
- end
- if !@new_params[:lva].nil?
- @lvas = [Lva.find(@new_params[:lva])]
- temp = @lvas.map{|x| x.modul}.flatten.uniq
- @module=@module.select{|k| temp.include?(k)}
- temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
- @modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
- temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
- @studien=@studien.select{|k| temp.include?(k)}
- else
- @lvas = Lva.all
- temp = @module.map{|x| x.lvas}.flatten.uniq #Force Module
- @lvas=@lvas.select{|k| temp.include?(k)}
- end
- if !@new_params[:beispiel].nil?
- @beispiele = [Beispiel.find(@new_params[:beispiel])]
- temp = @lvas.map{|x| x.beispiele}.flatten.uniq #Force Force Lvas
- @lvas=@lvas.select{|k| temp.include?(k)}
- temp = @module.map{|x| x.lvas}.flatten.uniq #Force Module
- @module=@module.select{|k| temp.include?(k)}
- temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
- @modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
- temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
- @studien=@studien.select{|k| temp.include?(k)}
-
-
- else
- @beispiele = Beispiel.all
- temp = @lvas.map{|x| x.beispiele}.flatten.uniq # Force beispiel
- @beispiele=@beispiele.select{|k| temp.include?(k)}
- end
-end
@messages = []
for s in @studien
if s.valid?
@messages << s.name + ' hat keine Modulgruppe' if s.modulgruppen.count == 0
+
else
- @messages << s.name + ': '
+ @messages << ''+s.name + ': '
@messages << s.errors.full_messages
+ @messages << ''
end
end
for mg in @modulgruppen
@@ -174,8 +176,9 @@ end
if mg.valid?
@messages << mg.name + ' hat kein Modul' if mg.moduls.count == 0
else
- @messages << mg.name + ': '
+ @messages << ''+mg.name + ': '
@messages << mg.errors.full_messages
+ @messages << ''
end
end
for m in @module
@@ -184,31 +187,43 @@ end
@messages << m.name + ' hat keine Modulgruppe' if m.modulgruppen.count == 0
@messages << m.name + ' hat keine Lvas' if m.lvas.count == 0
else
- @messages << m.name + ': '
+ @messages << ''+m.name + ': '
@messages << m.errors.full_messages
+ @messages << ''
end
end
for lva in @lvas
if lva.valid?
@messages << lva.name + ' hat keine Module' if lva.modul.count == 0
-
+ for s in @studien
+ stu_sem = s.semester.map{|l| l.lvas}.flatten.uniq.index(lva)
+ stu_mod = s.modulgruppen.map{|m| m.moduls}.flatten.map{|l| l.lvas}.flatten.uniq.index(lva)
+ if (stu_sem.nil? && !stu_mod.nil?)
+ @messages << lva.name + ' erscheint nicht in der Semesteransicht von ' +s.name + ' aber in der Modulgruppenansicht'
+ end
+ if (!stu_sem.nil? && stu_mod.nil?)
+ @messages << lva.name + ' erscheint in der Semesteransicht von ' +s.name + ' aber nicht in der Modulgruppenansicht'
+ end
+ end
else
- @messages << lva.name + ': '
+ @messages << ''+lva.name + ': '
@messages << lva.errors.full_messages
+ @messages << ''
end
end
for b in @beispiele
if b.valid?
@messages << b.name + ' hat keine Lva' if lva.moduls
else
- @messages << b.name + ': '
+ @messages << ''+b.name + ': '
@messages << b.errors.full_messages
+ @messages << ''
end
end
render 'studien/verwalten'
end
-
+
def default_url_options
{:ansicht=> params[:ansicht],
:studium=> params[:studium],
diff --git a/app/models/studium.rb b/app/models/studium.rb
index 94177f9..8a204dc 100755
--- a/app/models/studium.rb
+++ b/app/models/studium.rb
@@ -12,7 +12,7 @@
# created_at :datetime not null
# updated_at :datetime not null
class Studium < ActiveRecord::Base
- attr_accessible :desc, :name, :typ, :zahl
+ attr_accessible :desc, :name, :typ, :zahl, :semester
has_many :modulgruppen, inverse_of: :studium, :class_name => "Modulgruppe", :dependent => :destroy
has_many :semester, :dependent => :destroy
diff --git a/app/views/studien/_verwalten_menu.html.erb b/app/views/studien/_verwalten_menu.html.erb
index a646743..0c37f91 100644
--- a/app/views/studien/_verwalten_menu.html.erb
+++ b/app/views/studien/_verwalten_menu.html.erb
@@ -1,7 +1,7 @@
+ <%= link_to I18n.t("filter.reset"), studien_verwalten_path(:studium=>nil, :modulgruppe=>nil, :modul=>nil, :lva=>nil, :beispiel=>nil), :class=>"btn" %>
+
+
diff --git a/app/views/studien/verwalten.html.erb b/app/views/studien/verwalten.html.erb
index 9674023..ca64fe5 100644
--- a/app/views/studien/verwalten.html.erb
+++ b/app/views/studien/verwalten.html.erb
@@ -1,63 +1,89 @@
<%= render 'studien/tabs'%>
-
-
Verwaltung <%=@title%>
-
-
<%= render 'studien/verwalten_menu'%>
-
-
-
-
- <% @messages.flatten.each do |m| %>
- <%= m.to_s %>
- <% end %>
-
-
-
-
Studien <%= link_to "new", new_studium_path %>
- <% @studien.each do |s| %>
- <%= link_to s.name, s %> <%= (s.valid?) ? "Gültig" : "Problemfall" %>
- <% end %>
-
-
-
Modulgruppen <%= link_to 'new', new_studium_modulgruppe_path(Studium.first) unless Studium.first.nil? %>
- <% @modulgruppen.each do |mg| %>
- <%= link_to mg.name, mg %><%=' ('+mg.studium.name.to_s+')' unless mg.studium.nil? %> <%= (mg.valid?) ? "Gültig" : "Problemfall" %>
- <% end %>
-
-
-
-
-
Module <%= link_to "new", new_modul_path %>
- <% @module.each do |m| %>
- <%= link_to m.name, m %> (
- <% m.modulgruppen.each do |mg| %>
- <%=mg.name.to_s+ ' ' %>
- <% end %>
- ) | <%= (m.valid?) ? "Gültig" : "Problemfall" %>
- <% end %>
-
-
-
-
LVas <%= link_to "new", new_lva_path %>
- <% @lvas.each do |lva| %>
- <%= link_to lva.name, lva %> |
- <%= (lva.valid?) ? "Gültig" : "Problemfall" %>
-
- <% end %>
-
-
-
Beispiele <%= link_to "new", new_beispiel_path %>
- <% @beispiele.each do |b| %>
- <%= link_to b.name, b %>
- <% end %>
+
+
+
+
<%= I18n.t("studien.verwaltung") %>
+ <%= I18n.t("filter.explanation").html_safe %>
+ <%= render 'studien/verwalten_menu' %>
+
+
+
+
+
Studien <%= link_to "new", new_studium_path %>
+ <% @studien.each do |s| %>
+ <%= link_to s.name, s %> <%= (s.valid?) ? "Gültig" : "Problemfall" %>
+ <% end %>
+
+
+
+
+
+
+
+
+
Modulgruppen <%= link_to 'new', new_studium_modulgruppe_path(Studium.first) unless Studium.first.nil? %>
+ <% @modulgruppen.each do |mg| %>
+ <%= link_to mg.name, mg %> | <%= (mg.valid?) ? "Gültig" : "Problemfall" %>
+ <% end %>
+
+
+
+
+
Module <%= link_to "new", new_modul_path %>
+ <% @module.each do |m| %>
+ <%= link_to m.name, m %>
+ | <%= (m.valid?) ? "Gültig" : "Problemfall" %>
+ <% end %>
+
+
+
+
+
LVas <%= link_to "new", new_lva_path %>
+ <% @lvas.each do |lva| %>
+ <%= link_to lva.name, lva %> |
+ <%= (lva.valid?) ? "Gültig" : "Problemfall" %>
+
+ <% end %>
+
+
+
+
+
Beispiele <%= link_to "new", new_beispiel_path %>
+ <% @beispiele.each do |b| %>
+ <%= link_to b.name, b %>
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
Error Log
+
+ - Red: Error, Solve immediately
+ - Black: Warning, should be solved
+ - Green: Everything is fine
+
+
+
+ <% @messages.flatten.each do |m| %>
+ - <%= m.html_safe %>
+ <% end %>
+
+
<%= I18n.t("verwalten.fehler.keine").html_safe if @messages.empty?%>
+
+
+
+
+
-
-
-
-
-
+
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 84fa7a6..94ea21c 100755
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -13,6 +13,7 @@ de:
allestudien: "Alle Studien"
loeschen: "Dieses Studium löschen"
edit: "Studium bearbeiten"
+ verwaltung: "Studien verwalten"
modul:
edit: "Modul bearbeiten"
list: "Alle Module"
@@ -102,6 +103,19 @@ de:
taken: "Der Name ist bereits vergeben"
typ:
inclusion: 'Wählen Sie "Bachelor" oder "Master" aus'
-
-
+ modul:
+ attributes:
+ modulgruppen:
+ blank: "Wählen Sie zumindest eine Modulgruppe aus"
+ filter:
+ explanation: "Per Dropdown-Menü kann nach einzelnen Objekten gefiltert werden. Die Filter können kombiniert werden, wobei nur erlaubte Kombinationen möglich sind.
Solange validation-Fehler (im Log rot und fett) auftreten, keine Filter verwenden"
+ studium: "Studium"
+ modulgruppe: "Modulgruppe"
+ modul: "Modul"
+ lva: "Lva"
+ beispiel: "Beispiel"
+ reset: "Alle Filter zurücksetzen"
+ verwalten:
+ fehler:
+ keine: "Keine Fehlermeldungen oder Warnungen"
From ae75459d58a14998e9e115be850537f99855140f Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Thu, 8 Aug 2013 09:08:43 +0200
Subject: [PATCH 08/53] Relationship Calentry,Calendar
---
app/models/calendar.rb | 1 +
app/models/calentry.rb | 10 ++++++++--
...8062732_create_calendar_calentries_join_table.rb | 13 +++++++++++++
3 files changed, 22 insertions(+), 2 deletions(-)
create mode 100644 db/migrate/20130808062732_create_calendar_calentries_join_table.rb
diff --git a/app/models/calendar.rb b/app/models/calendar.rb
index 5b55280..eaaa1a9 100644
--- a/app/models/calendar.rb
+++ b/app/models/calendar.rb
@@ -1,3 +1,4 @@
class Calendar < ActiveRecord::Base
attr_accessible :name, :public
+ has_and_belongs_to_many :calentries
end
diff --git a/app/models/calentry.rb b/app/models/calentry.rb
index 6e892ad..7d7ded6 100644
--- a/app/models/calentry.rb
+++ b/app/models/calentry.rb
@@ -1,4 +1,10 @@
class Calentry < ActiveRecord::Base
- attr_accessible :ende, :start, :summary, :typ
-
+ attr_accessible :ende, :start, :summary, :typ,:calendar_ids
+ has_and_belongs_to_many :calendar
+ def start_time
+ start
+ end
+ def name
+ summary
+ end
end
diff --git a/db/migrate/20130808062732_create_calendar_calentries_join_table.rb b/db/migrate/20130808062732_create_calendar_calentries_join_table.rb
new file mode 100644
index 0000000..bbf0362
--- /dev/null
+++ b/db/migrate/20130808062732_create_calendar_calentries_join_table.rb
@@ -0,0 +1,13 @@
+class CreateCalendarCalentriesJoinTable < ActiveRecord::Migration
+ def up
+ create_table :calendars_calentries, :id=>false do |t|
+ t.integer :calentry_id
+ t.integer :calendar_id
+ end
+ add_index :calendars_calentries, [:calentry_id, :calendar_id]
+ add_index :calendars_calentries, :calendar_id
+ end
+
+ def down
+ end
+end
From b329fa489603761a724a5d28c6a9a22c2d35acef Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Thu, 8 Aug 2013 09:09:34 +0200
Subject: [PATCH 09/53] simple_calendar, calender_show_view
Kalender in Tabellenansicht
---
Gemfile | 2 ++
app/controllers/calentries_controller.rb | 2 +-
app/views/calendars/show.html.erb | 9 +++++++++
app/views/calentries/_form.html.erb | 1 +
app/views/layouts/menu.html.erb | 4 ++--
5 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/Gemfile b/Gemfile
index 7fce64e..d81643d 100755
--- a/Gemfile
+++ b/Gemfile
@@ -75,3 +75,5 @@ group :development, :test do
gem 'factory_girl_rails'
gem 'rspec-rails'
end
+
+gem "simple_calendar", "~> 0.1.9"
diff --git a/app/controllers/calentries_controller.rb b/app/controllers/calentries_controller.rb
index 89990cd..3452d72 100644
--- a/app/controllers/calentries_controller.rb
+++ b/app/controllers/calentries_controller.rb
@@ -18,7 +18,7 @@ class CalentriesController < ApplicationController
respond_to do |format|
format.html # show.html.erb
format.json { render json: @calentry }
- format.ics { render 'show.ics.erb',}
+ format.ics { render 'show.ics.erb'}
end
end
diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb
index efadc5a..8778ca8 100644
--- a/app/views/calendars/show.html.erb
+++ b/app/views/calendars/show.html.erb
@@ -9,7 +9,16 @@
Public:
<%= @calendar.public %>
+
+
+<% @calendar.calentries.each do |entry| %>
+<%= entry.summary+ "- " + entry.start.to_s %>
+<% end %>
+<%= calendar @calendar.calentries do |entry| %>
+ <%= link_to entry.name, entry %>
+<% end %>
+<%= link_to 'New Entry', new_calentry_path %>
<%= link_to 'Edit', edit_calendar_path(@calendar) %> |
<%= link_to 'Back', calendars_path %>
diff --git a/app/views/calentries/_form.html.erb b/app/views/calentries/_form.html.erb
index bd74e58..6dd64ad 100644
--- a/app/views/calentries/_form.html.erb
+++ b/app/views/calentries/_form.html.erb
@@ -3,6 +3,7 @@
<%= f.input :start %>
<%= f.input :ende %>
<%= f.input :summary %>
+ <%= f.input :calendar, :as=> :radio %>
<%= f.input :typ %>
<% end %>
diff --git a/app/views/layouts/menu.html.erb b/app/views/layouts/menu.html.erb
index bc71698..cd73c74 100755
--- a/app/views/layouts/menu.html.erb
+++ b/app/views/layouts/menu.html.erb
@@ -4,8 +4,8 @@
- <%= link_to I18n.t(:news,:scope=>'home' ),rubriken_path %>
- <%= link_to I18n.t(:info,:scope=>'home' ) %>
-- <%= link_to I18n.t(:studien,:scope=>'home' ), studien_path %>
-
+- <%= link_to I18n.t(:studien,:scope=>'home' ), studien_path %>
+- <%= link_to "Kalender", calendars_path %>
- <%= link_to "wiki intern", page_path(1) %>
From 8ec00d6a5658513069263a46d55d3aa8ac105089 Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Thu, 8 Aug 2013 09:09:55 +0200
Subject: [PATCH 10/53] Lokalisierung date,time
---
config/locales/de.yml | 201 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 197 insertions(+), 4 deletions(-)
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 84fa7a6..75fd73f 100755
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -101,7 +101,200 @@ de:
blank: "Geben Sie den Namen des Studiums ein"
taken: "Der Name ist bereits vergeben"
typ:
- inclusion: 'Wählen Sie "Bachelor" oder "Master" aus'
-
-
-
+ inclusion: 'Wählen Sie "Bachelor" oder "Master" aus'
+
+ date:
+ abbr_day_names:
+ - So
+ - Mo
+ - Di
+ - Mi
+ - Do
+ - Fr
+ - Sa
+ abbr_month_names:
+ -
+ - Jan
+ - Feb
+ - Mär
+ - Apr
+ - Mai
+ - Jun
+ - Jul
+ - Aug
+ - Sep
+ - Okt
+ - Nov
+ - Dez
+ day_names:
+ - Sonntag
+ - Montag
+ - Dienstag
+ - Mittwoch
+ - Donnerstag
+ - Freitag
+ - Samstag
+ formats:
+ default: ! '%d.%m.%Y'
+ long: ! '%e. %B %Y'
+ short: ! '%e. %b'
+ month_names:
+ -
+ - Januar
+ - Februar
+ - März
+ - April
+ - Mai
+ - Juni
+ - Juli
+ - August
+ - September
+ - Oktober
+ - November
+ - Dezember
+ order:
+ - :day
+ - :month
+ - :year
+ datetime:
+ distance_in_words:
+ about_x_hours:
+ one: etwa eine Stunde
+ other: etwa %{count} Stunden
+ about_x_months:
+ one: etwa ein Monat
+ other: etwa %{count} Monate
+ about_x_years:
+ one: etwa ein Jahr
+ other: etwa %{count} Jahre
+ almost_x_years:
+ one: fast ein Jahr
+ other: fast %{count} Jahre
+ half_a_minute: eine halbe Minute
+ less_than_x_minutes:
+ one: weniger als eine Minute
+ other: weniger als %{count} Minuten
+ less_than_x_seconds:
+ one: weniger als eine Sekunde
+ other: weniger als %{count} Sekunden
+ over_x_years:
+ one: mehr als ein Jahr
+ other: mehr als %{count} Jahre
+ x_days:
+ one: ein Tag
+ other: ! '%{count} Tage'
+ x_minutes:
+ one: eine Minute
+ other: ! '%{count} Minuten'
+ x_months:
+ one: ein Monat
+ other: ! '%{count} Monate'
+ x_seconds:
+ one: eine Sekunde
+ other: ! '%{count} Sekunden'
+ prompts:
+ day: Tag
+ hour: Stunden
+ minute: Minuten
+ month: Monat
+ second: Sekunden
+ year: Jahr
+ errors:
+ format: ! '%{attribute} %{message}'
+ messages:
+ accepted: muss akzeptiert werden
+ blank: muss ausgefüllt werden
+ confirmation: stimmt nicht mit der Bestätigung überein
+ empty: muss ausgefüllt werden
+ equal_to: muss genau %{count} sein
+ even: muss gerade sein
+ exclusion: ist nicht verfügbar
+ greater_than: muss größer als %{count} sein
+ greater_than_or_equal_to: muss größer oder gleich %{count} sein
+ inclusion: ist kein gültiger Wert
+ invalid: ist nicht gültig
+ less_than: muss kleiner als %{count} sein
+ less_than_or_equal_to: muss kleiner oder gleich %{count} sein
+ not_a_number: ist keine Zahl
+ not_an_integer: muss ganzzahlig sein
+ odd: muss ungerade sein
+ record_invalid: ! 'Gültigkeitsprüfung ist fehlgeschlagen: %{errors}'
+ taken: ist bereits vergeben
+ too_long: ist zu lang (nicht mehr als %{count} Zeichen)
+ too_short: ist zu kurz (nicht weniger als %{count} Zeichen)
+ wrong_length: hat die falsche Länge (muss genau %{count} Zeichen haben)
+ template:
+ body: ! 'Bitte überprüfen Sie die folgenden Felder:'
+ header:
+ one: ! 'Konnte %{model} nicht speichern: ein Fehler.'
+ other: ! 'Konnte %{model} nicht speichern: %{count} Fehler.'
+ helpers:
+ select:
+ prompt: Bitte wählen
+ submit:
+ create: ! '%{model} erstellen'
+ submit: ! '%{model} speichern'
+ update: ! '%{model} aktualisieren'
+ number:
+ currency:
+ format:
+ delimiter: .
+ format: ! '%n %u'
+ precision: 2
+ separator: ! ','
+ significant: false
+ strip_insignificant_zeros: false
+ unit: €
+ format:
+ delimiter: .
+ precision: 2
+ separator: ! ','
+ significant: false
+ strip_insignificant_zeros: false
+ human:
+ decimal_units:
+ format: ! '%n %u'
+ units:
+ billion:
+ one: Milliarde
+ other: Milliarden
+ million: Millionen
+ quadrillion:
+ one: Billiarde
+ other: Billiarden
+ thousand: Tausend
+ trillion: Billionen
+ unit: ''
+ format:
+ delimiter: ''
+ precision: 1
+ significant: true
+ strip_insignificant_zeros: true
+ storage_units:
+ format: ! '%n %u'
+ units:
+ byte:
+ one: Byte
+ other: Bytes
+ gb: GB
+ kb: KB
+ mb: MB
+ tb: TB
+ percentage:
+ format:
+ delimiter: ''
+ precision:
+ format:
+ delimiter: ''
+ support:
+ array:
+ last_word_connector: ! ' und '
+ two_words_connector: ! ' und '
+ words_connector: ! ', '
+ time:
+ am: vormittags
+ formats:
+ default: ! '%A, %d. %B %Y, %H:%M Uhr'
+ long: ! '%A, %d. %B %Y, %H:%M Uhr'
+ short: ! '%d. %B, %H:%M Uhr'
+ pm: nachmittags
From 3b975461e6d4344cc27b956732b9097235e86de8 Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Thu, 8 Aug 2013 09:09:55 +0200
Subject: [PATCH 11/53] Lokalisierung date,time
---
config/locales/de.yml | 201 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 197 insertions(+), 4 deletions(-)
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 84fa7a6..75fd73f 100755
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -101,7 +101,200 @@ de:
blank: "Geben Sie den Namen des Studiums ein"
taken: "Der Name ist bereits vergeben"
typ:
- inclusion: 'Wählen Sie "Bachelor" oder "Master" aus'
-
-
-
+ inclusion: 'Wählen Sie "Bachelor" oder "Master" aus'
+
+ date:
+ abbr_day_names:
+ - So
+ - Mo
+ - Di
+ - Mi
+ - Do
+ - Fr
+ - Sa
+ abbr_month_names:
+ -
+ - Jan
+ - Feb
+ - Mär
+ - Apr
+ - Mai
+ - Jun
+ - Jul
+ - Aug
+ - Sep
+ - Okt
+ - Nov
+ - Dez
+ day_names:
+ - Sonntag
+ - Montag
+ - Dienstag
+ - Mittwoch
+ - Donnerstag
+ - Freitag
+ - Samstag
+ formats:
+ default: ! '%d.%m.%Y'
+ long: ! '%e. %B %Y'
+ short: ! '%e. %b'
+ month_names:
+ -
+ - Januar
+ - Februar
+ - März
+ - April
+ - Mai
+ - Juni
+ - Juli
+ - August
+ - September
+ - Oktober
+ - November
+ - Dezember
+ order:
+ - :day
+ - :month
+ - :year
+ datetime:
+ distance_in_words:
+ about_x_hours:
+ one: etwa eine Stunde
+ other: etwa %{count} Stunden
+ about_x_months:
+ one: etwa ein Monat
+ other: etwa %{count} Monate
+ about_x_years:
+ one: etwa ein Jahr
+ other: etwa %{count} Jahre
+ almost_x_years:
+ one: fast ein Jahr
+ other: fast %{count} Jahre
+ half_a_minute: eine halbe Minute
+ less_than_x_minutes:
+ one: weniger als eine Minute
+ other: weniger als %{count} Minuten
+ less_than_x_seconds:
+ one: weniger als eine Sekunde
+ other: weniger als %{count} Sekunden
+ over_x_years:
+ one: mehr als ein Jahr
+ other: mehr als %{count} Jahre
+ x_days:
+ one: ein Tag
+ other: ! '%{count} Tage'
+ x_minutes:
+ one: eine Minute
+ other: ! '%{count} Minuten'
+ x_months:
+ one: ein Monat
+ other: ! '%{count} Monate'
+ x_seconds:
+ one: eine Sekunde
+ other: ! '%{count} Sekunden'
+ prompts:
+ day: Tag
+ hour: Stunden
+ minute: Minuten
+ month: Monat
+ second: Sekunden
+ year: Jahr
+ errors:
+ format: ! '%{attribute} %{message}'
+ messages:
+ accepted: muss akzeptiert werden
+ blank: muss ausgefüllt werden
+ confirmation: stimmt nicht mit der Bestätigung überein
+ empty: muss ausgefüllt werden
+ equal_to: muss genau %{count} sein
+ even: muss gerade sein
+ exclusion: ist nicht verfügbar
+ greater_than: muss größer als %{count} sein
+ greater_than_or_equal_to: muss größer oder gleich %{count} sein
+ inclusion: ist kein gültiger Wert
+ invalid: ist nicht gültig
+ less_than: muss kleiner als %{count} sein
+ less_than_or_equal_to: muss kleiner oder gleich %{count} sein
+ not_a_number: ist keine Zahl
+ not_an_integer: muss ganzzahlig sein
+ odd: muss ungerade sein
+ record_invalid: ! 'Gültigkeitsprüfung ist fehlgeschlagen: %{errors}'
+ taken: ist bereits vergeben
+ too_long: ist zu lang (nicht mehr als %{count} Zeichen)
+ too_short: ist zu kurz (nicht weniger als %{count} Zeichen)
+ wrong_length: hat die falsche Länge (muss genau %{count} Zeichen haben)
+ template:
+ body: ! 'Bitte überprüfen Sie die folgenden Felder:'
+ header:
+ one: ! 'Konnte %{model} nicht speichern: ein Fehler.'
+ other: ! 'Konnte %{model} nicht speichern: %{count} Fehler.'
+ helpers:
+ select:
+ prompt: Bitte wählen
+ submit:
+ create: ! '%{model} erstellen'
+ submit: ! '%{model} speichern'
+ update: ! '%{model} aktualisieren'
+ number:
+ currency:
+ format:
+ delimiter: .
+ format: ! '%n %u'
+ precision: 2
+ separator: ! ','
+ significant: false
+ strip_insignificant_zeros: false
+ unit: €
+ format:
+ delimiter: .
+ precision: 2
+ separator: ! ','
+ significant: false
+ strip_insignificant_zeros: false
+ human:
+ decimal_units:
+ format: ! '%n %u'
+ units:
+ billion:
+ one: Milliarde
+ other: Milliarden
+ million: Millionen
+ quadrillion:
+ one: Billiarde
+ other: Billiarden
+ thousand: Tausend
+ trillion: Billionen
+ unit: ''
+ format:
+ delimiter: ''
+ precision: 1
+ significant: true
+ strip_insignificant_zeros: true
+ storage_units:
+ format: ! '%n %u'
+ units:
+ byte:
+ one: Byte
+ other: Bytes
+ gb: GB
+ kb: KB
+ mb: MB
+ tb: TB
+ percentage:
+ format:
+ delimiter: ''
+ precision:
+ format:
+ delimiter: ''
+ support:
+ array:
+ last_word_connector: ! ' und '
+ two_words_connector: ! ' und '
+ words_connector: ! ', '
+ time:
+ am: vormittags
+ formats:
+ default: ! '%A, %d. %B %Y, %H:%M Uhr'
+ long: ! '%A, %d. %B %Y, %H:%M Uhr'
+ short: ! '%d. %B, %H:%M Uhr'
+ pm: nachmittags
From 33c3fea2bce27267462b51a57a0bedf0aff5e493 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Thu, 8 Aug 2013 15:23:12 +0200
Subject: [PATCH 12/53] Formatierung
---
app/views/studien/verwalten.html.erb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/studien/verwalten.html.erb b/app/views/studien/verwalten.html.erb
index ca64fe5..a834154 100644
--- a/app/views/studien/verwalten.html.erb
+++ b/app/views/studien/verwalten.html.erb
@@ -1,7 +1,7 @@
<%= render 'studien/tabs'%>
-
+
-
+
Error Log
From 585af6f162b5b93a01c056dc2fe1e26ace84b0d6 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Fri, 9 Aug 2013 14:15:02 +0200
Subject: [PATCH 13/53] Lva form verbessert
---
.../stylesheets/formtastic-changes.css.scss | 21 +++++++
app/views/lvas/_form.html.erb | 55 ++++++++++++++-----
config/locales/de.yml | 10 +++-
3 files changed, 71 insertions(+), 15 deletions(-)
create mode 100644 app/assets/stylesheets/formtastic-changes.css.scss
diff --git a/app/assets/stylesheets/formtastic-changes.css.scss b/app/assets/stylesheets/formtastic-changes.css.scss
new file mode 100644
index 0000000..5007540
--- /dev/null
+++ b/app/assets/stylesheets/formtastic-changes.css.scss
@@ -0,0 +1,21 @@
+form.formtastic .stringish input {
+width:90%;
+}
+form.formtastic textarea {
+width:90%;
+height:20em;
+}
+form.formtastic .stringish label {
+font-weight: bold;
+}
+form.formtastic .choice-group label {
+font-weight: bold;
+}
+form.formtastic fieldset div.control-group{}
+
+div.form-group {
+border-width: 1px;
+border-style: dashed;
+padding: 10px;
+border-radius: 10px;
+}
diff --git a/app/views/lvas/_form.html.erb b/app/views/lvas/_form.html.erb
index 49bbb78..8692e8e 100755
--- a/app/views/lvas/_form.html.erb
+++ b/app/views/lvas/_form.html.erb
@@ -1,15 +1,44 @@
-<%= semantic_form_for @lva do |f| %>
- <%= f.inputs do %>
- <%= f.input :semester, :collection=>Semester.all.sort_by{|n| [:name]}%>
- <%= f.input :modul %>
- <%= f.input :name %>
- <%= f.input :ects %>
- <%= f.input :stunden %>
- <%= f.input :desc %>
- <%= f.input :lvanr %>
- <% end %>
- <%= f.actions do %>
- <%= f.action :submit, :as => :input %>
- <% end %>
+<%= semantic_form_for @lva do |f| %>
+
+ <%= f.inputs do %>
+
+
+
+
+
+
+
BILD
+ <%= f.input :modul,:label=>'Modul'.html_safe, :as=>:check_boxes%>
+
+
+
+
+
+ <%= f.input :semester, :label=>'Semester'.html_safe, :as=>:check_boxes%>
+
+
+ <% end %>
+ <%= f.actions do %>
+ <%= f.action :submit, :as => :input %>
+ <% end %>
<% end %>
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 94ea21c..2e2ca1e 100755
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -91,7 +91,10 @@ de:
stunden:
blank: "Geben Sie die Stunden der LVA an"
lvanr:
- invalid: "Geben Sie eine LVA-Nummer in richtigem Format an. Wenn die LVA noch keine Nummer hat, so geben sie 000 an."
+ invalid: "Geben Sie eine Nummer im Format 000.000 an."
+ blank: "Geben sie eine Lva-Nr an"
+ taken: "Die Lva-Nummer ist bereits vergeben"
+
studium:
attributes:
zahl:
@@ -118,4 +121,7 @@ de:
verwalten:
fehler:
keine: "Keine Fehlermeldungen oder Warnungen"
-
+ support:
+ array:
+ two_words_connector: ', '
+
From 61fc09bcf07696e2d6d1cf23bc6aa5ebe17f14e8 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Fri, 9 Aug 2013 16:17:51 +0200
Subject: [PATCH 14/53] Formatierungen
---
.../stylesheets/formtastic-changes.css.scss | 13 +++---
app/controllers/modulgruppen_controller.rb | 7 +--
app/views/modulgruppen/_form.html.erb | 24 +++++++---
app/views/studien/verwalten.html.erb | 44 ++++++++-----------
4 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/app/assets/stylesheets/formtastic-changes.css.scss b/app/assets/stylesheets/formtastic-changes.css.scss
index 5007540..498eb2a 100644
--- a/app/assets/stylesheets/formtastic-changes.css.scss
+++ b/app/assets/stylesheets/formtastic-changes.css.scss
@@ -5,13 +5,7 @@ form.formtastic textarea {
width:90%;
height:20em;
}
-form.formtastic .stringish label {
-font-weight: bold;
-}
-form.formtastic .choice-group label {
-font-weight: bold;
-}
-form.formtastic fieldset div.control-group{}
+
div.form-group {
border-width: 1px;
@@ -19,3 +13,8 @@ border-style: dashed;
padding: 10px;
border-radius: 10px;
}
+div.verwalten-block {
+border-width: 1px;
+border-style: solid;
+padding: 5px;
+}
\ No newline at end of file
diff --git a/app/controllers/modulgruppen_controller.rb b/app/controllers/modulgruppen_controller.rb
index c69f8fe..d84de6f 100755
--- a/app/controllers/modulgruppen_controller.rb
+++ b/app/controllers/modulgruppen_controller.rb
@@ -51,15 +51,10 @@ class ModulgruppenController < ApplicationController
def create
@modulgruppe = Modulgruppe.new(params[:modulgruppe])
- if !params[:studium_id].nil?
- @studium=Studium.find_by_id(params[:studium_id])
- else
- @studium=Studium.find_by_id(params[:modulgruppe][:studium_id])
- end
respond_to do |format|
if @modulgruppe.save
- format.html { redirect_to @studium, notice: 'Modulgruppe was successfully created.' }
+ format.html { redirect_to @modulgruppe.studium, notice: 'Modulgruppe was successfully created.' }
else
format.html { render action: "new" }
diff --git a/app/views/modulgruppen/_form.html.erb b/app/views/modulgruppen/_form.html.erb
index 8191af5..22cc925 100755
--- a/app/views/modulgruppen/_form.html.erb
+++ b/app/views/modulgruppen/_form.html.erb
@@ -1,13 +1,25 @@
<%= semantic_form_for @modulgruppe do |f| %>
<%= f.inputs do %>
- <%= f.input :studium_id, :as =>:select, :collection => Studium.all %>
- <%= f.input :typ ,:as => :radio, :collection=>["Pflicht","Vertiefungspflicht","Wahl"]%>
- <%= f.input :phase,:as => :radio,:collection=>1..3 %>
- <%= f.input :name %>
- <%= f.input :desc,:input_html=>{:rows=> 3 }%>
- <% end %>
+
+
+ <%= f.input :name, :wrapper_html=>{:class=>"span12"}%>
+
+ <%= f.input :studium_id, :as =>:select, :collection => Studium.all, :wrapper_html=>{:class=>"span4"} %>
+ <%= f.input :typ, :collection=>["Pflicht","Vertiefungspflicht","Wahl"], :wrapper_html=>{:class=>"span4"}%>
+ <%= f.input :phase, :as=>:select, :collection=>1..3, :wrapper_html=>{:class=>"span4"} %>
+
+
+
+
+
+ <%= f.input :desc %>
+
+
+ <% end %>
+
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
+
<% end %>
<% end %>
diff --git a/app/views/studien/verwalten.html.erb b/app/views/studien/verwalten.html.erb
index a834154..279026f 100644
--- a/app/views/studien/verwalten.html.erb
+++ b/app/views/studien/verwalten.html.erb
@@ -1,8 +1,7 @@
<%= render 'studien/tabs'%>
-
-
+
<%= I18n.t("studien.verwaltung") %>
@@ -11,7 +10,7 @@
-
+
Studien <%= link_to "new", new_studium_path %>
<% @studien.each do |s| %>
<%= link_to s.name, s %> <%= (s.valid?) ? "Gültig" : "Problemfall" %>
@@ -23,7 +22,7 @@
-
+
Modulgruppen <%= link_to 'new', new_studium_modulgruppe_path(Studium.first) unless Studium.first.nil? %>
<% @modulgruppen.each do |mg| %>
<%= link_to mg.name, mg %> | <%= (mg.valid?) ? "Gültig" : "Problemfall" %>
@@ -31,7 +30,7 @@
-
+
Module <%= link_to "new", new_modul_path %>
<% @module.each do |m| %>
<%= link_to m.name, m %>
@@ -40,7 +39,7 @@
-
+
LVas <%= link_to "new", new_lva_path %>
<% @lvas.each do |lva| %>
<%= link_to lva.name, lva %> |
@@ -50,7 +49,7 @@
-
+
Beispiele <%= link_to "new", new_beispiel_path %>
<% @beispiele.each do |b| %>
<%= link_to b.name, b %>
@@ -62,28 +61,23 @@
-
-
-
-
Error Log
+
+
Error Log
+
+ - Red: Error, Solve immediately
+ - Black: Warning, should be solved
+ - Green: Everything is fine
+
+
- - Red: Error, Solve immediately
- - Black: Warning, should be solved
- - Green: Everything is fine
-
-
-
- <% @messages.flatten.each do |m| %>
- - <%= m.html_safe %>
- <% end %>
-
-
<%= I18n.t("verwalten.fehler.keine").html_safe if @messages.empty?%>
-
+ <% @messages.flatten.each do |m| %>
+
- <%= m.html_safe %>
+ <% end %>
+
+
<%= I18n.t("verwalten.fehler.keine").html_safe if @messages.empty?%>
-
-
From b6671879fc906dbb8dca561e53c28ca1fec4e7e1 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Fri, 9 Aug 2013 18:49:30 +0200
Subject: [PATCH 15/53] Bug fix
Die persistent variables waren schlecht benannt. hab sie eindeutig
benannt
---
app/controllers/studien_controller.rb | 32 +++++++++++-----------
app/views/studien/_verwalten_menu.html.erb | 32 +++++++++++-----------
2 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/app/controllers/studien_controller.rb b/app/controllers/studien_controller.rb
index 4d0a0b3..f2c9231 100755
--- a/app/controllers/studien_controller.rb
+++ b/app/controllers/studien_controller.rb
@@ -92,7 +92,7 @@ class StudienController < ApplicationController
end
def verwalten
- @new_params={:studium=>params[:studium], :modulgruppe=>params[:modulgruppe], :modul=>params[:modul], :lva=>params[:lva], :beispiel=>params[:beispiel]}
+ @new_params={:std_verw=>params[:std_verw], :mg_verw=>params[:mg_verw], :m_verw=>params[:m_verw], :lva_verw=>params[:lva_verw], :b_verw=>params[:b_verw]}
if @new_params.values.compact.empty?
@studien=Studium.all
@modulgruppen=Modulgruppe.all
@@ -100,13 +100,13 @@ class StudienController < ApplicationController
@lvas=Lva.all
@beispiele=Beispiel.all
else
- if !@new_params[:studium].nil?
- @studien = [Studium.find(@new_params[:studium])]
+ if !@new_params[:std_verw].nil?
+ @studien = [Studium.find(@new_params[:std_verw])]
else
@studien = Studium.all
end
- if !@new_params[:modulgruppe].nil?
- @modulgruppen = [Modulgruppe.find(@new_params[:modulgruppe])]
+ if !@new_params[:mg_verw].nil?
+ @modulgruppen = [Modulgruppe.find(@new_params[:mg_verw])]
temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
@studien=@studien.select{|k| temp.include?(k)}
@@ -115,8 +115,8 @@ class StudienController < ApplicationController
temp = @studien.map{|x| x.modulgruppen}.flatten.uniq # Studien forcen Modulgruppen
@modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
end
- if !@new_params[:modul].nil?
- @module = [Modul.find(@new_params[:modul])]
+ if !@new_params[:m_verw].nil?
+ @module = [Modul.find(@new_params[:m_verw])]
temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
@modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
@@ -127,8 +127,8 @@ class StudienController < ApplicationController
temp = @modulgruppen.map{|x| x.moduls}.flatten.uniq
@module=@module.select{|k| temp.include?(k)}
end
- if !@new_params[:lva].nil?
- @lvas = [Lva.find(@new_params[:lva])]
+ if !@new_params[:lva_verw].nil?
+ @lvas = [Lva.find(@new_params[:lva_verw])]
temp = @lvas.map{|x| x.modul}.flatten.uniq
@module=@module.select{|k| temp.include?(k)}
temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
@@ -140,8 +140,8 @@ class StudienController < ApplicationController
temp = @module.map{|x| x.lvas}.flatten.uniq #Force Module
@lvas=@lvas.select{|k| temp.include?(k)}
end
- if !@new_params[:beispiel].nil?
- @beispiele = [Beispiel.find(@new_params[:beispiel])]
+ if !@new_params[:b_verw].nil?
+ @beispiele = [Beispiel.find(@new_params[:b_verw])]
temp = @lvas.map{|x| x.beispiele}.flatten.uniq #Force Force Lvas
@lvas=@lvas.select{|k| temp.include?(k)}
temp = @module.map{|x| x.lvas}.flatten.uniq #Force Module
@@ -226,11 +226,11 @@ class StudienController < ApplicationController
def default_url_options
{:ansicht=> params[:ansicht],
- :studium=> params[:studium],
- :modulgruppe=> params[:modulgruppe],
- :modul=>params[:modul],
- :lva=>params[:lva],
- :beispiel=>params[:beispiel]}.merge(super)
+ :std_verw=> params[:std_verw],
+ :mg_verw=> params[:mg_verw],
+ :m_verw=>params[:m_verw],
+ :lva_verw=>params[:lva_verw],
+ :b_verw=>params[:b_verw]}.merge(super)
end
end
diff --git a/app/views/studien/_verwalten_menu.html.erb b/app/views/studien/_verwalten_menu.html.erb
index 0c37f91..3f7c051 100644
--- a/app/views/studien/_verwalten_menu.html.erb
+++ b/app/views/studien/_verwalten_menu.html.erb
@@ -1,68 +1,68 @@
From 9bf4768e0981313ca33db9a79385be837435371a Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Fri, 9 Aug 2013 18:49:56 +0200
Subject: [PATCH 16/53] Form designs
---
.../stylesheets/formtastic-changes.css.scss | 4 +--
app/views/moduls/_form.html.erb | 31 ++++++++++++++-----
app/views/studien/_form.html.erb | 29 ++++++++++++-----
3 files changed, 47 insertions(+), 17 deletions(-)
diff --git a/app/assets/stylesheets/formtastic-changes.css.scss b/app/assets/stylesheets/formtastic-changes.css.scss
index 498eb2a..192ee43 100644
--- a/app/assets/stylesheets/formtastic-changes.css.scss
+++ b/app/assets/stylesheets/formtastic-changes.css.scss
@@ -9,9 +9,9 @@ height:20em;
div.form-group {
border-width: 1px;
-border-style: dashed;
+border-style: none;
padding: 10px;
-border-radius: 10px;
+// border-radius: 10px;
}
div.verwalten-block {
border-width: 1px;
diff --git a/app/views/moduls/_form.html.erb b/app/views/moduls/_form.html.erb
index fb6b68b..db03f9d 100755
--- a/app/views/moduls/_form.html.erb
+++ b/app/views/moduls/_form.html.erb
@@ -1,15 +1,30 @@
+
+ <%= semantic_form_for @modul do |f| %>
-<%= semantic_form_for @modul do |f| %>
<%= f.inputs do %>
- <% # f.input :modulgruppen,:as => :select, :collection => Hash[Modulgruppe.all.map{|m| [m.studium.name + " " + m.name,m.id]}] %>
- <%= f.input :modulgruppen %>
- <%= f.input :name ,:hint=>true%>
- <%= f.input :desc, :as=>:tinymce_text %>
- <%= f.input :depend %>
+
+
+ <%= f.input :name ,:hint=>true%>
+
+
+ <%= f.input :desc, :as=>:tinymce_text %>
+
+
+ <%= f.input :depend %>
+
+
+
+
+ <%= f.input :modulgruppen,:as => :check_boxes, :collection => Hash[Modulgruppe.all.map{|m| [m.studium.name + " " + m.name,m.id]}.sort] %>
+
+
+
<% end %>
<%= f.actions do %>
- <%= f.action :submit, :as => :input %>
+ <%= f.action :submit, :as => :input %>
<% end %>
-<% end %>
+
+ <% end %>
+
<%= tinymce %>
diff --git a/app/views/studien/_form.html.erb b/app/views/studien/_form.html.erb
index 471a8c3..0973ef5 100755
--- a/app/views/studien/_form.html.erb
+++ b/app/views/studien/_form.html.erb
@@ -1,13 +1,28 @@
+
<%= tinymce_assets %>
-<%= semantic_form_for @studium do |f| %>
+ <%= semantic_form_for @studium do |f| %>
+
<%= f.inputs do %>
- <%= f.input :zahl %>
- <%= f.input :name,:append=>"NAME" %>
+
+
+
+ <%= f.input :name,:append=>"NAME" %>
+
+
+ <%= f.input :zahl %>
+
+
+ <%= f.input :typ, :as=>:select, :include_blank=>false, :collection=>["Bachelor","Master"]%>
+
+
+
<%= f.input :desc, :as=>:tinymce_text %>
- <%= f.input :typ, :as=>:radio, :collection=>["Bachelor","Master"]%>
+
<% end %>
-<%= tinymce %>
+ <%= tinymce %>
<%= f.actions do %>
- <%= f.action :submit, :as => :input %>
+ <%= f.action :submit, :as => :input %>
<% end %>
-<% end %>
+
+ <% end %>
+
From 36381343949196ce3c934600da9be17c8c0de01a Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Fri, 9 Aug 2013 18:49:30 +0200
Subject: [PATCH 17/53] Bug fix
Die persistent variables waren schlecht benannt. hab sie eindeutig
benannt
---
app/controllers/studien_controller.rb | 32 +++++++++++-----------
app/views/studien/_verwalten_menu.html.erb | 32 +++++++++++-----------
2 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/app/controllers/studien_controller.rb b/app/controllers/studien_controller.rb
index 4d0a0b3..f2c9231 100755
--- a/app/controllers/studien_controller.rb
+++ b/app/controllers/studien_controller.rb
@@ -92,7 +92,7 @@ class StudienController < ApplicationController
end
def verwalten
- @new_params={:studium=>params[:studium], :modulgruppe=>params[:modulgruppe], :modul=>params[:modul], :lva=>params[:lva], :beispiel=>params[:beispiel]}
+ @new_params={:std_verw=>params[:std_verw], :mg_verw=>params[:mg_verw], :m_verw=>params[:m_verw], :lva_verw=>params[:lva_verw], :b_verw=>params[:b_verw]}
if @new_params.values.compact.empty?
@studien=Studium.all
@modulgruppen=Modulgruppe.all
@@ -100,13 +100,13 @@ class StudienController < ApplicationController
@lvas=Lva.all
@beispiele=Beispiel.all
else
- if !@new_params[:studium].nil?
- @studien = [Studium.find(@new_params[:studium])]
+ if !@new_params[:std_verw].nil?
+ @studien = [Studium.find(@new_params[:std_verw])]
else
@studien = Studium.all
end
- if !@new_params[:modulgruppe].nil?
- @modulgruppen = [Modulgruppe.find(@new_params[:modulgruppe])]
+ if !@new_params[:mg_verw].nil?
+ @modulgruppen = [Modulgruppe.find(@new_params[:mg_verw])]
temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
@studien=@studien.select{|k| temp.include?(k)}
@@ -115,8 +115,8 @@ class StudienController < ApplicationController
temp = @studien.map{|x| x.modulgruppen}.flatten.uniq # Studien forcen Modulgruppen
@modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
end
- if !@new_params[:modul].nil?
- @module = [Modul.find(@new_params[:modul])]
+ if !@new_params[:m_verw].nil?
+ @module = [Modul.find(@new_params[:m_verw])]
temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
@modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
@@ -127,8 +127,8 @@ class StudienController < ApplicationController
temp = @modulgruppen.map{|x| x.moduls}.flatten.uniq
@module=@module.select{|k| temp.include?(k)}
end
- if !@new_params[:lva].nil?
- @lvas = [Lva.find(@new_params[:lva])]
+ if !@new_params[:lva_verw].nil?
+ @lvas = [Lva.find(@new_params[:lva_verw])]
temp = @lvas.map{|x| x.modul}.flatten.uniq
@module=@module.select{|k| temp.include?(k)}
temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
@@ -140,8 +140,8 @@ class StudienController < ApplicationController
temp = @module.map{|x| x.lvas}.flatten.uniq #Force Module
@lvas=@lvas.select{|k| temp.include?(k)}
end
- if !@new_params[:beispiel].nil?
- @beispiele = [Beispiel.find(@new_params[:beispiel])]
+ if !@new_params[:b_verw].nil?
+ @beispiele = [Beispiel.find(@new_params[:b_verw])]
temp = @lvas.map{|x| x.beispiele}.flatten.uniq #Force Force Lvas
@lvas=@lvas.select{|k| temp.include?(k)}
temp = @module.map{|x| x.lvas}.flatten.uniq #Force Module
@@ -226,11 +226,11 @@ class StudienController < ApplicationController
def default_url_options
{:ansicht=> params[:ansicht],
- :studium=> params[:studium],
- :modulgruppe=> params[:modulgruppe],
- :modul=>params[:modul],
- :lva=>params[:lva],
- :beispiel=>params[:beispiel]}.merge(super)
+ :std_verw=> params[:std_verw],
+ :mg_verw=> params[:mg_verw],
+ :m_verw=>params[:m_verw],
+ :lva_verw=>params[:lva_verw],
+ :b_verw=>params[:b_verw]}.merge(super)
end
end
diff --git a/app/views/studien/_verwalten_menu.html.erb b/app/views/studien/_verwalten_menu.html.erb
index 0c37f91..3f7c051 100644
--- a/app/views/studien/_verwalten_menu.html.erb
+++ b/app/views/studien/_verwalten_menu.html.erb
@@ -1,68 +1,68 @@
From a8c6ecd08cfff0995c1ac704f06c44364aeebcbb Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Fri, 9 Aug 2013 19:09:01 +0200
Subject: [PATCH 18/53] beispiel formular
---
app/views/beispiele/_form.html.erb | 39 ++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 10 deletions(-)
diff --git a/app/views/beispiele/_form.html.erb b/app/views/beispiele/_form.html.erb
index bf0c027..1e3833c 100755
--- a/app/views/beispiele/_form.html.erb
+++ b/app/views/beispiele/_form.html.erb
@@ -1,13 +1,32 @@
-<%= semantic_form_for @beispiel, :html => { :multipart => true } do |f| %>
- <%= f.inputs do %>
- <%= f.input :name %>
- <%= f.input :desc %>
- <%= f.file_field :beispieldatei %>
- <%= f.hidden_field :beispieldatei_cache %>
- <%= f.input :lva, :as=>:select, :collection => Lva.all%>
- <% end %>
+
+
+ <%= semantic_form_for @beispiel, :html => { :multipart => true } do |f| %>
+
+ <%= f.inputs do %>
+
+
+ <%= f.file_field :beispieldatei %>
+ <%= f.hidden_field :beispieldatei_cache %>
+
+
+ <%= f.input :lva, :as=>:select, :collection => Lva.all%>
+
+
+
+ <%= f.input :name %>
+
+
+
+
+ <%= f.input :desc %>
+
+ <% end %>
<%= f.actions do %>
- <%= f.action :submit, :as => :input %>
+ <%= f.action :submit, :as => :input %>
+
<% end %>
-<% end %>
+
+ <% end %>
+
+
From 1a10f4fc5e2bebf4bcaab01928ed40e9341990d2 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Fri, 9 Aug 2013 20:04:23 +0200
Subject: [PATCH 19/53] Kleiner edit
---
app/views/beispiele/_form.html.erb | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/app/views/beispiele/_form.html.erb b/app/views/beispiele/_form.html.erb
index 1e3833c..01cb3b8 100755
--- a/app/views/beispiele/_form.html.erb
+++ b/app/views/beispiele/_form.html.erb
@@ -4,17 +4,10 @@
<%= f.inputs do %>
-
- <%= f.file_field :beispieldatei %>
- <%= f.hidden_field :beispieldatei_cache %>
-
-
- <%= f.input :lva, :as=>:select, :collection => Lva.all%>
-
-
-
- <%= f.input :name %>
-
+ <%= f.file_field :beispieldatei, :wrapper_html=>{:class=>'span4'}%>
+ <%= f.hidden_field :beispieldatei_cache, :wrapper_html=>{:class=>'span0'} %>
+ <%= f.input :lva, :as=>:select, :collection => Lva.all, :wrapper_html=>{:class=>'span3'}%>
+ <%= f.input :name, :wrapper_html=>{:class=>'span5'} %>
From 9d8b8ad3d603bc8bdad24b27e20af8ae1cf62ce8 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Sat, 10 Aug 2013 00:58:09 +0200
Subject: [PATCH 20/53] kleiner bugfix, layout
---
app/controllers/beispiele_controller.rb | 2 +-
app/controllers/studien_controller.rb | 2 +-
app/views/beispiele/_form.html.erb | 28 ++++++++++++++-----------
app/views/beispiele/show.html.erb | 4 +++-
4 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/app/controllers/beispiele_controller.rb b/app/controllers/beispiele_controller.rb
index ccd30a3..c9d4c49 100755
--- a/app/controllers/beispiele_controller.rb
+++ b/app/controllers/beispiele_controller.rb
@@ -42,7 +42,7 @@ class BeispieleController < ApplicationController
# POST /beispiele.json
def create
@beispiel = Beispiel.new(params[:beispiel])
-
+
respond_to do |format|
if @beispiel.save
format.html { redirect_to @beispiel, notice: 'Beispiel was successfully created.' }
diff --git a/app/controllers/studien_controller.rb b/app/controllers/studien_controller.rb
index f2c9231..0504b84 100755
--- a/app/controllers/studien_controller.rb
+++ b/app/controllers/studien_controller.rb
@@ -214,7 +214,7 @@ class StudienController < ApplicationController
end
for b in @beispiele
if b.valid?
- @messages << b.name + ' hat keine Lva' if lva.moduls
+ @messages << b.name + ' hat keine Lva' if b.lva.nil?
else
@messages << ''+b.name + ': '
@messages << b.errors.full_messages
diff --git a/app/views/beispiele/_form.html.erb b/app/views/beispiele/_form.html.erb
index 01cb3b8..a5795e7 100755
--- a/app/views/beispiele/_form.html.erb
+++ b/app/views/beispiele/_form.html.erb
@@ -1,25 +1,29 @@
- <%= semantic_form_for @beispiel, :html => { :multipart => true } do |f| %>
+ <%= semantic_form_for @beispiel, :html => { :multipart => true } do |f| %>
<%= f.inputs do %>
-
- <%= f.file_field :beispieldatei, :wrapper_html=>{:class=>'span4'}%>
- <%= f.hidden_field :beispieldatei_cache, :wrapper_html=>{:class=>'span0'} %>
- <%= f.input :lva, :as=>:select, :collection => Lva.all, :wrapper_html=>{:class=>'span3'}%>
- <%= f.input :name, :wrapper_html=>{:class=>'span5'} %>
-
+ <%= f.hidden_field :beispieldatei_cache %>
+
+ <%= f.file_field :beispieldatei, :wrapper_html=>{:class=>"span4"}%>
+
+ <%= f.input :name, :wrapper_html=>{:class=>'span6'} %>
+ <%= f.input :lva, :as=>:select, :collection => Lva.all, :wrapper_html=>{:class=>'span6'}%>
+
+
+ <% end %>
+
<%= f.input :desc %>
<% end %>
- <%= f.actions do %>
- <%= f.action :submit, :as => :input %>
+ <%= f.actions do %>
+ <%= f.action :submit, :as => :input %>
- <% end %>
+ <% end %>
- <% end %>
-
+ <% end %>
+
diff --git a/app/views/beispiele/show.html.erb b/app/views/beispiele/show.html.erb
index 1115fb3..49501a7 100755
--- a/app/views/beispiele/show.html.erb
+++ b/app/views/beispiele/show.html.erb
@@ -10,7 +10,9 @@
<%= @beispiel.desc %>
<%= @beispiel.beispieldatei.url %>
-
+
+ <%= @beispiel.lva.name %>
+
<%= link_to 'Edit', edit_beispiel_path(@beispiel) %> |
<%= link_to 'Back', beispiele_path %>
From 86913257afd97a5d1df9f3a52c9a51f585610e7f Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Sat, 10 Aug 2013 02:03:45 +0200
Subject: [PATCH 21/53] Layout changes
---
.../stylesheets/formtastic-changes.css.scss | 1 +
app/views/beispiele/_form.html.erb | 8 +-
app/views/studien/_verwalten_menu.html.erb | 68 ------
app/views/studien/verwalten.html.erb | 193 +++++++++++++-----
4 files changed, 140 insertions(+), 130 deletions(-)
diff --git a/app/assets/stylesheets/formtastic-changes.css.scss b/app/assets/stylesheets/formtastic-changes.css.scss
index 192ee43..bd015db 100644
--- a/app/assets/stylesheets/formtastic-changes.css.scss
+++ b/app/assets/stylesheets/formtastic-changes.css.scss
@@ -17,4 +17,5 @@ div.verwalten-block {
border-width: 1px;
border-style: solid;
padding: 5px;
+border-radius:10px;
}
\ No newline at end of file
diff --git a/app/views/beispiele/_form.html.erb b/app/views/beispiele/_form.html.erb
index a5795e7..26e018e 100755
--- a/app/views/beispiele/_form.html.erb
+++ b/app/views/beispiele/_form.html.erb
@@ -1,5 +1,4 @@
-
-
+
<%= semantic_form_for @beispiel, :html => { :multipart => true } do |f| %>
<%= f.inputs do %>
@@ -10,8 +9,7 @@
<%= f.input :name, :wrapper_html=>{:class=>'span6'} %>
<%= f.input :lva, :as=>:select, :collection => Lva.all, :wrapper_html=>{:class=>'span6'}%>
-
- <% end %>
+
@@ -25,5 +23,3 @@
<% end %>
<% end %>
-
-
diff --git a/app/views/studien/_verwalten_menu.html.erb b/app/views/studien/_verwalten_menu.html.erb
index 3f7c051..e69de29 100644
--- a/app/views/studien/_verwalten_menu.html.erb
+++ b/app/views/studien/_verwalten_menu.html.erb
@@ -1,68 +0,0 @@
-
-
-
diff --git a/app/views/studien/verwalten.html.erb b/app/views/studien/verwalten.html.erb
index 279026f..f991b3f 100644
--- a/app/views/studien/verwalten.html.erb
+++ b/app/views/studien/verwalten.html.erb
@@ -1,68 +1,123 @@
<%= render 'studien/tabs'%>
-
-
-
-
<%= I18n.t("studien.verwaltung") %>
- <%= I18n.t("filter.explanation").html_safe %>
- <%= render 'studien/verwalten_menu' %>
-
-
-
-
-
Studien <%= link_to "new", new_studium_path %>
- <% @studien.each do |s| %>
- <%= link_to s.name, s %> <%= (s.valid?) ? "Gültig" : "Problemfall" %>
- <% end %>
+
+
+
<%= I18n.t("studien.verwaltung") %>
<%= link_to I18n.t("filter.reset"), studien_verwalten_path(:std_verw=>nil, :mg_verw=>nil, :m_verw=>nil, :lva_verw=>nil, :b_verw=>nil), :class=>"btn" %>
+ <%= I18n.t("filter.explanation").html_safe %>
+
Studien
+
+
+ |
+ <% @studien.each do |s| %>
+ <%= link_to s.name, s %> <%= (s.valid?) ? "Gültig" : "Problemfall" %> | <% end %>
+
+
+
+
+
+
+
Modulgruppen
+
+ <% @modulgruppen.each do |mg| %>
+ <%= link_to mg.name, mg %> | <%= (mg.valid?) ? "Gültig" : "Problemfall" %>
+ <% end %>
+
+
+
+
+
+
+
Module
+
+
+
+ <% @module.each do |m| %>
+ <%= link_to m.name, m %>
+ | <%= (m.valid?) ? "Gültig" : "Problemfall" %>
+ <% end %>
+
-
-
-
-
-
Modulgruppen <%= link_to 'new', new_studium_modulgruppe_path(Studium.first) unless Studium.first.nil? %>
- <% @modulgruppen.each do |mg| %>
- <%= link_to mg.name, mg %> | <%= (mg.valid?) ? "Gültig" : "Problemfall" %>
- <% end %>
-
-
-
-
-
Module <%= link_to "new", new_modul_path %>
- <% @module.each do |m| %>
- <%= link_to m.name, m %>
- | <%= (m.valid?) ? "Gültig" : "Problemfall" %>
- <% end %>
-
-
-
-
-
LVas <%= link_to "new", new_lva_path %>
- <% @lvas.each do |lva| %>
- <%= link_to lva.name, lva %> |
- <%= (lva.valid?) ? "Gültig" : "Problemfall" %>
-
- <% end %>
-
-
-
-
-
Beispiele <%= link_to "new", new_beispiel_path %>
- <% @beispiele.each do |b| %>
- <%= link_to b.name, b %>
- <% end %>
-
-
-
-
+
+
Lvas
+
+
+ <% @lvas.each do |lva| %>
+ <%= link_to lva.name, lva %> |
+ <%= (lva.valid?) ? "Gültig" : "Problemfall" %>
+
+ <% end %>
+
+
+
+
+
+
+
-
+
Error Log
- Red: Error, Solve immediately
@@ -71,12 +126,38 @@
- <% @messages.flatten.each do |m| %>
- - <%= m.html_safe %>
+ <% @messages.flatten.each do |m| %>
+ <% if !m.strip.empty? %>
+ - <%= m.html_safe %>
+ <% end %>
<% end %>
<%= I18n.t("verwalten.fehler.keine").html_safe if @messages.empty?%>
+
Beispiele
+
+
+
+ <% @beispiele.each do |b| %>
+ <%= link_to b.name, b %>
+ <% end %>
+
+
+
From a6b4501d2d40b38a42fce74988cc6c68b4efb371 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Fri, 9 Aug 2013 18:49:56 +0200
Subject: [PATCH 22/53] Form designs
Conflicts:
app/assets/stylesheets/formtastic-changes.css.scss
---
.../stylesheets/formtastic-changes.css.scss | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 app/assets/stylesheets/formtastic-changes.css.scss
diff --git a/app/assets/stylesheets/formtastic-changes.css.scss b/app/assets/stylesheets/formtastic-changes.css.scss
new file mode 100644
index 0000000..192ee43
--- /dev/null
+++ b/app/assets/stylesheets/formtastic-changes.css.scss
@@ -0,0 +1,20 @@
+form.formtastic .stringish input {
+width:90%;
+}
+form.formtastic textarea {
+width:90%;
+height:20em;
+}
+
+
+div.form-group {
+border-width: 1px;
+border-style: none;
+padding: 10px;
+// border-radius: 10px;
+}
+div.verwalten-block {
+border-width: 1px;
+border-style: solid;
+padding: 5px;
+}
\ No newline at end of file
From 5f7bad1004544f748e13c436ccbad2a90829d3b0 Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Sat, 10 Aug 2013 14:27:15 +0200
Subject: [PATCH 23/53] Date-String Input angelegt
---
app/inputs/date_string_input.rb | 6 ++++++
app/views/calentries/_form.html.erb | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
create mode 100644 app/inputs/date_string_input.rb
diff --git a/app/inputs/date_string_input.rb b/app/inputs/date_string_input.rb
new file mode 100644
index 0000000..d10e2c9
--- /dev/null
+++ b/app/inputs/date_string_input.rb
@@ -0,0 +1,6 @@
+class DateStringInput < FormtasticBootstrap::Inputs::StringInput
+ def input_html_options
+ super.merge(:class => "datetext", :onclick =>"beep", :value=>I18n.l(@object.send(method.to_sym)))
+ end
+
+end
diff --git a/app/views/calentries/_form.html.erb b/app/views/calentries/_form.html.erb
index 6dd64ad..5306d58 100644
--- a/app/views/calentries/_form.html.erb
+++ b/app/views/calentries/_form.html.erb
@@ -1,6 +1,6 @@
<%= semantic_form_for @calentry do |f| %>
<%= f.inputs do %>
- <%= f.input :start %>
+ <%= f.input :start , :as => :date_string %>
<%= f.input :ende %>
<%= f.input :summary %>
<%= f.input :calendar, :as=> :radio %>
From c31c530e626ad2c602ad32cbce18aedb12844cbd Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Sat, 10 Aug 2013 14:28:17 +0200
Subject: [PATCH 24/53] Datumsformat - Time.short angepasst
---
config/locales/de.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 75fd73f..16f6956 100755
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -294,7 +294,7 @@ de:
time:
am: vormittags
formats:
- default: ! '%A, %d. %B %Y, %H:%M Uhr'
+ default: ! '%d.%m.%Y, %H:%M Uhr'
long: ! '%A, %d. %B %Y, %H:%M Uhr'
- short: ! '%d. %B, %H:%M Uhr'
+ short: ! '%d.%m.%Y, %H:%M Uhr'
pm: nachmittags
From 116446ff63d82a4fd3885cfef34912e5be701581 Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Sat, 10 Aug 2013 14:29:36 +0200
Subject: [PATCH 25/53] merge layout formular moduls & studien
---
app/views/moduls/_form.html.erb | 31 +++++++++++++++++++++++--------
app/views/studien/_form.html.erb | 29 ++++++++++++++++++++++-------
2 files changed, 45 insertions(+), 15 deletions(-)
diff --git a/app/views/moduls/_form.html.erb b/app/views/moduls/_form.html.erb
index fb6b68b..db03f9d 100755
--- a/app/views/moduls/_form.html.erb
+++ b/app/views/moduls/_form.html.erb
@@ -1,15 +1,30 @@
+
+ <%= semantic_form_for @modul do |f| %>
-<%= semantic_form_for @modul do |f| %>
<%= f.inputs do %>
- <% # f.input :modulgruppen,:as => :select, :collection => Hash[Modulgruppe.all.map{|m| [m.studium.name + " " + m.name,m.id]}] %>
- <%= f.input :modulgruppen %>
- <%= f.input :name ,:hint=>true%>
- <%= f.input :desc, :as=>:tinymce_text %>
- <%= f.input :depend %>
+
+
+ <%= f.input :name ,:hint=>true%>
+
+
+ <%= f.input :desc, :as=>:tinymce_text %>
+
+
+ <%= f.input :depend %>
+
+
+
+
+ <%= f.input :modulgruppen,:as => :check_boxes, :collection => Hash[Modulgruppe.all.map{|m| [m.studium.name + " " + m.name,m.id]}.sort] %>
+
+
+
<% end %>
<%= f.actions do %>
- <%= f.action :submit, :as => :input %>
+ <%= f.action :submit, :as => :input %>
<% end %>
-<% end %>
+
+ <% end %>
+
<%= tinymce %>
diff --git a/app/views/studien/_form.html.erb b/app/views/studien/_form.html.erb
index 471a8c3..0973ef5 100755
--- a/app/views/studien/_form.html.erb
+++ b/app/views/studien/_form.html.erb
@@ -1,13 +1,28 @@
+
<%= tinymce_assets %>
-<%= semantic_form_for @studium do |f| %>
+ <%= semantic_form_for @studium do |f| %>
+
<%= f.inputs do %>
- <%= f.input :zahl %>
- <%= f.input :name,:append=>"NAME" %>
+
+
+
+ <%= f.input :name,:append=>"NAME" %>
+
+
+ <%= f.input :zahl %>
+
+
+ <%= f.input :typ, :as=>:select, :include_blank=>false, :collection=>["Bachelor","Master"]%>
+
+
+
<%= f.input :desc, :as=>:tinymce_text %>
- <%= f.input :typ, :as=>:radio, :collection=>["Bachelor","Master"]%>
+
<% end %>
-<%= tinymce %>
+ <%= tinymce %>
<%= f.actions do %>
- <%= f.action :submit, :as => :input %>
+ <%= f.action :submit, :as => :input %>
<% end %>
-<% end %>
+
+ <% end %>
+
From 57a7e49a3452d07c2068adb3e69997568536aa90 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Sat, 10 Aug 2013 22:47:32 +0200
Subject: [PATCH 26/53] CSS changes
---
.../stylesheets/formtastic-changes.css.scss | 14 +---
app/assets/stylesheets/lvas.css.scss | 8 ++
app/assets/stylesheets/studien.css.scss | 15 ++++
app/views/lvas/_form.html.erb | 4 +-
app/views/lvas/_lva_semester.html.erb | 5 +-
app/views/studien/semesteransicht.html.erb | 6 +-
app/views/studien/verwalten.html.erb | 81 ++++++++++---------
7 files changed, 76 insertions(+), 57 deletions(-)
diff --git a/app/assets/stylesheets/formtastic-changes.css.scss b/app/assets/stylesheets/formtastic-changes.css.scss
index bd015db..35dfec3 100644
--- a/app/assets/stylesheets/formtastic-changes.css.scss
+++ b/app/assets/stylesheets/formtastic-changes.css.scss
@@ -6,16 +6,6 @@ width:90%;
height:20em;
}
-
-div.form-group {
-border-width: 1px;
-border-style: none;
-padding: 10px;
-// border-radius: 10px;
+form.formtastic .input label.control-label {
+font-weight:bold;
}
-div.verwalten-block {
-border-width: 1px;
-border-style: solid;
-padding: 5px;
-border-radius:10px;
-}
\ No newline at end of file
diff --git a/app/assets/stylesheets/lvas.css.scss b/app/assets/stylesheets/lvas.css.scss
index 797b72c..32979e8 100755
--- a/app/assets/stylesheets/lvas.css.scss
+++ b/app/assets/stylesheets/lvas.css.scss
@@ -1,3 +1,11 @@
// Place all the styles related to the lvas controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+
+div.lva-semester {
+border: solid;
+border-width: 1px;
+margin: 1px;
+padding: 5px;
+border-color: green;
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/studien.css.scss b/app/assets/stylesheets/studien.css.scss
index 7b5973a..5c788c2 100755
--- a/app/assets/stylesheets/studien.css.scss
+++ b/app/assets/stylesheets/studien.css.scss
@@ -1,3 +1,18 @@
// Place all the styles related to the studia controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+div.verwalten-block {
+border-width: 1px;
+border-style: solid;
+padding: 5px;
+border-radius:10px;
+margin: 2px;
+}
+div.studien-semester {
+border-width: 1px;
+border-style: solid;
+padding: 5px;
+border-radius:10px;
+border-color: blue;
+margin: 2px;
+}
diff --git a/app/views/lvas/_form.html.erb b/app/views/lvas/_form.html.erb
index 8692e8e..d43f386 100755
--- a/app/views/lvas/_form.html.erb
+++ b/app/views/lvas/_form.html.erb
@@ -28,13 +28,13 @@
BILD
- <%= f.input :modul,:label=>'Modul'.html_safe, :as=>:check_boxes%>
+ <%= f.input :modul, :as=>:check_boxes%>
- <%= f.input :semester, :label=>'Semester'.html_safe, :as=>:check_boxes%>
+ <%= f.input :semester, :as=>:check_boxes%>
<% end %>
diff --git a/app/views/lvas/_lva_semester.html.erb b/app/views/lvas/_lva_semester.html.erb
index a60029d..8e92fd7 100755
--- a/app/views/lvas/_lva_semester.html.erb
+++ b/app/views/lvas/_lva_semester.html.erb
@@ -1,10 +1,9 @@
-
+
<%= link_to lva.name, lva_path(lva)%>
Module: /<% lva.modul.each do |m| %> <%= link_to m.name + ' / ', modul_path(m) unless m.modulgruppen.map{|x| x.studium}.index(@studium).nil? && !@studium.nil? %><% end %>
<%="LVa-Nr " + lva.lvanr.to_s %>
<%= lva.ects %> ECTS / <%= lva.stunden %> Std <% " / " + lva.beispiele.count.to_s + " Beispiele"%>
<%= link_to "Edit", edit_lva_path(lva) %> | <%= link_to "Beispiel hinzufügen", new_beispiel_path(:lva_id=>lva.id) %>
-
-<% #toolbar_html(@toolbar_elements) %>
+
diff --git a/app/views/studien/semesteransicht.html.erb b/app/views/studien/semesteransicht.html.erb
index ee4d588..abf692a 100644
--- a/app/views/studien/semesteransicht.html.erb
+++ b/app/views/studien/semesteransicht.html.erb
@@ -11,16 +11,16 @@
<% @studium.semester.each do |sem| %>
-
+
<%= sem.name %>
- <% sem.lvas.each_slice(2) do |row| %>
+ <% sem.lvas.each_slice(4) do |row| %>
<% row.each do |l| %>
-
+
<%= render :partial=>'lvas/lva_semester', :locals =>{:lva => l}%>
<% end %>
diff --git a/app/views/studien/verwalten.html.erb b/app/views/studien/verwalten.html.erb
index f991b3f..a7b7d4b 100644
--- a/app/views/studien/verwalten.html.erb
+++ b/app/views/studien/verwalten.html.erb
@@ -5,7 +5,7 @@
<%= I18n.t("studien.verwaltung") %>
<%= link_to I18n.t("filter.reset"), studien_verwalten_path(:std_verw=>nil, :mg_verw=>nil, :m_verw=>nil, :lva_verw=>nil, :b_verw=>nil), :class=>"btn" %>
<%= I18n.t("filter.explanation").html_safe %>
-
Studien
+
Studien
|
@@ -24,15 +24,16 @@
<% end %>
- <%= link_to 'Neues Studium', new_studium_path, :class=>'btn'%>
+
+ <%= link_to 'Neues Studium', new_studium_path, :class=>'btn'%>
-
Modulgruppen
+
Modulgruppen
<% @modulgruppen.each do |mg| %>
<%= link_to mg.name, mg %> | <%= (mg.valid?) ? "Gültig" : "Problemfall" %>
@@ -50,14 +51,16 @@
- <%= link_to mg.name, studien_verwalten_path(:mg_verw=>mg)%>
<% end %>
- <%= link_to "Neue Modulgruppe", new_studium_modulgruppe_path(Studium.first), :class=>"btn" unless Studium.first.nil?%>
-
+
+
+ <%= link_to "Neue Modulgruppe", new_studium_modulgruppe_path(Studium.first), :class=>"btn" unless Studium.first.nil?%>
+
-
Module
+
Module
@@ -78,14 +81,14 @@
- <%= link_to m.name, studien_verwalten_path(:m_verw=>m)%>
<% end %>
- <%= link_to "Neues Modul", new_modul_path, :class=>"btn"%>
+
-
+ <%= link_to "Neues Modul", new_modul_path, :class=>"btn"%>
-
Lvas
+
Lvas
@@ -95,20 +98,22 @@
<% end %>
+ <%= link_to "Neue LVa", new_lva_path, :class=>'btn'%>
+
@@ -128,8 +133,8 @@
<% @messages.flatten.each do |m| %>
<% if !m.strip.empty? %>
- - <%= m.html_safe %>
- <% end %>
+ - <%= m.html_safe %>
+ <% end %>
<% end %>
<%= I18n.t("verwalten.fehler.keine").html_safe if @messages.empty?%>
@@ -141,21 +146,23 @@
<% @beispiele.each do |b| %>
<%= link_to b.name, b %>
<% end %>
-
From 8229570ec7d5bab339ba1059a45f3b0209b96686 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Sun, 11 Aug 2013 00:34:49 +0200
Subject: [PATCH 27/53] =?UTF-8?q?css=20=C3=A4nderungen?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/assets/stylesheets/formtastic-changes.css.scss | 1 +
app/assets/stylesheets/lvas.css.scss | 1 +
2 files changed, 2 insertions(+)
diff --git a/app/assets/stylesheets/formtastic-changes.css.scss b/app/assets/stylesheets/formtastic-changes.css.scss
index 35dfec3..ea322e8 100644
--- a/app/assets/stylesheets/formtastic-changes.css.scss
+++ b/app/assets/stylesheets/formtastic-changes.css.scss
@@ -8,4 +8,5 @@ height:20em;
form.formtastic .input label.control-label {
font-weight:bold;
+font-size:125%;
}
diff --git a/app/assets/stylesheets/lvas.css.scss b/app/assets/stylesheets/lvas.css.scss
index 32979e8..54abac2 100755
--- a/app/assets/stylesheets/lvas.css.scss
+++ b/app/assets/stylesheets/lvas.css.scss
@@ -8,4 +8,5 @@ border-width: 1px;
margin: 1px;
padding: 5px;
border-color: green;
+border-radius: 5px;
}
\ No newline at end of file
From 1bddc125eb21b11651d0ec8e07ff1cdc3681c163 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Sun, 11 Aug 2013 00:35:23 +0200
Subject: [PATCH 28/53] =?UTF-8?q?Semesters=20edit=20=C3=BCberarbeitet?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/semesters_controller.rb | 3 ++-
app/views/semesters/_form.html.erb | 7 +++----
app/views/semesters/edit.html.erb | 7 ++-----
3 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/app/controllers/semesters_controller.rb b/app/controllers/semesters_controller.rb
index 751a4b7..8a527c4 100755
--- a/app/controllers/semesters_controller.rb
+++ b/app/controllers/semesters_controller.rb
@@ -16,6 +16,7 @@ class SemestersController < ApplicationController
def edit
@semester = Semester.find(params[:id])
+ @studium = @semester.studium
end
def create
@@ -33,7 +34,7 @@ class SemestersController < ApplicationController
def update
@semester = Semester.find(params[:id])
-
+ @studium= @semester.studium
respond_to do |format|
if @semester.update_attributes(params[:semester])
format.html { redirect_to @semester, notice: 'Semester was successfully updated.' }
diff --git a/app/views/semesters/_form.html.erb b/app/views/semesters/_form.html.erb
index 710e4ea..7ff4d18 100755
--- a/app/views/semesters/_form.html.erb
+++ b/app/views/semesters/_form.html.erb
@@ -1,12 +1,11 @@
<%= semantic_form_for @semester do |f| %>
<%= f.inputs do %>
- <%= f.input :name %>
- <%= f.input :nummer %>
- <%= f.input :ssws %>
- <%= f.input :lvas %>
+ <%= f.input :lvas, :as=>:check_boxes%>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>
+<%= link_to 'Zurück',@studium, :class=>"btn"%>
+x
diff --git a/app/views/semesters/edit.html.erb b/app/views/semesters/edit.html.erb
index 10925ec..bf39462 100755
--- a/app/views/semesters/edit.html.erb
+++ b/app/views/semesters/edit.html.erb
@@ -1,6 +1,3 @@
-Editing semester
+ <%=@semester.name%>
+ <%= render 'form' %>
-<%= render 'form' %>
-
-<%= link_to 'Show', @semester %> |
-<%= link_to 'Back', semesters_path %>
From 4da8b3a0b37b73392f6ff495acad986e8cf7e1f6 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Sun, 11 Aug 2013 00:36:09 +0200
Subject: [PATCH 29/53] =?UTF-8?q?Module=20k=C3=B6nnen=20Modulgruppen=20auc?=
=?UTF-8?q?h=20per=20form=20hinzugef=C3=BCgt=20werden?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/modulgruppe.rb | 2 +-
app/views/modulgruppen/_form.html.erb | 38 +++++++++++++++------------
2 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/app/models/modulgruppe.rb b/app/models/modulgruppe.rb
index dc3787b..236811c 100755
--- a/app/models/modulgruppe.rb
+++ b/app/models/modulgruppe.rb
@@ -13,7 +13,7 @@
#
class Modulgruppe < ActiveRecord::Base
- attr_accessible :name, :phase, :typ,:desc, :studium_id
+ attr_accessible :name, :phase, :typ,:desc, :studium_id, :modul_ids
belongs_to :studium, :foreign_key => "studium_id"
has_and_belongs_to_many :moduls
diff --git a/app/views/modulgruppen/_form.html.erb b/app/views/modulgruppen/_form.html.erb
index 22cc925..52a558e 100755
--- a/app/views/modulgruppen/_form.html.erb
+++ b/app/views/modulgruppen/_form.html.erb
@@ -1,25 +1,29 @@
<%= semantic_form_for @modulgruppe do |f| %>
- <%= f.inputs do %>
-
+<%= f.inputs do %>
+
-
- <%= f.input :name, :wrapper_html=>{:class=>"span12"}%>
-
- <%= f.input :studium_id, :as =>:select, :collection => Studium.all, :wrapper_html=>{:class=>"span4"} %>
- <%= f.input :typ, :collection=>["Pflicht","Vertiefungspflicht","Wahl"], :wrapper_html=>{:class=>"span4"}%>
- <%= f.input :phase, :as=>:select, :collection=>1..3, :wrapper_html=>{:class=>"span4"} %>
-
-
+
+ <%= f.input :name, :wrapper_html=>{:class=>"span12"}%>
+
+
+ <%= f.input :studium_id, :as =>:select, :collection => Studium.all, :wrapper_html=>{:class=>"span4"} %>
+ <%= f.input :typ, :collection=>["Pflicht","Vertiefungspflicht","Wahl"], :wrapper_html=>{:class=>"span4"}%>
+ <%= f.input :phase, :as=>:select, :collection=>1..3, :wrapper_html=>{:class=>"span4"} %>
+
-
- <%= f.input :desc %>
-
-
- <% end %>
+
+ <%= f.input :desc %>
+
- <%= f.actions do %>
- <%= f.action :submit, :as => :input %>
+
+
+ <%= f.input :moduls, :as=>:check_boxes %>
+
<% end %>
+<%= f.actions do %>
+<%= f.action :submit, :as => :input %>
+
+<% end %>
<% end %>
From cd14b0dd52dfa112eca10c028cc107eeaa9ef71f Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Sun, 11 Aug 2013 00:37:13 +0200
Subject: [PATCH 30/53] Layout kleinigkeiten
---
app/views/lvas/show.html.erb | 2 +-
app/views/modulgruppen/show.html.erb | 2 +-
app/views/moduls/show.html.erb | 6 ++----
app/views/studien/_form.html.erb | 6 +++---
4 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/app/views/lvas/show.html.erb b/app/views/lvas/show.html.erb
index ce41a44..b1e0e04 100755
--- a/app/views/lvas/show.html.erb
+++ b/app/views/lvas/show.html.erb
@@ -1,5 +1,5 @@
-<%= render 'layouts/topbar'%>
+<%= render 'studien/tabs'%>
<%= notice %>
diff --git a/app/views/modulgruppen/show.html.erb b/app/views/modulgruppen/show.html.erb
index b8a33b3..a127623 100755
--- a/app/views/modulgruppen/show.html.erb
+++ b/app/views/modulgruppen/show.html.erb
@@ -19,7 +19,7 @@
<% @modulgruppe.moduls.each do |modul| %>
-<%= render modul%>
+<%= render 'moduls/kurz', :modul=>modul%>
<% end %>
diff --git a/app/views/moduls/show.html.erb b/app/views/moduls/show.html.erb
index 7e297e7..8253a6b 100755
--- a/app/views/moduls/show.html.erb
+++ b/app/views/moduls/show.html.erb
@@ -1,8 +1,6 @@
-<%= render 'layouts/topbar'%>
+
+<%= render 'studien/tabs'%>
<%= notice %>
<%= render @modul %>
<%= render 'layouts/pretty_toolbar' %>
-<% # link_to 'Add LVA', %>
-<% # link_to ''.html_safe+ I18n.t("common.edit") , edit_modul_path(@modul) %>
-<% # link_to "Loeschen", [@modul],:method=>:delete ,:data => {:confirm =>"Are you sure" } %>
diff --git a/app/views/studien/_form.html.erb b/app/views/studien/_form.html.erb
index 0973ef5..3aa4a64 100755
--- a/app/views/studien/_form.html.erb
+++ b/app/views/studien/_form.html.erb
@@ -1,9 +1,8 @@
<%= tinymce_assets %>
<%= semantic_form_for @studium do |f| %>
-
- <%= f.inputs do %>
+ <%= f.inputs do %>
<%= f.input :name,:append=>"NAME" %>
@@ -18,11 +17,12 @@
<%= f.input :desc, :as=>:tinymce_text %>
+
<% end %>
<%= tinymce %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
-
+
<% end %>
From 6408d04ea88f2a24e40150dd1787a273c11a1e34 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Sun, 11 Aug 2013 00:38:01 +0200
Subject: [PATCH 31/53] =?UTF-8?q?Modul-show=20=C3=BCberarbeitet?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/modulgruppen/_kurz.html.erb | 1 +
app/views/moduls/_modul.html.erb | 43 +++++++++++++--------------
2 files changed, 21 insertions(+), 23 deletions(-)
create mode 100644 app/views/modulgruppen/_kurz.html.erb
diff --git a/app/views/modulgruppen/_kurz.html.erb b/app/views/modulgruppen/_kurz.html.erb
new file mode 100644
index 0000000..610f838
--- /dev/null
+++ b/app/views/modulgruppen/_kurz.html.erb
@@ -0,0 +1 @@
+<%=link_to modulgruppe.name, modulgruppe %> <%= ' ( ' + modulgruppe.studium.name + ')' unless modulgruppe.studium.nil? %>
diff --git a/app/views/moduls/_modul.html.erb b/app/views/moduls/_modul.html.erb
index eca542f..78ff8dc 100755
--- a/app/views/moduls/_modul.html.erb
+++ b/app/views/moduls/_modul.html.erb
@@ -1,26 +1,23 @@
-
- <%=
-if modul.name.nil?
-name=""
-else
-name=modul.name
-end
-link_to "Modul "+name , modul_path(modul) %>
-
+
+
<%=@modul.name %>
+
+
+
Beschreibung
- <%= raw(modul.desc) %>
+ <%= raw(@modul.desc) %>
-LVAs:
-
-
-
-<% modul.lvas.each do |lv| %>
--
-<%= link_to lv.name.to_s, lva_path(lv.id) %>
-
-<% end %>
-
-
-
-<% # @toolbar_elements << {:icon=>:pencil,:text=>I18n.t("common.edit"),:path=> edit_modul_path(modul)} %>
+
Lvas
+<% @modul.lvas.each_slice(3) do |row| %>
+
+<% row.each do |lv| %>
+
+<%= render 'lvas/lva_semester', :lva=>lv%>
+<% end %>
+
+
+<% end %>
+
Modulgruppen
+<% @modul.modulgruppen.each do |mg| %>
+<%= render 'modulgruppen/kurz', :modulgruppe=>mg %>
+<% end %>
From 661783bcd1e8841a246b65699ed7681c9184f11a Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Sun, 11 Aug 2013 00:38:24 +0200
Subject: [PATCH 32/53] =?UTF-8?q?Aus=20semesteransicht=20per=20link=20lvas?=
=?UTF-8?q?=20zu=20semester=20hinzuf=C3=BCgen=20/entfernen?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/studien/semesteransicht.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/studien/semesteransicht.html.erb b/app/views/studien/semesteransicht.html.erb
index abf692a..ca302e7 100644
--- a/app/views/studien/semesteransicht.html.erb
+++ b/app/views/studien/semesteransicht.html.erb
@@ -14,7 +14,7 @@
-
<%= sem.name %>
+
<%= sem.name %> <%= link_to 'Lvas hinzufügen/entfernen', edit_semester_path(sem)%>
<% sem.lvas.each_slice(4) do |row| %>
From a5a02e065a319d162c5a280605c2c0d3c15643ca Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Sun, 11 Aug 2013 01:17:37 +0200
Subject: [PATCH 33/53] =?UTF-8?q?Calendar=20Klasse=20=C3=BCberarbeitet=20V?=
=?UTF-8?q?iews,gefixt,=20Pictures=20hinzugef=C3=BCgt?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Gemfile | 5 +-
app/assets/stylesheets/application.css.scss | 2 +-
app/controllers/calendars_controller.rb | 2 +-
app/inputs/date_string_input.rb | 3 +-
app/models/calendar.rb | 3 +-
app/models/calentry.rb | 9 ++-
app/uploaders/picture_uploader.rb | 51 ++++++++++++++
app/views/calendars/_form.html.erb | 1 +
app/views/calendars/index.html.erb | 27 +++-----
app/views/calendars/show.html.erb | 40 ++++++-----
app/views/calendars/show.ics.erb | 3 +
app/views/calentries/_calentry.ics.erb | 5 ++
app/views/calentries/_form.html.erb | 27 +++++++-
app/views/calentries/show.html.erb | 36 +++++-----
...20130810214456_add_picture_to_calendars.rb | 5 ++
db/schema.rb | 69 ++++++++++++++++++-
spec/models/calentry_spec.rb | 17 ++++-
17 files changed, 238 insertions(+), 67 deletions(-)
create mode 100644 app/uploaders/picture_uploader.rb
create mode 100644 app/views/calendars/show.ics.erb
create mode 100644 app/views/calentries/_calentry.ics.erb
create mode 100644 db/migrate/20130810214456_add_picture_to_calendars.rb
diff --git a/Gemfile b/Gemfile
index d81643d..1fdf2bd 100755
--- a/Gemfile
+++ b/Gemfile
@@ -12,9 +12,9 @@ gem 'rails', '3.2.9'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
- gem 'sass-rails', '~> 3.2.3'
+ gem 'sass-rails', '~> 3.2'
gem 'coffee-rails', '~> 3.2.1'
- gem 'bootstrap-sass','~> 2.2.0'
+ gem 'bootstrap-sass','~> 2.3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
@@ -77,3 +77,4 @@ gem 'rspec-rails'
end
gem "simple_calendar", "~> 0.1.9"
+gem 'rmagick'
diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss
index 71eebc4..ecbb13d 100755
--- a/app/assets/stylesheets/application.css.scss
+++ b/app/assets/stylesheets/application.css.scss
@@ -10,7 +10,7 @@
*
*= require_self
*= require_tree .
- * require 'bootstrap'
+ *= require 'bootstrap'
*/
$linkColor: #03006E;
@import 'bootstrap';
diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb
index b3631aa..059a7f0 100644
--- a/app/controllers/calendars_controller.rb
+++ b/app/controllers/calendars_controller.rb
@@ -3,7 +3,6 @@ class CalendarsController < ApplicationController
# GET /calendars.json
def index
@calendars = Calendar.all
-
respond_to do |format|
format.html # index.html.erb
format.json { render json: @calendars }
@@ -18,6 +17,7 @@ class CalendarsController < ApplicationController
respond_to do |format|
format.html # show.html.erb
format.json { render json: @calendar }
+ format.ics { render 'show.ics.erb'}
end
end
diff --git a/app/inputs/date_string_input.rb b/app/inputs/date_string_input.rb
index d10e2c9..a70ab33 100644
--- a/app/inputs/date_string_input.rb
+++ b/app/inputs/date_string_input.rb
@@ -1,6 +1,7 @@
class DateStringInput < FormtasticBootstrap::Inputs::StringInput
def input_html_options
- super.merge(:class => "datetext", :onclick =>"beep", :value=>I18n.l(@object.send(method.to_sym)))
+ value = (@object.send(method.to_sym))
+ super.merge(:class => "datetext", :onclick =>"beep", :value=>I18n.l((value.is_a?(Time)||value.is_a?(Date)||value.is_a?(DateTime)) ? value : Time.now))
end
end
diff --git a/app/models/calendar.rb b/app/models/calendar.rb
index eaaa1a9..4f5de1d 100644
--- a/app/models/calendar.rb
+++ b/app/models/calendar.rb
@@ -1,4 +1,5 @@
class Calendar < ActiveRecord::Base
- attr_accessible :name, :public
+ attr_accessible :name, :public, :picture
has_and_belongs_to_many :calentries
+ mount_uploader :picture, PictureUploader
end
diff --git a/app/models/calentry.rb b/app/models/calentry.rb
index 7d7ded6..d6cf59e 100644
--- a/app/models/calentry.rb
+++ b/app/models/calentry.rb
@@ -1,6 +1,13 @@
class Calentry < ActiveRecord::Base
attr_accessible :ende, :start, :summary, :typ,:calendar_ids
- has_and_belongs_to_many :calendar
+ has_and_belongs_to_many :calendars
+ validates :start, :presence => true
+ validates :typ, :presence => true
+ validate do |entry|
+ if entry.ende.nil?
+ errors.add(:ende, "Es muss ein Endzeitpunkt vorhanden sein")
+ end
+ end
def start_time
start
end
diff --git a/app/uploaders/picture_uploader.rb b/app/uploaders/picture_uploader.rb
new file mode 100644
index 0000000..ec0f27a
--- /dev/null
+++ b/app/uploaders/picture_uploader.rb
@@ -0,0 +1,51 @@
+# encoding: utf-8
+
+class PictureUploader < CarrierWave::Uploader::Base
+
+ # Include RMagick or MiniMagick support:
+ include CarrierWave::RMagick
+ # include CarrierWave::MiniMagick
+
+ # Choose what kind of storage to use for this uploader:
+ storage :file
+ # storage :fog
+
+ # Override the directory where uploaded files will be stored.
+ # This is a sensible default for uploaders that are meant to be mounted:
+ def store_dir
+ "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
+ end
+
+ # Provide a default URL as a default if there hasn't been a file uploaded:
+ # def default_url
+ # # For Rails 3.1+ asset pipeline compatibility:
+ # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
+ #
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
+ # end
+
+ # Process files as they are uploaded:
+ # process :scale => [200, 300]
+ #
+ # def scale(width, height)
+ # # do something
+ # end
+
+ # Create different versions of your uploaded files:
+ version :thumb do
+ process :resize_to_fill => [64, 64]
+ end
+
+ # Add a white list of extensions which are allowed to be uploaded.
+ # For images you might use something like this:
+ def extension_white_list
+ %w(jpg jpeg gif png)
+ end
+
+ # Override the filename of the uploaded files:
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
+ # def filename
+ # "something.jpg" if original_filename
+ # end
+
+end
diff --git a/app/views/calendars/_form.html.erb b/app/views/calendars/_form.html.erb
index dc6e021..139e9d8 100644
--- a/app/views/calendars/_form.html.erb
+++ b/app/views/calendars/_form.html.erb
@@ -2,6 +2,7 @@
<%= f.inputs do %>
<%= f.input :name %>
<%= f.input :public %>
+ <%= f.input :picture, :as => :file %>
<% end %>
<%= f.actions do %>
diff --git a/app/views/calendars/index.html.erb b/app/views/calendars/index.html.erb
index 402c093..8d6c591 100644
--- a/app/views/calendars/index.html.erb
+++ b/app/views/calendars/index.html.erb
@@ -1,25 +1,14 @@
Listing calendars
-
-
- | Name |
- Public |
- |
- |
- |
-
-
<% @calendars.each do |calendar| %>
-
- | <%= calendar.name %> |
- <%= calendar.public %> |
- <%= link_to 'Show', calendar %> |
- <%= link_to 'Edit', edit_calendar_path(calendar) %> |
- <%= link_to 'Destroy', calendar, method: :delete, data: { confirm: 'Are you sure?' } %> |
-
+
<% end %>
-
-
-
<%= link_to 'New Calendar', new_calendar_path %>
diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb
index 8778ca8..0c7e038 100644
--- a/app/views/calendars/show.html.erb
+++ b/app/views/calendars/show.html.erb
@@ -1,24 +1,30 @@
+
+
<%= notice %>
-
- Name:
- <%= @calendar.name %>
-
-
-
- Public:
- <%= @calendar.public %>
-
-
-
+
+ <%= ''.html_safe unless !@calendar.public%>
+ <%= @calendar.name %>
+
+
+
<% @calendar.calentries.each do |entry| %>
-<%= entry.summary+ "- " + entry.start.to_s %>
+-
+<%= link_to entry.summary+ " - " + I18n.l(entry.start), entry %>
+
<% end %>
-
+
+
+
<%= calendar @calendar.calentries do |entry| %>
<%= link_to entry.name, entry %>
<% end %>
-
-<%= link_to 'New Entry', new_calentry_path %>
-<%= link_to 'Edit', edit_calendar_path(@calendar) %> |
-<%= link_to 'Back', calendars_path %>
+
+
+
+<%= link_to 'New Entry', new_calentry_path, {:class=>"btn"} %>
+<%= link_to 'Edit', edit_calendar_path(@calendar), {:class=>"btn"} %>
+<%= link_to 'Back', calendars_path, {:class=>"btn"} %>
+
+
+
diff --git a/app/views/calendars/show.ics.erb b/app/views/calendars/show.ics.erb
new file mode 100644
index 0000000..8d3126f
--- /dev/null
+++ b/app/views/calendars/show.ics.erb
@@ -0,0 +1,3 @@
+<% @calendar.calentries.each do |entry| %>
+<%= render entry %>
+<% end %>
diff --git a/app/views/calentries/_calentry.ics.erb b/app/views/calentries/_calentry.ics.erb
new file mode 100644
index 0000000..dead832
--- /dev/null
+++ b/app/views/calentries/_calentry.ics.erb
@@ -0,0 +1,5 @@
+ <%= calentry.start %>
+ <%= calentry.ende %>
+ <%= calentry.summary %>
+ <%= calentry.typ %>
+
diff --git a/app/views/calentries/_form.html.erb b/app/views/calentries/_form.html.erb
index 5306d58..eb9bb02 100644
--- a/app/views/calentries/_form.html.erb
+++ b/app/views/calentries/_form.html.erb
@@ -1,13 +1,34 @@
+
<%= semantic_form_for @calentry do |f| %>
<%= f.inputs do %>
+
+
<%= f.input :start , :as => :date_string %>
- <%= f.input :ende %>
+
+
+ <%= f.input :ende , :as => :date_string %>
+
+
+
+
<%= f.input :summary %>
- <%= f.input :calendar, :as=> :radio %>
+
+
+
+
+ <%= f.input :calendars, :as=> :radio %>
+
+
<%= f.input :typ %>
+
+
<% end %>
-
+
+
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
+
+
<% end %>
+
diff --git a/app/views/calentries/show.html.erb b/app/views/calentries/show.html.erb
index 908d8dc..faa5c9c 100644
--- a/app/views/calentries/show.html.erb
+++ b/app/views/calentries/show.html.erb
@@ -1,25 +1,25 @@
<%= notice %>
-
-
- Start:
- <%= @calentry.start %>
-
-
-
- Ende:
- <%= @calentry.ende %>
-
-
-
- Summary:
+
+
+
+
<%= @calentry.summary %>
-
+
-
- Typ:
+
+
+
+
+ <%= I18n.l @calentry.start %>
+ <%= " bis " unless @calentry.ende.nil? %>
+ <%= I18n.l @calentry.ende %>
+
+
<%= @calentry.typ %>
-
-
+
+
+
<%= link_to 'Edit', edit_calentry_path(@calentry) %> |
<%= link_to 'Back', calentries_path %>
+
diff --git a/db/migrate/20130810214456_add_picture_to_calendars.rb b/db/migrate/20130810214456_add_picture_to_calendars.rb
new file mode 100644
index 0000000..d1b4b44
--- /dev/null
+++ b/db/migrate/20130810214456_add_picture_to_calendars.rb
@@ -0,0 +1,5 @@
+class AddPictureToCalendars < ActiveRecord::Migration
+ def change
+ add_column :calendars, :picture, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 6a96d37..b8d0781 100755
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,23 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130729085446) do
+ActiveRecord::Schema.define(:version => 20130810214456) do
+
+ create_table "attachments", :force => true do |t|
+ t.string "name"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "beispiel_translations", :force => true do |t|
+ t.string "locale"
+ t.text "desc"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "beispiele_id"
+ end
+
+ add_index "beispiel_translations", ["locale"], :name => "index_beispiel_translations_on_locale"
create_table "beispiele", :force => true do |t|
t.string "name"
@@ -22,6 +38,38 @@ ActiveRecord::Schema.define(:version => 20130729085446) do
t.string "beispieldatei"
end
+ create_table "calendars", :force => true do |t|
+ t.string "name"
+ t.boolean "public"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "picture"
+ end
+
+ create_table "calendars_calentries", :id => false, :force => true do |t|
+ t.integer "calentry_id"
+ t.integer "calendar_id"
+ end
+
+ add_index "calendars_calentries", ["calendar_id"], :name => "index_calendars_calentries_on_calendar_id"
+ add_index "calendars_calentries", ["calentry_id", "calendar_id"], :name => "index_calendars_calentries_on_calentry_id_and_calendar_id"
+
+ create_table "calentries", :force => true do |t|
+ t.datetime "start"
+ t.datetime "ende"
+ t.string "summary"
+ t.integer "typ"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "fragen", :force => true do |t|
+ t.string "title"
+ t.text "text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "lva_translations", :force => true do |t|
t.integer "lva_id"
t.string "locale"
@@ -50,11 +98,14 @@ ActiveRecord::Schema.define(:version => 20130729085446) do
t.integer "modul_id"
end
- create_table "lvas_semesters", :force => true do |t|
+ create_table "lvas_semesters", :id => false, :force => true do |t|
t.integer "lva_id"
t.integer "semester_id"
end
+ add_index "lvas_semesters", ["lva_id", "semester_id"], :name => "index_lvas_semesters_on_lva_id_and_semester_id"
+ add_index "lvas_semesters", ["semester_id"], :name => "index_lvas_semesters_on_semester_id"
+
create_table "modul_translations", :force => true do |t|
t.integer "modul_id"
t.string "locale"
@@ -161,6 +212,20 @@ ActiveRecord::Schema.define(:version => 20130729085446) do
add_index "studium_translations", ["locale"], :name => "index_studium_translations_on_locale"
+ create_table "themen", :force => true do |t|
+ t.string "title"
+ t.text "text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "themengruppen", :force => true do |t|
+ t.string "title"
+ t.text "text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
diff --git a/spec/models/calentry_spec.rb b/spec/models/calentry_spec.rb
index 0e3a169..02e654e 100644
--- a/spec/models/calentry_spec.rb
+++ b/spec/models/calentry_spec.rb
@@ -1,5 +1,20 @@
require 'spec_helper'
describe Calentry do
- pending "add some examples to (or delete) #{__FILE__}"
+ it "should be valid with full data" do
+ e = FactoryGirl.build(:calentry)
+ c = FactoryGirl.create(:calendar)
+ e.calendars<
nil)
+ c=FactoryGirl.create(:calendar)
+ e.calendars<
Date: Sun, 11 Aug 2013 10:50:33 +0200
Subject: [PATCH 34/53] merge conflict behoben
---
Gemfile.lock | 11 +-
.../stylesheets/formtastic-changes.css.scss | 14 --
config/locales/de.yml | 9 +-
config/routes.rb | 121 +-----------------
4 files changed, 16 insertions(+), 139 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 2f98cfb..ff6d52b 100755
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -35,7 +35,7 @@ GEM
activerecord (>= 3.0.0)
bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-x86-mingw32)
- bootstrap-sass (2.2.2.0)
+ bootstrap-sass (2.3.2.1)
sass (~> 3.2)
builder (3.0.4)
cancan (1.6.9)
@@ -128,6 +128,7 @@ GEM
rdoc (3.12.1)
json (~> 1.4)
ref (1.0.2)
+ rmagick (2.13.2)
rolify (3.2.0)
rspec-core (2.14.4)
rspec-expectations (2.14.0)
@@ -145,6 +146,8 @@ GEM
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
+ simple_calendar (0.1.9)
+ rails (>= 3.0)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
@@ -176,7 +179,7 @@ PLATFORMS
DEPENDENCIES
annotate (>= 2.5.0)
awesome_nested_set
- bootstrap-sass (~> 2.2.0)
+ bootstrap-sass (~> 2.3.2.1)
cancan
carrierwave
coffee-rails (~> 3.2.1)
@@ -192,9 +195,11 @@ DEPENDENCIES
paper_trail (>= 2.7.0)
paperclip (~> 3.4.0)
rails (= 3.2.9)
+ rmagick
rolify
rspec-rails
- sass-rails (~> 3.2.3)
+ sass-rails (~> 3.2)
+ simple_calendar (~> 0.1.9)
sqlite3
therubyracer
tinymce-rails (>= 3.5.8)
diff --git a/app/assets/stylesheets/formtastic-changes.css.scss b/app/assets/stylesheets/formtastic-changes.css.scss
index 07c5dfe..233b45e 100644
--- a/app/assets/stylesheets/formtastic-changes.css.scss
+++ b/app/assets/stylesheets/formtastic-changes.css.scss
@@ -6,22 +6,8 @@ width:90%;
height:20em;
}
-<<<<<<< HEAD
form.formtastic .input label.control-label {
font-weight:bold;
font-size:125%;
}
-=======
-div.form-group {
-border-width: 1px;
-border-style: none;
-padding: 10px;
-// border-radius: 10px;
-}
-div.verwalten-block {
-border-width: 1px;
-border-style: solid;
-padding: 5px;
-}
->>>>>>> a5a02e065a319d162c5a280605c2c0d3c15643ca
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 0a24057..0b26e0f 100755
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -105,7 +105,6 @@ de:
blank: "Geben Sie den Namen des Studiums ein"
taken: "Der Name ist bereits vergeben"
typ:
-<<<<<<< HEAD
inclusion: 'Wählen Sie "Bachelor" oder "Master" aus'
modul:
attributes:
@@ -124,11 +123,7 @@ de:
keine: "Keine Fehlermeldungen oder Warnungen"
support:
array:
- two_words_connector: ', '
-
-=======
- inclusion: 'Wählen Sie "Bachelor" oder "Master" aus'
-
+ two_words_connector: ', '
date:
abbr_day_names:
- So
@@ -324,4 +319,4 @@ de:
long: ! '%A, %d. %B %Y, %H:%M Uhr'
short: ! '%d.%m.%Y, %H:%M Uhr'
pm: nachmittags
->>>>>>> a5a02e065a319d162c5a280605c2c0d3c15643ca
+
diff --git a/config/routes.rb b/config/routes.rb
index 46911fd..db295a4 100755
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,10 @@
-<<<<<<< HEAD
Fetsite::Application.routes.draw do
-
+
+ resources :calendars
+
+
+ resources :calentries
+
devise_for :users
resources :home, :only=>[:index]
#get 'home',:controller=>home,:action=>:index,:as=>"home_index"
@@ -107,116 +111,3 @@
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id))(.:format)'
end
-=======
-Fetsite::Application.routes.draw do
-
- resources :calendars
-
-
- resources :calentries
-
-
- devise_for :users
- resources :home, :only=>[:index]
- #get 'home',:controller=>home,:action=>:index,:as=>"home_index"
- scope '(:locale)/admin' do
- resources :users
- get 'config',:controller=>:config,:action=>:index , :as => 'config'
- get 'config/get_git_update',:controller=>:config,:action=>:get_git_update, :as=>'config_getgitupdate'
- get 'config/get_git_update',:controller=>:config,:action=>:get_git_update
- end
-
- devise_for :users
-
- resources :pages, :except => [:index] do
- member do
- post 'preview'
- end
- end
- get 'pages', :to =>'pages#show'
- scope '(:locale)' do
-
- resources :studien, :only=>[:show,:new,:edit,:update,:destroy]
- resources :modulgruppen,:only =>[:create,:index]
-
- resources :studien,:except=>[:show,:new,:edit,:update,:destroy], :shallow=>true do
- resources :modulgruppen, :path => "(:locale)/modulgruppen"
-
- end
- get 'studien/:id/semesteransicht', :controller=>:studien, :action=>:semesteransicht, :as=>'studium_semesteransicht'
- resources :semesters
- resources :moduls
- resources :lvas
- resources :neuigkeiten
- get 'rubriken/verwalten', :controller=>:rubriken, :action=>:alle_verwalten, :as=>'alle_verwalten_rubrik'
-
- resources :rubriken do
- resources :neuigkeiten, :only=>[:new, :show]
- end
- put 'rubriken/(:id)/addmoderator',:controller=>:rubriken,:action=>:addmoderator
- get 'rubriken/:id/verwalten',:controller=>:rubriken,:action=>:verwalten, :as=>'verwalten_rubrik'
- resources :home, :only=>[:index]
- get 'home/dev', :controller=>:home, :action=>:dev, :as=>'home_dev'
- resources :beispiele
-
- end
-
- # The priority is based upon order of creation:
- # first created -> highest priority.
-
- # Sample of regular route:
- # match 'products/:id' => 'catalog#view'
- # Keep in mind you can assign values other than :controller and :action
-
- # Sample of named route:
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
- # This route can be invoked with purchase_url(:id => product.id)
-
- # Sample resource route (maps HTTP verbs to controller actions automatically):
- # resources :products
-
- # Sample resource route with options:
- # resources :products do
- # member do
- # get 'short'
- # post 'toggle'
- # end
- #
- # collection do
- # get 'sold'
- # end
- # end
-
- # Sample resource route with sub-resources:
- # resources :products do
- # resources :comments, :sales
- # resource :seller
- # end
-
- # Sample resource route with more complex sub-resources
- # resources :products do
- # resources :comments
- # resources :sales do
- # get 'recent', :on => :collection
- # end
- # end
-
- # Sample resource route within a namespace:
- # namespace :admin do
- # # Directs /admin/products/* to Admin::ProductsController
- # # (app/controllers/admin/products_controller.rb)
- # resources :products
- # end
-
- # You can have the root of your site routed with "root"
- # just remember to delete public/index.html.
-
- root :to => 'home#index'
-
- # See how all your routes lay out with "rake routes"
-
- # This is a legacy wild controller route that's not recommended for RESTful applications.
- # Note: This route will make all actions in every controller accessible via GET requests.
- # match ':controller(/:action(/:id))(.:format)'
-end
->>>>>>> a5a02e065a319d162c5a280605c2c0d3c15643ca
From eefd3d9a76e703ed613b196e6ac91a376a19f438 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Sun, 11 Aug 2013 11:09:03 +0200
Subject: [PATCH 35/53] schema
---
db/schema.rb | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 89 insertions(+), 1 deletion(-)
diff --git a/db/schema.rb b/db/schema.rb
index 6a96d37..4dbfdf9 100755
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,14 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130729085446) do
+ActiveRecord::Schema.define(:version => 20130810214456) do
+
+ create_table "attachments", :force => true do |t|
+ t.string "name"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "thema_id"
+ end
create_table "beispiele", :force => true do |t|
t.string "name"
@@ -22,6 +29,50 @@ ActiveRecord::Schema.define(:version => 20130729085446) do
t.string "beispieldatei"
end
+ create_table "calendars", :force => true do |t|
+ t.string "name"
+ t.boolean "public"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "picture"
+ end
+
+ create_table "calendars_calentries", :id => false, :force => true do |t|
+ t.integer "calentry_id"
+ t.integer "calendar_id"
+ end
+
+ add_index "calendars_calentries", ["calendar_id"], :name => "index_calendars_calentries_on_calendar_id"
+ add_index "calendars_calentries", ["calentry_id", "calendar_id"], :name => "index_calendars_calentries_on_calentry_id_and_calendar_id"
+
+ create_table "calentries", :force => true do |t|
+ t.datetime "start"
+ t.datetime "ende"
+ t.string "summary"
+ t.integer "typ"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "frage_translations", :force => true do |t|
+ t.string "locale"
+ t.string "title"
+ t.text "text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "fragen_id"
+ end
+
+ add_index "frage_translations", ["locale"], :name => "index_frage_translations_on_locale"
+
+ create_table "fragen", :force => true do |t|
+ t.string "title"
+ t.text "text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "thema_id"
+ end
+
create_table "lva_translations", :force => true do |t|
t.integer "lva_id"
t.string "locale"
@@ -161,6 +212,43 @@ ActiveRecord::Schema.define(:version => 20130729085446) do
add_index "studium_translations", ["locale"], :name => "index_studium_translations_on_locale"
+ create_table "thema_translations", :force => true do |t|
+ t.string "locale"
+ t.string "title"
+ t.text "text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "themen_id"
+ end
+
+ add_index "thema_translations", ["locale"], :name => "index_thema_translations_on_locale"
+
+ create_table "themen", :force => true do |t|
+ t.string "title"
+ t.text "text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "themengruppe_id"
+ end
+
+ create_table "themengruppe_translations", :force => true do |t|
+ t.string "locale"
+ t.string "title"
+ t.text "text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "themengruppen_id"
+ end
+
+ add_index "themengruppe_translations", ["locale"], :name => "index_themengruppe_translations_on_locale"
+
+ create_table "themengruppen", :force => true do |t|
+ t.string "title"
+ t.text "text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
From 4f95770fa7e33354440c875119a3838ab4788fa3 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Sun, 11 Aug 2013 11:27:37 +0200
Subject: [PATCH 36/53] =?UTF-8?q?Lva-show=20=C3=BCberarbeitet?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/lvas_controller.rb | 8 -----
app/views/lvas/show.html.erb | 53 ++++++++++++++++++------------
2 files changed, 32 insertions(+), 29 deletions(-)
diff --git a/app/controllers/lvas_controller.rb b/app/controllers/lvas_controller.rb
index 7b737dd..d2ee71f 100755
--- a/app/controllers/lvas_controller.rb
+++ b/app/controllers/lvas_controller.rb
@@ -16,14 +16,6 @@ class LvasController < ApplicationController
@toolbar_elements<<{:hicon=>'icon-plus-sign', :icon=>:plus, :text => "Neues Beispiel", :path=> new_beispiel_path(:lva_id =>@lva.id)}
@toolbar_elements<<{:hicon=>'icon-pencil', :icon=>:pencil,:text =>I18n.t('common.edit'),:path => edit_lva_path(@lva)}
- @topbar_elements =[{:hicon=>'icon-list', :text=>I18n.t("lva.list"), :path=>lvas_path}]
- for m in @lva.modul
- @topbar_elements << {:newline=>true}
- @topbar_elements << {:text=> '' + m.name + '', :path=>modul_path(m)}
- for mg in m.modulgruppen
- @topbar_elements << {:text => mg.studium.name + ' (' + mg.name + ')', :path=>studium_path(mg.studium)}
- end
- end
end
# GET /lvas/new
diff --git a/app/views/lvas/show.html.erb b/app/views/lvas/show.html.erb
index b1e0e04..9f01de4 100755
--- a/app/views/lvas/show.html.erb
+++ b/app/views/lvas/show.html.erb
@@ -1,36 +1,47 @@
-<%= render 'studien/tabs'%>
-
<%= notice %>
-
+ <%= render 'studien/tabs'%>
+
<%= notice %>
-
<%= @lva.lvanr %><%= @lva.name %> <%= @lva.ects %> ECTS/ <%= @lva.stunden %> Std
-
-
-
-
Beschreibung
- <%= @lva.desc %>
-
-
Beispiele
+
+
<%= @lva.name %>
+
+
Beschreibung
+
+ <%= @lva.desc %>
+
+
+
Beispiele
<% @lva.beispiele.each do |b|%>
-
+
<%= render b%>
-
+
<% end %>
-
Module
-
- <% @lva.modul.each do |modul| %>
+
+
+
+ - LVA-Nummer: <%=@lva.lvanr %>
+ - ECTS: <%=@lva.ects %>
+ - Stunden: <%=@lva.ects %>
+
+
Module
+
+ <% @lva.modul.each do |modul| %>
- <%= link_to modul.name , modul_path(modul)%>
-
- <% modul.modulgruppen.each do |g| %>
+
+ <% modul.modulgruppen.each do |g| %>
- <%= link_to g.studium.name , studium_path(g.studium)%> (<%=link_to g.name, modulgruppe_path(g)%>)
- <% end %>
+ <% end %>
- <% end %>
-
+ <% end %>
+
+
+
+
+
<%= render 'layouts/pretty_toolbar' %>
From 90b8aff78decf1d779a899933f83305051b9392d Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Sun, 11 Aug 2013 11:34:20 +0200
Subject: [PATCH 37/53] lva view tweaks
---
app/assets/stylesheets/lvas.css.scss | 15 ++++++
app/views/beispiele/_beispiel.html.erb | 2 +-
app/views/lvas/show.html.erb | 69 +++++++++++++-------------
3 files changed, 51 insertions(+), 35 deletions(-)
diff --git a/app/assets/stylesheets/lvas.css.scss b/app/assets/stylesheets/lvas.css.scss
index 54abac2..9084fc3 100755
--- a/app/assets/stylesheets/lvas.css.scss
+++ b/app/assets/stylesheets/lvas.css.scss
@@ -9,4 +9,19 @@ margin: 1px;
padding: 5px;
border-color: green;
border-radius: 5px;
+}
+div.lva-sidebar {
+border:solid;
+border-width: 1px;
+margin: 2px;
+padding:5px;
+border-radius:5px;
+}
+div.lva-beispiele {
+border:solid;
+border-width: 1px;
+margin: 2px;
+padding:5px;
+border-radius:5px;
+border-color: green;
}
\ No newline at end of file
diff --git a/app/views/beispiele/_beispiel.html.erb b/app/views/beispiele/_beispiel.html.erb
index 740e496..07c9cf9 100644
--- a/app/views/beispiele/_beispiel.html.erb
+++ b/app/views/beispiele/_beispiel.html.erb
@@ -1,4 +1,4 @@
-
+
<%=link_to beispiel.name, beispiel.beispieldatei.url%>
<%= beispiel.desc %>
diff --git a/app/views/lvas/show.html.erb b/app/views/lvas/show.html.erb
index 9f01de4..b2d9e89 100755
--- a/app/views/lvas/show.html.erb
+++ b/app/views/lvas/show.html.erb
@@ -6,42 +6,43 @@
<%= @lva.name %>
-
Beschreibung
-
- <%= @lva.desc %>
-
-
-
Beispiele
- <% @lva.beispiele.each do |b|%>
-
- <%= render b%>
-
- <% end %>
-
-
-
-
- - LVA-Nummer: <%=@lva.lvanr %>
- - ECTS: <%=@lva.ects %>
- - Stunden: <%=@lva.ects %>
-
-
Module
-
- <% @lva.modul.each do |modul| %>
- - <%= link_to modul.name , modul_path(modul)%>
-
- <% modul.modulgruppen.each do |g| %>
+ Beschreibung
+
+ <%= @lva.desc %>
+
+
+
Beispiele
- - <%= link_to g.studium.name , studium_path(g.studium)%> (<%=link_to g.name, modulgruppe_path(g)%>)
+ <% @lva.beispiele.each do |b|%>
+
+ <%= render b%>
<% end %>
-
-
-
- <% end %>
-
-
-
+
+
+
+
+
+
-<%= render 'layouts/pretty_toolbar' %>
+ <%= render 'layouts/pretty_toolbar' %>
From 0736320be6eb5b408b52099b9533e05299051544 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Sun, 11 Aug 2013 11:43:06 +0200
Subject: [PATCH 38/53] Semesteransicht verbessert
---
app/views/studien/semesteransicht.html.erb | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/app/views/studien/semesteransicht.html.erb b/app/views/studien/semesteransicht.html.erb
index ca302e7..e9f423a 100644
--- a/app/views/studien/semesteransicht.html.erb
+++ b/app/views/studien/semesteransicht.html.erb
@@ -13,9 +13,12 @@
-
-
<%= sem.name %> <%= link_to 'Lvas hinzufügen/entfernen', edit_semester_path(sem)%>
-
+
+
+
<%= sem.name %>
+
+
<%= link_to 'Lvas hinzufügen/entfernen', edit_semester_path(sem), :class=>"btn"%>
+
<% sem.lvas.each_slice(4) do |row| %>
<% row.each do |l| %>
From ff31ba6bff3d403a55977f1005e82d904670f8fa Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Sun, 11 Aug 2013 17:05:56 +0200
Subject: [PATCH 39/53] Kleine Anpassungen Calentry
---
app/models/calentry.rb | 3 +++
app/views/calendars/show.html.erb | 2 +-
config/routes.rb | 8 +++-----
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/app/models/calentry.rb b/app/models/calentry.rb
index d6cf59e..47f90ee 100644
--- a/app/models/calentry.rb
+++ b/app/models/calentry.rb
@@ -11,6 +11,9 @@ class Calentry < ActiveRecord::Base
def start_time
start
end
+ def start1
+ start.to_date
+ end
def name
summary
end
diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb
index 0c7e038..cb20b2a 100644
--- a/app/views/calendars/show.html.erb
+++ b/app/views/calendars/show.html.erb
@@ -10,7 +10,7 @@
<% @calendar.calentries.each do |entry| %>
-
-<%= link_to entry.summary+ " - " + I18n.l(entry.start), entry %>
+<%= link_to entry.summary+ " - " + I18n.l(entry.start1), entry %>
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index 696aeb1..5a7fbf6 100755
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,9 +1,6 @@
Fetsite::Application.routes.draw do
- resources :calendars
-
-
- resources :calentries
+
devise_for :users
@@ -48,7 +45,8 @@ Fetsite::Application.routes.draw do
resources :home, :only=>[:index]
get 'home/dev', :controller=>:home, :action=>:dev, :as=>'home_dev'
resources :beispiele
-
+ resources :calendars
+ resources :calentries
end
# The priority is based upon order of creation:
From 7bdd3b19599a190e748573925e5c21df28c34f1b Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Sun, 11 Aug 2013 17:06:22 +0200
Subject: [PATCH 40/53] =?UTF-8?q?Bootstrap=20wieder=20zur=C3=BCck=20korrig?=
=?UTF-8?q?iert?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/assets/stylesheets/application.css.scss | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss
index ecbb13d..3de1cac 100755
--- a/app/assets/stylesheets/application.css.scss
+++ b/app/assets/stylesheets/application.css.scss
@@ -10,7 +10,7 @@
*
*= require_self
*= require_tree .
- *= require 'bootstrap'
+ * require 'bootstrap'
*/
$linkColor: #03006E;
@import 'bootstrap';
From ac09de9e0ab1c45aa641d6b7a7d92a2853c4612a Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Sun, 11 Aug 2013 17:06:39 +0200
Subject: [PATCH 41/53] =?UTF-8?q?Link=20->Issues=20f=C3=BCr=20Startseite?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Gemfile.lock | 11 ++++++++---
app/views/home/index.html.erb | 10 ++++++++++
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 2f98cfb..ff6d52b 100755
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -35,7 +35,7 @@ GEM
activerecord (>= 3.0.0)
bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-x86-mingw32)
- bootstrap-sass (2.2.2.0)
+ bootstrap-sass (2.3.2.1)
sass (~> 3.2)
builder (3.0.4)
cancan (1.6.9)
@@ -128,6 +128,7 @@ GEM
rdoc (3.12.1)
json (~> 1.4)
ref (1.0.2)
+ rmagick (2.13.2)
rolify (3.2.0)
rspec-core (2.14.4)
rspec-expectations (2.14.0)
@@ -145,6 +146,8 @@ GEM
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
+ simple_calendar (0.1.9)
+ rails (>= 3.0)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
@@ -176,7 +179,7 @@ PLATFORMS
DEPENDENCIES
annotate (>= 2.5.0)
awesome_nested_set
- bootstrap-sass (~> 2.2.0)
+ bootstrap-sass (~> 2.3.2.1)
cancan
carrierwave
coffee-rails (~> 3.2.1)
@@ -192,9 +195,11 @@ DEPENDENCIES
paper_trail (>= 2.7.0)
paperclip (~> 3.4.0)
rails (= 3.2.9)
+ rmagick
rolify
rspec-rails
- sass-rails (~> 3.2.3)
+ sass-rails (~> 3.2)
+ simple_calendar (~> 0.1.9)
sqlite3
therubyracer
tinymce-rails (>= 3.5.8)
diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb
index 4d56fdb..9dc3abb 100755
--- a/app/views/home/index.html.erb
+++ b/app/views/home/index.html.erb
@@ -1,3 +1,13 @@
<%= t 'home.willkommen' %>
<%= t 'home.hallobeiderfet' %>
+
+
Alpha Test
+
Die Webseite befindet sich derzeit in einem Entsicklungsstadium,
+volle Funktionsfähigkeit ist noch nicht erreicht. Bitte Featurerequests und
+Fehlermeldungen auf GitHub melden.
+
+
+<%= link_to "Issues", "http://www.github.com/fetsite/fetsite/issues" %>
+
+
<%= link_to "Entwicklungsstatus" , home_dev_path %>
From dfd99bec5fad90afd113a0674bcee316b52980a4 Mon Sep 17 00:00:00 2001
From: Thomas Blazek
Date: Sun, 11 Aug 2013 21:25:18 +0200
Subject: [PATCH 42/53] =?UTF-8?q?Pr=C3=BCfungsinformation=20und=20Lernaufw?=
=?UTF-8?q?and=20zu=20Lva=20hinzugef=C3=BCgt?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/lva.rb | 2 +-
app/views/lvas/_form.html.erb | 2 ++
app/views/lvas/show.html.erb | 9 ++++++++-
db/schema.rb | 8 +++++---
4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/app/models/lva.rb b/app/models/lva.rb
index 86d1c5c..300e0e2 100755
--- a/app/models/lva.rb
+++ b/app/models/lva.rb
@@ -17,7 +17,7 @@
class Lva < ActiveRecord::Base
has_paper_trail # Versionsverfolgung
- attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids, :semester_ids
+ attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids, :semester_ids, :pruefungsinformation, :lernaufwand
has_and_belongs_to_many :modul # Gehört zu einem Modul
has_and_belongs_to_many :semester
#Gehört zu einem Semester( derzeit nicht implementiert)
diff --git a/app/views/lvas/_form.html.erb b/app/views/lvas/_form.html.erb
index d43f386..be3ef9d 100755
--- a/app/views/lvas/_form.html.erb
+++ b/app/views/lvas/_form.html.erb
@@ -23,6 +23,8 @@
diff --git a/app/views/lvas/show.html.erb b/app/views/lvas/show.html.erb
index b2d9e89..d5e5950 100755
--- a/app/views/lvas/show.html.erb
+++ b/app/views/lvas/show.html.erb
@@ -5,7 +5,14 @@