##// END OF EJS Templates
Code cleanup: implement Plugin#to_param for generating routes....
Jean-Philippe Lang -
r10766:c31f498ba6a2
parent child
Show More
@@ -55,7 +55,7 class SettingsController < ApplicationController
55 if request.post?
55 if request.post?
56 Setting.send "plugin_#{@plugin.id}=", params[:settings]
56 Setting.send "plugin_#{@plugin.id}=", params[:settings]
57 flash[:notice] = l(:notice_successful_update)
57 flash[:notice] = l(:notice_successful_update)
58 redirect_to plugin_settings_path(@plugin.id)
58 redirect_to plugin_settings_path(@plugin)
59 else
59 else
60 @partial = @plugin.settings[:partial]
60 @partial = @plugin.settings[:partial]
61 @settings = Setting.send "plugin_#{@plugin.id}"
61 @settings = Setting.send "plugin_#{@plugin.id}"
@@ -3,14 +3,14
3 <% if @plugins.any? %>
3 <% if @plugins.any? %>
4 <table class="list plugins">
4 <table class="list plugins">
5 <% @plugins.each do |plugin| %>
5 <% @plugins.each do |plugin| %>
6 <tr class="<%= cycle('odd', 'even') %>">
6 <tr id="plugin-<%= plugin.id %>" class="<%= cycle('odd', 'even') %>">
7 <td><span class="name"><%=h plugin.name %></span>
7 <td><span class="name"><%=h plugin.name %></span>
8 <%= content_tag('span', h(plugin.description), :class => 'description') unless plugin.description.blank? %>
8 <%= content_tag('span', h(plugin.description), :class => 'description') unless plugin.description.blank? %>
9 <%= content_tag('span', link_to(h(plugin.url), plugin.url), :class => 'url') unless plugin.url.blank? %>
9 <%= content_tag('span', link_to(h(plugin.url), plugin.url), :class => 'url') unless plugin.url.blank? %>
10 </td>
10 </td>
11 <td class="author"><%= plugin.author_url.blank? ? h(plugin.author) : link_to(h(plugin.author), plugin.author_url) %></td>
11 <td class="author"><%= plugin.author_url.blank? ? h(plugin.author) : link_to(h(plugin.author), plugin.author_url) %></td>
12 <td class="version"><%=h plugin.version %></td>
12 <td class="version"><%=h plugin.version %></td>
13 <td class="configure"><%= link_to(l(:button_configure), :controller => 'settings', :action => 'plugin', :id => plugin.id) if plugin.configurable? %></td>
13 <td class="configure"><%= link_to(l(:button_configure), plugin_settings_path(plugin)) if plugin.configurable? %></td>
14 </tr>
14 </tr>
15 <% end %>
15 <% end %>
16 </table>
16 </table>
@@ -145,6 +145,10 module Redmine #:nodoc:
145 File.join(self.class.public_directory, id.to_s)
145 File.join(self.class.public_directory, id.to_s)
146 end
146 end
147
147
148 def to_param
149 id
150 end
151
148 def assets_directory
152 def assets_directory
149 File.join(directory, 'assets')
153 File.join(directory, 'assets')
150 end
154 end
@@ -27,15 +27,13 class AdminControllerTest < ActionController::TestCase
27
27
28 def test_index
28 def test_index
29 get :index
29 get :index
30 assert_no_tag :tag => 'div',
30 assert_select 'div.nodata', 0
31 :attributes => { :class => /nodata/ }
32 end
31 end
33
32
34 def test_index_with_no_configuration_data
33 def test_index_with_no_configuration_data
35 delete_configuration_data
34 delete_configuration_data
36 get :index
35 get :index
37 assert_tag :tag => 'div',
36 assert_select 'div.nodata'
38 :attributes => { :class => /nodata/ }
39 end
37 end
40
38
41 def test_projects
39 def test_projects
@@ -128,8 +126,14 class AdminControllerTest < ActionController::TestCase
128 assert_response :success
126 assert_response :success
129 assert_template 'plugins'
127 assert_template 'plugins'
130
128
131 assert_tag :td, :child => { :tag => 'span', :content => 'Foo plugin' }
129 assert_select 'tr#plugin-foo' do
132 assert_tag :td, :child => { :tag => 'span', :content => 'Bar' }
130 assert_select 'td span.name', :text => 'Foo plugin'
131 assert_select 'td.configure a[href=/settings/plugin/foo]'
132 end
133 assert_select 'tr#plugin-bar' do
134 assert_select 'td span.name', :text => 'Bar'
135 assert_select 'td.configure a', 0
136 end
133 end
137 end
134
138
135 def test_info
139 def test_info
@@ -145,8 +149,7 class AdminControllerTest < ActionController::TestCase
145
149
146 get :index
150 get :index
147 assert_response :success
151 assert_response :success
148 assert_tag :a, :attributes => { :href => '/foo/bar' },
152 assert_select 'div#admin-menu a[href=/foo/bar]', :text => 'Test'
149 :content => 'Test'
150
153
151 Redmine::MenuManager.map :admin_menu do |menu|
154 Redmine::MenuManager.map :admin_menu do |menu|
152 menu.delete :test_admin_menu_plugin_extension
155 menu.delete :test_admin_menu_plugin_extension
General Comments 0
You need to be logged in to leave comments. Login now