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 }
end
end
# GET /calendars/1/edit
def edit
@calendar = Calendar.find(params[:id])

View File

@@ -10,7 +10,7 @@ class NeuigkeitenController < ApplicationController
@neuigkeit=Neuigkeit.find(params[:id])
end
@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-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 << {: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
def new
@neuigkeit = Neuigkeit.new

View File

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

View File

@@ -22,7 +22,7 @@ class Calentry < ActiveRecord::Base
before_save :get_public
belongs_to :object, polymorphic: true # Objekt zu dem der Calentry gehört (derzeit ein Newsartikel)
validate do |entry|
validate do |entry|
if entry.ende.nil?
errors.add(:ende, "Es muss ein Endzeitpunkt vorhanden sein")
end
@@ -61,5 +61,5 @@ def text
I18n.l(self.start) +" bis "+ I18n.l(self.ende)
end
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

View File

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

View File

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

View File

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