diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f7c7c86..cdd3a1f 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -22,6 +22,6 @@ else end end def default_url_options - {locale: I18n.locale, theme: theme_name} + {locale: I18n.locale, theme: theme_name, ansicht: nil} end end diff --git a/app/controllers/rubriken_controller.rb b/app/controllers/rubriken_controller.rb index 79e1d6b..0ff05ff 100755 --- a/app/controllers/rubriken_controller.rb +++ b/app/controllers/rubriken_controller.rb @@ -11,13 +11,12 @@ class RubrikenController < ApplicationController @rubrik = Rubrik.find(params[:id]) @moderatoren=User.with_role(:newsmoderator,@rubrik) if can?(:showunpublished, Neuigkeit) - @neuigkeiten = @rubrik.neuigkeiten -else - @neuigkeiten = @rubrik.neuigkeiten.published -end -@toolbar_elements << {:text=>I18n.t('neuigkeit.new.title'),:path=> new_rubrik_neuigkeit_path(@rubrik),:hicon=>'icon-plus-sign'} if can? :verwalten, @rubrik - -@toolbar_elements << {:text=>I18n.t('common.verwalten'),:path=>verwalten_rubrik_path(@rubrik),:icon=>:pencil} if can? :verwalten, @rubrik + @neuigkeiten = @rubrik.neuigkeiten + else + @neuigkeiten = @rubrik.neuigkeiten.published + end + @toolbar_elements << {:text=>I18n.t('neuigkeit.new.title'), :path=> new_rubrik_neuigkeit_path(@rubrik),:hicon=>'icon-plus-sign'} if can? :verwalten, @rubrik + @toolbar_elements << {:text=>I18n.t('common.verwalten'), :path=>verwalten_rubrik_path(@rubrik),:icon=>:pencil} if can? :verwalten, @rubrik diff --git a/app/controllers/themen_controller.rb b/app/controllers/themen_controller.rb index 566aa4b..9b84e0a 100644 --- a/app/controllers/themen_controller.rb +++ b/app/controllers/themen_controller.rb @@ -51,7 +51,8 @@ class ThemenController < ApplicationController # POST /themen.json def create @thema = Thema.new(params[:thema]) - + + @themen = @thema.themengruppe.themen.order(:priority).reverse respond_to do |format| if @thema.save format.html { redirect_to @thema, notice: 'Thema was successfully created.' } @@ -75,7 +76,7 @@ class ThemenController < ApplicationController # PUT /themen/1.json def update @thema = Thema.find(params[:id]) - + @themen = @thema.themengruppe.themen.order(:priority).reverse respond_to do |format| if @thema.update_attributes(params[:thema]) format.html { redirect_to @thema, notice: 'Thema was successfully updated.' } diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f34ec3d..b2acb74 100755 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,9 +1,11 @@ module ApplicationHelper - def current_url(overwrite={}) - url_for :params => params.merge(overwrite).except(:controller,:action) - end + def current_url1(overwrite={}) + url_for :params => params.merge(overwrite).except(:controller,:action,:ansicht) + end + + def switch_locale_url(target_locale) - current_url({:locale=>target_locale}) .sub "/"+I18n.locale.to_s+"/", "/"+target_locale.to_s+"/" + current_url1({:locale=>target_locale}) .sub "/"+I18n.locale.to_s+"/", "/"+target_locale.to_s+"/" end def toolbar_html(elemente) diff --git a/app/models/calentry.rb b/app/models/calentry.rb index 1689d1d..f7f0699 100644 --- a/app/models/calentry.rb +++ b/app/models/calentry.rb @@ -21,6 +21,7 @@ class Calentry < ActiveRecord::Base validates :typ, :presence => true before_save :get_public belongs_to :object, polymorphic: true # Objekt zu dem der Calentry gehört (derzeit ein Newsartikel) + scope :upcoming, ->{ where("start >= ?", Time.now).order(:start)} scope :recent,-> { where("start <= ?", Time.now).order(:start).reverse_order} validate do |entry| @@ -31,8 +32,8 @@ class Calentry < ActiveRecord::Base resourcify def get_public - self.public = (self.try(:object).nil?)? (self.calendar.try(:public)) : object.try(:public) - true + self.public = (self.try(:object).nil?)? (self.calendar.try(:public)) : object.try(:public) + true end def start_time start diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1531dfd..030adb2 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -36,21 +36,27 @@ +
- -