##// END OF EJS Templates
Display a warning if some attachments were not saved (#2008)....
Jean-Philippe Lang -
r2222:e0bda97b6f93
parent child
Show More
@@ -175,6 +175,7 class ApplicationController < ActionController::Base
175 # TODO: move to model
175 # TODO: move to model
176 def attach_files(obj, attachments)
176 def attach_files(obj, attachments)
177 attached = []
177 attached = []
178 unsaved = []
178 if attachments && attachments.is_a?(Hash)
179 if attachments && attachments.is_a?(Hash)
179 attachments.each_value do |attachment|
180 attachments.each_value do |attachment|
180 file = attachment['file']
181 file = attachment['file']
@@ -183,7 +184,10 class ApplicationController < ActionController::Base
183 :file => file,
184 :file => file,
184 :description => attachment['description'].to_s.strip,
185 :description => attachment['description'].to_s.strip,
185 :author => User.current)
186 :author => User.current)
186 attached << a unless a.new_record?
187 a.new_record? ? (unsaved << a) : (attached << a)
188 end
189 if unsaved.any?
190 flash[:warning] = l(:warning_attachments_not_saved, unsaved.size)
187 end
191 end
188 end
192 end
189 attached
193 attached
@@ -697,3 +697,4 label_updated_time_by: Updated by %s %s ago
697 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
697 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
698 setting_diff_max_lines_displayed: Max number of diff lines displayed
698 setting_diff_max_lines_displayed: Max number of diff lines displayed
699 text_plugin_assets_writable: Plugin assets directory writable
699 text_plugin_assets_writable: Plugin assets directory writable
700 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -698,3 +698,4 label_updated_time_by: Updated by %s %s ago
698 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
698 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
699 setting_diff_max_lines_displayed: Max number of diff lines displayed
699 setting_diff_max_lines_displayed: Max number of diff lines displayed
700 text_plugin_assets_writable: Plugin assets directory writable
700 text_plugin_assets_writable: Plugin assets directory writable
701 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -702,3 +702,4 label_updated_time_by: Updated by %s %s ago
702 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
702 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
703 setting_diff_max_lines_displayed: Max number of diff lines displayed
703 setting_diff_max_lines_displayed: Max number of diff lines displayed
704 text_plugin_assets_writable: Plugin assets directory writable
704 text_plugin_assets_writable: Plugin assets directory writable
705 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -698,3 +698,4 label_updated_time_by: Updated by %s %s ago
698 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
698 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
699 setting_diff_max_lines_displayed: Max number of diff lines displayed
699 setting_diff_max_lines_displayed: Max number of diff lines displayed
700 text_plugin_assets_writable: Plugin assets directory writable
700 text_plugin_assets_writable: Plugin assets directory writable
701 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -699,3 +699,4 enumeration_issue_priorities: Ticket-Prioritäten
699 enumeration_doc_categories: Dokumentenkategorien
699 enumeration_doc_categories: Dokumentenkategorien
700 enumeration_activities: Aktivitäten (Zeiterfassung)
700 enumeration_activities: Aktivitäten (Zeiterfassung)
701 text_plugin_assets_writable: Plugin assets directory writable
701 text_plugin_assets_writable: Plugin assets directory writable
702 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -85,6 +85,8 error_scm_command_failed: "An error occurred when trying to access the repositor
85 error_scm_annotate: "The entry does not exist or can not be annotated."
85 error_scm_annotate: "The entry does not exist or can not be annotated."
86 error_issue_not_found_in_project: 'The issue was not found or does not belong to this project'
86 error_issue_not_found_in_project: 'The issue was not found or does not belong to this project'
87
87
88 warning_attachments_not_saved: "%d file(s) could not be saved."
89
88 mail_subject_lost_password: Your %s password
90 mail_subject_lost_password: Your %s password
89 mail_body_lost_password: 'To change your password, click on the following link:'
91 mail_body_lost_password: 'To change your password, click on the following link:'
90 mail_subject_register: Your %s account activation
92 mail_subject_register: Your %s account activation
@@ -682,3 +682,4 text_user_wrote: '%s escribió:'
682 text_wiki_destroy_confirmation: ¿Seguro que quiere borrar el wiki y todo su contenido?
682 text_wiki_destroy_confirmation: ¿Seguro que quiere borrar el wiki y todo su contenido?
683 text_workflow_edit: Seleccionar un flujo de trabajo para actualizar
683 text_workflow_edit: Seleccionar un flujo de trabajo para actualizar
684 text_plugin_assets_writable: Plugin assets directory writable
684 text_plugin_assets_writable: Plugin assets directory writable
685 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -697,3 +697,4 label_updated_time_by: Updated by %s %s ago
697 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
697 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
698 setting_diff_max_lines_displayed: Max number of diff lines displayed
698 setting_diff_max_lines_displayed: Max number of diff lines displayed
699 text_plugin_assets_writable: Plugin assets directory writable
699 text_plugin_assets_writable: Plugin assets directory writable
700 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -85,6 +85,8 error_scm_command_failed: "Une erreur s'est produite lors de l'accès au dépôt
85 error_scm_annotate: "L'entrée n'existe pas ou ne peut pas être annotée."
85 error_scm_annotate: "L'entrée n'existe pas ou ne peut pas être annotée."
86 error_issue_not_found_in_project: "La demande n'existe pas ou n'appartient pas à ce projet"
86 error_issue_not_found_in_project: "La demande n'existe pas ou n'appartient pas à ce projet"
87
87
88 warning_attachments_not_saved: "%d fichier(s) n'ont pas pu être sauvegardés."
89
88 mail_subject_lost_password: Votre mot de passe %s
90 mail_subject_lost_password: Votre mot de passe %s
89 mail_body_lost_password: 'Pour changer votre mot de passe, cliquez sur le lien suivant:'
91 mail_body_lost_password: 'Pour changer votre mot de passe, cliquez sur le lien suivant:'
90 mail_subject_register: Activation de votre compte %s
92 mail_subject_register: Activation de votre compte %s
@@ -697,3 +697,4 label_updated_time_by: עודכן ע"י %s לפני %s
697 setting_diff_max_lines_displayed: Max number of diff lines displayed
697 setting_diff_max_lines_displayed: Max number of diff lines displayed
698 text_plugin_assets_writable: Plugin assets directory writable
698 text_plugin_assets_writable: Plugin assets directory writable
699 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
699 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
700 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -698,3 +698,4 label_updated_time_by: "Módosította %s ennyivel ezelőtt: %s"
698 text_diff_truncated: '... A diff fájl vége nem jelenik meg, mert hosszab, mint a megjeleníthető sorok száma.'
698 text_diff_truncated: '... A diff fájl vége nem jelenik meg, mert hosszab, mint a megjeleníthető sorok száma.'
699 setting_diff_max_lines_displayed: A megjelenítendő sorok száma (maximum) a diff fájloknál
699 setting_diff_max_lines_displayed: A megjelenítendő sorok száma (maximum) a diff fájloknál
700 text_plugin_assets_writable: Plugin assets directory writable
700 text_plugin_assets_writable: Plugin assets directory writable
701 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -697,3 +697,4 label_updated_time_by: Updated by %s %s ago
697 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
697 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
698 setting_diff_max_lines_displayed: Max number of diff lines displayed
698 setting_diff_max_lines_displayed: Max number of diff lines displayed
699 text_plugin_assets_writable: Plugin assets directory writable
699 text_plugin_assets_writable: Plugin assets directory writable
700 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -698,3 +698,4 label_updated_time_by: Updated by %s %s ago
698 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
698 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
699 setting_diff_max_lines_displayed: Max number of diff lines displayed
699 setting_diff_max_lines_displayed: Max number of diff lines displayed
700 text_plugin_assets_writable: Plugin assets directory writable
700 text_plugin_assets_writable: Plugin assets directory writable
701 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -697,3 +697,4 label_updated_time_by: %s가 %s 전에 변경
697 text_diff_truncated: '... 차이점은 표시할 있는 최대 줄수를 초과해서 차이점은 잘렸습니다.'
697 text_diff_truncated: '... 차이점은 표시할 있는 최대 줄수를 초과해서 차이점은 잘렸습니다.'
698 setting_diff_max_lines_displayed: 차이점보기에 표시할 최대 줄수
698 setting_diff_max_lines_displayed: 차이점보기에 표시할 최대 줄수
699 text_plugin_assets_writable: Plugin assets directory writable
699 text_plugin_assets_writable: Plugin assets directory writable
700 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -699,3 +699,4 enumeration_issue_priorities: Darbo prioritetai
699 enumeration_doc_categories: Dokumento kategorijos
699 enumeration_doc_categories: Dokumento kategorijos
700 enumeration_activities: Veiklos (laiko sekimas)
700 enumeration_activities: Veiklos (laiko sekimas)
701 text_plugin_assets_writable: Plugin assets directory writable
701 text_plugin_assets_writable: Plugin assets directory writable
702 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -699,3 +699,4 label_updated_time_by: Updated by %s %s ago
699 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
699 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
700 setting_diff_max_lines_displayed: Max number of diff lines displayed
700 setting_diff_max_lines_displayed: Max number of diff lines displayed
701 text_plugin_assets_writable: Plugin assets directory writable
701 text_plugin_assets_writable: Plugin assets directory writable
702 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -698,3 +698,4 label_updated_time_by: Updated by %s %s ago
698 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
698 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
699 setting_diff_max_lines_displayed: Max number of diff lines displayed
699 setting_diff_max_lines_displayed: Max number of diff lines displayed
700 text_plugin_assets_writable: Plugin assets directory writable
700 text_plugin_assets_writable: Plugin assets directory writable
701 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -716,3 +716,4 label_updated_time_by: Uaktualnione przez %s %s temu
716 text_diff_truncated: '... Ten plik różnic został przycięty ponieważ jest zbyt długi.'
716 text_diff_truncated: '... Ten plik różnic został przycięty ponieważ jest zbyt długi.'
717 setting_diff_max_lines_displayed: Maksymalna liczba linii różnicy do pokazania
717 setting_diff_max_lines_displayed: Maksymalna liczba linii różnicy do pokazania
718 text_plugin_assets_writable: Plugin assets directory writable
718 text_plugin_assets_writable: Plugin assets directory writable
719 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -698,3 +698,4 label_updated_time_by: Updated by %s %s ago
698 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
698 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
699 setting_diff_max_lines_displayed: Max number of diff lines displayed
699 setting_diff_max_lines_displayed: Max number of diff lines displayed
700 text_plugin_assets_writable: Plugin assets directory writable
700 text_plugin_assets_writable: Plugin assets directory writable
701 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -699,3 +699,4 label_updated_time_by: Actualizado por %s há %s
699 text_diff_truncated: '... Este diff foi truncado porque excede o tamanho máximo que pode ser mostrado.'
699 text_diff_truncated: '... Este diff foi truncado porque excede o tamanho máximo que pode ser mostrado.'
700 setting_diff_max_lines_displayed: Número máximo de linhas de diff mostradas
700 setting_diff_max_lines_displayed: Número máximo de linhas de diff mostradas
701 text_plugin_assets_writable: Plugin assets directory writable
701 text_plugin_assets_writable: Plugin assets directory writable
702 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -697,3 +697,4 label_updated_time_by: Updated by %s %s ago
697 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
697 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
698 setting_diff_max_lines_displayed: Max number of diff lines displayed
698 setting_diff_max_lines_displayed: Max number of diff lines displayed
699 text_plugin_assets_writable: Plugin assets directory writable
699 text_plugin_assets_writable: Plugin assets directory writable
700 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -731,3 +731,4 text_wiki_destroy_confirmation: Вы уверены, что хотите уда
731 text_workflow_edit: Выберите роль и трекер для редактирования последовательности состояний
731 text_workflow_edit: Выберите роль и трекер для редактирования последовательности состояний
732
732
733 text_plugin_assets_writable: Plugin assets directory writable
733 text_plugin_assets_writable: Plugin assets directory writable
734 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -703,3 +703,4 label_updated_time_by: Updated by %s %s ago
703 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
703 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
704 setting_diff_max_lines_displayed: Max number of diff lines displayed
704 setting_diff_max_lines_displayed: Max number of diff lines displayed
705 text_plugin_assets_writable: Plugin assets directory writable
705 text_plugin_assets_writable: Plugin assets directory writable
706 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -698,3 +698,4 label_updated_time_by: Updated by %s %s ago
698 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
698 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
699 setting_diff_max_lines_displayed: Max number of diff lines displayed
699 setting_diff_max_lines_displayed: Max number of diff lines displayed
700 text_plugin_assets_writable: Plugin assets directory writable
700 text_plugin_assets_writable: Plugin assets directory writable
701 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -698,3 +698,4 enumeration_issue_priorities: Ärendeprioriteter
698 enumeration_doc_categories: Dokumentkategorier
698 enumeration_doc_categories: Dokumentkategorier
699 enumeration_activities: Aktiviteter (tidsuppföljning)
699 enumeration_activities: Aktiviteter (tidsuppföljning)
700 text_plugin_assets_writable: Plugin assets directory writable
700 text_plugin_assets_writable: Plugin assets directory writable
701 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -700,3 +700,4 label_updated_time_by: Updated by %s %s ago
700 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
700 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
701 setting_diff_max_lines_displayed: Max number of diff lines displayed
701 setting_diff_max_lines_displayed: Max number of diff lines displayed
702 text_plugin_assets_writable: Plugin assets directory writable
702 text_plugin_assets_writable: Plugin assets directory writable
703 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -698,3 +698,4 label_updated_time_by: Updated by %s %s ago
698 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
698 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
699 setting_diff_max_lines_displayed: Max number of diff lines displayed
699 setting_diff_max_lines_displayed: Max number of diff lines displayed
700 text_plugin_assets_writable: Plugin assets directory writable
700 text_plugin_assets_writable: Plugin assets directory writable
701 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -699,3 +699,4 label_updated_time_by: Updated by %s %s ago
699 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
699 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
700 setting_diff_max_lines_displayed: Max number of diff lines displayed
700 setting_diff_max_lines_displayed: Max number of diff lines displayed
701 text_plugin_assets_writable: Plugin assets directory writable
701 text_plugin_assets_writable: Plugin assets directory writable
702 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -700,3 +700,4 label_updated_time_by: Updated by %s %s ago
700 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
700 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
701 setting_diff_max_lines_displayed: Max number of diff lines displayed
701 setting_diff_max_lines_displayed: Max number of diff lines displayed
702 text_plugin_assets_writable: Plugin assets directory writable
702 text_plugin_assets_writable: Plugin assets directory writable
703 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -699,3 +699,4 enumeration_issue_priorities: 項目優先權
699 enumeration_doc_categories: 文件分類
699 enumeration_doc_categories: 文件分類
700 enumeration_activities: 活動 (時間追蹤)
700 enumeration_activities: 活動 (時間追蹤)
701 text_plugin_assets_writable: Plugin assets directory writable
701 text_plugin_assets_writable: Plugin assets directory writable
702 warning_attachments_not_saved: "%d file(s) could not be saved."
@@ -699,3 +699,4 enumeration_issue_priorities: 问题优先级
699 enumeration_doc_categories: 文档类别
699 enumeration_doc_categories: 文档类别
700 enumeration_activities: 活动(时间跟踪)
700 enumeration_activities: 活动(时间跟踪)
701 text_plugin_assets_writable: Plugin assets directory writable
701 text_plugin_assets_writable: Plugin assets directory writable
702 warning_attachments_not_saved: "%d file(s) could not be saved."
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -314,6 +314,14 div.flash.notice {
314 color: #005f00;
314 color: #005f00;
315 }
315 }
316
316
317 div.flash.warning {
318 background: url(../images/warning.png) 8px 5px no-repeat;
319 background-color: #FFEBC1;
320 border-color: #FDBF3B;
321 color: #A6750C;
322 text-align: left;
323 }
324
317 .nodata, .warning {
325 .nodata, .warning {
318 text-align: center;
326 text-align: center;
319 background-color: #FFEBC1;
327 background-color: #FFEBC1;
General Comments 0
You need to be logged in to leave comments. Login now