Commit 72ab3b17 authored by Douwe Maan's avatar Douwe Maan

Use js-requires-input where appropriate

parent 2aeb26bd
%div %div
= form_for [:profile, @key], html: { class: 'form-horizontal' } do |f| = form_for [:profile, @key], html: { class: 'form-horizontal js-requires-input' } do |f|
- if @key.errors.any? - if @key.errors.any?
.alert.alert-danger .alert.alert-danger
%ul %ul
...@@ -9,12 +9,11 @@ ...@@ -9,12 +9,11 @@
.form-group .form-group
= f.label :key, class: 'control-label' = f.label :key, class: 'control-label'
.col-sm-10 .col-sm-10
= f.text_area :key, class: "form-control", rows: 8 = f.text_area :key, class: "form-control", rows: 8, autofocus: true, required: true
.form-group .form-group
= f.label :title, class: 'control-label' = f.label :title, class: 'control-label'
.col-sm-10= f.text_field :title, class: "form-control" .col-sm-10= f.text_field :title, class: "form-control", required: true
.form-actions .form-actions
= f.submit 'Add key', class: "btn btn-create" = f.submit 'Add key', class: "btn btn-create"
= link_to "Cancel", profile_keys_path, class: "btn btn-cancel" = link_to "Cancel", profile_keys_path, class: "btn btn-cancel"
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
%a.close{href: "#", "data-dismiss" => "modal"} × %a.close{href: "#", "data-dismiss" => "modal"} ×
%h3.page-title Create New Directory %h3.page-title Create New Directory
.modal-body .modal-body
= form_tag namespace_project_create_dir_path(@project.namespace, @project, @id), method: :post, remote: false, class: 'form-horizontal js-create-dir-form' do = form_tag namespace_project_create_dir_path(@project.namespace, @project, @id), method: :post, remote: false, class: 'form-horizontal js-create-dir-form js-requires-input' do
.form-group .form-group
= label_tag :dir_name, 'Directory name', class: 'control-label' = label_tag :dir_name, 'Directory name', class: 'control-label'
.col-sm-10 .col-sm-10
...@@ -18,5 +18,4 @@ ...@@ -18,5 +18,4 @@
= link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal" = link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal"
:javascript :javascript
disableButtonIfAnyEmptyField($(".js-create-dir-form"), ".form-control", ".btn-create");
new NewCommitForm($('.js-create-dir-form')) new NewCommitForm($('.js-create-dir-form'))
%div %div
= form_for [@project.namespace.becomes(Namespace), @project, @key], url: namespace_project_deploy_keys_path, html: { class: 'deploy-key-form form-horizontal' } do |f| = form_for [@project.namespace.becomes(Namespace), @project, @key], url: namespace_project_deploy_keys_path, html: { class: 'deploy-key-form form-horizontal js-requires-input' } do |f|
-if @key.errors.any? -if @key.errors.any?
.alert.alert-danger .alert.alert-danger
%ul %ul
...@@ -8,16 +8,15 @@ ...@@ -8,16 +8,15 @@
.form-group .form-group
= f.label :title, class: "control-label" = f.label :title, class: "control-label"
.col-sm-10= f.text_field :title, class: 'form-control' .col-sm-10= f.text_field :title, class: 'form-control', autofocus: true, required: true
.form-group .form-group
= f.label :key, class: "control-label" = f.label :key, class: "control-label"
.col-sm-10 .col-sm-10
%p.light %p.light
Paste a machine public key here. Read more about how to generate it Paste a machine public key here. Read more about how to generate it
= link_to "here", help_page_path("ssh", "README") = link_to "here", help_page_path("ssh", "README")
= f.text_area :key, class: "form-control thin_area", rows: 5 = f.text_area :key, class: "form-control thin_area", rows: 5, required: true
.form-actions .form-actions
= f.submit 'Create Deploy Key', class: "btn-create btn" = f.submit 'Create Deploy Key', class: "btn-create btn"
= link_to "Cancel", namespace_project_deploy_keys_path(@project.namespace, @project), class: "btn btn-cancel" = link_to "Cancel", namespace_project_deploy_keys_path(@project.namespace, @project), class: "btn btn-cancel"
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
New Tag New Tag
%hr %hr
= form_tag namespace_project_tags_path, method: :post, id: "new-tag-form", class: "form-horizontal gfm-form tag-form" do = form_tag namespace_project_tags_path, method: :post, id: "new-tag-form", class: "form-horizontal gfm-form tag-form js-requires-input" do
.form-group .form-group
= label_tag :tag_name, nil, class: 'control-label' = label_tag :tag_name, nil, class: 'control-label'
.col-sm-10 .col-sm-10
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
= link_to 'Cancel', namespace_project_tags_path(@project.namespace, @project), class: 'btn btn-cancel' = link_to 'Cancel', namespace_project_tags_path(@project.namespace, @project), class: 'btn btn-cancel'
:javascript :javascript
disableButtonIfAnyEmptyField($("#new-tag-form"), ".form-control", ".btn-create");
var availableTags = #{@project.repository.ref_names.to_json}; var availableTags = #{@project.repository.ref_names.to_json};
$("#ref").autocomplete({ $("#ref").autocomplete({
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
.form-group.branch .form-group.branch
= label_tag 'new_branch', 'Target branch', class: 'control-label' = label_tag 'new_branch', 'Target branch', class: 'control-label'
.col-sm-10 .col-sm-10
= text_field_tag 'new_branch', @new_branch || @ref, class: "form-control js-new-branch" = text_field_tag 'new_branch', @new_branch || @ref, required: true, class: "form-control js-new-branch"
.form-group.js-create-merge-request-form-group .form-group.js-create-merge-request-form-group
.col-sm-offset-2.col-sm-10 .col-sm-offset-2.col-sm-10
......
.snippet-form-holder .snippet-form-holder
= form_for @snippet, url: url, html: { class: "form-horizontal snippet-form" } do |f| = form_for @snippet, url: url, html: { class: "form-horizontal snippet-form js-requires-input" } do |f|
- if @snippet.errors.any? - if @snippet.errors.any?
.alert.alert-danger .alert.alert-danger
%ul %ul
......
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