diff --git a/app/controllers/application.rb b/app/controllers/application.rb index a55a1b5..afea22c 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -41,7 +41,7 @@ class ApplicationController < ActionController::Base # Erro de validacao elsif exception.is_a?(ActiveRecord::RecordInvalid) respond_to do |format| - format.html { render :action => (exception.record.new_record? ? 'new' : 'edit') } + format.html { render :action => (params[:from].nil? ? (exception.record.new_record? ? 'new' : 'edit') : params[:from]) } format.xml { render :xml => exception.record.errors, :status => :unprocessable_entity } end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 054fa5c..b98cc77 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -54,6 +54,10 @@ module ApplicationHelper return {:class => 'highlight'} if (flash[:highlight] == name) end + def spinner(name) + return image_tag "loading.gif", :id => "spinner_#{name}", :style => "display:none" + end + def gravatar_url_for(email, size=80) "http://www.gravatar.com/avatar.php?gravatar_id=#{Digest::MD5.hexdigest(email)}&size=#{size}&default=#{App.default_avatar}" end diff --git a/app/views/stylesheets/wiki.css.erb b/app/views/stylesheets/wiki.css.erb index 0c67d83..4e75bb9 100644 --- a/app/views/stylesheets/wiki.css.erb +++ b/app/views/stylesheets/wiki.css.erb @@ -490,6 +490,7 @@ select { } #passmeter { + margin-left: 5px; font-size: 11px; } @@ -513,8 +514,6 @@ select { margin-top: 9px; } - - .history { margin-top: 18px; margin-left: 18px; @@ -718,6 +717,10 @@ text-align: center; text-align: left; } +.box dl { + margin: 0px 18px; +} + .top { vertical-align: top; } .center { text-align: center !important; } .left { float: left !important; } diff --git a/app/views/users/_form_settings.html.haml b/app/views/users/_form_settings.html.haml index 2bd38b5..e3e3a1a 100644 --- a/app/views/users/_form_settings.html.haml +++ b/app/views/users/_form_settings.html.haml @@ -1,37 +1,44 @@ = javascript_include_tag 'color' = error_messages_for 'user' -%dl - - if defined?(signup) and signup - %dt - %label{:for => 'user_login'} Login - %dd= text_field('user', 'login') - - %dt - %label{:for => 'user_name'} Nome completo - %dd= text_field('user', 'name') += hidden_field_tag 'from', 'settings' - %dt - %label{:for => 'user_display_name'} Nome de exibição - %dd= text_field('user', 'display_name') +.box + %h3 Informações Pessoais + %dl + - if defined?(signup) and signup + %dt + %label{:for => 'user_login'} Login + %dd= text_field('user', 'login') - %dt - %laber{:for => 'user_email'} Email - %dd= text_field('user', 'email') + %dt + %label{:for => 'user_name'} Nome completo + %dd= text_field('user', 'name') + %dt + %label{:for => 'user_display_name'} Nome de exibição + %dd= text_field('user', 'display_name') - %dt - %label{:for => 'user_password'} Senha - %dd= password_field('user', 'password', {:value => '', :id => 'password'}) + %dt + %laber{:for => 'user_email'} Email + %dd= text_field('user', 'email') - %dt - %label{:for => 'user_password_confirmation'} Confirmação de Senha - %dd= password_field('user', 'password_confirmation', {:value => ''}) + %dt + %label{:for => 'user_password'} Senha + %dd + = password_field('user', 'password', {:value => '', :id => 'password'}) + %span#passmeter   - #passmeter   + %dt + %label{:for => 'user_password_confirmation'} Confirmação de Senha + %dd + =password_field('user', 'password_confirmation', {:value => ''}) - %dt - %label{:for => 'user_color_pref'} Esquema de cores - = render :partial => 'widgets/color', :collection => App.color_schemes - %br.clear +.box + %h3 Preferências + %dl + %dt + %label{:for => 'user_color_pref'} Esquema de cores + = render :partial => 'widgets/color', :collection => App.color_schemes + %br.clear diff --git a/config/application.rb b/config/application.rb index 8adf06a..5d61c3e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -10,38 +10,39 @@ App.max_upload_file_size = 5.megabytes #App.forum_uri = "http://127.0.0.1:3001/" # Tema -App.default_color = 6 +App.default_color = 0 App.default_avatar = "http://wikiufc.gelsol.org/images/avatar.png" App.color_schemes = [ # Default + [ "#037", "#069", "#455", "#778" ], + + # Legado [ "#000", "#069", "#455", "#455" ], + [ "#000", "#690", "#444", "#666" ], - # Aqua + # Mono + + [ "#900", "#c00", "#444", "#888" ], + + # Aqua [ "#7b7", "#455", "#899", "#abb" ], [ "#005B9A", "#455", "#899", "#abb" ], [ "#8D009A", "#455", "#899", "#abb" ], [ "#9A000D", "#455", "#899", "#abb" ], [ "#5A9A00", "#455", "#899", "#abb" ], - # Mono - [ "#037", "#069", "#455", "#778" ], - [ "#900", "#c00", "#444", "#888" ], - # Complementar - [ "#037", "#c60", "#457", "#568" ], - [ "#070", "#c00", "#474", "#585" ], + #[ "#037", "#c60", "#457", "#568" ], + #[ "#070", "#c00", "#474", "#585" ], # Pink [ "#d18", "#d18", "#457", "#668" ], - [ "#609", "#455", "#547", "#658" ], + #[ "#609", "#455", "#547", "#658" ], # Sand [ "#900", "#663", "#888", "#cc9" ], [ "#036", "#663", "#888", "#cc9" ], - [ "#680", "#663", "#888", "#cc9" ], - - # Original - [ "#000", "#690", "#444", "#666" ] + [ "#680", "#663", "#888", "#cc9" ] ] diff --git a/db/migrate/032_more_paranoid.rb b/db/migrate/032_more_paranoid.rb index 49c850e..89c87b4 100644 --- a/db/migrate/032_more_paranoid.rb +++ b/db/migrate/032_more_paranoid.rb @@ -6,8 +6,8 @@ class MoreParanoid < ActiveRecord::Migration end def self.down - add_column :courses, :deleted_at - add_column :log_entries, :deleted_at - add_column :users, :deleted_at + remove_column :courses, :deleted_at + remove_column :log_entries, :deleted_at + remove_column :users, :deleted_at end end diff --git a/db/migrate/033_default_color.rb b/db/migrate/033_default_color.rb new file mode 100644 index 0000000..8eff791 --- /dev/null +++ b/db/migrate/033_default_color.rb @@ -0,0 +1,12 @@ +class DefaultColor < ActiveRecord::Migration + def self.up + change_column :users, :pref_color, :integer, :default => 0, :null => false + User.find(:all).each do |user| + user.update_attribute(:pref_color, 0) + end + end + + def self.down + change_column :users, :pref_color, :integer, :default => 6, :null => false + end +end diff --git a/db/schema.rb b/db/schema.rb index 1670c83..a370c8a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,7 +9,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 32) do +ActiveRecord::Schema.define(:version => 33) do create_table "attachments", :force => true do |t| t.string "file_name", :null => false @@ -83,7 +83,7 @@ ActiveRecord::Schema.define(:version => 32) do t.string "salt", :null => false t.datetime "created_at" t.string "name", :default => "", :null => false - t.integer "pref_color", :default => 6, :null => false + t.integer "pref_color", :default => 0, :null => false t.string "display_name", :null => false t.text "description" t.datetime "last_seen", :null => false diff --git a/public/javascripts/color.js b/public/javascripts/color.js index 2f16d5e..727c8c9 100644 --- a/public/javascripts/color.js +++ b/public/javascripts/color.js @@ -1,6 +1,6 @@ events['.color_radio:click'] = function(element, e) { style = document.createElement('link'); style.rel = 'Stylesheet'; - style.href = BASE_PATH + "/stylesheets/themes/color." + element.value + ".css"; + style.href = BASE_PATH + "/stylesheets/cache/color." + element.value + ".css"; $$('head')[0].appendChild(style); }