peractus_app/app/helpers/application_helper.rb
Nicolas Bally a5cfbad091 initial
2018-08-06 16:55:14 +02:00

34 lines
901 B
Ruby

module ApplicationHelper
def edit_watcher(element_type, element_id, key='' )
raw ('<script type="text/javascript">')+("edit_watcher('"+element_type+"', '"+element_id.to_s+"','"+key+"');")+("setInterval(function(){ edit_watcher('"+element_type+"', '"+element_id.to_s+"','"+key+"');}, 1000);")+('</script><div id="edit_watcher_result"></div>')
end
def hashtag_link(hash)
link_to " ##{hash} ", hashtag_public_image_actu_path(hash.to_slug), :target => "_blank"
end
def parse_hashtag(text)
text.gsub(Hashtag::REGEX) {hashtag_link($1)}
end
def flash_js
r = raw ("$('#flashs').append('"+ escape_javascript(bootstrap_flash) +"');flash_delay();")
flash[:notice] = nil
flash[:error] = nil
flash[:success] = nil
r
end
def forum_avatar_url(user)
if user
user.avatar_url
else
"/default_avatar.png"
end
end
end