Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
7f1633e2
Commit
7f1633e2
authored
Jan 21, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7615 from yglukhov/new-branch-submit-button-validation
Validation of 'Create branch' and 'Create tag' buttons
parents
7d1e6f15
b34e83d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
17 deletions
+13
-17
app/assets/javascripts/application.js.coffee
app/assets/javascripts/application.js.coffee
+9
-15
app/views/projects/branches/new.html.haml
app/views/projects/branches/new.html.haml
+2
-1
app/views/projects/tags/new.html.haml
app/views/projects/tags/new.html.haml
+2
-1
No files found.
app/assets/javascripts/application.js.coffee
View file @
7f1633e2
...
@@ -74,24 +74,18 @@ window.disableButtonIfEmptyField = (field_selector, button_selector) ->
...
@@ -74,24 +74,18 @@ window.disableButtonIfEmptyField = (field_selector, button_selector) ->
# Disable button if any input field with given selector is empty
# Disable button if any input field with given selector is empty
window
.
disableButtonIfAnyEmptyField
=
(
form
,
form_selector
,
button_selector
)
->
window
.
disableButtonIfAnyEmptyField
=
(
form
,
form_selector
,
button_selector
)
->
closest_submit
=
form
.
find
(
button_selector
)
closest_submit
=
form
.
find
(
button_selector
)
empty
=
false
updateButtons
=
->
form
.
find
(
'input'
).
filter
(
form_selector
).
each
->
filled
=
true
empty
=
true
if
rstrip
(
$
(
this
).
val
())
is
""
if
empty
closest_submit
.
disable
()
else
closest_submit
.
enable
()
form
.
keyup
->
empty
=
false
form
.
find
(
'input'
).
filter
(
form_selector
).
each
->
form
.
find
(
'input'
).
filter
(
form_selector
).
each
->
empty
=
true
if
rstrip
(
$
(
this
).
val
())
is
""
filled
=
rstrip
(
$
(
this
).
val
())
!=
""
||
!
$
(
this
).
attr
(
'required'
)
if
empty
if
filled
closest_submit
.
disable
()
else
closest_submit
.
enable
()
closest_submit
.
enable
()
else
closest_submit
.
disable
()
updateButtons
()
form
.
keyup
(
updateButtons
)
window
.
sanitize
=
(
str
)
->
window
.
sanitize
=
(
str
)
->
return
str
.
replace
(
/<(?:.|\n)*?>/gm
,
''
)
return
str
.
replace
(
/<(?:.|\n)*?>/gm
,
''
)
...
...
app/views/projects/branches/new.html.haml
View file @
7f1633e2
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
%h3
.page-title
%h3
.page-title
%i
.fa.fa-code-fork
%i
.fa.fa-code-fork
New branch
New branch
=
form_tag
project_branches_path
,
method: :post
,
class:
"form-horizontal"
do
=
form_tag
project_branches_path
,
method: :post
,
id:
"new-branch-form"
,
class:
"form-horizontal"
do
.form-group
.form-group
=
label_tag
:branch_name
,
'Name for new branch'
,
class:
'control-label'
=
label_tag
:branch_name
,
'Name for new branch'
,
class:
'control-label'
.col-sm-10
.col-sm-10
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
=
link_to
'Cancel'
,
project_branches_path
(
@project
),
class:
'btn btn-cancel'
=
link_to
'Cancel'
,
project_branches_path
(
@project
),
class:
'btn btn-cancel'
:javascript
:javascript
disableButtonIfAnyEmptyField
(
$
(
"
#new-branch-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
({
...
...
app/views/projects/tags/new.html.haml
View file @
7f1633e2
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
%h3
.page-title
%h3
.page-title
%i
.fa.fa-code-fork
%i
.fa.fa-code-fork
New tag
New tag
=
form_tag
project_tags_path
,
method: :post
,
class:
"form-horizontal"
do
=
form_tag
project_tags_path
,
method: :post
,
id:
"new-tag-form"
,
class:
"form-horizontal"
do
.form-group
.form-group
=
label_tag
:tag_name
,
'Name for new tag'
,
class:
'control-label'
=
label_tag
:tag_name
,
'Name for new tag'
,
class:
'control-label'
.col-sm-10
.col-sm-10
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
=
link_to
'Cancel'
,
project_tags_path
(
@project
),
class:
'btn btn-cancel'
=
link_to
'Cancel'
,
project_tags_path
(
@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
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment