preferred theme
This commit is contained in:
@@ -37,24 +37,20 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
def get_theme
|
||||||
|
u=current_user
|
||||||
def get_theme
|
if ! u.try(:preferredtheme).nil? and ThemesForRails.available_theme_names.include?(u.preferredtheme)
|
||||||
|
u.preferredtheme
|
||||||
# if params[:theme]== "default" || params[:theme]=="2003" || params[:theme].nil?
|
|
||||||
# params[:theme]="blue1"
|
|
||||||
# end
|
|
||||||
if ThemesForRails.available_theme_names.include?(params[:theme]) and can? :showintern,Thema
|
|
||||||
params[:theme]
|
|
||||||
else
|
else
|
||||||
"blue1"
|
"blue1"
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
end
|
||||||
|
|
||||||
def current_ability
|
def current_ability
|
||||||
@current_ability ||= Ability.new(current_user, request)
|
@current_ability ||= Ability.new(current_user, request)
|
||||||
end
|
end
|
||||||
def default_url_options
|
def default_url_options
|
||||||
{locale: I18n.locale, theme: (theme_name=="blue1") ? nil : theme_name , ansicht: nil}
|
{locale: I18n.locale, theme: nil , ansicht: nil}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -113,4 +113,17 @@ m.save
|
|||||||
url.path=path
|
url.path=path
|
||||||
return url
|
return url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_theme_help(u)
|
||||||
|
|
||||||
|
# if params[:theme]== "default" || params[:theme]=="2003" || params[:theme].nil?
|
||||||
|
# params[:theme]="blue1"
|
||||||
|
# end
|
||||||
|
if ! u.try(:preferredtheme).nil? and ThemesForRails.available_theme_names.include?(u.preferredtheme)
|
||||||
|
u.preferredtheme
|
||||||
|
else
|
||||||
|
"blue1"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<div id="maincontainer" class="container-fluid">
|
<div id="maincontainer" class="container-fluid">
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span10 offset1 header_span">
|
<div class="span10 offset1 header_span">
|
||||||
<% cache("menu_u"+user_signed_in?.to_s+current_user.try(:id).to_s+"l"+I18n.locale.to_s+ can?(:seeintern, User).to_s+ can?(:index,Gallery).to_s, expires_in: 24.hours) do %>
|
<% cache("menu_u"+user_signed_in?.to_s+current_user.try(:id).to_s+"l"+I18n.locale.to_s+ can?(:seeintern, User).to_s+ can?(:index,Gallery).to_s+params[:theme].to_s, expires_in: 24.hours) do %>
|
||||||
<div class="header_wrap">
|
<div class="header_wrap">
|
||||||
<div class="header hidden-print">
|
<div class="header hidden-print">
|
||||||
<%= link_to home_index_path do %>
|
<%= link_to home_index_path do %>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="span3">
|
<div class="span3">
|
||||||
<% cache("calendar_" + cache_array_key(@calentries)+params[:month].to_s+params[:year].to_s) do %>
|
<% cache("calendar_" + cache_array_key(@calentries)+params[:month].to_s+params[:year].to_s+params[:theme].to_s) do %>
|
||||||
<%= render 'calendars/calentries', :object=>@calentries %>
|
<%= render 'calendars/calentries', :object=>@calentries %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
5
db/migrate/20150602085525_add_preferredtheme_to_users.rb
Normal file
5
db/migrate/20150602085525_add_preferredtheme_to_users.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class AddPreferredthemeToUsers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :users, :preferredtheme, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user