Commit 98e938bdb0049ee4e25b0aac41ce3c3489735052
1 parent
7caf4de2
Exists in
master
and in
4 other branches
Fix editor form, styles and JS
Showing
2 changed files
with
58 additions
and
14 deletions
Show diff stats
app/assets/stylesheets/sections/editor.scss
1 | 1 | .file-editor { |
2 | 2 | #editor{ |
3 | 3 | border: none; |
4 | + border-radius: 0; | |
4 | 5 | height: 500px; |
5 | 6 | margin: 0; |
6 | 7 | padding: 0; |
7 | 8 | position: relative; |
8 | 9 | width: 100%; |
9 | 10 | } |
10 | - .editor-commit-comment { | |
11 | - padding-top:20px; | |
11 | + | |
12 | + .cancel-btn { | |
13 | + color: #B94A48; | |
14 | + &:hover { | |
15 | + color: #B94A48; | |
16 | + } | |
17 | + } | |
18 | + .commit-button-annotation { | |
19 | + @extend .alert; | |
20 | + @extend .alert-info; | |
21 | + display: inline-block; | |
22 | + margin: 0; | |
23 | + padding: 2px; | |
24 | + | |
25 | + > * { | |
26 | + float: left; | |
27 | + } | |
28 | + | |
29 | + .commit-btn { | |
30 | + @extend .save-btn; | |
31 | + } | |
32 | + .message { | |
33 | + display: inline-block; | |
34 | + margin: 5px 8px 0 8px; | |
35 | + } | |
36 | + } | |
37 | + .commit_message-group { | |
38 | + margin-top: 20px; | |
39 | + | |
40 | + label { | |
41 | + font-size: 16px; | |
42 | + line-height: 20px; | |
43 | + } | |
12 | 44 | textarea { |
13 | - width: 50%; | |
14 | - margin-left: 20px; | |
45 | + @extend .span8; | |
15 | 46 | } |
16 | 47 | } |
17 | 48 | } | ... | ... |
app/views/tree/edit.html.haml
1 | 1 | .file-editor |
2 | - = form_tag(project_tree_path(@project, @id), :method => :put) do | |
2 | + = form_tag(project_tree_path(@project, @id), method: :put, class: "form-horizontal") do | |
3 | 3 | .file_holder |
4 | 4 | .file_title |
5 | 5 | %i.icon-file |
6 | 6 | %span.file_name |
7 | - = "#{@tree.path} (#{@ref})" | |
7 | + = @tree.path | |
8 | + %small | |
9 | + on | |
10 | + %strong= @ref | |
11 | + %span.options | |
12 | + .btn-group.tree-btn-group | |
13 | + = link_to "Cancel", project_tree_path(@project, @id), class: "btn very_small cancel-btn", confirm: "Are you sure?" | |
8 | 14 | .file_content.code |
9 | 15 | %pre#editor= @tree.data |
10 | 16 | |
11 | - .editor-commit-comment | |
12 | - = label_tag 'commit_message' do | |
13 | - %p.slead Commit message | |
14 | - = text_area_tag 'commit_message', '', :required => true | |
17 | + .control-group.commit_message-group | |
18 | + = label_tag 'commit_message', class: "control-label" do | |
19 | + Commit message | |
20 | + .controls | |
21 | + = text_area_tag 'commit_message', '', placeholder: "Update #{@tree.name}", required: true, rows: 3 | |
15 | 22 | .form-actions |
16 | 23 | = hidden_field_tag 'last_commit', @last_commit |
17 | - = hidden_field_tag 'content', '', :id => :file_content | |
18 | - = button_tag "Commit", class: 'btn save-btn' | |
24 | + = hidden_field_tag 'content', '', id: :file_content | |
25 | + .commit-button-annotation | |
26 | + = button_tag "Commit", class: 'btn commit-btn js-commit-button' | |
27 | + .message | |
28 | + to branch | |
29 | + %strong= @ref | |
19 | 30 | = link_to "Cancel", project_tree_path(@project, @id), class: "btn cancel-btn", confirm: "Are you sure?" |
20 | 31 | |
21 | 32 | :javascript |
... | ... | @@ -25,7 +36,9 @@ |
25 | 36 | editor.getSession().setMode('ace/mode/' + ace_mode); |
26 | 37 | } |
27 | 38 | |
28 | - $(".save-btn").click(function(){ | |
39 | + disableButtonIfEmptyField("#commit_message", ".js-commit-button"); | |
40 | + | |
41 | + $(".js-commit-button").click(function(){ | |
29 | 42 | $("#file_content").val(editor.getValue()); |
30 | - $(".form_editor form").submit(); | |
43 | + $(".file-editor form").submit(); | |
31 | 44 | }); | ... | ... |