Module: Elabs::ActsHelper
- Defined in:
- app/helpers/elabs/acts_helper.rb
Instance Method Summary collapse
Instance Method Details
#act_action(action) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'app/helpers/elabs/acts_helper.rb', line 3 def act_action(action) actions = { create: _('created'), update: _('updated'), lock: _('locked'), unlock: _('unlocked'), publish: _('published'), unpublish: _('removed from publication') }.freeze actions[action.to_sym] || "[missing: #{action}]" end |
#act_notice_string(act, include_link = true) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/elabs/acts_helper.rb', line 15 def act_notice_string(act, include_link = true) type = act.content_type.demodulize title = act.content.title_to_display string = if %w[unpublish destroy lock].include?(act.event) || !include_link format('%<type>s "%<title>s"', type: type, title: title) else format('%<type>s "%<link>s"', type: type, link: link_to(title, act.content)) end format(_('%<string>s has been %<event>s'), string: string, event: act_action(act.event)).html_safe end |