diff --git a/app/controllers/neuigkeiten_controller.rb b/app/controllers/neuigkeiten_controller.rb index 34ba860..9703e8d 100755 --- a/app/controllers/neuigkeiten_controller.rb +++ b/app/controllers/neuigkeiten_controller.rb @@ -27,6 +27,18 @@ class NeuigkeitenController < ApplicationController @rubrik=Rubrik.find(params[:rubrik_id]) unless params[:rubrik_id].nil? @neuigkeit.rubrik=@rubrik unless @rubrik.nil? end + def add_calentry + @neuigkeit=Neuigkeit.find(params[:id]) + if params[:calentry_id].nil? + ce = Calentry.new + else + ce=Calentry.find(params[:calentry_id]) + end + @calentry=ce + ce.object=@neuigkeit + render 'edit' + end + def unpublish @neuigkeit = Neuigkeit.find(params[:id]) @neuigkeit.reverse_publish diff --git a/app/views/neuigkeiten/_form.html.erb b/app/views/neuigkeiten/_form.html.erb index 2a1a0a8..f190993 100755 --- a/app/views/neuigkeiten/_form.html.erb +++ b/app/views/neuigkeiten/_form.html.erb @@ -7,6 +7,11 @@ <%= f.input :rubrik, :as=>:radio, :collection=>Rubrik.all %> <%= f.input :author, :as=>:radio %> <%= f.input :picture, :as=>:file %> + <%= f.inputs :for => :calentry do |calentry| %> + <%= calentry.input :start, :as =>:datepicker %> + <%= calentry.input :ende, :as =>:datepicker %> + <%= calentry.input :typ %> + <% end %> <% end %> <%= f.actions do %> diff --git a/config/routes.rb b/config/routes.rb index 89ec740..8da7ed0 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -69,6 +69,8 @@ member do get 'publish' get 'unpublish' + get 'add_calentry' + get 'rm_calentry' end end end