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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
7157f79c
Commit
7157f79c
authored
Mar 11, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor js behaviours helpers
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
9f405068
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
155 additions
and
147 deletions
+155
-147
app/assets/javascripts/behaviors/details_behavior.coffee
app/assets/javascripts/behaviors/details_behavior.coffee
+11
-1
app/assets/javascripts/behaviors/toggler_behavior.coffee
app/assets/javascripts/behaviors/toggler_behavior.coffee
+8
-7
app/assets/javascripts/main.js.coffee
app/assets/javascripts/main.js.coffee
+0
-9
app/assets/stylesheets/generic/common.scss
app/assets/stylesheets/generic/common.scss
+0
-4
app/views/groups/members.html.haml
app/views/groups/members.html.haml
+3
-3
app/views/projects/commit/_commit_box.html.haml
app/views/projects/commit/_commit_box.html.haml
+1
-1
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+87
-86
app/views/projects/merge_requests/show/_mr_accept.html.haml
app/views/projects/merge_requests/show/_mr_accept.html.haml
+12
-11
app/views/projects/new.html.haml
app/views/projects/new.html.haml
+33
-25
No files found.
app/assets/javascripts/behaviors/details_behavior.coffee
View file @
7157f79c
$
->
$
->
$
(
"body"
).
on
"click"
,
".js-details-target"
,
->
$
(
"body"
).
on
"click"
,
".js-details-target"
,
->
container
=
$
(
@
).
closest
(
".js-details-container"
)
container
=
$
(
@
).
closest
(
".js-details-container"
)
container
.
toggleClass
(
"open"
)
container
.
toggleClass
(
"open"
)
# Show details content. Hides link after click.
#
# %div
# %a.js-details-expand
# %div.js-details-content
#
$
(
"body"
).
on
"click"
,
".js-details-expand"
,
(
e
)
->
$
(
@
).
next
(
'.js-details-content'
).
removeClass
(
"hide"
)
$
(
@
).
hide
()
e
.
preventDefault
()
app/assets/javascripts/behaviors/toggler_behavior.coffee
View file @
7157f79c
$
->
$
->
$
(
"body"
).
on
"click"
,
".js-toggler-target"
,
->
$
(
"body"
).
on
"click"
,
".js-toggler-target"
,
->
container
=
$
(
@
).
closest
(
".js-toggler-container"
)
container
=
$
(
@
).
closest
(
".js-toggler-container"
)
container
.
toggleClass
(
"on"
)
container
.
toggleClass
(
"on"
)
$
(
"body"
).
on
"click"
,
".js-toggle-visibility-link"
,
(
e
)
->
# Toggle button. Show/hide content inside parent container.
# Button does not change visibility. If button has icon - it changes chevron style.
#
# %div.js-toggle-container
# %a.js-toggle-button
# %div.js-toggle-content
#
$
(
"body"
).
on
"click"
,
".js-toggle-button"
,
(
e
)
->
$
(
@
).
find
(
'i'
).
$
(
@
).
find
(
'i'
).
toggleClass
(
'icon-chevron-down'
).
toggleClass
(
'icon-chevron-down'
).
toggleClass
(
'icon-chevron-up'
)
toggleClass
(
'icon-chevron-up'
)
container
=
$
(
".js-toggle-visibility-container"
)
container
.
toggleClass
(
"hide"
)
e
.
preventDefault
()
$
(
"body"
).
on
"click"
,
".js-toggle-button"
,
(
e
)
->
$
(
@
).
closest
(
".js-toggle-container"
).
find
(
".js-toggle-content"
).
toggle
()
$
(
@
).
closest
(
".js-toggle-container"
).
find
(
".js-toggle-content"
).
toggle
()
e
.
preventDefault
()
e
.
preventDefault
()
app/assets/javascripts/main.js.coffee
View file @
7157f79c
...
@@ -62,11 +62,6 @@ $ ->
...
@@ -62,11 +62,6 @@ $ ->
$
(
'.remove-row'
).
bind
'ajax:success'
,
->
$
(
'.remove-row'
).
bind
'ajax:success'
,
->
$
(
this
).
closest
(
'li'
).
fadeOut
()
$
(
this
).
closest
(
'li'
).
fadeOut
()
# Click a .appear-link, appear-data fadeout
$
(
".appear-link"
).
on
'click'
,
(
e
)
->
$
(
'.appear-data'
).
fadeIn
()
e
.
preventDefault
()
# Initialize select2 selects
# Initialize select2 selects
$
(
'select.select2'
).
select2
(
width
:
'resolve'
,
dropdownAutoWidth
:
true
)
$
(
'select.select2'
).
select2
(
width
:
'resolve'
,
dropdownAutoWidth
:
true
)
...
@@ -121,10 +116,6 @@ $ ->
...
@@ -121,10 +116,6 @@ $ ->
$
(
@
).
next
(
'table'
).
show
()
$
(
@
).
next
(
'table'
).
show
()
$
(
@
).
remove
()
$
(
@
).
remove
()
$
(
".diff-content"
).
on
"click"
,
".js-details-expand"
,
->
$
(
@
).
next
(
'.js-details-contain'
).
removeClass
(
"hide"
)
$
(
@
).
remove
()
((
$
)
->
((
$
)
->
# Disable an element and add the 'disabled' Bootstrap class
# Disable an element and add the 'disabled' Bootstrap class
$
.
fn
.
extend
disable
:
->
$
.
fn
.
extend
disable
:
->
...
...
app/assets/stylesheets/generic/common.scss
View file @
7157f79c
...
@@ -298,10 +298,6 @@ img.emoji {
...
@@ -298,10 +298,6 @@ img.emoji {
width
:
20px
;
width
:
20px
;
}
}
.appear-data
{
display
:
none
;
}
.chart
{
.chart
{
overflow
:
hidden
;
overflow
:
hidden
;
height
:
220px
;
height
:
220px
;
...
...
app/views/groups/members.html.haml
View file @
7157f79c
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
%hr
%hr
.clearfix
.clearfix
.js-toggle-container
=
form_tag
members_group_path
(
@group
),
method: :get
,
class:
'form-inline member-search-form'
do
=
form_tag
members_group_path
(
@group
),
method: :get
,
class:
'form-inline member-search-form'
do
.form-group
.form-group
=
search_field_tag
:search
,
params
[
:search
],
{
placeholder:
'Find member by name'
,
class:
'form-control search-text-input input-mn-300'
}
=
search_field_tag
:search
,
params
[
:search
],
{
placeholder:
'Find member by name'
,
class:
'form-control search-text-input input-mn-300'
}
...
@@ -17,11 +17,11 @@
...
@@ -17,11 +17,11 @@
-
if
current_user
&&
current_user
.
can?
(
:manage_group
,
@group
)
-
if
current_user
&&
current_user
.
can?
(
:manage_group
,
@group
)
.pull-right
.pull-right
=
link_to
'#'
,
class:
'btn btn-new js-toggle-
visibility-link
'
do
=
link_to
'#'
,
class:
'btn btn-new js-toggle-
button
'
do
Add members
Add members
%i
.icon-chevron-down
%i
.icon-chevron-down
.js-toggle-
visibility-container
.hide.new-group-member-holder
.js-toggle-
content
.hide.new-group-member-holder
=
render
"new_group_member"
=
render
"new_group_member"
.ui-box.prepend-top-20
.ui-box.prepend-top-20
...
...
app/views/projects/commit/_commit_box.html.haml
View file @
7157f79c
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
-
if
@branches
.
any?
-
if
@branches
.
any?
and in
and in
=
link_to
(
"
#{
pluralize
(
@branches
.
count
,
"other branch"
)
}
"
,
"#"
,
class:
"js-details-expand"
)
=
link_to
(
"
#{
pluralize
(
@branches
.
count
,
"other branch"
)
}
"
,
"#"
,
class:
"js-details-expand"
)
%span
.js-details-cont
ain
.hide
%span
.js-details-cont
ent
.hide
=
commit_branches_links
(
@project
,
@branches
)
=
commit_branches_links
(
@project
,
@branches
)
.commit-box
.commit-box
...
...
app/views/projects/edit.html.haml
View file @
7157f79c
...
@@ -93,100 +93,101 @@
...
@@ -93,100 +93,101 @@
.centered-light-block
.danger-settings.js-toggle-container
%h3
.centered-light-block
%i
.icon-warning-sign
%h3
Dangerous settings
%i
.icon-warning-sign
Dangerous settings
%p
Project settings below may result in data loss!
=
link_to
'#'
,
class:
'btn js-toggle-visibility-link'
do
%p
Project settings below may result in data loss!
Show it to me
=
link_to
'#'
,
class:
'btn js-toggle-button'
do
%i
.icon-chevron-down
Show it to me
%i
.icon-chevron-down
.js-toggle-visibility-container.hide
-
if
can?
current_user
,
:archive_project
,
@project
.js-toggle-content.hide
.ui-box.ui-box-danger
-
if
can?
current_user
,
:archive_project
,
@project
.title
.ui-box.ui-box-danger
-
if
@project
.
archived?
.title
Unarchive project
-
if
@project
.
archived?
-
else
Unarchive project
Archive project
-
else
.body
Archive project
-
if
@project
.
archived?
.body
%p
-
if
@project
.
archived?
Unarchiving the project will mark its repository as active.
%p
%br
Unarchiving the project will mark its repository as active.
The project can be committed to.
%br
%br
The project can be committed to.
%strong
Once active this project shows up in the search and on the dashboard.
%br
=
link_to
'Unarchive'
,
unarchive_project_path
(
@project
),
%strong
Once active this project shows up in the search and on the dashboard.
data:
{
confirm:
"Are you sure that you want to unarchive this project?
\n
When this project is unarchived it is active and can be comitted to again."
},
=
link_to
'Unarchive'
,
unarchive_project_path
(
@project
),
method: :post
,
class:
"btn btn-remove"
data:
{
confirm:
"Are you sure that you want to unarchive this project?
\n
When this project is unarchived it is active and can be comitted to again."
},
-
else
method: :post
,
class:
"btn btn-remove"
%p
-
else
Archiving the project will mark its repository as read-only.
%p
%br
Archiving the project will mark its repository as read-only.
It is hidden from the dashboard and doesn't show up in searches.
%br
%br
It is hidden from the dashboard and doesn't show up in searches.
%strong
Archived projects cannot be committed to!
%br
=
link_to
'Archive'
,
archive_project_path
(
@project
),
%strong
Archived projects cannot be committed to!
data:
{
confirm:
"Are you sure that you want to archive this project?
\n
An archived project cannot be committed to."
},
=
link_to
'Archive'
,
archive_project_path
(
@project
),
method: :post
,
class:
"btn btn-remove"
data:
{
confirm:
"Are you sure that you want to archive this project?
\n
An archived project cannot be committed to."
},
-
else
method: :post
,
class:
"btn btn-remove"
.nothing-here-block
Only the project owner can archive a project
-
else
.nothing-here-block
Only the project owner can archive a project
-
if
can?
(
current_user
,
:change_namespace
,
@project
)
-
if
can?
(
current_user
,
:change_namespace
,
@project
)
.ui-box.ui-box-danger
.title
Transfer project
.errors-holder
.form-holder
=
form_for
(
@project
,
url:
transfer_project_path
(
@project
),
method: :put
,
remote:
true
,
html:
{
class:
'transfer-project form-horizontal'
})
do
|
f
|
.form-group
=
f
.
label
:namespace_id
,
class:
'control-label'
do
%span
Namespace
.col-sm-10
.form-group
=
f
.
select
:namespace_id
,
namespaces_options
(
@project
.
namespace_id
),
{
prompt:
'Choose a project namespace'
},
{
class:
'select2'
}
%ul
%li
Be careful. Changing the project's namespace can have unintended side effects.
%li
You can only transfer the project to namespaces you manage.
%li
You will need to update your local repositories to point to the new location.
.form-actions
=
f
.
submit
'Transfer'
,
class:
"btn btn-remove"
-
else
.nothing-here-block
Only the project owner can transfer a project
.ui-box.ui-box-danger
.ui-box.ui-box-danger
.title
Transfer project
.title
Rename repository
.errors-holder
.errors-holder
.form-holder
.form-holder
=
form_for
(
@project
,
url:
transfer_project_path
(
@project
),
method: :put
,
remote:
true
,
html:
{
class:
'transfer-project
form-horizontal'
})
do
|
f
|
=
form_for
(
@project
,
html:
{
class:
'
form-horizontal'
})
do
|
f
|
.form-group
.form-group
=
f
.
label
:
namespace_id
,
class:
'control-label'
do
=
f
.
label
:
path
,
class:
'control-label'
do
%span
Namespace
%span
Path
.col-sm-
10
.col-sm-
9
.form-group
.form-group
=
f
.
select
:namespace_id
,
namespaces_options
(
@project
.
namespace_id
),
{
prompt:
'Choose a project namespace'
},
{
class:
'select2'
}
.input-group
=
f
.
text_field
:path
,
class:
'form-control'
%span
.input-group-addon
.git
%ul
%ul
%li
Be careful. Changing the project's namespace can have unintended side effects.
%li
Be careful. Renaming a project's repository can have unintended side effects.
%li
You can only transfer the project to namespaces you manage.
%li
You will need to update your local repositories to point to the new location.
%li
You will need to update your local repositories to point to the new location.
.form-actions
.form-actions
=
f
.
submit
'Transfer'
,
class:
"btn btn-remove"
=
f
.
submit
'Rename'
,
class:
"btn btn-remove"
-
else
.nothing-here-block
Only the project owner can transfer a project
-
if
can?
(
current_user
,
:remove_project
,
@project
)
.ui-box.ui-box-danger
.ui-box.ui-box-danger
.title
Remove project
.title
Rename repository
.body
.errors-holder
%p
.form-holder
Removing the project will delete its repository and all related resources including issues, merge requests etc.
=
form_for
(
@project
,
html:
{
class:
'form-horizontal'
})
do
|
f
|
%br
.form-group
%strong
Removed projects cannot be restored!
=
f
.
label
:path
,
class:
'control-label'
do
%span
Path
=
link_to
'Remove project'
,
@project
,
data:
{
confirm:
remove_project_message
(
@project
)
},
method: :delete
,
class:
"btn btn-remove"
.col-sm-9
-
else
.form-group
.nothing-here-block
Only project owner can remove a project
.input-group
=
f
.
text_field
:path
,
class:
'form-control'
%span
.input-group-addon
.git
%ul
%li
Be careful. Renaming a project's repository can have unintended side effects.
%li
You will need to update your local repositories to point to the new location.
.form-actions
=
f
.
submit
'Rename'
,
class:
"btn btn-remove"
-
if
can?
(
current_user
,
:remove_project
,
@project
)
.ui-box.ui-box-danger
.title
Remove project
.body
%p
Removing the project will delete its repository and all related resources including issues, merge requests etc.
%br
%strong
Removed projects cannot be restored!
=
link_to
'Remove project'
,
@project
,
data:
{
confirm:
remove_project_message
(
@project
)
},
method: :delete
,
class:
"btn btn-remove"
-
else
.nothing-here-block
Only project owner can remove a project
.save-project-loader.hide
.save-project-loader.hide
%center
%center
...
...
app/views/projects/merge_requests/show/_mr_accept.html.haml
View file @
7157f79c
...
@@ -15,18 +15,19 @@
...
@@ -15,18 +15,19 @@
=
link_to
"click here"
,
"#modal_merge_info"
,
class:
"how_to_merge_link vlink"
,
title:
"How To Merge"
,
"data-toggle"
=>
"modal"
=
link_to
"click here"
,
"#modal_merge_info"
,
class:
"how_to_merge_link vlink"
,
title:
"How To Merge"
,
"data-toggle"
=>
"modal"
for instructions.
for instructions.
%br
If you want to modify merge commit message -
%strong
=
link_to
"click here"
,
"#"
,
class:
"modify-merge-commit-link js-toggle-visibility-link"
,
title:
"Modify merge commit message"
.js-toggle-visibility-container.hide
.js-toggle-container
.form-group
%p
=
label_tag
:merge_commit_message
,
"Commit message"
,
class:
'control-label'
If you want to modify merge commit message -
.col-sm-10
%strong
=
text_area_tag
:merge_commit_message
,
@merge_request
.
merge_commit_message
,
class:
"form-control js-gfm-input"
,
rows:
14
,
required:
true
=
link_to
"click here"
,
"#"
,
class:
"modify-merge-commit-link js-toggle-button"
,
title:
"Modify merge commit message"
%p
.hint
.js-toggle-content.hide
The recommended maximum line length is 52 characters for the first line and 72 characters for all following lines.
.form-group
=
label_tag
:merge_commit_message
,
"Commit message"
,
class:
'control-label'
.col-sm-10
=
text_area_tag
:merge_commit_message
,
@merge_request
.
merge_commit_message
,
class:
"form-control js-gfm-input"
,
rows:
14
,
required:
true
%p
.hint
The recommended maximum line length is 52 characters for the first line and 72 characters for all following lines.
.accept-group
.accept-group
.pull-left
.pull-left
...
...
app/views/projects/new.html.haml
View file @
7157f79c
...
@@ -9,18 +9,6 @@
...
@@ -9,18 +9,6 @@
%strong
Project name
%strong
Project name
.col-sm-10
.col-sm-10
=
f
.
text_field
:name
,
placeholder:
"Example Project"
,
class:
"form-control"
,
tabindex:
1
,
autofocus:
true
=
f
.
text_field
:name
,
placeholder:
"Example Project"
,
class:
"form-control"
,
tabindex:
1
,
autofocus:
true
.help-inline
=
link_to
"#"
,
class:
'js-toggle-visibility-link'
do
%span
Customize repository name?
.form-group.js-toggle-visibility-container.hide
=
f
.
label
:path
,
class:
'control-label'
do
%span
Repository name
.col-sm-10
.input-group
=
f
.
text_field
:path
,
class:
'form-control'
%span
.input-group-addon
.git
-
if
current_user
.
can_select_namespace?
-
if
current_user
.
can_select_namespace?
.form-group
.form-group
...
@@ -29,19 +17,39 @@
...
@@ -29,19 +17,39 @@
.col-sm-10
.col-sm-10
=
f
.
select
:namespace_id
,
namespaces_options
(
params
[
:namespace_id
]
||
:current_user
),
{},
{
class:
'select2'
,
tabindex:
2
}
=
f
.
select
:namespace_id
,
namespaces_options
(
params
[
:namespace_id
]
||
:current_user
),
{},
{
class:
'select2'
,
tabindex:
2
}
.form-group
%hr
.col-sm-2
.js-toggle-container
.col-sm-10
.form-group
=
link_to
"#"
,
class:
'appear-link'
do
.col-sm-2
%i
.icon-upload-alt
.col-sm-10
%span
Import existing repository?
=
link_to
"#"
,
class:
'js-toggle-button'
do
.form-group.appear-data.import-url-data
%span
Customize repository name?
=
f
.
label
:import_url
,
class:
'control-label'
do
.js-toggle-content.hide
%span
Import existing repo
.form-group
.col-sm-10
=
f
.
label
:path
,
class:
'control-label'
do
=
f
.
text_field
:import_url
,
class:
'form-control'
,
placeholder:
'https://github.com/randx/six.git'
%span
Repository name
.light
.col-sm-10
URL must be cloneable
.input-group
=
f
.
text_field
:path
,
class:
'form-control'
%span
.input-group-addon
.git
.js-toggle-container
.form-group
.col-sm-2
.col-sm-10
=
link_to
"#"
,
class:
'js-toggle-button'
do
%i
.icon-upload-alt
%span
Import existing repository?
.js-toggle-content.hide
.form-group.import-url-data
=
f
.
label
:import_url
,
class:
'control-label'
do
%span
Import existing repo
.col-sm-10
=
f
.
text_field
:import_url
,
class:
'form-control'
,
placeholder:
'https://github.com/randx/six.git'
.light
URL must be cloneable
%hr
.form-group
.form-group
=
f
.
label
:description
,
class:
'control-label'
do
=
f
.
label
:description
,
class:
'control-label'
do
Description
Description
...
...
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