Use boolean comparators where it makes sense

This commit is contained in:
wvengen 2015-01-14 21:15:08 +01:00
parent dbdc7ae4aa
commit 118886344a
28 changed files with 60 additions and 60 deletions

View file

@ -10,7 +10,7 @@ class MessagesController < ApplicationController
# Creates a new message object.
def new
@message = Message.new(params[:message])
if @message.reply_to and not @message.reply_to.is_readable_for?(current_user)
if @message.reply_to && !@message.reply_to.is_readable_for?(current_user)
redirect_to new_message_url, alert: 'Nachricht ist privat!'
end
end

View file

@ -6,7 +6,7 @@ module FoodsoftMessages
# modify user presentation link to writing a message for the user
def show_user_link(user=@current_user)
if user.nil? or not FoodsoftMessages.enabled?
if user.nil? || !FoodsoftMessages.enabled?
show_user user
else
link_to show_user(user), new_message_path('message[mail_to]' => user.id),

View file

@ -4,7 +4,7 @@ require "foodsoft_uservoice/engine"
module FoodsoftUservoice
# enabled when configured, but can still be disabled by use_uservoice option
def self.enabled?
FoodsoftConfig[:use_uservoice] != false and FoodsoftConfig[:uservoice]
FoodsoftConfig[:use_uservoice] != false && FoodsoftConfig[:uservoice]
end
module LoadUservoice

View file

@ -84,7 +84,7 @@ class PagesController < ApplicationController
else
if @page.save
@page.parent_id = parent_id if (!params[:parent_id].blank? \
and params[:parent_id] != @page_id)
&& params[:parent_id] != @page_id)
flash[:notice] = I18n.t('pages.update.notice')
redirect_to wiki_page_path(@page.permalink)
else

View file

@ -62,7 +62,7 @@ module PagesHelper
def parent_pages_to_select(current_page)
unless current_page.homepage? # Homepage is the page trees root!
Page.non_redirected.reject { |p| p == current_page or p.ancestors.include?(current_page) }
Page.non_redirected.reject { |p| p == current_page || p.ancestors.include?(current_page) }
else
Array.new
end

View file

@ -1,7 +1,7 @@
- content = wikified_body @page.body, @page.title
- toc = generate_toc @page.body
- unless toc.blank? or params[:preview]
- unless toc.blank? || params[:preview]
- content_for :sidebar do
#wikitoc.well.well-small
%h3= t '.title_toc'