summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorIllya Klymov <xanf@xanf.me>2019-04-19 12:44:21 +0300
committerIllya Klymov <xanf@xanf.me>2019-07-24 07:33:08 +0300
commita6ac0a2765f07348f618076b8e550e29c9675b77 (patch)
treec676b9deb087388c6cb234e00a2b4a3b7308d286 /app/helpers
parentc47412d48369c5e2becb2a7ce786aac73d0b325c (diff)
downloadgitlab-ce-a6ac0a2765f07348f618076b8e550e29c9675b77.tar.gz
Add links in admin area overviewce-xanf-add-admin-area-links
Introduces new `feature_entry` helper for dashboard. This helper reduces code duplication when listing available features and relevant links to configuration sections
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/dashboard_helper.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb
index 42732eb93dd..d71af08a656 100644
--- a/app/helpers/dashboard_helper.rb
+++ b/app/helpers/dashboard_helper.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true
module DashboardHelper
+ include IconsHelper
+
def assigned_issues_dashboard_path
issues_dashboard_path(assignee_username: current_user.username)
end
@@ -25,6 +27,19 @@ module DashboardHelper
false
end
+ def feature_entry(title, href: nil, enabled: true)
+ enabled_text = enabled ? 'on' : 'off'
+ label = "#{title}: status #{enabled_text}"
+ link_or_title = href && enabled ? tag.a(title, href: href) : title
+
+ tag.p(aria: { label: label }) do
+ concat(link_or_title)
+ concat(tag.span(class: ['light', 'float-right']) do
+ concat(boolean_to_icon(enabled))
+ end)
+ end
+ end
+
private
def get_dashboard_nav_links