From fc753282d32be40e02752cae3b6fe8e6053d1842 Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Thu, 26 Jun 2014 15:43:24 +0300 Subject: [PATCH] hound fixes --- .../admin/registrations_controller.rb | 6 +- app/controllers/admin/stats_controller.rb | 73 ++++++++++++------- app/controllers/api/v1/events_controller.rb | 18 +++-- app/controllers/api/v1/speakers_controller.rb | 24 +++--- .../conference_registration_controller.rb | 44 ++++++----- app/controllers/registrations_controller.rb | 10 ++- app/models/conference.rb | 2 +- app/models/datatable_supporters.rb | 4 +- app/models/email_settings.rb | 22 +++--- app/models/event.rb | 48 ++++++------ app/models/user.rb | 22 +++--- app/serializers/event_serializer.rb | 2 +- app/views/admin/events/index.html.haml | 8 +- app/views/devise/registrations/edit.html.haml | 41 ++++++----- 14 files changed, 180 insertions(+), 144 deletions(-) diff --git a/app/controllers/admin/registrations_controller.rb b/app/controllers/admin/registrations_controller.rb index 3272874a..e00fa7ba 100644 --- a/app/controllers/admin/registrations_controller.rb +++ b/app/controllers/admin/registrations_controller.rb @@ -5,7 +5,8 @@ module Admin def index session[:return_to] ||= request.referer @pdf_filename = "#{@conference.title}.pdf" - @registrations = @conference.registrations.includes(:user).order('registrations.created_at ASC') + @registrations = @conference.registrations.includes(:user) + @registrations = @registrations.order('registrations.created_at ASC') @attended = @conference.registrations.where('attended = ?', true).count @headers = %w(name email nickname other_needs arrival departure attended) end @@ -36,7 +37,8 @@ module Admin @user.update_attributes!(params[:registration][:user_attributes]) params[:registration].delete :user_attributes if params[:registration][:supporter_registration] - @registration.supporter_registration.update_attributes(params[:registration][:supporter_registration_attributes]) + @registration.supporter_registration. + update_attributes(params[:registration][:supporter_registration_attributes]) params[:registration].delete :supporter_registration_attributes end @registration.update_attributes!(params[:registration]) diff --git a/app/controllers/admin/stats_controller.rb b/app/controllers/admin/stats_controller.rb index 2c37c34f..894aea6e 100644 --- a/app/controllers/admin/stats_controller.rb +++ b/app/controllers/admin/stats_controller.rb @@ -3,23 +3,31 @@ module Admin before_filter :verify_organizer def index - @registrations = @conference.registrations.includes(:user).order('registrations.created_at ASC') + @registrations = @conference.registrations.includes(:user) + @registrations = @registrations.order('registrations.created_at ASC') @registered = @conference.registrations.count @attendees = @conference.registrations.where('attended = ?', true).count - @pre_registered = @conference.registrations.where('created_at < ?', @conference.start_date).count - @pre_registered_attended = @conference.registrations.where('created_at < ? AND attended = ?', @conference.start_date, true).count + @pre_registered = @conference.registrations + @pre_registered = @pre_registered.where('created_at < ?', @conference.start_date).count + @pre_registered_attended = @conference.registrations.where('created_at < ? AND attended = ?', + @conference.start_date, true).count - @registered_with_partner = @conference.registrations.where('attending_with_partner = ?', true).count - @attended_with_partner = @conference.registrations.where('attending_with_partner = ? AND attended = ?', true, true).count + @registered_with_partner = @conference.registrations.where('attending_with_partner = ?', + true).count + @attended_with_partner = @conference.registrations.where( + 'attending_with_partner = ? AND attended = ?', true, true).count @handicapped_access = @conference.registrations.where(handicapped_access_required: true).count - @handicapped_access_attended = @conference.registrations.where(handicapped_access_required: true) + @handicapped_access_attended = @conference.registrations.where(handicapped_access_required: + true) @handicapped_access_attended = @handicapped_access_attended.where(attended: true).count - @suggested_hotel_stay = @conference.registrations.where('using_affiliated_lodging = ?', true).count + @suggested_hotel_stay = @conference.registrations.where('using_affiliated_lodging = ?', + true).count @events = @conference.events # Events charts - @machine_states = [['confirmed'], ['cancelled'], ['rejected'], ['withdrawn'], ['new', 'review'], ['unconfirmed', 'accepted']] + @machine_states = [['confirmed'], ['cancelled'], ['rejected'], ['withdrawn'], + ['new', 'review'], ['unconfirmed', 'accepted']] # Types distribution per state @type_state = {} @machine_states.each do |state| @@ -40,7 +48,7 @@ module Admin if @events.count > 0 start_date = @events.minimum('created_at').strftime('%Y-%m-%d') end_date = @events.maximum('created_at').strftime('%Y-%m-%d') - if start_date != nil && end_date != nil + unless start_date == nil || end_date == nil @events_time = var_time(start_date, end_date, @events, 'created_at') end end @@ -79,8 +87,13 @@ 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 - tmp = { "#{mystate.name}" => { 'type_state_count' => events_mytype_mystate.count, 'type_state_length' => typelength } } + 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) end end @@ -88,7 +101,8 @@ module Admin @eventstats['totallength'] = @totallength # SPEAKERS stats - @speakers = User.joins(:events).where('events.conference_id = ? AND events.state LIKE ?', @conference.id, 'confirmed').uniq + @speakers = User.joins(:events).where('events.conference_id = ? AND events.state LIKE ?', + @conference.id, 'confirmed').uniq @speaker_fields_user = %w(name email affiliation) @speaker_fields_reg = %w(arrival departure) # TICKETS stats @@ -98,7 +112,7 @@ module Admin @tickets_time = [] - if @conference.registration_start_date and @conference.end_date and @registered > 0 and @supporter_levels + if @conference.registration_start_date && @conference.end_date && @registered > 0 && @supporter_levels start_date = @conference.registration_start_date end_date = @conference.end_date levels = [] @@ -108,10 +122,13 @@ module Admin end (start_date..end_date).each do |day| - if @tickets.where('supporter_registrations.created_at LIKE ?', "%#{day}%").where('supporter_levels.title' => levels).count != 0 + if @tickets.where('supporter_registrations.created_at LIKE ?', "%#{day}%").where( + 'supporter_levels.title' => levels).count != 0 @conference.supporter_levels.each do |level| - day_ticket_count = @tickets.where('supporter_registrations.created_at LIKE ? AND supporter_levels.title LIKE ?', "%#{day}%", "%#{level.title}%").count + day_ticket_count = @tickets.where('supporter_registrations.created_at LIKE ? + AND supporter_levels.title LIKE ?', + "%#{day}%", "%#{level.title}%").count index = @tickets_time.index { |v| v['key'] == "#{level.title}" } @tickets_time[index]['values'] << { 'label' => "#{day}", 'value' => day_ticket_count } @@ -123,7 +140,8 @@ module Admin @tickets_time.each do |ticket| value = ticket['values'].map { |x| x['value'] }.sum percent = (value.to_f / @tickets.count * 100).round(2) - @tickets_distribution << { 'status' => ticket['key'], 'value' => value, 'percent' => percent } + @tickets_distribution << { 'status' => ticket['key'], + 'value' => value, 'percent' => percent } end # OTHER_INFO chart / To be 'Questions' @@ -136,7 +154,7 @@ module Admin ] # REGISTRATIONS, registered_time - if @conference.registration_start_date and @conference.end_date and @registered > 0 + if @conference.registration_start_date && @conference.end_date && @registered > 0 start_date = @conference.registration_start_date end_date = @conference.end_date @registered_time = var_time(start_date, end_date, @registrations, 'created_at') @@ -156,39 +174,39 @@ module Admin result << { 'status' => "#{day}", 'value' => day_var_count } end end - return result + result end def var_state_func(vars, field, mystate) result = [] - for myvar in vars do + vars.each do |myvar| # Find events per track and state value = @conference.events.where("#{field}_id" => myvar.id).where(state: mystate).count # Find all events in that state total = @conference.events.where(state: mystate).count status = "#{myvar.name}" + percent = 0 if value != 0 percent = (value.to_f / total * 100).round(2) result << { 'status' => status, 'value' => value, 'percent' => percent } - else - percent = 0 end end - # Get no of events for which the field is not set (Needed so that the pie shows half piece for 50%) - sum = result.inject(0) { |sum, hash| sum + hash['value'] } - value = total - sum if total and sum + # Get no of events for which the field is not set (So that pie shows half piece for 50%) + sum = result.inject(0) { |s, hash| s + hash['value'] } + value = total - sum if sum != 0 && value != 0 percent = (value.to_f / total * 100).round(2) result << { 'status' => "no #{field} set", 'value' => value, 'percent' => percent } end - return result + result end def speaker_reg(speaker) - speaker.registrations.where('conference_id = ? AND user_id = ?', @conference.id, speaker.id).first + speaker.registrations.where('conference_id = ? AND user_id = ?', + @conference.id, speaker.id).first end def speaker_diet(reg) @@ -200,7 +218,8 @@ module Admin end def social_event_count(event) - @conference.registrations.joins(:social_events).where('registrations_social_events.social_event_id = ?', event).count + @conference.registrations.joins(:social_events).where( + 'registrations_social_events.social_event_id = ?', event).count end helper_method :speaker_reg diff --git a/app/controllers/api/v1/events_controller.rb b/app/controllers/api/v1/events_controller.rb index 1729b333..e654f167 100644 --- a/app/controllers/api/v1/events_controller.rb +++ b/app/controllers/api/v1/events_controller.rb @@ -1,11 +1,15 @@ -class Api::V1::EventsController < Api::BaseController - respond_to :json +module Api + module V1 + class EventsController < Api::BaseController + respond_to :json - def index - events = Event.includes(:conference, :track, :room, :event_type, {:event_user => :user}) - unless params[:conference_id].blank? - events = events.where("conferences.guid" => params[:conference_id]) + def index + events = Event.includes(:conference, :track, :room, :event_type, event_user: :user) + unless params[:conference_id].blank? + events = events.where('conferences.guid' => params[:conference_id]) + end + respond_with events.confirmed + end end - respond_with events.confirmed end end diff --git a/app/controllers/api/v1/speakers_controller.rb b/app/controllers/api/v1/speakers_controller.rb index 22afff38..cbf298d4 100644 --- a/app/controllers/api/v1/speakers_controller.rb +++ b/app/controllers/api/v1/speakers_controller.rb @@ -1,14 +1,18 @@ -class Api::V1::SpeakersController < Api::BaseController - respond_to :json +module Api + module V1 + class SpeakersController < Api::BaseController + respond_to :json - def index - if params[:conference_id].blank? - people = User.joins(:event_users) - else - people = User.joins(:event_users => {:event => :conference}) - people = people.where("conferences.guid" => params[:conference_id]) + def index + if params[:conference_id].blank? + users = User.joins(:event_users) + else + users = User.joins(event_users: { event: :conference }) + users = users.where('conferences.guid' => params[:conference_id]) + end + users = users.where('event_users.event_role' => 'speaker') + render json: users, each_serializer: SpeakerSerializer + end end - people = people.where("event_users.event_role" => "speaker") - render :json => users, :each_serializer => SpeakerSerializer end end diff --git a/app/controllers/conference_registration_controller.rb b/app/controllers/conference_registration_controller.rb index b63fe05f..101916d4 100644 --- a/app/controllers/conference_registration_controller.rb +++ b/app/controllers/conference_registration_controller.rb @@ -4,34 +4,40 @@ class ConferenceRegistrationController < ApplicationController def register # TODO Figure out how to change the route's id from :id to :conference_id @conference = Conference.find_by(short_title: params[:id]) - @workshops = @conference.events.where("require_registration = ? AND state LIKE ?", true, 'confirmed') + @workshops = @conference.events.where('require_registration = ? AND state LIKE ?', + true, 'confirmed') @user = current_user - @registration = @user.registrations.where(:conference_id => @conference.id).first + @registration = @user.registrations.where(conference_id: @conference.id).first @registered = true if @registration.nil? @registered = false - @registration = @user.registrations.new(:conference_id => @conference.id) + @registration = @user.registrations.new(conference_id: @conference.id) end # Check if there's an existing SupporterRegistration for this email and link it when appropriate - @registration.supporter_registration ||= @conference.supporter_registrations.where(:email => @user.email).first - @registration.supporter_registration ||= SupporterRegistration.new(:conference_id => @conference.id) + @registration.supporter_registration ||= @conference.supporter_registrations.where( + email: @user.email).first + @registration.supporter_registration ||= SupporterRegistration.new(conference_id: @conference.id) end # TODO this is ugly def update conference = Conference.find_by(short_title: params[:id]) user = current_user - registration = user.registrations.where(:conference_id => conference.id).first + registration = user.registrations.where(conference_id: conference.id).first update_registration = true # First verify that the supporter code is legit - if !params[:registration][:supporter_registration_attributes].nil? && !params[:registration][:supporter_registration_attributes][:code].empty? - regs = conference.supporter_registrations.where(:code => params[:registration][:supporter_registration_attributes][:code]) + if !params[:registration][:supporter_registration_attributes].nil? && + !params[:registration][:supporter_registration_attributes][:code].empty? + regs = conference.supporter_registrations.where( + code: params[:registration][:supporter_registration_attributes][:code]) if regs.count != 0 - if regs.where(:email => user.email).count == 0 - redirect_to(register_conference_path(:id => conference.short_title), :alert => "This code is already in use. Please contact #{conference.contact_email} for assistance.") + if regs.where(email: user.email).count == 0 + redirect_to(register_conference_path(id: conference.short_title), + alert: "This code is already in use. + Please contact #{conference.contact_email} for assistance.") return end end @@ -46,10 +52,10 @@ class ConferenceRegistrationController < ApplicationController registration = user.registrations.new(registration_params) if conference.use_supporter_levels? && !supporter_reg.nil? if !supporter_reg[:id].blank? - # This means that their supporter registration was entered ahead of time, probably by an admin + # Means that their supporter registration was entered ahead of time, by an admin registration.supporter_registration = SupporterRegistration.find(supporter_reg[:id]) if registration.supporter_registration.email != user.email - raise "Invalid code" + raise 'Invalid code' end else registration.supporter_registration = conference. @@ -63,14 +69,15 @@ class ConferenceRegistrationController < ApplicationController registration.update_attributes!(registration_params) end rescue Exception => e - Rails.logger.debug e.backtrace.join("\n") - redirect_to(register_conference_path(:id => conference.short_title), :alert => 'Registration failed:' + e.message) + Rails.logger.debug e.backtrace.join('\n') + redirect_to(register_conference_path(id: conference.short_title), + alert: 'Registration failed:' + e.message) return end - redirect_message = "You are now registered." + redirect_message = 'You are now registered.' if update_registration - redirect_message = "Registration updated." + redirect_message = 'Registration updated.' else # Track ahoy event ahoy.track 'Registered', title: 'New registration' @@ -78,13 +85,14 @@ class ConferenceRegistrationController < ApplicationController Mailbot.registration_mail(conference, current_user).deliver end end - redirect_to(register_conference_path(:id => conference.short_title), :notice => redirect_message) + redirect_to(register_conference_path(id: conference.short_title), + notice: redirect_message) end def unregister conference = Conference.find_by(short_title: params[:id]) user = current_user - registration = user.registrations.where(:conference_id => conference.id).first + registration = user.registrations.where(conference_id: conference.id).first registration.destroy redirect_to :root end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 06a4e967..e19a0a18 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -6,6 +6,7 @@ class RegistrationsController < Devise::RegistrationsController end def update + @openids = Openid.where(user_id: current_user.id).order(:provider) @user = User.find(current_user.id) email_changed = false @@ -20,14 +21,14 @@ class RegistrationsController < Devise::RegistrationsController password_changed = false if !params[:user][:password].nil? if !params[:user][:password].empty? - password_changed = true + password_changed = true else params[:user].delete :password params[:user].delete :password_confirmation end end - if email_changed or password_changed + if email_changed || password_changed successfully_updated = @user.update_with_password(account_update_params) else params[:user].delete :current_password @@ -36,7 +37,7 @@ class RegistrationsController < Devise::RegistrationsController if successfully_updated if email_changed - if !@user.nil? + unless @user.nil? @user.update_attribute('email', params[:user][:email]) end set_flash_message :notice, :update_needs_confirmation @@ -66,7 +67,8 @@ class RegistrationsController < Devise::RegistrationsController def configure_permitted_parameters devise_parameter_sanitizer.for(:account_update) do |u| u. - permit(:email, :password, :password_confirmation, :current_password, :name, :biography) + permit(:email, :password, :password_confirmation, :current_password, :name, :biography, + :nickname, :affiliation) end devise_parameter_sanitizer.for(:sign_up) do |u| u. diff --git a/app/models/conference.rb b/app/models/conference.rb index 53dff803..40e3e181 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -114,7 +114,7 @@ class Conference < ActiveRecord::Base def user_registered? user return nil if user.nil? - if self.registrations.where(user_id: user.id).count == 0 + if registrations.where(user_id: user.id).count == 0 logger.debug("User #{user.email} isn't registered to self.title") return false else diff --git a/app/models/datatable_supporters.rb b/app/models/datatable_supporters.rb index 5cba6c7d..d823d65d 100644 --- a/app/models/datatable_supporters.rb +++ b/app/models/datatable_supporters.rb @@ -4,7 +4,7 @@ class DatatableSupporters < Datatable items.each do |i| item = [] if i.name.blank? - if !i.registration.nil? && !i.registration.user.nil? + unless i.registration.nil? || i.registration.user.nil? item << i.registration.user.name else item << "Unknown" @@ -15,7 +15,7 @@ class DatatableSupporters < Datatable end if i.email.blank? - if !i.registration.nil? && !i.registration.user.nil? + unless i.registration.nil? && i.registration.user.nil? item << i.registration.user.email else item << "Unknown" diff --git a/app/models/email_settings.rb b/app/models/email_settings.rb index fba9686f..532869cc 100644 --- a/app/models/email_settings.rb +++ b/app/models/email_settings.rb @@ -7,46 +7,48 @@ class EmailSettings < ActiveRecord::Base def get_values(conference, user, event = nil) h = { - 'email' => user.email, - 'name' => user.name, - 'conference' => conference.title, - 'registrationlink' => Rails.application.routes.url_helpers.register_conference_url(conference.short_title, host: CONFIG['url_for_emails']) + 'email' => user.email, + 'name' => user.name, + 'conference' => conference.title, + 'registrationlink' => Rails.application.routes.url_helpers.register_conference_url( + conference.short_title, host: CONFIG['url_for_emails']) } if !event.nil? h['eventtitle'] = event.title - h['proposalslink'] = Rails.application.routes.url_helpers.conference_proposal_url(conference.short_title, event, host: CONFIG['url_for_emails']) + h['proposalslink'] = Rails.application.routes.url_helpers.conference_proposal_url( + conference.short_title, event, host: CONFIG['url_for_emails']) end h end def generate_registration_email(conference, user) values = get_values(conference, user) - template = self.registration_email_template + template = registration_email_template parse_template(template, values) end def generate_accepted_email(event) values = get_values(event.conference, event.submitter, event) - template = self.accepted_email_template + template = accepted_email_template parse_template(template, values) end def generate_rejected_email(event) values = get_values(event.conference, event.submitter, event) - template = self.rejected_email_template + template = rejected_email_template parse_template(template, values) end def confirmed_but_not_registered_email(event) values = get_values(event.conference, event.submitter, event) - template = self.confirmed_email_template + template = confirmed_email_template parse_template(template, values) end def parse_template(text, values) values.each do |key, value| - text = text.gsub"{#{key}}", value unless text.blank? + text = text.gsub "{#{key}}", value unless text.blank? end text end diff --git a/app/models/event.rb b/app/models/event.rb index 8f48fdce..85ffa892 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -71,23 +71,23 @@ class Event < ActiveRecord::Base def average_rating @total_rating = 0 - self.votes.each do |vote| + votes.each do |vote| @total_rating = @total_rating + vote.rating end - @total = self.votes.size + @total = votes.size number_with_precision(@total_rating / @total.to_f, precision: 2, strip_insignificant_zeros: true) end def submitter - result = self.event_users.where(event_role: 'submitter').first + result = event_users.where(event_role: 'submitter').first if !result.nil? result.user else user = nil # Perhaps the event_users haven't been saved, if this is a new proposal - self.event_users.each do |p| - if p.event_role == 'submitter' - user = p.user + event_users.each do |u| + if u.event_role == 'submitter' + user = u.user end end user @@ -97,34 +97,34 @@ class Event < ActiveRecord::Base def as_json(options) json = super(options) - if self.room.nil? + if room.nil? json[:room_guid] = nil else - json[:room_guid] = self.room.guid + json[:room_guid] = room.guid end - if self.track.nil? + if track.nil? json[:track_color] = '#ffffff' else - json[:track_color] = self.track.color; + json[:track_color] = track.color end - if self.event_type.nil? + if event_type.nil? json[:length] = 25 else - json[:length] = self.event_type.length + json[:length] = event_type.length end json end def transition_possible?(transition) - self.class.state_machine.events_for(self.current_state).include?(transition) + self.class.state_machine.events_for(current_state).include?(transition) end def process_confirmation - if self.conference.email_settings.send_on_confirmed_without_registration? - if self.conference.registrations.where(:user_id => self.submitter.id).first.nil? + if conference.email_settings.send_on_confirmed_without_registration? + if conference.registrations.where(user_id: submitter.id).first.nil? Mailbot.confirm_reminder_mail(self).deliver end end @@ -147,10 +147,10 @@ class Event < ActiveRecord::Base end def abstract_word_count - if self.abstract.nil? + if abstract.nil? 0 else - self.abstract.split.size + abstract.split.size end end @@ -181,23 +181,19 @@ class Event < ActiveRecord::Base private def abstract_limit - len = self.abstract.split.size - max = self.event_type.maximum_abstract_length - min = self.event_type.minimum_abstract_length + len = abstract.split.size + max = event_type.maximum_abstract_length + min = event_type.minimum_abstract_length if len < min errors.add(:abstract, "cannot have less than #{min} words") end - if len > max - errors.add(:abstract, "cannot have more than #{max} words") - end + errors.add(:abstract, "cannot have more than #{max} words") if len > max end def biography_exists - if self.submitter.biography_word_count == 0 - errors.add(:user_biography, 'must be filled out') - end + errors.add(:user_biography, 'must be filled out') if submitter.biography_word_count == 0 end def generate_guid diff --git a/app/models/user.rb b/app/models/user.rb index 34f1b35b..9f1f69c8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,7 +2,6 @@ class User < ActiveRecord::Base include Gravtastic gravtastic size: 32 - # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, # :lockable, :timeoutable and :omniauthable @@ -54,7 +53,7 @@ class User < ActiveRecord::Base end def get_roles - return self.roles + roles end def setup_role @@ -86,7 +85,7 @@ class User < ActiveRecord::Base end def attended - registrations_attended = self.registrations.where(attended: true) + registrations_attended = registrations.where(attended: true) if registrations_attended.count == 0 'None' else @@ -98,32 +97,31 @@ class User < ActiveRecord::Base !confirmed_at.nil? end - def attending_conference? conference + def attending_conference?(conference) Registration.where(conference_id: conference.id, - user_id: self.id).count + user_id: id).count end - def proposals conference + def proposals(conference) events.where('conference_id = ? AND event_users.event_role=?', conference.id, 'submitter') end - def proposal_count conference + def proposal_count(conference) proposals(conference).count end def biography_word_count - if self.biography.nil? + if biography.nil? 0 else - self.biography.split.size + biography.split.size end end private def biography_limit - if !self.biography.nil? && self.biography.split.size > 150 - errors.add(:abstract, 'cannot have more than 150 words') - end + errors.add(:abstract, 'cannot have more than 150 words') if !biography.nil? && + biography.split.size > 150 end end diff --git a/app/serializers/event_serializer.rb b/app/serializers/event_serializer.rb index 773e0c61..d9e254f5 100644 --- a/app/serializers/event_serializer.rb +++ b/app/serializers/event_serializer.rb @@ -5,7 +5,7 @@ class EventSerializer < ActiveModel::Serializer def date t = object.start_time - t.blank? ? '' : %(#{t.time.strftime('%Y-%m-%dT%H:%M:%S')}#{t.formatted_offset(false)}) + t.blank? ? '' : %{ #{t.time.strftime('%Y-%m-%dT%H:%M:%S')}#{t.formatted_offset(false)} } end def speaker_ids diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index a9737289..88a7c108 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -34,10 +34,10 @@ = event.id %td =link_to event.title, admin_conference_event_path(@conference.short_title, event) - + - if @conference.call_for_papers.rating != 0 %td{:style => "width:96px"} - - if event.average_rating.to_f > 0 + - if event.average_rating.to_f > 0 #{event.average_rating}/#{@conference.call_for_papers.rating} %br #{pluralize(event.voters.length, 'voter')} @@ -52,9 +52,9 @@ 0/#{@conference.call_for_papers.rating} %br - - if event.submitter.registrations.count < 1 + - if event.submitter.registrations.count < 1 - bgcolor="#F7819F" - - else + - else - bgcolor="" %td{:style=>"background-color: #{bgcolor}"} - if !event.submitter.nil? diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index fcfe0e05..aa7bf163 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -1,19 +1,19 @@ .row .col-md-12 - = semantic_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| - = f.inputs :name => "Profile" do - = f.fields_for :user do |u| - = u.input :name, :as => :string - = u.input :nickname, :as => :string - = u.input :affiliation, :as => :string, :hint => "This could be a company, a user group, or nothing at all." - = u.input :biography, :input_html => {:rows => 5, "onkeyup" => "word_count(this, 'biography-count', 150)"} - You have used - %span#biography-count #{current_user.biography_word_count} - words. Biographies are limited to 150 words. - %br - %br - = render :partial => 'devise/registrations/volunteeruser', :locals => {:u => u} - = f.inputs :name => 'OpenID' do + = semantic_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| + = f.inputs name: 'Profile' do + = f.input :name, as: :string + = f.input :nickname, as: :string + = f.input :affiliation, as: :string, + hint: 'This could be a company, a user group, or nothing at all.' + = f.input :biography, input_html: {rows: 5, + 'onkeyup' => "word_count(this, 'biography-count', 150)"} + You have used + %span#biography-count #{current_user.biography_word_count} + words. Biographies are limited to 150 words. + %br + %br + = f.inputs name: 'OpenID' do %h4 Currently using the following openIDs: - @openids.each do |openid| @@ -25,9 +25,10 @@ openID while logged in to OSEM = render 'devise/shared/openid' - = f.inputs :name => "Account" do - = f.input :email, :required => false - = 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"}, :hint => "(we need your current password to confirm password or email changes)" - = f.action :submit, :as => :button, :label => "Update", :button_html => {:class => "btn btn-primary"} + = f.inputs name: 'Account' do + = 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'}, + hint: '(we need your current password to confirm password or email changes)' + = f.action :submit, as: :button, label: 'Update', button_html: {class: 'btn btn-primary'}