module Rostra
module ApplicationHelper
# If you don't need to make any changes, you can delete this file.
#
# Include base helper methods required for Rostra views. You probably don't want to remove
# this line but you can add/override rostra methods in this file. The helpers which you may
# need to override are listed below. Just un-comment them and make changes.
#
include Rostra::Base::ApplicationHelper
# If you want to user helper methods defined elsewhere in your app, you can include them here
# as well. For example:
#
# include MainAppHelper
# Snippet used to share a question on Twitter.
#
# def twitter_sharing_link
# raw %{
#
#
# }
# end
# Snippet used to share a question on Facebook.
#
# def facebook_sharing_link
# raw %{
#
#
# }
# end
# Creates a list of tags linking to the index showing only questions with that tag
#
# def tag_list(question)
# tags = question.tags.map { |tag| link_to tag, questions_path(:tag_search => "#{tag}")}.join
# content_tag :div, "Tags: #{tags}".html_safe, class: 'tags'
# end
# Finds the url to the user's avatar following this logic:
#
# 1. Calls avatar on the user object
# 2. Uses the users email address to look for a gravatar
# 3. Renders app/assets/images/rostra/anonymous_avatar.png
#
# def rostra_user_avatar(user)
# if user.respond_to?(:avatar)
# url = user.avatar
# else
# default_url = "#{main_app.root_url}assets/rostra/anonymous_avatar.png"
# gravatar_id = Digest::MD5.hexdigest(user.rostra_user_email.downcase)
# url = "http://gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{CGI.escape(default_url)}"
# end
# image_tag(url, class: 'avatar')
# end
# Used to populate both the title and h1 elements for each page.
#
# def page_title_helper
# case "#{controller_name}##{action_name}"
# when "questions#show" then @question.title
# when "questions#index" then
# if params[:tag_search].present?
# "Recent Questions for tag #{params[:tag_search]}"
# else
# "Recent Questions"
# end
# when "questions#new" then "Post a new question"
# when "questions#edit" then "Editing question"
# when "answers#edit" then "Editing answer"
# else "Recent Questions"
# end
# end
end
end