Commit cbb44b9d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #7662 from Razer6/disable_buttons_on_empty_form

[UX] Disable buttons if form is empty
parents 318d5d93 233d89a9
...@@ -19,5 +19,8 @@ ...@@ -19,5 +19,8 @@
.form-group .form-group
.col-sm-2 .col-sm-2
.col-sm-10 .col-sm-10
= submit_tag 'Remove file', class: 'btn btn-remove' = submit_tag 'Remove file', class: 'btn btn-remove btn-remove-file'
= link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal" = link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal"
:javascript
disableButtonIfEmptyField('#commit_message', '.btn-remove-file')
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
.project-network .project-network
.controls .controls
= form_tag project_network_path(@project, @id), method: :get, class: 'form-inline network-form' do |f| = form_tag project_network_path(@project, @id), method: :get, class: 'form-inline network-form' do |f|
= text_field_tag :extended_sha1, @options[:extended_sha1], placeholder: "Input an extended SHA1 syntax", class: "search-input form-control input-mx-250" = text_field_tag :extended_sha1, @options[:extended_sha1], placeholder: "Input an extended SHA1 syntax", class: 'search-input form-control input-mx-250 search-sha'
= button_tag type: 'submit', class: 'btn btn-success' do = button_tag type: 'submit', class: 'btn btn-success btn-search-sha' do
%i.icon-search %i.icon-search
.inline.prepend-left-20 .inline.prepend-left-20
.checkbox.light .checkbox.light
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
= spinner nil, true = spinner nil, true
:javascript :javascript
disableButtonIfEmptyField('#extended_sha1', '.btn-search-sha')
network_graph = new Network({ network_graph = new Network({
url: '#{project_network_path(@project, @ref, @options.merge(format: :json))}', url: '#{project_network_path(@project, @ref, @options.merge(format: :json))}',
commit_url: '#{project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")}', commit_url: '#{project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")}',
......
%h3.page-title New file %h3.page-title New file
%hr %hr
.file-editor .file-editor
= form_tag(project_new_tree_path(@project, @id), method: :put, class: "form-horizontal") do = form_tag(project_new_tree_path(@project, @id), method: :put, class: 'form-horizontal form-new-file') do
.form-group.commit_message-group .form-group.commit_message-group
= label_tag 'file_name', class: "control-label" do = label_tag 'file_name', class: 'control-label' do
File name File name
.col-sm-10 .col-sm-10
.input-group .input-group
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
= label_tag 'commit_message', class: "control-label" do = label_tag 'commit_message', class: "control-label" do
Commit message Commit message
.col-sm-10 .col-sm-10
= render 'shared/commit_message_container', {textarea: text_area_tag('commit_message', = render 'shared/commit_message_container', {textarea: text_area_tag('commit_message form-control',
params[:commit_message], placeholder: "Added new file", required: true, rows: 3, class: 'form-control')} params[:commit_message], placeholder: "Added new file", required: true, rows: 3, class: 'form-control')}
.file-holder .file-holder
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
ace.config.set("modePath", gon.relative_url_root + "#{Gitlab::Application.config.assets.prefix}/ace-src-noconflict") ace.config.set("modePath", gon.relative_url_root + "#{Gitlab::Application.config.assets.prefix}/ace-src-noconflict")
var editor = ace.edit("editor"); var editor = ace.edit("editor");
disableButtonIfEmptyField("#commit_message", ".js-commit-button"); disableButtonIfAnyEmptyField($('.form-new-file'), '.form-control', '.btn-create')
$(".js-commit-button").click(function(){ $(".js-commit-button").click(function(){
$("#file-content").val(editor.getValue()); $("#file-content").val(editor.getValue());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment