neuigkeiten/calender kleine anpassungen

+ ics link
- Kein "Verwalten Button" mehr
This commit is contained in:
Andreas Stephanides
2013-12-18 09:48:52 +01:00
parent ec17e4f04f
commit c85b8c50cb
7 changed files with 15 additions and 14 deletions

View File

@@ -34,7 +34,6 @@ class CalendarsController < ApplicationController
format.json { render json: @calendar } format.json { render json: @calendar }
end end
end end
# GET /calendars/1/edit # GET /calendars/1/edit
def edit def edit
@calendar = Calendar.find(params[:id]) @calendar = Calendar.find(params[:id])

View File

@@ -10,7 +10,7 @@ class NeuigkeitenController < ApplicationController
@neuigkeit=Neuigkeit.find(params[:id]) @neuigkeit=Neuigkeit.find(params[:id])
end end
@calentries1=@neuigkeit.calentries @calentries1=@neuigkeit.calentries
if params[:verwalten]
@toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('neuigkeit.publish'),:path => publish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>"Sure?" } if can? :publish, @neuigkeit @toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('neuigkeit.publish'),:path => publish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>"Sure?" } if can? :publish, @neuigkeit
@toolbar_elements << {:hicon=>'icon-minus', :text=> I18n.t('neuigkeit.unpublish'),:path => unpublish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>"Sure?" } if can?(:unpublish, @neuigkeit) && !@neuigkeit.published? @toolbar_elements << {:hicon=>'icon-minus', :text=> I18n.t('neuigkeit.unpublish'),:path => unpublish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>"Sure?" } if can?(:unpublish, @neuigkeit) && !@neuigkeit.published?
@@ -21,11 +21,8 @@ class NeuigkeitenController < ApplicationController
@toolbar_elements << {:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit), :method=> :delete,:confirm=>'Sure?' } if can? :delete, @neuigkeit @toolbar_elements << {:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit), :method=> :delete,:confirm=>'Sure?' } if can? :delete, @neuigkeit
# @toolbar_elements << {:path=> add_calentry_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit), :text=>"Add Calentry", :icon=>:plus} # @toolbar_elements << {:path=> add_calentry_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit), :text=>"Add Calentry", :icon=>:plus}
else
@toolbar_elements << {:text=>I18n.t('common.verwalten'),:path=>rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit,{:verwalten=>true}),:icon=>:pencil} if can? :verwalten, @neuigkeit
end end
end
def new def new
@neuigkeit = Neuigkeit.new @neuigkeit = Neuigkeit.new

View File

@@ -4,7 +4,7 @@ class RubrikenController < ApplicationController
def index def index
@rubriken = Rubrik.all @rubriken = Rubrik.all
@neuigkeiten = Neuigkeit.recent @neuigkeiten = Neuigkeit.recent
@calentries= Calentry.all @calentries= Calentry.public
end end
def show def show

View File

@@ -61,5 +61,5 @@ def text
I18n.l(self.start) +" bis "+ I18n.l(self.ende) I18n.l(self.start) +" bis "+ I18n.l(self.ende)
end end
scope :public, -> { where(:public => :true) } scope :public, -> { where(:public => :true) }
scope :upcoming, -> { where("start >= ?" , Time.now).where("start <= ?", 8.days.from_now) } scope :upcoming, -> { where("start >= ?" , Time.now).where("start <= ?", 28.days.from_now) }
end end

View File

@@ -5,6 +5,7 @@ format=:timeonly
else else
format =:default format =:default
end%> end%>
<%= link_to calentry.text, calentry_path(calentry) %> <%= calentry.text %>
</div> </div>

View File

@@ -14,7 +14,10 @@
</p> </p>
</div> </div>
<div class="media-body"> <div class="media-body">
<h1><%= link_to @neuigkeit.title,rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit) %></h1> <h1>
<%= @neuigkeit.title%>
</h1>
<%= raw(@neuigkeit.text) %> <%= raw(@neuigkeit.text) %>
<p></p> <p></p>
</div> </div>

View File

@@ -30,6 +30,7 @@
</div> </div>
<div class="span3"> <div class="span3">
<%= render 'calendars/calentries', :object=>@rubrik.calendar.calentries %> <%= render 'calendars/calentries', :object=>@rubrik.calendar.calentries %>
<%= link_to "ics-format", calendar_path(@rubrik.calendar,:format=>:ics) %>
</div> </div>
</div> </div>