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
b5442eb5
Commit
b5442eb5
authored
Sep 17, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1479 from tsigo/ref_switch
Extract ref switcher into a partial
parents
7c7e9b13
465e40d3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
11 deletions
+12
-11
app/assets/javascripts/projects.js.coffee
app/assets/javascripts/projects.js.coffee
+5
-1
app/views/commits/_head.html.haml
app/views/commits/_head.html.haml
+1
-6
app/views/refs/_head.html.haml
app/views/refs/_head.html.haml
+1
-4
app/views/shared/_ref_switcher.html.haml
app/views/shared/_ref_switcher.html.haml
+5
-0
No files found.
app/assets/javascripts/projects.js.coffee
View file @
b5442eb5
...
@@ -10,11 +10,15 @@ window.Projects = ->
...
@@ -10,11 +10,15 @@ window.Projects = ->
$
(
'form #project_default_branch'
).
chosen
()
$
(
'form #project_default_branch'
).
chosen
()
disableButtonIfEmptyField
'#project_name'
,
'.project-submit'
disableButtonIfEmptyField
'#project_name'
,
'.project-submit'
# Git clone panel switcher
$
->
$
->
# Git clone panel switcher
scope
=
$
'.project_clone_holder'
scope
=
$
'.project_clone_holder'
if
scope
.
length
>
0
if
scope
.
length
>
0
$
(
'a, button'
,
scope
).
click
->
$
(
'a, button'
,
scope
).
click
->
$
(
'a, button'
,
scope
).
removeClass
'active'
$
(
'a, button'
,
scope
).
removeClass
'active'
$
(
@
).
addClass
'active'
$
(
@
).
addClass
'active'
$
(
'#project_clone'
,
scope
).
val
$
(
@
).
data
'clone'
$
(
'#project_clone'
,
scope
).
val
$
(
@
).
data
'clone'
# Ref switcher
$
(
'.project-refs-select'
).
on
'change'
,
->
$
(
@
).
parents
(
'form'
).
submit
()
app/views/commits/_head.html.haml
View file @
b5442eb5
%ul
.nav.nav-tabs
%ul
.nav.nav-tabs
%li
%li
=
render
partial:
'shared/ref_switcher'
,
locals:
{
destination:
'commits'
}
=
form_tag
switch_project_refs_path
(
@project
),
method: :get
,
class:
"project-refs-form"
do
=
select_tag
"ref"
,
grouped_options_refs
,
onchange:
"$(this.form).trigger('submit');"
,
class:
"project-refs-select chosen"
=
hidden_field_tag
:destination
,
"commits"
%li
{
class:
"#{'active' if current_page?(project_commits_path(@project)) }"
}
%li
{
class:
"#{'active' if current_page?(project_commits_path(@project)) }"
}
=
link_to
project_commits_path
(
@project
)
do
=
link_to
project_commits_path
(
@project
)
do
Commits
Commits
...
@@ -20,7 +16,6 @@
...
@@ -20,7 +16,6 @@
Tags
Tags
%span
.badge
=
@project
.
repo
.
tag_count
%span
.badge
=
@project
.
repo
.
tag_count
-
if
current_page?
(
project_commits_path
(
@project
))
&&
current_user
.
private_token
-
if
current_page?
(
project_commits_path
(
@project
))
&&
current_user
.
private_token
%li
.right
%li
.right
%span
.rss-icon
%span
.rss-icon
...
...
app/views/refs/_head.html.haml
View file @
b5442eb5
%ul
.nav.nav-tabs
%ul
.nav.nav-tabs
%li
%li
=
form_tag
switch_project_refs_path
(
@project
),
method: :get
,
class:
"project-refs-form"
,
remote:
true
do
=
render
partial:
'shared/ref_switcher'
,
locals:
{
destination:
'tree'
,
path:
params
[
:path
]}
=
select_tag
"ref"
,
grouped_options_refs
,
onchange:
"$(this.form).trigger('submit');"
,
class:
"project-refs-select chosen"
=
hidden_field_tag
:destination
,
"tree"
=
hidden_field_tag
:path
,
params
[
:path
]
%li
{
class:
"#{'active' if (controller.controller_name == "
refs
") }"
}
%li
{
class:
"#{'active' if (controller.controller_name == "
refs
") }"
}
=
link_to
tree_project_ref_path
(
@project
,
@ref
)
do
=
link_to
tree_project_ref_path
(
@project
,
@ref
)
do
Source
Source
...
...
app/views/
projects/_refs
.html.haml
→
app/views/
shared/_ref_switcher
.html.haml
View file @
b5442eb5
=
form_tag
switch_project_refs_path
(
@project
),
method: :get
,
class:
"project-refs-form"
do
=
form_tag
switch_project_refs_path
(
@project
),
method: :get
,
class:
"project-refs-form"
do
=
select_tag
"ref"
,
grouped_options_refs
,
onchange:
"this.form.submit();"
,
class:
"project-refs-select chosen"
=
select_tag
"ref"
,
grouped_options_refs
,
class:
"project-refs-select chosen"
=
hidden_field_tag
:destination
,
destination
=
hidden_field_tag
:destination
,
destination
-
if
respond_to?
(
:path
)
=
hidden_field_tag
:path
,
path
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