add documentation for each helper

This commit is contained in:
hitman 2017-03-07 01:42:33 +05:30 committed by Stella Rouzi
parent 5dece1ea48
commit a5d637fcf1
3 changed files with 11 additions and 12 deletions

View file

@ -1,4 +1,5 @@
module ApplicationHelper module ApplicationHelper
# Including custom made helpers
include DateTimeHelper include DateTimeHelper
include FormatHelper include FormatHelper
include EventsHelper include EventsHelper
@ -34,15 +35,6 @@ module ApplicationHelper
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 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']
redirect_to :back
else
redirect_to options, response_status
end
end
def tracks(conference) def tracks(conference)
all = conference.program.tracks.map {|t| t.name} all = conference.program.tracks.map {|t| t.name}
first = all[0...-1] first = all[0...-1]

View file

@ -1,9 +1,8 @@
module DateTimeHelper module DateTimeHelper
## ##
<<<<<<< HEAD
# Includes functions related to date or time manipulations # Includes functions related to date or time manipulations
## ##
======= ##
# Returns a string build from the start and end date of the given conference. # Returns a string build from the start and end date of the given conference.
# #
# If the conference is only one day long # If the conference is only one day long
@ -38,7 +37,6 @@ module DateTimeHelper
result result
end end
>>>>>>> refractor code into different files
## ##
# Gets an EventType object, and returns its length in timestamp format (HH:MM) # Gets an EventType object, and returns its length in timestamp format (HH:MM)
# ====Gets # ====Gets

View file

@ -30,4 +30,13 @@ module PathsHelper
return '' return ''
end end
end 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']
redirect_to :back
else
redirect_to options, response_status
end
end
end end