From ca300ccdeaf3cae3015a548ba3fffa9c6f112c55 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 20 Nov 2011 13:23:20 +0000 Subject: [PATCH] Adds a dialog box for CSV export options (#4742). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7874 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/issues_controller.rb | 2 +- app/helpers/issues_helper.rb | 79 ++++++++--------------- app/views/issues/index.html.erb | 19 +++++- config/locales/bg.yml | 3 + config/locales/bs.yml | 3 + config/locales/ca.yml | 3 + config/locales/cs.yml | 3 + config/locales/da.yml | 3 + config/locales/de.yml | 3 + config/locales/el.yml | 3 + config/locales/en-GB.yml | 3 + config/locales/en.yml | 3 + config/locales/es.yml | 3 + config/locales/eu.yml | 3 + config/locales/fa.yml | 3 + config/locales/fi.yml | 3 + config/locales/fr.yml | 7 +- config/locales/gl.yml | 3 + config/locales/he.yml | 3 + config/locales/hr.yml | 3 + config/locales/hu.yml | 3 + config/locales/id.yml | 3 + config/locales/it.yml | 3 + config/locales/ja.yml | 3 + config/locales/ko.yml | 3 + config/locales/lt.yml | 3 + config/locales/lv.yml | 3 + config/locales/mk.yml | 3 + config/locales/mn.yml | 3 + config/locales/nl.yml | 3 + config/locales/no.yml | 3 + config/locales/pl.yml | 3 + config/locales/pt-BR.yml | 3 + config/locales/pt.yml | 3 + config/locales/ro.yml | 3 + config/locales/ru.yml | 3 + config/locales/sk.yml | 3 + config/locales/sl.yml | 3 + config/locales/sr-YU.yml | 3 + config/locales/sr.yml | 3 + config/locales/sv.yml | 3 + config/locales/th.yml | 3 + config/locales/tr.yml | 3 + config/locales/uk.yml | 3 + config/locales/vi.yml | 3 + config/locales/zh-TW.yml | 3 + config/locales/zh.yml | 3 + public/javascripts/application.js | 33 ++++++++++ public/stylesheets/application.css | 6 ++ test/functional/issues_controller_test.rb | 42 +++++++++--- 50 files changed, 253 insertions(+), 64 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index d782a7965..7978bc001 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -94,7 +94,7 @@ class IssuesController < ApplicationController Issue.load_relations(@issues) if include_in_api_response?('relations') } format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") } - format.csv { send_data(issues_to_csv(@issues, @project), :type => 'text/csv; header=present', :filename => 'export.csv') } + format.csv { send_data(issues_to_csv(@issues, @project, @query, params), :type => 'text/csv; header=present', :filename => 'export.csv') } format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'export.pdf') } end else diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 9ef9e0458..ff97aed5b 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -263,62 +263,39 @@ module IssuesHelper end end - def issues_to_csv(issues, project = nil) + def issues_to_csv(issues, project, query, options={}) + ic = Iconv.new(l(:general_csv_encoding), 'UTF-8') decimal_separator = l(:general_csv_decimal_separator) + encoding = l(:general_csv_encoding) + columns = (options[:columns] == 'all' ? query.available_columns : query.columns) + export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv| # csv header fields - headers = [ "#", - l(:field_status), - l(:field_project), - l(:field_tracker), - l(:field_priority), - l(:field_subject), - l(:field_assigned_to), - l(:field_category), - l(:field_fixed_version), - l(:field_author), - l(:field_start_date), - l(:field_due_date), - l(:field_done_ratio), - l(:field_estimated_hours), - l(:field_parent_issue), - l(:field_created_on), - l(:field_updated_on) - ] - # Export project custom fields if project is given - # otherwise export custom fields marked as "For all projects" - custom_fields = project.nil? ? IssueCustomField.for_all : project.all_issue_custom_fields - custom_fields.each {|f| headers << f.name} - # Description in the last column - headers << l(:field_description) - csv << headers.collect {|c| Redmine::CodesetUtil.from_utf8( - c.to_s, - l(:general_csv_encoding) ) } + csv << [ "#" ] + columns.collect {|c| Redmine::CodesetUtil.from_utf8(c.caption.to_s, encoding) } + + (options[:description] ? [Redmine::CodesetUtil.from_utf8(l(:field_description), encoding)] : []) + # csv lines issues.each do |issue| - fields = [issue.id, - issue.status.name, - issue.project.name, - issue.tracker.name, - issue.priority.name, - issue.subject, - issue.assigned_to, - issue.category, - issue.fixed_version, - issue.author.name, - format_date(issue.start_date), - format_date(issue.due_date), - issue.done_ratio, - issue.estimated_hours.to_s.gsub('.', decimal_separator), - issue.parent_id, - format_time(issue.created_on), - format_time(issue.updated_on) - ] - custom_fields.each {|f| fields << show_value(issue.custom_value_for(f)) } - fields << issue.description - csv << fields.collect {|c| Redmine::CodesetUtil.from_utf8( - c.to_s, - l(:general_csv_encoding) ) } + col_values = columns.collect do |column| + s = if column.is_a?(QueryCustomFieldColumn) + cv = issue.custom_values.detect {|v| v.custom_field_id == column.custom_field.id} + show_value(cv) + else + value = issue.send(column.name) + if value.is_a?(Date) + format_date(value) + elsif value.is_a?(Time) + format_time(value) + elsif value.is_a?(Float) + value.to_s.gsub('.', decimal_separator) + else + value + end + end + s.to_s + end + csv << [ issue.id.to_s ] + col_values.collect {|c| Redmine::CodesetUtil.from_utf8(c.to_s, encoding) } + + (options[:description] ? [Redmine::CodesetUtil.from_utf8(issue.description, encoding)] : []) end end export diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index a5e657ec1..22791a9ae 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -54,10 +54,27 @@ <% other_formats_links do |f| %> <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> - <%= f.link_to 'CSV', :url => params %> + <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> <%= f.link_to 'PDF', :url => params %> <% end %> + + <% end %> <%= call_hook(:view_issues_index_bottom, { :issues => @issues, :project => @project, :query => @query }) %> diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 3c234a376..666948714 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -1000,3 +1000,6 @@ bg: description_date_from: Въведете начална дата description_date_to: Въведете крайна дата setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/bs.yml b/config/locales/bs.yml index 07b43487f..1087e1a26 100644 --- a/config/locales/bs.yml +++ b/config/locales/bs.yml @@ -1016,3 +1016,6 @@ bs: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 110f05148..3737830ff 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -1005,3 +1005,6 @@ ca: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/cs.yml b/config/locales/cs.yml index c4c2ef7b1..6c8dcc924 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -1006,3 +1006,6 @@ cs: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/da.yml b/config/locales/da.yml index 6dead5564..de532a420 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -1019,3 +1019,6 @@ da: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/de.yml b/config/locales/de.yml index daf694cfa..8dcbb686a 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1023,3 +1023,6 @@ de: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/el.yml b/config/locales/el.yml index fdb1cb711..372830b8e 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -1002,3 +1002,6 @@ el: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index be143756e..7c5844dc4 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -1005,3 +1005,6 @@ en-GB: label_child_revision: Child button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/en.yml b/config/locales/en.yml index 16bb6a9cd..a4f366848 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -827,6 +827,7 @@ en: label_git_report_last_commit: Report last commit for files and directories label_parent_revision: Parent label_child_revision: Child + label_export_options: %{export_format} export options button_login: Login button_submit: Submit @@ -875,6 +876,7 @@ en: button_duplicate: Duplicate button_show: Show button_edit_section: Edit this section + button_export: Export status_active: active status_registered: registered @@ -994,6 +996,7 @@ en: description_user_mail_notification: Mail notification settings description_available_columns: Available Columns description_selected_columns: Selected Columns + description_all_columns: All Columns description_issue_category_reassign: Choose issue category description_wiki_subpages_reassign: Choose new parent page description_date_range_list: Choose range from list diff --git a/config/locales/es.yml b/config/locales/es.yml index 45ee938b1..6d0d19c4b 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1039,3 +1039,6 @@ es: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 78295da47..010379275 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -1006,3 +1006,6 @@ eu: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/fa.yml b/config/locales/fa.yml index a0c1c7b3a..db4961b72 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -1005,3 +1005,6 @@ fa: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 36da700a7..970c99f6f 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -1023,3 +1023,6 @@ fi: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 3ba06c451..8412a5e9d 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -803,6 +803,7 @@ fr: label_issues_visibility_all: Toutes les demandes label_issues_visibility_public: Toutes les demandes non privées label_issues_visibility_own: Demandes créées par ou assignées à l'utilisateur + label_export_options: Options d'exportation %{export_format} button_login: Connexion button_submit: Soumettre @@ -850,6 +851,7 @@ fr: button_duplicate: Dupliquer button_show: Afficher button_edit_section: Modifier cette section + button_export: Exporter status_active: actif status_registered: enregistré @@ -1002,7 +1004,8 @@ fr: description_user_mail_notification: Mail notification settings description_date_from: Enter start date description_message_content: Message content - description_available_columns: Available Columns + description_available_columns: Colonnes disponibles + description_all_columns: Toutes les colonnes description_date_range_interval: Choose range by selecting start and end date description_issue_category_reassign: Choose issue category description_search: Searchfield @@ -1012,7 +1015,7 @@ fr: description_date_to: Enter end date description_query_sort_criteria_attribute: Sort attribute description_wiki_subpages_reassign: Choose new parent page - description_selected_columns: Selected Columns + description_selected_columns: Colonnes sélectionnées label_parent_revision: Parent label_child_revision: Child error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size. diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 4d4f58f61..4f1347563 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -1014,3 +1014,6 @@ gl: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/he.yml b/config/locales/he.yml index a7b7ae5b2..22c1c20e9 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -1007,3 +1007,6 @@ he: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/hr.yml b/config/locales/hr.yml index 3a1fc3963..a90cd6b4d 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -1009,3 +1009,6 @@ hr: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 79030c3f2..ec80dac6b 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -1021,3 +1021,6 @@ setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/id.yml b/config/locales/id.yml index 70899ffc4..3895f9318 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -1010,3 +1010,6 @@ id: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/it.yml b/config/locales/it.yml index 5b89ecf1b..61d6ba4c6 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -1003,3 +1003,6 @@ it: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 3b106bd04..55958d26c 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -1032,3 +1032,6 @@ ja: error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size. setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 1d909da25..7ed420999 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -1054,3 +1054,6 @@ ko: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 55654da51..7cd3879a2 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -1062,3 +1062,6 @@ lt: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/lv.yml b/config/locales/lv.yml index ed6186780..5be9a3f19 100644 --- a/config/locales/lv.yml +++ b/config/locales/lv.yml @@ -997,3 +997,6 @@ lv: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/mk.yml b/config/locales/mk.yml index fc0fb9d1c..b3ff76b9a 100644 --- a/config/locales/mk.yml +++ b/config/locales/mk.yml @@ -1002,3 +1002,6 @@ mk: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/mn.yml b/config/locales/mn.yml index da04b9f29..16128e4ae 100644 --- a/config/locales/mn.yml +++ b/config/locales/mn.yml @@ -1003,3 +1003,6 @@ mn: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/nl.yml b/config/locales/nl.yml index f610520f4..f6bb27d16 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -984,3 +984,6 @@ nl: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/no.yml b/config/locales/no.yml index 33572781f..69bf7490b 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -992,3 +992,6 @@ setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 41abb1ff5..4e53459ad 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -1019,3 +1019,6 @@ pl: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 0baa3b092..a5b26fe02 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -1023,3 +1023,6 @@ pt-BR: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/pt.yml b/config/locales/pt.yml index a951e719f..2ff204dc6 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -1007,3 +1007,6 @@ pt: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/ro.yml b/config/locales/ro.yml index 19631bd65..c430fe3a8 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -995,3 +995,6 @@ ro: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 66976fdca..0a15b80e6 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -1115,3 +1115,6 @@ ru: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/sk.yml b/config/locales/sk.yml index ac69b9cd7..628812d12 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -997,3 +997,6 @@ sk: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 5949313b2..0b4f060cb 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -1002,3 +1002,6 @@ sl: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/sr-YU.yml b/config/locales/sr-YU.yml index 2545636e2..662ef51eb 100644 --- a/config/locales/sr-YU.yml +++ b/config/locales/sr-YU.yml @@ -1002,3 +1002,6 @@ sr-YU: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/sr.yml b/config/locales/sr.yml index c9d7689a7..390f24e2e 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -1003,3 +1003,6 @@ sr: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/sv.yml b/config/locales/sv.yml index ae0fb5ba9..841da7b15 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -1043,3 +1043,6 @@ sv: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/th.yml b/config/locales/th.yml index 9e0a24be8..c625e68bd 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -999,3 +999,6 @@ th: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/tr.yml b/config/locales/tr.yml index e494b86f1..1bde02b64 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -1021,3 +1021,6 @@ tr: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 264e75724..3f2643485 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -998,3 +998,6 @@ uk: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/vi.yml b/config/locales/vi.yml index 9b19d392c..d766a69e6 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -1053,3 +1053,6 @@ vi: setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 7fc8c6e62..e0e612c6c 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -1082,3 +1082,6 @@ description_date_to: 輸入結束日期 button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 161d897f3..410dc84a9 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1004,3 +1004,6 @@ zh: setting_default_issue_start_date_to_creation_date: 使用当前日期作为新问题的开始日期 button_edit_section: Edit this section setting_repositories_encodings: Attachments and repositories encodings + description_all_columns: All Columns + button_export: Export + label_export_options: "%{export_format} export options" diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 19aef77b8..230e40b5d 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -186,6 +186,39 @@ function promptToRemote(text, param, url) { } } +function showModal(id, width) { + el = $(id); + if (el == undefined || el.visible()) {return;} + var h = $$('body')[0].getHeight(); + var d = document.createElement("div"); + d.id = 'modalbg'; + $('main').appendChild(d); + $('modalbg').setStyle({ width: '100%', height: h + 'px' }); + $('modalbg').show(); + + var pageWidth = document.viewport.getWidth(); + el.setStyle({'width': width}); + el.setStyle({'left': (((pageWidth - el.getWidth())/2 *100) / pageWidth) + '%'}); + el.addClassName('modal'); + el.show(); + + var submit = el.down("input[type=submit]"); + if (submit) { + submit.focus(); + } +} + +function hideModal(el) { + var modal = Element.up(el, 'div.modal'); + if (modal) { + modal.hide(); + } + var bg = $('modalbg'); + if (bg) { + bg.remove(); + } +} + function collapseScmEntry(id) { var els = document.getElementsByClassName(id, 'browser'); for (var i = 0; i < els.length; i++) { diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 4f708c907..715cfdd78 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -91,6 +91,12 @@ html>body #content { min-height: 600px; } #login-form label {font-weight: bold;} #login-form input#username, #login-form input#password { width: 300px; } +#modalbg {position:absolute; top:0; left:0; width:100%; height:100%; background:#ccc; z-index:49; opacity:0.5;} +html>body #modalbg {position:fixed;} +div.modal { border-radius:5px; position:absolute; top:25%; background:#fff; border:2px solid #759FCF; z-index:50; padding:0px; padding:8px;} +div.modal h3.title {background:#759FCF; color:#fff; border:0; padding-left:8px; margin:-8px; margin-bottom: 1em; border-top-left-radius:2px;border-top-right-radius:2px;} +html>body div.modal {position:fixed;} + input#openid_url { background: url(../images/openid-bg.gif) no-repeat; background-color: #fff; background-position: 0 50%; padding-left: 18px; } .clear:after{ content: "."; display: block; height: 0; clear: both; visibility: hidden; } diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index b350512af..017f47451 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -281,21 +281,43 @@ class IssuesControllerTest < ActionController::TestCase get :index, :sort => 'tracker' end - def test_index_csv_with_project - Setting.default_language = 'en' - + def test_index_csv get :index, :format => 'csv' assert_response :success assert_not_nil assigns(:issues) assert_equal 'text/csv', @response.content_type assert @response.body.starts_with?("#,") + lines = @response.body.chomp.split("\n") + assert_equal assigns(:query).columns.size + 1, lines[0].split(',').size + end + def test_index_csv_with_project get :index, :project_id => 1, :format => 'csv' assert_response :success assert_not_nil assigns(:issues) assert_equal 'text/csv', @response.content_type end + def test_index_csv_with_description + get :index, :format => 'csv', :description => '1' + assert_response :success + assert_not_nil assigns(:issues) + assert_equal 'text/csv', @response.content_type + assert @response.body.starts_with?("#,") + lines = @response.body.chomp.split("\n") + assert_equal assigns(:query).columns.size + 2, lines[0].split(',').size + end + + def test_index_csv_with_all_columns + get :index, :format => 'csv', :columns => 'all' + assert_response :success + assert_not_nil assigns(:issues) + assert_equal 'text/csv', @response.content_type + assert @response.body.starts_with?("#,") + lines = @response.body.chomp.split("\n") + assert_equal assigns(:query).available_columns.size + 1, lines[0].split(',').size + end + def test_index_csv_big_5 with_settings :default_language => "zh-TW" do str_utf8 = "\xe4\xb8\x80\xe6\x9c\x88" @@ -314,7 +336,7 @@ class IssuesControllerTest < ActionController::TestCase :op => '=', :values => [str_utf8], :format => 'csv' assert_equal 'text/csv', @response.content_type - lines = @response.body.chomp.split("\n") + lines = @response.body.chomp.split("\n") s1 = "\xaa\xac\xbaA" if str_utf8.respond_to?(:force_encoding) s1.force_encoding('Big5') @@ -338,17 +360,19 @@ class IssuesControllerTest < ActionController::TestCase get :index, :project_id => 1, :f => ['subject'], :op => '=', :values => [str_utf8], - :format => 'csv' + :c => ['status', 'subject'], + :format => 'csv', + :set_filter => 1 assert_equal 'text/csv', @response.content_type - lines = @response.body.chomp.split("\n") - s1 = "\xaa\xac\xbaA" + lines = @response.body.chomp.split("\n") + s1 = "\xaa\xac\xbaA" # status if str_utf8.respond_to?(:force_encoding) s1.force_encoding('Big5') end assert lines[0].include?(s1) - s2 = lines[1].split(",")[5] + s2 = lines[1].split(",")[2] if s1.respond_to?(:force_encoding) - s3 = "\xa5H?" + s3 = "\xa5H?" # subject s3.force_encoding('Big5') assert_equal s3, s2 elsif RUBY_PLATFORM == 'java' -- 2.39.5