diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index e08ddde7..301dd585 100644 --- a/app/controllers/admin/events_controller.rb +++ b/app/controllers/admin/events_controller.rb @@ -103,7 +103,7 @@ module Admin comment.commentable = @event comment.user_id = current_user.id comment.save! - if !params[:parent].nil? + unless params[:parent].nil? comment.move_to_child_of(params[:parent]) end @@ -202,7 +202,7 @@ module Admin def get_event @event = @conference.program.events.find(params[:id]) - if !@event + unless @event redirect_to admin_conference_program_events_path(conference_id: @conference.short_title), error: 'Error! Could not find event!' return diff --git a/app/controllers/admin/questions_controller.rb b/app/controllers/admin/questions_controller.rb index 51eefb8a..701f1fb2 100644 --- a/app/controllers/admin/questions_controller.rb +++ b/app/controllers/admin/questions_controller.rb @@ -67,7 +67,7 @@ module Admin def destroy if can? :destroy, @question # Do not delete global questions - if !@question.global + unless @question.global # Delete question and its answers begin diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8fdc2a0d..68b88cce 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -47,7 +47,7 @@ class ApplicationController < ActionController::Base rescue_from CanCan::AccessDenied do |exception| Rails.logger.debug "Access denied on #{exception.action} #{exception.subject.inspect}" message = exception.message - message << ' Maybe you need to sign in?' if !current_user + message << ' Maybe you need to sign in?' unless current_user redirect_to root_path, alert: message end diff --git a/app/controllers/conference_registrations_controller.rb b/app/controllers/conference_registrations_controller.rb index 2fb080aa..95e5c447 100644 --- a/app/controllers/conference_registrations_controller.rb +++ b/app/controllers/conference_registrations_controller.rb @@ -52,7 +52,7 @@ class ConferenceRegistrationsController < ApplicationController ahoy.track 'Registered', title: 'New registration' # Sign in the new user - if !current_user + unless current_user sign_in(@registration.user) end @@ -96,7 +96,7 @@ class ConferenceRegistrationsController < ApplicationController def set_registration @registration = Registration.find_by(conference: @conference, user: current_user) - if !@registration + unless @registration redirect_to new_conference_conference_registration_path(@conference.short_title), error: "Can't find a registration for #{@conference.title} for you. Please register." end diff --git a/app/models/conference.rb b/app/models/conference.rb index 6d35946b..9079bd71 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -551,7 +551,7 @@ class Conference < ActiveRecord::Base result[state.name] = count end - if !conference.events_per_week + unless conference.events_per_week conference.events_per_week = {} end @@ -692,7 +692,7 @@ class Conference < ActiveRecord::Base events_per_week.each do |week, values| values.each do |state, value| if [:confirmed, :unconfirmed].include?(state) - if !result[state.to_s.capitalize] + unless result[state.to_s.capitalize] result[state.to_s.capitalize] = {} end result[state.to_s.capitalize][week.strftime('%W').to_i] = value @@ -768,7 +768,7 @@ class Conference < ActiveRecord::Base def assert_keys_are_continuously(hash) keys = hash.keys (keys.min..keys.max).each do |key| - if !hash[key] + unless hash[key] hash[key] = 0 end end @@ -1004,7 +1004,7 @@ class Conference < ActiveRecord::Base # Adds a random color to the conference # def add_color - if !color + unless color self.color = get_color end end diff --git a/app/models/contact.rb b/app/models/contact.rb index c2e3fd2d..9f0b8c0f 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -7,7 +7,7 @@ class Contact < ActiveRecord::Base format: URI::regexp(%w(http https)), allow_blank: true def has_social_media? - return true if !facebook.blank? || !twitter.blank? || !googleplus.blank? || !instagram.blank? || !email.blank? + return true if facebook.present? || twitter.present? || googleplus.present? || instagram.present? || email.present? false end end diff --git a/app/models/event.rb b/app/models/event.rb index 0202613c..676bbd26 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -115,9 +115,7 @@ class Event < ActiveRecord::Base def submitter result = event_users.where(event_role: 'submitter').first - if !result.nil? - result.user - else + if result.nil? user = nil # Perhaps the event_users haven't been saved, if this is a new proposal event_users.each do |u| @@ -126,6 +124,8 @@ class Event < ActiveRecord::Base end end user + else + result.user end end @@ -281,7 +281,7 @@ class Event < ActiveRecord::Base def generate_guid loop do @guid = SecureRandom.urlsafe_base64 - break if !self.class.where(guid: guid).any? + break unless self.class.where(guid: guid).any? end self.guid = @guid end diff --git a/app/models/venue.rb b/app/models/venue.rb index d0f5a005..aa65816c 100644 --- a/app/models/venue.rb +++ b/app/models/venue.rb @@ -44,7 +44,7 @@ class Venue < ActiveRecord::Base def generate_guid loop do @guid = SecureRandom.urlsafe_base64 - break if !Venue.where(guid: guid).any? + break unless Venue.where(guid: guid).any? end self.guid = @guid end diff --git a/app/views/admin/events/_proposal.html.haml b/app/views/admin/events/_proposal.html.haml index 03b0f07a..04405676 100644 --- a/app/views/admin/events/_proposal.html.haml +++ b/app/views/admin/events/_proposal.html.haml @@ -106,13 +106,13 @@ %td = @event.language - - if !@event.room.nil? + - unless @event.room.nil? %tr %td %b Room %td = @event.room.name - - if !@event.start_time.nil? + - unless @event.start_time.nil? %tr %td %b Scheduled time diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index 66e1d2f0..b7bb2b21 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -62,7 +62,7 @@ - bgcolor="" %td{:style=>"background-color: #{bgcolor}"} - if @program.show_voting? - - if !event.submitter.nil? + - unless event.submitter.nil? =link_to event.submitter.name, admin_user_path(event.submitter) - if event.submitter.registrations.count < 1 (Unregistered!) diff --git a/app/views/admin/events/show.html.haml b/app/views/admin/events/show.html.haml index 5508f2be..9372ecbf 100644 --- a/app/views/admin/events/show.html.haml +++ b/app/views/admin/events/show.html.haml @@ -23,7 +23,7 @@ - @event.versions.each do |version| %tr %td - - if !version.whodunnit.nil? + - unless version.whodunnit.nil? = User.find(version.whodunnit).name - else No user (probably via the console) @@ -35,4 +35,3 @@ - version.changeset.each_key do |key| = "#{key}: #{version.changeset[key][0]} -> #{version.changeset[key][1]}" %br - diff --git a/app/views/admin/lodgings/index.html.haml b/app/views/admin/lodgings/index.html.haml index 1f3a89fb..1d81c2d1 100644 --- a/app/views/admin/lodgings/index.html.haml +++ b/app/views/admin/lodgings/index.html.haml @@ -10,7 +10,7 @@ - slice.each do |lodging| .col-md-4 .thumbnail - - if !lodging.picture? + - unless lodging.picture? %p.text-center %i.fa.fa-home.fa-5x - else diff --git a/app/views/conference/_conference_details.html.haml b/app/views/conference/_conference_details.html.haml index b0f4a02d..d7a2e02b 100644 --- a/app/views/conference/_conference_details.html.haml +++ b/app/views/conference/_conference_details.html.haml @@ -13,7 +13,7 @@ - if conference.venue %p = "#{conference.venue.city}/#{conference.venue.country_name}" - - if !conference.description.blank? + - unless conference.description.blank? %p = markdown(conference.description) .col-md-2 diff --git a/app/views/conference/_lodging.html.haml b/app/views/conference/_lodging.html.haml index ca30edc0..1f87f442 100644 --- a/app/views/conference/_lodging.html.haml +++ b/app/views/conference/_lodging.html.haml @@ -13,7 +13,7 @@ - slice.each do |lodging| .col-md-4.col-sm-4.ticket.col-centered.col-top .thumbnail - - if !lodging.picture? + - unless lodging.picture? %p.text-center %i.fa.fa-home.fa-5x - else diff --git a/app/views/conference_registrations/_form.html.haml b/app/views/conference_registrations/_form.html.haml index 2d85b50d..971a613f 100644 --- a/app/views/conference_registrations/_form.html.haml +++ b/app/views/conference_registrations/_form.html.haml @@ -7,7 +7,7 @@ = @conference.title .row .col-md-8 - - if !current_user + - unless current_user %legend %span =link_to('#signup', role: 'tab', "aria-controls" => "home", "data-toggle" => "tab") do diff --git a/app/views/conference_registrations/_ticket.html.haml b/app/views/conference_registrations/_ticket.html.haml index e8ac5510..7e240a41 100644 --- a/app/views/conference_registrations/_ticket.html.haml +++ b/app/views/conference_registrations/_ticket.html.haml @@ -5,7 +5,7 @@ %h4.media-heading = ticket.title %h5.media-heading - -if !ticket.description.blank? + -unless ticket.description.blank? = markdown(ticket.description) %td.col-sm-1.col-md-1 = text_field_tag("tickets[][#{ticket.id}]", 0, type: 'number', min: 0, diff --git a/app/views/proposal/new.html.haml b/app/views/proposal/new.html.haml index 03d246de..658afa18 100644 --- a/app/views/proposal/new.html.haml +++ b/app/views/proposal/new.html.haml @@ -8,7 +8,7 @@ = render partial: 'encouragement_text' .row .col-md-8 - - if !current_user + - unless current_user %legend %span =link_to('#signup', role: 'tab', 'aria-controls' => 'home', 'data-toggle' => 'tab') do diff --git a/app/views/tickets/_ticket.html.haml b/app/views/tickets/_ticket.html.haml index c31703b3..1a93f46b 100644 --- a/app/views/tickets/_ticket.html.haml +++ b/app/views/tickets/_ticket.html.haml @@ -5,7 +5,7 @@ %h4.media-heading = ticket.title %h5.media-heading - -if !ticket.description.blank? + - unless ticket.description.blank? = markdown(ticket.description) %td.col-sm-1.col-md-1 - if ticket.bought?(current_user)