From a87018192a46b3a87ed9d9c21d6b378f23f8ef93 Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Thu, 26 Jun 2014 17:41:46 +0300 Subject: [PATCH] style fixes --- app/controllers/admin/events_controller.rb | 10 ++++++++-- app/models/datatable_supporters.rb | 10 +++++----- app/models/user.rb | 2 +- app/views/devise/registrations/edit.html.haml | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index 5fb5e215..6b664ec6 100644 --- a/app/controllers/admin/events_controller.rb +++ b/app/controllers/admin/events_controller.rb @@ -49,7 +49,12 @@ module Admin typelength += myevent.event_type.length @totallength += myevent.event_type.length end - @eventstats[mytype.title] = { 'count' => events_mytype.count, 'length' => events_mytype.count * mytype.length } if @eventstats[mytype.title] == nil + + if @eventstats[mytype.title] == nil + @eventstats[mytype.title] = { 'count' => events_mytype.count, + 'length' => events_mytype.count * mytype.length } + end + tmp = { "#{mystate.name}" => { 'type_state_count' => events_mytype_mystate.count, 'type_state_length' => typelength } } @eventstats[mytype.title].merge!(tmp) @@ -108,7 +113,8 @@ module Admin @event.update_attribute(:difficulty_level_id, params[:difficulty_level_id]) end - if @event.submitter.update_attributes!(params[:user]) && @event.update_attributes!(params[:event]) + if @event.submitter.update_attributes!(params[:user]) && @event. + update_attributes!(params[:event]) flash[:notice] = "Successfully updated #{@event.title}." else flash[:notice] = 'Update not successful.' diff --git a/app/models/datatable_supporters.rb b/app/models/datatable_supporters.rb index d823d65d..4f6c4f25 100644 --- a/app/models/datatable_supporters.rb +++ b/app/models/datatable_supporters.rb @@ -4,10 +4,10 @@ class DatatableSupporters < Datatable items.each do |i| item = [] if i.name.blank? - unless i.registration.nil? || i.registration.user.nil? + if !i.registration.nil? && !i.registration.user.nil? item << i.registration.user.name else - item << "Unknown" + item << 'Unknown' end else @@ -15,10 +15,10 @@ class DatatableSupporters < Datatable end if i.email.blank? - unless i.registration.nil? && i.registration.user.nil? + if !i.registration.nil? && !i.registration.user.nil? item << i.registration.user.email else - item << "Unknown" + item << 'Unknown' end else @@ -35,6 +35,6 @@ class DatatableSupporters < Datatable end def columns - ["name", "email", "name", "name", "name"] + ['name', 'email', 'name', 'name', 'name'] end end diff --git a/app/models/user.rb b/app/models/user.rb index 9f1f69c8..e8ab574a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -121,7 +121,7 @@ class User < ActiveRecord::Base private def biography_limit - errors.add(:abstract, 'cannot have more than 150 words') if !biography.nil? && + errors.add(:abstract, 'cannot have more than 150 words') if biography && biography.split.size > 150 end end diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index aa7bf163..1ae3355e 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -26,7 +26,7 @@ = render 'devise/shared/openid' = f.inputs name: 'Account' do - = f.input :email, :required => false, :input_html => {autocomplete: "off"} + = f.input :email, required: false, input_html: {autocomplete: "off"} = f.input :password, hint: "(Leave blank if you don't want to change it)", input_html: {autocomplete: 'off'} = f.input :password_confirmation, input_html: {autocomplete: 'off'} = f.input :current_password, input_html: {autocomplete: 'off'},