Module: BugReportsClient::BugReportsHelper
- Defined in:
- app/helpers/bug_reports_client/bug_reports_helper.rb
Overview
View helpers for the engine's own pages, plus bug_report_alerts which is
exposed to host layouts so resolved-report notifications can be rendered
with a single line: <%= bug_report_alerts %>
Instance Method Summary collapse
-
#brc_input_classes ⇒ Object
Shared input styling for the default form - one place to tweak the look of every generated field.
- #brc_label_classes ⇒ Object
-
#bug_report_alerts ⇒ Object
Renders dismissable "your report has been resolved" alerts for the signed-in user.
-
#report_type_pill_class(active, type = nil) ⇒ Object
Pill used for the type filter (All types / Bugs / Features).
Instance Method Details
#brc_input_classes ⇒ Object
Shared input styling for the default form - one place to tweak the look of every generated field.
34 35 36 37 38 |
# File 'app/helpers/bug_reports_client/bug_reports_helper.rb', line 34 def brc_input_classes "w-full rounded-lg border border-slate-300 bg-white px-3 py-2 text-sm text-slate-900 " \ "placeholder:text-slate-400 focus:border-slate-500 focus:outline-none focus:ring-1 focus:ring-slate-500 " \ "disabled:bg-slate-100 disabled:text-slate-500" end |
#brc_label_classes ⇒ Object
40 41 42 |
# File 'app/helpers/bug_reports_client/bug_reports_helper.rb', line 40 def brc_label_classes "block text-xs font-medium text-slate-500 uppercase tracking-wide mb-1" end |
#bug_report_alerts ⇒ Object
Renders dismissable "your report has been resolved" alerts for the signed-in user. Returns nil quickly when signed out or nothing resolved, so it is safe on every page including public ones.
9 10 11 12 13 14 15 16 17 |
# File 'app/helpers/bug_reports_client/bug_reports_helper.rb', line 9 def bug_report_alerts user = alerts_user return if user.nil? resolved = BugReportsClient::BugReport.where(user: user).resolved_and_undismissed.order(created_at: :desc) return if resolved.empty? render "bug_reports_client/shared/alerts", resolved_bug_reports: resolved end |
#report_type_pill_class(active, type = nil) ⇒ Object
Pill used for the type filter (All types / Bugs / Features). When active, each type carries its own accent colour to match the row badges.
21 22 23 24 25 26 27 28 29 30 |
# File 'app/helpers/bug_reports_client/bug_reports_helper.rb', line 21 def report_type_pill_class(active, type = nil) base = "inline-flex items-center gap-1 px-3 py-1 rounded-full border text-sm font-medium transition-colors" return "#{base} bg-white text-slate-500 border-slate-200 hover:text-slate-700 hover:border-slate-300" unless active case type when "bug" then "#{base} bg-rose-100 text-rose-700 border-rose-200" when "feature" then "#{base} bg-indigo-100 text-indigo-700 border-indigo-200" else "#{base} bg-slate-700 text-white border-slate-700" end end |