1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
.form-group.commit_message-group
- nonce = SecureRandom.hex
= label_tag "commit_message-#{nonce}", class: 'control-label' do
Commit message
.col-sm-10
.commit-message-container
.max-width-marker
= text_area_tag 'commit_message',
(params[:commit_message] || local_assigns[:text] || local_assigns[:placeholder]),
class: 'form-control js-commit-message', placeholder: local_assigns[:placeholder],
data: local_assigns.slice(:message_with_description, :message_without_description),
required: true, rows: (local_assigns[:rows] || 3),
id: "commit_message-#{nonce}"
- if local_assigns[:hint]
%p.hint
Try to keep the first line under 52 characters
and the others under 72.
-if local_assigns.slice(:message_with_description, :message_without_description).present?
%p.hint.with-description-hint
= link_to "#", class: "with-description-link" do
Include description in commit message
%p.hint.without-description-hint.hide
= link_to "#", class: "without-description-link" do
Don't include description in commit message
:javascript
$('.with-description-link').on('click', function(e) {
e.preventDefault();
var textarea = $('.js-commit-message')
textarea.val(textarea.data('messageWithDescription'))
$('.with-description-hint').hide();
$('.without-description-hint').show();
});
$('.without-description-link').on('click', function(e) {
e.preventDefault();
var textarea = $('.js-commit-message')
textarea.val(textarea.data('messageWithoutDescription'))
$('.with-description-hint').show();
$('.without-description-hint').hide();
});
|