From 166c215a75b50ce62fd40297f52e366df7dc9103 Mon Sep 17 00:00:00 2001 From: Ciro Santilli <ciro.santilli@gmail.com> Date: Fri, 3 Oct 2014 00:13:23 +0200 Subject: [PATCH] Make new and edit file submit more uniform --- app/views/projects/_commit_button.html.haml | 9 +++++++++ app/views/projects/edit_tree/show.html.haml | 15 +++++---------- app/views/projects/new_tree/show.html.haml | 11 +++-------- features/project/source/browse_files.feature | 4 ++-- features/steps/project/source/browse_files.rb | 4 ++-- 5 files changed, 21 insertions(+), 22 deletions(-) create mode 100644 app/views/projects/_commit_button.html.haml diff --git a/app/views/projects/_commit_button.html.haml b/app/views/projects/_commit_button.html.haml new file mode 100644 index 0000000000..fd8320adb8 --- /dev/null +++ b/app/views/projects/_commit_button.html.haml @@ -0,0 +1,9 @@ +.form-actions + .commit-button-annotation + = button_tag 'Commit Changes', + class: 'btn commit-btn js-commit-button btn-create' + .message + to branch + %strong= ref + = link_to 'Cancel', cancel_path, + class: 'btn btn-cancel', data: {confirm: leave_edit_message} diff --git a/app/views/projects/edit_tree/show.html.haml b/app/views/projects/edit_tree/show.html.haml index a863f7420a..5ccde05063 100644 --- a/app/views/projects/edit_tree/show.html.haml +++ b/app/views/projects/edit_tree/show.html.haml @@ -23,16 +23,11 @@ %i.fa.fa-spinner.fa-spin = render 'shared/commit_message_container', params: params, placeholder: "Update #{@blob.name}" - .form-actions - = hidden_field_tag 'last_commit', @last_commit - = hidden_field_tag 'content', '', id: "file-content" - = hidden_field_tag 'from_merge_request_id', params[:from_merge_request_id] - .commit-button-annotation - = button_tag "Commit changes", class: 'btn commit-btn js-commit-button btn-primary' - .message - to branch - %strong= @ref - = link_to "Cancel", @after_edit_path, class: "btn btn-cancel", data: { confirm: leave_edit_message} + = hidden_field_tag 'last_commit', @last_commit + = hidden_field_tag 'content', '', id: "file-content" + = hidden_field_tag 'from_merge_request_id', params[:from_merge_request_id] + = render 'projects/commit_button', ref: @ref, + cancel_path: @after_edit_path :javascript ace.config.set("modePath", gon.relative_url_root + "#{Gitlab::Application.config.assets.prefix}/ace") diff --git a/app/views/projects/new_tree/show.html.haml b/app/views/projects/new_tree/show.html.haml index 49c504c104..c47c0a3f64 100644 --- a/app/views/projects/new_tree/show.html.haml +++ b/app/views/projects/new_tree/show.html.haml @@ -27,14 +27,9 @@ .file-content.code %pre#editor= params[:content] - .form-actions - = hidden_field_tag 'content', '', id: "file-content" - .commit-button-annotation - = button_tag "Commit changes", class: 'btn commit-btn js-commit-button btn-create' - .message - to branch - %strong= @ref - = link_to "Cancel", project_tree_path(@project, @id), class: "btn btn-cancel", data: { confirm: leave_edit_message} + = hidden_field_tag 'content', '', id: 'file-content' + = render 'projects/commit_button', ref: @ref, + cancel_path: project_tree_path(@project, @id) :javascript ace.config.set("modePath", gon.relative_url_root + "#{Gitlab::Application.config.assets.prefix}/ace-src-noconflict") diff --git a/features/project/source/browse_files.feature b/features/project/source/browse_files.feature index 20ef7ac570..8ff2f583b3 100644 --- a/features/project/source/browse_files.feature +++ b/features/project/source/browse_files.feature @@ -30,7 +30,7 @@ Feature: Project Source Browse files And I edit code And I fill the new file name And I fill the commit message - And I click on "Commit changes" + And I click on "Commit Changes" Then I am redirected to the new file And I should see its new content @@ -46,7 +46,7 @@ Feature: Project Source Browse files And I click button "Edit" And I edit code And I fill the commit message - And I click on "Commit changes" + And I click on "Commit Changes" Then I am redirected to the ".gitignore" And I should see its new content diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index 0642302e79..20f8f6c24a 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -69,8 +69,8 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps click_link 'Diff' end - step 'I click on "Commit changes"' do - click_button 'Commit changes' + step 'I click on "Commit Changes"' do + click_button 'Commit Changes' end step 'I click on "Remove"' do -- 2.30.9