Feature #13767 » 0001-Added-an-option-form-so-that-you-can-select-the-enco.patch
| app/helpers/roles_helper.rb | ||
|---|---|---|
|
include ApplicationHelper
|
||
|
def permissions_to_csv(roles, permissions)
|
||
|
Redmine::Export::CSV.generate do |csv|
|
||
|
Redmine::Export::CSV.generate(:encoding => params[:encoding]) do |csv|
|
||
|
# csv header fields
|
||
|
headers = [l(:field_cvs_module), l(:label_permissions)] + roles.collect(&:name)
|
||
|
csv << headers
|
||
| app/views/roles/permissions.html.erb | ||
|---|---|---|
|
<p><%= submit_tag l(:button_save) %></p>
|
||
|
<% end %>
|
||
|
<% other_formats_links do |f| %>
|
||
|
<%= f.link_to 'CSV' %>
|
||
|
<%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
|
||
|
<% end %>
|
||
|
<div id="csv-export-options" style="display: none;">
|
||
|
<h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
|
||
|
<%= form_tag(permissions_roles_path(:format => 'csv'), :method => :get, :id => 'csv-export-form') do %>
|
||
|
<%= export_csv_encoding_select_tag %>
|
||
|
<p class="buttons">
|
||
|
<%= submit_tag l(:button_export), :name => nil, :onclick => 'hideModal(this);', :data => {:disable_with => false} %>
|
||
|
<%= link_to_function l(:button_cancel), 'hideModal(this);' %>
|
||
|
</p>
|
||
|
<% end %>
|
||
|
</div>
|
||
| test/functional/roles_controller_test.rb | ||
|---|---|---|
|
assert_select 'input[name=?][type=checkbox][value=delete_issues]:not([checked])', 'permissions[3][]'
|
||
|
end
|
||
|
def test_permissions_should_include_csv_export
|
||
|
get :permissions
|
||
|
assert_response :success
|
||
|
# Assert CSV export link
|
||
|
assert_select 'p.other-formats a.csv'
|
||
|
# Assert export modal
|
||
|
assert_select '#csv-export-options' do
|
||
|
assert_select 'form[action=?][method=get]', '/roles/permissions.csv'
|
||
|
end
|
||
|
end
|
||
|
def test_permissions_csv_export
|
||
|
get(
|
||
|
:permissions,
|
||
- « Previous
- 1
- 2
- 3
- 4
- Next »