##// END OF EJS Templates
Adds plugin id attribute....
Jean-Philippe Lang -
r2036:97252c26eefe
parent child
Show More
@@ -50,7 +50,7 class AdminController < ApplicationController
50 end
50 end
51
51
52 def plugins
52 def plugins
53 @plugins = Redmine::Plugin.registered_plugins
53 @plugins = Redmine::Plugin.registered_plugins.values.sort
54 end
54 end
55
55
56 # Loads the default configuration
56 # Loads the default configuration
@@ -2,13 +2,13
2
2
3 <% if @plugins.any? %>
3 <% if @plugins.any? %>
4 <table class="list">
4 <table class="list">
5 <% @plugins.keys.sort {|x,y| x.to_s <=> y.to_s}.each do |plugin| %>
5 <% @plugins.each do |plugin| %>
6 <tr class="<%= cycle('odd', 'even') %>">
6 <tr class="<%= cycle('odd', 'even') %>">
7 <td><%=h @plugins[plugin].name %></td>
7 <td><%=h plugin.name %></td>
8 <td><%=h @plugins[plugin].description %></td>
8 <td><%=h plugin.description %></td>
9 <td><%=h @plugins[plugin].author %></td>
9 <td><%=h plugin.author %></td>
10 <td><%=h @plugins[plugin].version %></td>
10 <td><%=h plugin.version %></td>
11 <td><%= link_to(l(:button_configure), :controller => 'settings', :action => 'plugin', :id => plugin.to_s) if @plugins[plugin].configurable? %></td>
11 <td><%= link_to(l(:button_configure), :controller => 'settings', :action => 'plugin', :id => plugin.id) if plugin.configurable? %></td>
12 </tr>
12 </tr>
13 <% end %>
13 <% end %>
14 </table>
14 </table>
@@ -56,12 +56,21 module Redmine #:nodoc:
56 end
56 end
57 end
57 end
58 def_field :name, :description, :author, :version, :settings
58 def_field :name, :description, :author, :version, :settings
59
59 attr_reader :id
60
60 # Plugin constructor
61 # Plugin constructor
61 def self.register(name, &block)
62 def self.register(id, &block)
62 p = new
63 p = new(id)
63 p.instance_eval(&block)
64 p.instance_eval(&block)
64 Plugin.registered_plugins[name] = p
65 Plugin.registered_plugins[id] = p
66 end
67
68 def initialize(id)
69 @id = id.to_sym
70 end
71
72 def <=>(plugin)
73 self.id.to_s <=> plugin.id.to_s
65 end
74 end
66
75
67 # Adds an item to the given +menu+.
76 # Adds an item to the given +menu+.
General Comments 0
You need to be logged in to leave comments. Login now