mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-16 05:04:03 +00:00
style: if ! changed by unless
- if ! changed by unless as it is more readable - !object.blank? is equivalent to object.present?, also more readable
This commit is contained in:
parent
96155eb87f
commit
7e5d20c89d
18 changed files with 27 additions and 28 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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!)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue