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