Module: Admin::FeedbackHelper
- Defined in:
- app/helpers/admin/feedback_helper.rb
Instance Method Summary collapse
- #button_to_conversation(item) ⇒ Object
- #button_to_delete_comment(item) ⇒ Object
- #button_to_edit_comment(item) ⇒ Object
- #change_status(item, context = "listing") ⇒ Object
- #comment_class(state) ⇒ Object
- #show_feedback_actions(item, context = "listing") ⇒ Object
Instance Method Details
#button_to_conversation(item) ⇒ Object
35 36 37 38 39 |
# File 'app/helpers/admin/feedback_helper.rb', line 35 def (item) link_to(t("generic.conversation"), { controller: "admin/feedback", action: "article", id: item.article_id }, { class: "btn btn-default btn-xs btn-action" }) end |
#button_to_delete_comment(item) ⇒ Object
29 30 31 32 33 |
# File 'app/helpers/admin/feedback_helper.rb', line 29 def (item) link_to(t("generic.delete"), { controller: "admin/feedback", action: "destroy", id: item.id }, { class: "btn btn-danger btn-xs btn-action" }) end |
#button_to_edit_comment(item) ⇒ Object
23 24 25 26 27 |
# File 'app/helpers/admin/feedback_helper.rb', line 23 def (item) link_to(t("generic.edit"), { controller: "admin/feedback", action: "edit", id: item.id }, { class: "btn btn-primary btn-xs btn-action" }) end |
#change_status(item, context = "listing") ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/helpers/admin/feedback_helper.rb', line 41 def change_status(item, context = "listing") spammy = item.state.to_s.downcase.include? "spam" link_text = spammy ? t("generic.mark_as_ham") : t("generic.mark_as_spam") = spammy ? "success" : "warning" link_to(link_text, { controller: "admin/feedback", action: "change_state", id: item.id, context: context }, { class: "btn btn-#{} btn-xs btn-action", method: :post, remote: true }) end |
#comment_class(state) ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/helpers/admin/feedback_helper.rb', line 4 def comment_class(state) return "label-info" if state.to_s.casecmp("presumed_ham").zero? return "label-warning" if state.to_s.casecmp("presumed_spam").zero? return "label-success" if state.to_s.casecmp("ham").zero? "label-danger" end |
#show_feedback_actions(item, context = "listing") ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'app/helpers/admin/feedback_helper.rb', line 12 def show_feedback_actions(item, context = "listing") return unless can? :manage, "admin/feedback" safe_join [ change_status(item, context), (item), (item), (item) ], " " end |