themes fixes and versioning small fix

This commit is contained in:
Andreas Stephanides
2014-01-22 12:33:45 +01:00
parent 783b9f41c9
commit eadc5d26b4
7 changed files with 25 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
class ApplicationController < ActionController::Base
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_i18n_locale_from_params
protected
@@ -14,11 +14,11 @@ class ApplicationController < ActionController::Base
end
end
def get_theme
set_theme(params[:theme])
if valid_theme?
theme_name
if ThemesForRails.available_theme_names.include?(params[:theme])
params[:theme]
else
nil
"2003"
end
end
def default_url_options

View File

@@ -45,8 +45,7 @@ class FotosController < ApplicationController
# POST /fotos.json
def create
@foto = Foto.new(params[:foto])
@foto.gallery_id = (params[:gallery_id])
@foto.gallery_id = (params[:gallery_id])
@gallery = @foto.gallery
respond_to do |format|
@foto.title = @foto.datei.filename

View File

@@ -4,10 +4,11 @@ class NeuigkeitenController < ApplicationController
def show
@neuigkeit = Neuigkeit.find(params[:id])
@rubrik=@neuigkeit.rubrik
@rubrik=@neuigkeit.rubrik
if !params[:version].nil?
@neuigkeit.versions.reverse[params[:version].to_i].reify.save!
@neuigkeit=Neuigkeit.find(params[:id])
@neuigkeit.assign_attributes(@neuigkeit.translation.versions.reverse[params[:version].to_i].reify.attributes.select{|k,v| @neuigkeit.translated_attribute_names.include? k.to_sym })
# @neuigkeit=Neuigkeit.find(params[:id])
end
@calentries1=@neuigkeit.calentries
@@ -15,7 +16,7 @@ class NeuigkeitenController < ApplicationController
@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 << {:text=>I18n.t('common.edit'),:path=>edit_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:icon=>:pencil} if can? :edit, @neuigkeit.rubrik
@versions= @neuigkeit.versions.select([:created_at]).reverse
@versions= @neuigkeit.translation.versions.select([:created_at]).reverse
@toolbar_elements <<{:path=>rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:method=>:versions,:versions=>@versions}
@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