##// END OF EJS Templates
Adds a setting to enable/disable formatting of commit messages (#22758)....
Jean-Philippe Lang -
r15680:ba2a47a8fb75
parent child
Show More
@@ -254,6 +254,11 module ApplicationHelper
254 end
254 end
255 end
255 end
256
256
257 def format_changeset_comments(changeset, options={})
258 method = options[:short] ? :short_comments : :comments
259 textilizable changeset, method, :formatting => Setting.commit_logs_formatting?
260 end
261
257 def due_date_distance_in_words(date)
262 def due_date_distance_in_words(date)
258 if date
263 if date
259 l((date < User.current.today ? :label_roadmap_overdue : :label_roadmap_due_in), distance_of_date_in_words(User.current.today, date))
264 l((date < User.current.today ? :label_roadmap_overdue : :label_roadmap_due_in), distance_of_date_in_words(User.current.today, date))
@@ -619,7 +624,13 module ApplicationHelper
619
624
620 text = text.dup
625 text = text.dup
621 macros = catch_macros(text)
626 macros = catch_macros(text)
622 text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text, :object => obj, :attribute => attr)
627
628 if options[:formatting] == false
629 text = h(text)
630 else
631 formatting = options[:formatting] || Setting.text_formatting
632 text = Redmine::WikiFormatting.to_html(formatting, text, :object => obj, :attribute => attr)
633 end
623
634
624 @parsed_headings = []
635 @parsed_headings = []
625 @heading_anchors = {}
636 @heading_anchors = {}
@@ -13,8 +13,8
13 <% end %>
13 <% end %>
14 <br />
14 <br />
15 <span class="author"><%= authoring(changeset.committed_on, changeset.author) %></span></p>
15 <span class="author"><%= authoring(changeset.committed_on, changeset.author) %></span></p>
16 <div class="wiki">
16 <div class="wiki changset-comments">
17 <%= textilizable(changeset, :comments) %>
17 <%= format_changeset_comments changeset %>
18 </div>
18 </div>
19 </div>
19 </div>
20 <% end %>
20 <% end %>
@@ -33,7 +33,9
33
33
34 </div>
34 </div>
35
35
36 <%= textilizable @changeset.comments %>
36 <div class="wiki changset-comments">
37 <%= format_changeset_comments @changeset %>
38 </div>
37
39
38 <% if @changeset.issues.visible.any? || User.current.allowed_to?(:manage_related_issues, @repository.project) %>
40 <% if @changeset.issues.visible.any? || User.current.allowed_to?(:manage_related_issues, @repository.project) %>
39 <%= render :partial => 'related_issues' %>
41 <%= render :partial => 'related_issues' %>
@@ -42,7 +42,7 end %>
42 <td class="checkbox"><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').prop('checked')) {$('#cb-#{line_num-1}').prop('checked',true);}") if show_diff && (line_num > 1) %></td>
42 <td class="checkbox"><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').prop('checked')) {$('#cb-#{line_num-1}').prop('checked',true);}") if show_diff && (line_num > 1) %></td>
43 <td class="committed_on"><%= format_time(changeset.committed_on) %></td>
43 <td class="committed_on"><%= format_time(changeset.committed_on) %></td>
44 <td class="author"><%= changeset.user.blank? ? changeset.author.to_s.truncate(30) : link_to_user(changeset.user) %></td>
44 <td class="author"><%= changeset.user.blank? ? changeset.author.to_s.truncate(30) : link_to_user(changeset.user) %></td>
45 <td class="comments"><%= textilizable(truncate_at_line_break(changeset.comments)) %></td>
45 <td class="comments"><%= format_changeset_comments changeset, :short => true %></td>
46 </tr>
46 </tr>
47 <% line_num += 1 %>
47 <% line_num += 1 %>
48 <% end %>
48 <% end %>
@@ -52,6 +52,8
52 </p>
52 </p>
53
53
54 <p><%= setting_text_field :repository_log_display_limit, :size => 6 %></p>
54 <p><%= setting_text_field :repository_log_display_limit, :size => 6 %></p>
55
56 <p><%= setting_check_box :commit_logs_formatting %></p>
55 </div>
57 </div>
56
58
57 <fieldset class="box tabular settings">
59 <fieldset class="box tabular settings">
@@ -448,6 +448,7 en:
448 setting_attachment_extensions_allowed: Allowed extensions
448 setting_attachment_extensions_allowed: Allowed extensions
449 setting_attachment_extensions_denied: Disallowed extensions
449 setting_attachment_extensions_denied: Disallowed extensions
450 setting_new_item_menu_tab: Project menu tab for creating new objects
450 setting_new_item_menu_tab: Project menu tab for creating new objects
451 setting_commit_logs_formatting: Apply text formatting to commit messages
451
452
452 permission_add_project: Create project
453 permission_add_project: Create project
453 permission_add_subprojects: Create subprojects
454 permission_add_subprojects: Create subprojects
@@ -460,6 +460,7 fr:
460 setting_sys_api_key: Clé de protection de l'API
460 setting_sys_api_key: Clé de protection de l'API
461 setting_lost_password: Autoriser la réinitialisation par email de mot de passe perdu
461 setting_lost_password: Autoriser la réinitialisation par email de mot de passe perdu
462 setting_new_item_menu_tab: Onglet de création d'objets dans le menu du project
462 setting_new_item_menu_tab: Onglet de création d'objets dans le menu du project
463 setting_commit_logs_formatting: Appliquer le formattage de texte aux messages de commit
463
464
464 permission_add_project: Créer un projet
465 permission_add_project: Créer un projet
465 permission_add_subprojects: Créer des sous-projets
466 permission_add_subprojects: Créer des sous-projets
@@ -239,6 +239,8 repositories_encodings:
239 # encoding used to convert commit logs to UTF-8
239 # encoding used to convert commit logs to UTF-8
240 commit_logs_encoding:
240 commit_logs_encoding:
241 default: 'UTF-8'
241 default: 'UTF-8'
242 commit_logs_formatting:
243 default: 1
242 repository_log_display_limit:
244 repository_log_display_limit:
243 format: int
245 format: int
244 default: 100
246 default: 100
@@ -492,6 +492,7 div#issue-changesets {float:right; width:45%; margin-left: 1em; margin-bottom: 1
492 div#issue-changesets div.changeset { padding: 4px;}
492 div#issue-changesets div.changeset { padding: 4px;}
493 div#issue-changesets div.changeset { border-bottom: 1px solid #ddd; }
493 div#issue-changesets div.changeset { border-bottom: 1px solid #ddd; }
494 div#issue-changesets p { margin-top: 0; margin-bottom: 1em;}
494 div#issue-changesets p { margin-top: 0; margin-bottom: 1em;}
495 .changset-comments {margin-bottom:1em; font-family:}
495
496
496 div.journal {overflow:auto;}
497 div.journal {overflow:auto;}
497 div.journal.private-notes {border-left:2px solid #d22; padding-left:4px; margin-left:-6px;}
498 div.journal.private-notes {border-left:2px solid #d22; padding-left:4px; margin-left:-6px;}
@@ -167,6 +167,16 class RepositoriesControllerTest < Redmine::ControllerTest
167 assert_select 'h2', :text => 'Revision 1'
167 assert_select 'h2', :text => 'Revision 1'
168 end
168 end
169
169
170 def test_revision_should_not_format_comments_when_disabled
171 Changeset.where(:id => 100).update_all(:comments => 'Simple *text*')
172
173 with_settings :commit_logs_formatting => '0' do
174 get :revision, :id => 1, :rev => 1
175 assert_response :success
176 assert_select '.changset-comments', :text => 'Simple *text*'
177 end
178 end
179
170 def test_revision_should_show_add_related_issue_form
180 def test_revision_should_show_add_related_issue_form
171 Role.find(1).add_permission! :manage_related_issues
181 Role.find(1).add_permission! :manage_related_issues
172 @request.session[:user_id] = 2
182 @request.session[:user_id] = 2
General Comments 0
You need to be logged in to leave comments. Login now