Plugins icon in administration menu

Added by Teddy L over 11 years ago

Hi,

I would have a custom icon for my plugin in administration menu, but the code in index.rhtml of admin view create a link with "icon22 icon22-mypluginname", but where can i declare this css class to show my custom icon without editing application.css ?

Thanks in advance,

Teddy

Replies (6)

RE: Plugins icon in administration menu - Added by Eric Davis over 11 years ago

I have the same problem with my system notification plugin but I think I know of a solution. Create a plugin hook for :view_layouts_base_html_head and add the CSS there.

Eric

RE: Plugins icon in administration menu - Added by transit dk almost 11 years ago

Hello all,

I was trying to do this for a plugin that I'm writting, and I'm coming up with a problem. I'm using the following code to add my stylesheet:


class RedmineMyPluginHookListener < Redmine::Hook::ViewListener
def view_layouts_base_html_head(context)
stylesheet_link_tag 'my_plugin', :plugin => :redmine_my_plugin
end
end

This seems to be adding the link correctly to the page, however the link is coming up like this:

<link type="text/css" rel="stylesheet" media="screen" href="/plugin_assets/redmine_my_plugin/stylesheets/my_plugin.css?1253810768">

Does anyone know why it's appending the '?1253810768' to the end of my stylesheet path? The stylesheet is there, and if that wasn't added on then it would link correctly.

Thanks for the help!

-Brian

RE: Plugins icon in administration menu - Added by transit dk almost 11 years ago

Sorry, formatting got jacked.

Code I'm using:

class RedmineMyPluginHookListener < Redmine::Hook::ViewListener
  def view_layouts_base_html_head(context)
      stylesheet_link_tag 'my_plugin', :plugin => :redmine_my_plugin
  end
end

Link that gets generated:

<link type="text/css" rel="stylesheet" media="screen" href="/plugin_assets/redmine_my_plugin/stylesheets/my_plugin.css?1253810768">

RE: Plugins icon in administration menu - Added by transit dk almost 11 years ago

OK, so I just realized that the problem is not the string appended to the css path, it's that even though redmine is running in a sub-uri (/redmine/), this is not being included in the link. The link should read:

<link type="text/css" rel="stylesheet" media="screen" href="/redmine/plugin_assets/redmine_my_plugin/stylesheets/my_plugin.css?1253810768">

RE: Plugins icon in administration menu - Added by Tide _ over 10 years ago

Has anyone ever figured this out? I am trying to set an icon for my plugin as well.

RE: Plugins icon in administration menu - Added by Eric Thomas over 10 years ago

Jake Tanner wrote:

Has anyone ever figured this out? I am trying to set an icon for my plugin as well.

Since it's going in the base layout, you can just hardcode it
stylesheet_link_tag '/redmine/plugin_assets/redmine_your_plugin/stylesheets/your_stylesheet.css'

(1-6/6)