Permalink
Browse files

Adds to specify cell format for date & time. refs #10 .

with following translations which was contributed on master branch:
* Bulgarian
* Danish
* Italiano
* Japanese
  • Loading branch information...
two-pack committed Dec 30, 2012
1 parent 9d0f37e commit 0a5b1e68ca68c38dc46e075aaf506b7b8c7156bb
@@ -18,7 +18,27 @@
<% end %>
<fieldset class="box tabular">
<p>
<legend><%= l(:label_plugin_xlse_legend_1a) %></legend>
<label class="floating">
<%= l(:label_plugin_xlse_date_created) %>
<%= text_field_tag 'settings[created_format]', @settings['created_format'], {:size => 25, :maxlength => 20 } %>
</label>
<label class="floating">
<%= l(:label_plugin_xlse_date_updated) %>
<%= text_field_tag 'settings[updated_format]', @settings['updated_format'], {:size => 25, :maxlength => 20 } %>
</label>
<label class="floating">
<%= l(:label_plugin_xlse_date_start) %>
<%= text_field_tag 'settings[start_date_format]', @settings['start_date_format'], {:size => 12, :maxlength => 20 } %>
</label>
<label class="floating">
<%= l(:label_plugin_xlse_date_due) %>
<%= text_field_tag 'settings[due_date_format]', @settings['due_date_format'], {:size => 12, :maxlength => 20 } %>
</label>
</fieldset>
<fieldset class="box tabular">
<p>
<%= label_tag('settings[issues_limit]', "#{l(:label_plugin_xlse_issues_limit)}<br/>#{l(:label_plugin_xlse_issues_limit_help)}".html_safe ) %>
<%= text_field_tag 'settings[issues_limit]', @settings['issues_limit'], {:size => 6, :maxlength => 10 } %>
</p>
View
@@ -1,4 +1,10 @@
bg:
label_plugin_xlse_legend_0: "Columns options"
label_plugin_xlse_legend_1: "Export options"
label_plugin_xlse_legend_1a: "Формат на датите"
label_plugin_xlse_legend_2: "Extra options"
label_plugin_xlse_legend_2_disabled: "Extra options (install rubyzip gem to access them)"
label_plugin_xlse_relations: "Експорт на връзките"
label_plugin_xlse_watchers: "Експорт на наблюдателите"
label_plugin_xlse_description: "Експорт на описанията"
@@ -22,3 +28,8 @@ bg:
label_plugin_xlse_export_format_quick_tooltip: "Експортиране с опции по подразбиране"
label_plugin_xlse_export_format_detailed: "Подробно"
label_plugin_xlse_export_format_detailed_tooltip: "Избор на опции преди експортиране"
label_plugin_xlse_date_created: "От дата"
label_plugin_xlse_date_updated: "Обновена"
label_plugin_xlse_date_start: "Начална дата"
label_plugin_xlse_date_due: "Крайна дата"
View
@@ -1,4 +1,10 @@
de:
label_plugin_xlse_legend_0: "Columns options"
label_plugin_xlse_legend_1: "Export options"
label_plugin_xlse_legend_1a: "Datumsformat"
label_plugin_xlse_legend_2: "Extra options"
label_plugin_xlse_legend_2_disabled: "Extra options (install rubyzip gem to access them)"
label_plugin_xlse_relations: "Ticket-Beziehnungen exportieren"
label_plugin_xlse_watchers: "Beobachter exportieren"
label_plugin_xlse_description: "Beschreibungen exportieren"
@@ -22,3 +28,8 @@ de:
label_plugin_xlse_export_format_quick_tooltip: "Exportiere mit Standard Einstellungen"
label_plugin_xlse_export_format_detailed: "Detailierter Export"
label_plugin_xlse_export_format_detailed_tooltip: "Wähle Export Optionen"
label_plugin_xlse_date_created: "Angelegt"
label_plugin_xlse_date_updated: "Aktualisiert"
label_plugin_xlse_date_start: "Beginn"
label_plugin_xlse_date_due: "Abgabedatum"
View
@@ -1,6 +1,7 @@
en:
label_plugin_xlse_legend_0: "Columns options"
label_plugin_xlse_legend_1: "Export options"
label_plugin_xlse_legend_1a: "Date format options"
label_plugin_xlse_legend_2: "Extra options"
label_plugin_xlse_legend_2_disabled: "Extra options (install rubyzip gem to access them)"
@@ -36,3 +37,8 @@ en:
label_plugin_xlse_export_format_detailed: "Detailed"
label_plugin_xlse_export_format_detailed_tooltip: "Choose options before export"
label_plugin_xlse_date_created: "Created"
label_plugin_xlse_date_updated: "Updated"
label_plugin_xlse_date_start: "Start date"
label_plugin_xlse_date_due: "Due date"
View
@@ -1,4 +1,10 @@
it:
label_plugin_xlse_legend_0: "Columns options"
label_plugin_xlse_legend_1: "Export options"
label_plugin_xlse_legend_1a: "Formato date"
label_plugin_xlse_legend_2: "Extra options"
label_plugin_xlse_legend_2_disabled: "Extra options (install rubyzip gem to access them)"
label_plugin_xlse_relations: "Esporta relazioni"
label_plugin_xlse_watchers: "Esporta osservatori"
label_plugin_xlse_description: "Esporta descrizione"
@@ -24,7 +30,9 @@ it:
label_plugin_xlse_export_format_detailed: "Dettagliato"
label_plugin_xlse_export_format_detailed_tooltip: "Scegli le opzioni prima di esportare"
label_plugin_xlse_date_format: "Formato date"
field_history: "Storia"
label_plugin_xlse_date_created: "Creato"
label_plugin_xlse_date_updated: "Aggiornato"
label_plugin_xlse_date_start: "Inizio"
label_plugin_xlse_date_due: "Scadenza"
View
@@ -1,6 +1,7 @@
ja:
label_plugin_xlse_legend_0: "カラム"
label_plugin_xlse_legend_1: "出力"
label_plugin_xlse_legend_1a: "日付の形式"
label_plugin_xlse_legend_2: "オプション"
label_plugin_xlse_legend_2_disabled: "オプション (使用するにはrubyzip gemのインストールが必要です)"
@@ -36,3 +37,8 @@ ja:
label_plugin_xlse_export_format_detailed: "オプション"
label_plugin_xlse_export_format_detailed_tooltip: "オプションを指定して出力する"
label_plugin_xlse_date_created: "作成日"
label_plugin_xlse_date_updated: "更新日"
label_plugin_xlse_date_start: "開始日"
label_plugin_xlse_date_due: "期日"
View
@@ -24,7 +24,11 @@
'export_attached' => '0',
'separate_journals' => '0',
'issues_limit' => '0',
'export_name' => 'issues_export'
'export_name' => 'issues_export',
'created_format' => "dd.mm.yyyy hh:mm:ss",
'updated_format' => "dd.mm.yyyy hh:mm:ss",
'start_date_format' => "dd.mm.yyyy",
'due_date_format' => "dd.mm.yyyy"
})
requires_redmine :version_or_higher => '1.3.0'
View
@@ -116,6 +116,12 @@ def issues_to_xls2(issues, project, query, options = {})
book = Spreadsheet::Workbook.new
issue_columns = []
date_formats = {
:created_on => options[:created_format],
:updated_on => options[:updated_format],
:start_date => options[:start_date_format],
:due_date => options[:due_date_format]}
(options[:query_columns_only] == '1' ? query.columns : query.available_columns).each do |c|
case c.name
when :formatted_relations
@@ -145,13 +151,13 @@ def issues_to_xls2(issues, project, query, options = {})
group = new_group
update_sheet_formatting(sheet1,columns_width) if sheet1
sheet1 = book.create_worksheet(:name => (group.blank? ? l(:label_none) : pretty_xls_tab_name(group.to_s)))
columns_width=init_header_columns(sheet1,issue_columns)
columns_width=init_header_columns(sheet1,issue_columns,date_formats)
idx = 0
end
else
if sheet1 == nil
sheet1 = book.create_worksheet(:name => l(:label_issue_plural))
columns_width=init_header_columns(sheet1,issue_columns)
columns_width=init_header_columns(sheet1,issue_columns,date_formats)
end
end
@@ -319,7 +325,7 @@ def column_exists_for_project?(column, project)
return false
end
def init_header_columns(sheet1,columns)
def init_header_columns(sheet1,columns,date_formats)
columns_width = [1]
sheet1.row(0).replace ["#"]
@@ -349,6 +355,8 @@ def init_header_columns(sheet1,columns)
opt[:number_format] = '0%'
when :estimated_hours, :spent_time
opt[:number_format] = "0.0"
when :created_on, :updated_on, :start_date, :due_date
opt[:number_format] = date_formats[c.name]
end
end

0 comments on commit 0a5b1e6

Please sign in to comment.