Module: Card::Set::All::Notify::BaseViews::Format
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb
Instance Method Summary collapse
-
#active_notice(key) ⇒ Object
-
#edit_info_for(field, action) ⇒ Object
-
#follow_option_card ⇒ Object
-
#followed_set_card ⇒ Object
-
#live_follow_rule_name ⇒ Object
-
#name_before_action(action) ⇒ Object
-
#notification_act(act = nil) ⇒ Object
-
#notification_action(action_id) ⇒ Object
-
#notification_action_label(action) ⇒ Object
-
#relevant_fields(action) ⇒ Object
-
#view: followed ⇒ Object
-
#view: follower ⇒ Object
-
#view: last_action_verb ⇒ Object
-
#view: list_of_changes ⇒ Object
-
#view: subedit_notice ⇒ Object
-
#view: subedits ⇒ Object
-
#view: unfollow_url ⇒ Object
-
#wrap_list(list) ⇒ Object
-
#wrap_list_item(item) ⇒ Object
-
#wrap_subedit_item ⇒ Object
-
#wrap_subedits ⇒ Object
Instance Method Details
#active_notice(key) ⇒ Object
82 83 84 85 86 87 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 82 def active_notice key @active_notice ||= inherit :active_notice return unless @active_notice @active_notice[key] end |
#edit_info_for(field, action) ⇒ Object
95 96 97 98 99 100 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 95 def edit_info_for field, action return nil unless (value = action.value field) value = action.previous_value(field) if action.action_type == :delete wrap_list_item " #{notification_action_label action} #{field}: #{value}" end |
#follow_option_card ⇒ Object
76 77 78 79 80 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 76 def follow_option_card return unless (option_name = active_notice(:follow_option)) Card.fetch option_name end |
#followed_set_card ⇒ Object
72 73 74 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 72 def followed_set_card (set_name = active_notice(:followed_set)) && Card.fetch(set_name) end |
#live_follow_rule_name ⇒ Object
89 90 91 92 93 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 89 def live_follow_rule_name return unless (set_card = followed_set_card) && (follower = active_notice(:follower)) set_card.follow_rule_name follower end |
#name_before_action(action) ⇒ Object
68 69 70 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 68 def name_before_action action (action.value(:name) && action.previous_value(:name)) || card.name end |
#notification_act(act = nil) ⇒ Object
128 129 130 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 128 def notification_act act=nil @notification_act ||= act || card.acts.last end |
#notification_action(action_id) ⇒ Object
132 133 134 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 132 def notification_action action_id action_id ? Action.fetch(action_id) : card.last_action end |
#notification_action_label(action) ⇒ Object
102 103 104 105 106 107 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 102 def notification_action_label action case action.action_type when :update then "new" when :delete then "deleted" end end |
#relevant_fields(action) ⇒ Object
60 61 62 63 64 65 66 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 60 def relevant_fields action case action.action_type when :create then %i[cardtype content] when :update then %i[name cardtype content] when :delete then %i[content] end end |
#view: followed ⇒ Object
36 37 38 39 40 41 42 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 36 view :followed, perms: :none, compact: true do if (set_card = followed_set_card) && (option_card = follow_option_card) option_card.description set_card else "*followed set of cards*" end end |
#view: follower ⇒ Object
44 45 46 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 44 view :follower, perms: :none, compact: true do active_notice(:follower) || "follower" end |
#view: last_action_verb ⇒ Object
48 49 50 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 48 view :last_action_verb, cache: :never do "#{notification_act&.main_action&.action_type || 'edite'}d" end |
#view: list_of_changes ⇒ Object
9 10 11 12 13 14 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 9 view :list_of_changes, denial: :blank, cache: :never do action = notification_action voo.action_id relevant_fields(action).map do |type| edit_info_for(type, action) end.compact.join end |
#view: subedit_notice ⇒ Object
28 29 30 31 32 33 34 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 28 view :subedit_notice, cache: :never do action = notification_action voo.action_id wrap_subedit_item do %(#{name_before_action action} #{action.action_type}d\n) + render_list_of_changes(action_id: action.id) end end |
#view: subedits ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 16 view :subedits, perms: :none, cache: :never do return unless notification_act wrap_subedits do notification_act.actions_affecting(card).map do |action| next if action.card_id == card.id action.card.format(format: @format).render_subedit_notice action_id: action.id end end end |
#view: unfollow_url ⇒ Object
52 53 54 55 56 57 58 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 52 view :unfollow_url, perms: :none, compact: true, cache: :never do return "" unless (rule_name = live_follow_rule_name) card_url path(mark: [active_notice(:follower), :follow].cardname, action: :update, card: { subcards: { rule_name => :never.cardname } }) end |
#wrap_list(list) ⇒ Object
116 117 118 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 116 def wrap_list list "\n#{list}\n" end |
#wrap_list_item(item) ⇒ Object
120 121 122 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 120 def wrap_list_item item "#{item}\n" end |
#wrap_subedit_item ⇒ Object
124 125 126 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 124 def wrap_subedit_item "\n#{yield}\n" end |
#wrap_subedits ⇒ Object
109 110 111 112 113 114 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/all/notify/base_views.rb', line 109 def wrap_subedits subedits = yield.compact.join return "" if subedits.blank? "\nThis update included the following changes:\n#{wrap_list subedits}" end |