Sha256: 44e040bf41148dc8e487a2ba159738c78dd65527a84d6407e9f1c3e61784e8a9
Contents?: true
Size: 1.37 KB
Versions: 4
Compression:
Stored size: 1.37 KB
Contents
module AbAdmin module Views module Helpers def admin? user_signed_in? && current_user.admin? end def moderator? user_signed_in? && current_user.moderator? end def as_html(text) return ''.html_safe if text.nil? Nokogiri::HTML.fragment(text).to_html.html_safe end def full_locale case I18n.locale when :en 'en_US' when :ru 'ru_RU' when :it 'it_IT' when :uk 'uk_UA' else 'ru_RU' end end def locale_path I18n.locale == I18n.default_locale ? '' : "/#{I18n.locale}" end def skype_link(skype, options={}) return '' if skype.blank? link_to skype, "skype:#{skype.strip}?chat", options end def init_js(js, delayed: false) if delayed @delayed_js ||= [] @delayed_js << js nil else %Q[<script type='text/javascript'>$(function(){#{js}})</script>].html_safe end end def render_delayed_js return if @delayed_js.blank? %Q[<script type='text/javascript'>$(function(){#{@delayed_js.join(';')}})</script>].html_safe end def image_tag_if(image, options={}) return unless image image_tag image, options end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ab_admin-0.8.3 | lib/ab_admin/views/helpers.rb |
ab_admin-0.8.2 | lib/ab_admin/views/helpers.rb |
ab_admin-0.8.1 | lib/ab_admin/views/helpers.rb |
ab_admin-0.8.0 | lib/ab_admin/views/helpers.rb |