Added site layout configuration for users

This commit is contained in:
Luke Barratt 2014-08-10 23:56:18 +01:00
parent 987a28d7d0
commit e57a3f569d
5 changed files with 68 additions and 2 deletions

View file

@ -10,7 +10,11 @@ module ApplicationHelper
end end
def active_theme def active_theme
'default' if cuser && cuser.profile
cuser.current_layout
else
'default'
end
end end
def theme_stylesheet_link_tag def theme_stylesheet_link_tag

View file

@ -177,6 +177,10 @@ class User < ActiveRecord::Base
a a
end end
def current_layout
profile.layout || 'default'
end
def joined def joined
created_at.strftime("%d %b %y") created_at.strftime("%d %b %y")
end end

View file

@ -109,6 +109,12 @@
<p>Daylight savings will be observed automatically.</p> <p>Daylight savings will be observed automatically.</p>
</div> </div>
</div> </div>
<div class="fields horizontal">
<%= p.label :layout %>
<div class="inputs">
<%= p.select :layout, ['default', 'flat'] %>
</div>
</div>
</div> </div>
<div class="tab" id="notifications"> <div class="tab" id="notifications">

View file

@ -0,0 +1,5 @@
class AddLayoutToProfile < ActiveRecord::Migration
def change
add_column :profiles, :layout, :string
end
end

View file

@ -11,7 +11,21 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140510080652) do ActiveRecord::Schema.define(:version => 20140810224606) do
create_table "admin_requests", :force => true do |t|
t.string "addr"
t.string "pwd"
t.integer "server_id"
t.string "player"
t.integer "user_id"
t.string "msg"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "admin_requests", ["server_id"], :name => "index_admin_requests_on_server_id"
add_index "admin_requests", ["user_id"], :name => "index_admin_requests_on_user_id"
create_table "article_versions", :force => true do |t| create_table "article_versions", :force => true do |t|
t.integer "article_id" t.integer "article_id"
@ -200,6 +214,16 @@ ActiveRecord::Schema.define(:version => 20140510080652) do
add_index "data_files", ["directory_id"], :name => "index_data_files_on_directory_id" add_index "data_files", ["directory_id"], :name => "index_data_files_on_directory_id"
add_index "data_files", ["related_id"], :name => "index_data_files_on_related_id" add_index "data_files", ["related_id"], :name => "index_data_files_on_related_id"
create_table "deleteds", :force => true do |t|
t.integer "deletable_id"
t.string "deletable_type"
t.integer "user_id"
t.text "reason"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "related_id"
end
create_table "directories", :force => true do |t| create_table "directories", :force => true do |t|
t.string "name" t.string "name"
t.string "description" t.string "description"
@ -212,6 +236,21 @@ ActiveRecord::Schema.define(:version => 20140510080652) do
add_index "directories", ["parent_id"], :name => "index_directories_on_parent_id" add_index "directories", ["parent_id"], :name => "index_directories_on_parent_id"
create_table "firms", :force => true do |t|
t.string "name"
t.string "y_code"
t.string "email"
t.string "website"
t.string "phone"
t.string "address"
t.integer "zipcode"
t.string "town"
t.integer "owner"
t.string "opentime"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "forumers", :force => true do |t| create_table "forumers", :force => true do |t|
t.integer "forum_id" t.integer "forum_id"
t.integer "group_id" t.integer "group_id"
@ -478,6 +517,13 @@ ActiveRecord::Schema.define(:version => 20140510080652) do
add_index "movies", ["status"], :name => "index_movies_on_status" add_index "movies", ["status"], :name => "index_movies_on_status"
add_index "movies", ["user_id"], :name => "index_movies_on_user_id" add_index "movies", ["user_id"], :name => "index_movies_on_user_id"
create_table "nodes", :force => true do |t|
t.string "name"
t.integer "foreign_key"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "options", :force => true do |t| create_table "options", :force => true do |t|
t.string "option" t.string "option"
t.integer "poll_id" t.integer "poll_id"
@ -587,6 +633,7 @@ ActiveRecord::Schema.define(:version => 20140510080652) do
t.string "achievements_parsed" t.string "achievements_parsed"
t.string "signature_parsed" t.string "signature_parsed"
t.string "stream" t.string "stream"
t.string "layout"
end end
add_index "profiles", ["user_id"], :name => "index_profiles_on_user_id" add_index "profiles", ["user_id"], :name => "index_profiles_on_user_id"