Improve icons in admin service settings sidenav
This commit is contained in:
		
							parent
							
								
									e8e6ee0bc4
								
							
						
					
					
						commit
						46d59e3371
					
				| @ -1,4 +1,8 @@ | ||||
| <%= link_to @path, class: @link_class, title: (@disabled ? "Coming soon" : nil) do %> | ||||
|   <% if @icon.present? %> | ||||
|   <%= render partial: "icons/#{@icon}", locals: { custom_class: @icon_class } %> | ||||
|   <% elsif @text_icon.present? %> | ||||
|   <span class="mr-3"><%= @text_icon %></span> | ||||
|   <% end %> | ||||
|   <span class="truncate"><%= @name %></span> | ||||
| <% end %> | ||||
|  | ||||
| @ -1,11 +1,13 @@ | ||||
| # frozen_string_literal: true | ||||
| 
 | ||||
| class SidenavLinkComponent < ViewComponent::Base | ||||
|   def initialize(name:, level: 1, path:, icon:, active: false, disabled: false) | ||||
|   def initialize(name:, level: 1, path:, icon: nil, text_icon: nil, | ||||
|                  active: false, disabled: false) | ||||
|     @name = name | ||||
|     @level = level | ||||
|     @path = path | ||||
|     @icon = icon | ||||
|     @text_icon = text_icon | ||||
|     @active = active | ||||
|     @disabled = disabled | ||||
|     @link_class = class_names_link(path) | ||||
|  | ||||
| @ -2,62 +2,62 @@ | ||||
|   level: 2, | ||||
|   name: "Discourse", | ||||
|   path: admin_settings_services_path(params: { s: "discourse" }), | ||||
|   icon: Setting.discourse_enabled? ? "check" : "x", | ||||
|   text_icon: Setting.discourse_enabled? ? "◉" : "○", | ||||
|   active: current_page?(admin_settings_services_path(params: { s: "discourse" })), | ||||
| ) %> | ||||
| <%= render SidenavLinkComponent.new( | ||||
|   level: 2, | ||||
|   name: "Drone CI", | ||||
|   path: admin_settings_services_path(params: { s: "droneci" }), | ||||
|   icon: Setting.droneci_enabled? ? "check" : "x", | ||||
|   text_icon: Setting.droneci_enabled? ? "◉" : "○", | ||||
|   active: current_page?(admin_settings_services_path(params: { s: "droneci" })), | ||||
| ) %> | ||||
| <%= render SidenavLinkComponent.new( | ||||
|   level: 2, | ||||
|   name: "ejabberd", | ||||
|   path: admin_settings_services_path(params: { s: "ejabberd" }), | ||||
|   icon: Setting.ejabberd_enabled? ? "check" : "x", | ||||
|   text_icon: Setting.ejabberd_enabled? ? "◉" : "○", | ||||
|   active: current_page?(admin_settings_services_path(params: { s: "ejabberd" })), | ||||
| ) %> | ||||
| <%= render SidenavLinkComponent.new( | ||||
|   level: 2, | ||||
|   name: "Gitea", | ||||
|   path: admin_settings_services_path(params: { s: "gitea" }), | ||||
|   icon: Setting.gitea_enabled? ? "check" : "x", | ||||
|   text_icon: Setting.gitea_enabled? ? "◉" : "○", | ||||
|   active: current_page?(admin_settings_services_path(params: { s: "gitea" })), | ||||
| ) %> | ||||
| <%= render SidenavLinkComponent.new( | ||||
|   level: 2, | ||||
|   name: "LNDHub", | ||||
|   path: admin_settings_services_path(params: { s: "lndhub" }), | ||||
|   icon: Setting.lndhub_enabled? ? "check" : "x", | ||||
|   text_icon: Setting.lndhub_enabled? ? "◉" : "○", | ||||
|   active: current_page?(admin_settings_services_path(params: { s: "lndhub" })), | ||||
| ) %> | ||||
| <%= render SidenavLinkComponent.new( | ||||
|   level: 2, | ||||
|   name: "Mastodon", | ||||
|   path: admin_settings_services_path(params: { s: "mastodon" }), | ||||
|   icon: Setting.mastodon_enabled? ? "check" : "x", | ||||
|   text_icon: Setting.mastodon_enabled? ? "◉" : "○", | ||||
|   active: current_page?(admin_settings_services_path(params: { s: "mastodon" })), | ||||
| ) %> | ||||
| <%= render SidenavLinkComponent.new( | ||||
|   level: 2, | ||||
|   name: "MediaWiki", | ||||
|   path: admin_settings_services_path(params: { s: "mediawiki" }), | ||||
|   icon: Setting.mediawiki_enabled? ? "check" : "x", | ||||
|   text_icon: Setting.mediawiki_enabled? ? "◉" : "○", | ||||
|   active: current_page?(admin_settings_services_path(params: { s: "mediawiki" })), | ||||
| ) %> | ||||
| <%= render SidenavLinkComponent.new( | ||||
|   level: 2, | ||||
|   name: "Nostr", | ||||
|   path: admin_settings_services_path(params: { s: "nostr" }), | ||||
|   icon: Setting.nostr_enabled? ? "check" : "x", | ||||
|   text_icon: Setting.nostr_enabled? ? "◉" : "○", | ||||
|   active: current_page?(admin_settings_services_path(params: { s: "nostr" })), | ||||
| ) %> | ||||
| <%= render SidenavLinkComponent.new( | ||||
|   level: 2, | ||||
|   name: "RemoteStorage", | ||||
|   path: admin_settings_services_path(params: { s: "remotestorage" }), | ||||
|   icon: Setting.remotestorage_enabled? ? "check" : "x", | ||||
|   text_icon: Setting.remotestorage_enabled? ? "◉" : "○", | ||||
|   active: current_page?(admin_settings_services_path(params: { s: "remotestorage" })), | ||||
| ) %> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user