diff --git a/app/assets/stylesheets/custom.scss b/app/assets/stylesheets/custom.scss index 4c349ab669..e2f0175741 100644 --- a/app/assets/stylesheets/custom.scss +++ b/app/assets/stylesheets/custom.scss @@ -112,3 +112,7 @@ max-width: 100%; } } + +.cursor-default { + cursor: default !important; +} diff --git a/app/helpers/partners_helper.rb b/app/helpers/partners_helper.rb index 74974649f3..af5e4cf77a 100644 --- a/app/helpers/partners_helper.rb +++ b/app/helpers/partners_helper.rb @@ -50,4 +50,22 @@ def partner_status_badge(partner) tag.span partner.display_status, class: %w(badge badge-pill badge-info bg-info float-right) end end + + def partner_status_label(status) + status_options = { + "uninvited" => {icon: "exclamation-circle"}, + "invited" => {icon: "check", type: "info"}, + "awaiting_review" => {icon: "check", type: "warning"}, + "approved" => {icon: "check", type: "success"}, + "recertification_required" => {icon: "minus", type: "danger"}, + "deactivated" => {icon: "minus", type: "secondary"} + } + return content_tag :span, "Errored", class: "label label-teal" unless status_options[status] + + status_label( + status.humanize, + status_options[status][:icon], + status_options[status][:type] || "default" + ) + end end diff --git a/app/helpers/ui_helper.rb b/app/helpers/ui_helper.rb index 1bce13b10c..aa922dbea9 100644 --- a/app/helpers/ui_helper.rb +++ b/app/helpers/ui_helper.rb @@ -148,6 +148,13 @@ def view_button_to(link, options = {}) _link_to link, { icon: "search", type: "info", text: "View", size: "xs" }.merge(options) end + def status_label(text, icon, type) + css_class = "cursor-default btn btn-xs btn-#{type}" + content_tag :span, class: css_class do + fa_icon icon, text: text + end + end + def invite_button_to(link, options = {}, properties = {}) properties = { method: options[:method]&.to_sym || :post, rel: "nofollow", data: { confirm: options[:confirm] || "Are you sure?" } }.merge(properties) _link_to link, { icon: "envelope", type: "warning", text: "Invite", size: "xs" }.merge(options), properties diff --git a/app/views/partners/_partner_row.html.erb b/app/views/partners/_partner_row.html.erb index 932f508bd7..c66b6eec3b 100644 --- a/app/views/partners/_partner_row.html.erb +++ b/app/views/partners/_partner_row.html.erb @@ -7,22 +7,7 @@ <%= partner_row.partner_group&.name %> <%= partner_row.quota %> - <% case status %> - <% when "uninvited" %> - <%= view_button_to "#", { text: "Uninvited", icon: "exclamation-circle" } %> - <% when "invited" %> - <%= view_button_to "#", { text: "#{status.humanize}", icon: "check", class: "w-100" } %> - <% when "awaiting_review" %> - <%= view_button_to "#", { text: "#{status.humanize}", icon: "check", type: "warning", class: "w-100" } %> - <% when "approved" %> - <%= view_button_to "#", { text: "#{status.humanize}", icon: "check", type: "success", class: "w-100" } %> - <% when "recertification_required" %> - <%= view_button_to "#", { text: "#{status.humanize}", icon: "minus", type: "danger", class: "w-100" } %> - <% when "deactivated" %> - <%= view_button_to "#", { text: "#{status.humanize}", icon: "minus", type: "secondary", class: "w-100" } %> - <% else %> - Errored - <% end %> + <%= partner_status_label(status) %> <% case status %>