mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 22:15:14 +00:00
Add admin_tool helper
This commit is contained in:
parent
c41ae264e5
commit
bd508e5904
3 changed files with 16 additions and 1 deletions
|
|
@ -15,4 +15,9 @@
|
|||
:root {
|
||||
--primary-color: var(--uchu-red);
|
||||
--muted-color: var(--uchu-gray);
|
||||
}
|
||||
}
|
||||
|
||||
.admin-tool {
|
||||
border-radius: 5px;
|
||||
border: 1px solid var(--uchu-gray);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,9 @@ module ApplicationHelper
|
|||
misses = Thread.current[:cache_misses] || 0
|
||||
{ hits: hits, misses: misses }
|
||||
end
|
||||
|
||||
def admin_tool(class_name = "", element = "div", **options, &block)
|
||||
return unless current_user&.is_admin?
|
||||
concat content_tag(element, class: "#{class_name}", **options, &block)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -28,5 +28,10 @@
|
|||
Leaderboards
|
||||
<% end %>
|
||||
</li>
|
||||
<% admin_tool(nil, "li") do %>
|
||||
<%= link_to avo_path, class: "nav-item #{current_page?(avo_path) ? 'active' : ''}" do %>
|
||||
Avo
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</aside>
|
||||
Loading…
Add table
Reference in a new issue