apply StringLiterals cop (remove double quotes, unless there is string interpolation)

This commit is contained in:
Stella Rouzi 2014-08-18 21:54:43 +03:00
parent f91467a00a
commit b7c45718d8
45 changed files with 275 additions and 109 deletions

View file

@ -92,17 +92,17 @@ module ApplicationHelper
def getdatetime(registration, field)
if registration.send(field.to_sym).kind_of?(String)
DateTime.parse(registration.send(field.to_sym)).strftime("%d %b %H:%M") if registration.send(field.to_sym)
DateTime.parse(registration.send(field.to_sym)).strftime('%d %b %H:%M') if registration.send(field.to_sym)
else
registration.send(field.to_sym).strftime("%d %b %H:%M") if registration.send(field.to_sym)
registration.send(field.to_sym).strftime('%d %b %H:%M') if registration.send(field.to_sym)
end
end
def getdate(var)
if var.kind_of?(String)
DateTime.parse(var).strftime("%a, %d %b")
DateTime.parse(var).strftime('%a, %d %b')
else
var.strftime("%a, %d %b")
var.strftime('%a, %d %b')
end
end
@ -122,24 +122,24 @@ module ApplicationHelper
end
def pre_registered(event)
@conference.events.joins(:registrations).where("events.id = ?", event.id)
@conference.events.joins(:registrations).where('events.id = ?', event.id)
end
def add_association_link(association_name, form_builder, div_class, html_options = {})
link_to_add_association "Add " + association_name.to_s.singularize, form_builder, div_class, html_options.merge(class: "assoc btn btn-success")
link_to_add_association 'Add ' + association_name.to_s.singularize, form_builder, div_class, html_options.merge(class: 'assoc btn btn-success')
end
def remove_association_link(association_name, form_builder)
link_to_remove_association("Remove " + association_name.to_s.singularize, form_builder, class: "assoc btn btn-danger") + tag(:hr)
link_to_remove_association('Remove ' + association_name.to_s.singularize, form_builder, class: 'assoc btn btn-danger') + tag(:hr)
end
def dynamic_association(association_name, title, form_builder, options = {})
render "shared/dynamic_association", association_name: association_name, title: title, f: form_builder, hint: options[:hint]
render 'shared/dynamic_association', association_name: association_name, title: title, f: form_builder, hint: options[:hint]
end
# Same as redirect_to(:back) if there is a valid HTTP referer, otherwise redirect_to()
def redirect_back_or_to(options = {}, response_status = {})
if request.env["HTTP_REFERER"]
if request.env['HTTP_REFERER']
redirect_to(:back)
else
redirect_to(options, response_status)
@ -148,7 +148,7 @@ module ApplicationHelper
# TODO Output better html
def format_comments(comment, padding = 0)
result = ""
result = ''
result += "<div style='padding-left:#{padding}px'>"
result += "<div class='well'>"
result += "<b>#{comment.user.name}</b> <i>#{comment.created_at}</i><br><br>"
@ -160,12 +160,12 @@ module ApplicationHelper
result += "<input name='authenticity_token' type='hidden' value='#{form_authenticity_token}' />"
result += "<textarea name='comment'></textarea>"
result += "<button class='btn btn-primary pull-right' name='button' type='submit'>Add Reply</button>"
result += "</form></div></div>"
result += "</div>"
result += '</form></div></div>'
result += '</div>'
#result += edit_admin_conference_event_path(@conference.short_title, @event)
comment.children.each do |child|
result += format_comments(child, 50)
result += "</div>"
result += '</div>'
end
result
@ -181,7 +181,7 @@ module ApplicationHelper
markdown.render(text).html_safe
end
def markdown_hint(text="")
def markdown_hint(text='')
markdown("#{text} Please look at #{link_to '**Markdown Syntax**', 'https://daringfireball.net/projects/markdown/syntax', target: '_blank'} to format your text")
end