Commit 00028702fc516f799296d10a1d0da960e93a0381

Authored by Dmitriy Zaporozhets
1 parent ed75afbb

design tab improved. Themes added

app/assets/stylesheets/common.scss
... ... @@ -642,3 +642,12 @@ p.time {
642 642 }
643 643 }
644 644 }
  645 +
  646 +.styled_image {
  647 + -webkit-border-radius: 4px;
  648 + -moz-border-radius: 4px;
  649 + border-radius: 4px;
  650 + -moz-box-shadow: 0 0 5px #888;
  651 + -webkit-box-shadow: 0 0 5px#888;
  652 + box-shadow: 0 0 5px #888;
  653 +}
... ...
app/helpers/application_helper.rb
... ... @@ -113,4 +113,12 @@ module ApplicationHelper
113 113 def layout
114 114 controller.send :_layout
115 115 end
  116 +
  117 + def app_theme
  118 + if current_user && current_user.theme_id == 1
  119 + "ui_basic"
  120 + else
  121 + "ui_mars"
  122 + end
  123 + end
116 124 end
... ...
app/models/user.rb
... ... @@ -6,7 +6,7 @@ class User < ActiveRecord::Base
6 6  
7 7 # Setup accessible (or protected) attributes for your model
8 8 attr_accessible :email, :password, :password_confirmation, :remember_me,
9   - :name, :projects_limit, :skype, :linkedin, :twitter, :dark_scheme
  9 + :name, :projects_limit, :skype, :linkedin, :twitter, :dark_scheme, :theme_id
10 10  
11 11 has_many :users_projects, :dependent => :destroy
12 12 has_many :projects, :through => :users_projects
... ...
app/views/layouts/application.html.haml
1 1 !!! 5
2 2 %html{ :lang => "en"}
3 3 = render "layouts/head"
4   - %body.ui_basic.application
  4 + %body{:class => "#{app_theme} application"}
5 5 = render "layouts/flash"
6 6 = render "layouts/head_panel", :title => "Dashboard"
7 7 .container
... ...
app/views/layouts/error.html.haml
1 1 !!! 5
2 2 %html{ :lang => "en"}
3 3 = render "layouts/head"
4   - %body.ui_basic.application
  4 + %body{:class => "#{app_theme} application"}
5 5 = render "layouts/flash"
6 6 = render "layouts/head_panel", :title => ""
7 7 .container
... ...
app/views/layouts/profile.html.haml
1 1 !!! 5
2 2 %html{ :lang => "en"}
3 3 = render "layouts/head"
4   - %body.ui_basic.profile
  4 + %body{:class => "#{app_theme} profile"}
5 5 = render "layouts/flash"
6 6 = render "layouts/head_panel", :title => "Profile"
7 7 .container
... ...
app/views/layouts/project.html.haml
1 1 !!! 5
2 2 %html{ :lang => "en"}
3 3 = render "layouts/head"
4   - %body.ui_basic.project
  4 + %body{:class => "#{app_theme} project"}
5 5 = render "layouts/flash"
6 6 = render "layouts/head_panel", :title => @project.name
7 7 .container
... ...
app/views/profile/design.html.haml
1   -%h3 Design
2   -%hr
3   -= form_for @user, :url => profile_update_path, :method => :put do |f|
  1 += form_for @user, :url => profile_update_path, :remote => true, :method => :put do |f|
  2 + %h3 Application theme
  3 + %hr
  4 + .clearfix
  5 + = label_tag do
  6 + = f.radio_button :theme_id, 1
  7 + Default
  8 +
  9 + = label_tag do
  10 + = f.radio_button :theme_id, 2
  11 + Classic
  12 + %br
  13 + %h3 Code review
  14 + %hr
4 15 .row
5 16 %label.span4{:for => "user_dark_scheme_false"}
6   - = image_tag "white.png", :width => 210
7 17 %center
8 18 %h4
9 19 = f.radio_button :dark_scheme, false
10 20 White code preview
  21 + = image_tag "white.png", :width => 210, :class => "styled_image"
11 22 %label.span4{:for => "user_dark_scheme_true"}
12   - = image_tag "dark.png", :width => 210
13 23 %center
14 24 %h4
15 25 = f.radio_button :dark_scheme, true
16 26 Dark code preview
17   - .clearfix
18   - .actions
19   - = f.submit 'Save', :class => "btn"
  27 + = image_tag "dark.png", :width => 210, :class => "styled_image"
20 28  
  29 +:javascript
  30 + $(function(){
  31 + $(".edit_user input").bind("click", function() {
  32 + $(".edit_user").submit();
  33 + });
  34 + })
... ...
db/migrate/20120301185805_add_theme_to_user.rb 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +class AddThemeToUser < ActiveRecord::Migration
  2 + def change
  3 + add_column :users, :theme_id, :integer, :null => false, :default => 1
  4 +
  5 + end
  6 +end
... ...
db/schema.rb
... ... @@ -11,7 +11,7 @@
11 11 #
12 12 # It's strongly recommended to check this file into your version control system.
13 13  
14   -ActiveRecord::Schema.define(:version => 20120228134252) do
  14 +ActiveRecord::Schema.define(:version => 20120301185805) do
15 15  
16 16 create_table "events", :force => true do |t|
17 17 t.string "target_type"
... ... @@ -24,6 +24,18 @@ ActiveRecord::Schema.define(:version =&gt; 20120228134252) do
24 24 t.integer "action"
25 25 end
26 26  
  27 + create_table "features", :force => true do |t|
  28 + t.string "name"
  29 + t.string "branch_name"
  30 + t.integer "assignee_id"
  31 + t.integer "author_id"
  32 + t.integer "project_id"
  33 + t.datetime "created_at"
  34 + t.datetime "updated_at"
  35 + t.string "version"
  36 + t.integer "status", :default => 0, :null => false
  37 + end
  38 +
27 39 create_table "issues", :force => true do |t|
28 40 t.string "title"
29 41 t.integer "assignee_id"
... ... @@ -150,6 +162,7 @@ ActiveRecord::Schema.define(:version =&gt; 20120228134252) do
150 162 t.string "twitter", :default => "", :null => false
151 163 t.string "authentication_token"
152 164 t.boolean "dark_scheme", :default => false, :null => false
  165 + t.integer "theme_id", :default => 1, :null => false
153 166 end
154 167  
155 168 add_index "users", ["email"], :name => "index_users_on_email", :unique => true
... ... @@ -163,13 +176,6 @@ ActiveRecord::Schema.define(:version =&gt; 20120228134252) do
163 176 t.integer "project_access", :default => 0, :null => false
164 177 end
165 178  
166   - create_table "web_hook_urls", :force => true do |t|
167   - t.string "url"
168   - t.integer "project_id"
169   - t.datetime "created_at"
170   - t.datetime "updated_at"
171   - end
172   -
173 179 create_table "web_hooks", :force => true do |t|
174 180 t.string "url"
175 181 t.integer "project_id"
... ...