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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
48ae8ef1
Commit
48ae8ef1
authored
Mar 01, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Activate tab according URL
parent
8c90b6ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
17 deletions
+23
-17
app/assets/javascripts/user_tabs.js.coffee
app/assets/javascripts/user_tabs.js.coffee
+16
-10
app/views/users/show.html.haml
app/views/users/show.html.haml
+7
-7
No files found.
app/assets/javascripts/user_tabs.js.coffee
View file @
48ae8ef1
class
@
UserTabs
class
@
UserTabs
actions
:
[
'activity'
,
'groups'
,
'contributed
'
,
'personal
'
],
actions
:
[
'activity'
,
'groups'
,
'contributed
_projects'
,
'projects
'
],
defaultAction
:
'activity'
,
defaultAction
:
'activity'
,
tabButtonSelector
:
'.nav-links a[data-toggle="tab"]'
constructor
:
(
@
opts
=
{})
->
constructor
:
(
@
opts
=
{})
->
# Store the `location` object, allowing for easier stubbing in tests
# Store the `location` object, allowing for easier stubbing in tests
...
@@ -9,16 +8,20 @@ class @UserTabs
...
@@ -9,16 +8,20 @@ class @UserTabs
@
loaded
=
{}
@
loaded
=
{}
@
bindEvents
()
@
bindEvents
()
@
setTabState
()
@
tabStateInit
()
# Set default tab
action
=
@
opts
.
action
source
=
$
(
".
#{
@
defaultAction
}
-tab a"
).
attr
(
'href'
)
action
=
@
defaultAction
if
action
==
'show'
@
setTab
(
source
,
@
defaultAction
)
# Set active tab
source
=
$
(
".
#{
action
}
-tab a"
).
attr
(
'href'
)
@
activateTab
(
action
)
@
setTab
(
source
,
action
)
bindEvents
:
->
bindEvents
:
->
$
(
document
).
on
'shown.bs.tab'
,
@
tabButtonSelector
,
@
tabShown
$
(
document
).
on
'shown.bs.tab'
,
'.nav-links a[data-toggle="tab"]'
,
@
tabShown
setTabState
:
->
tabStateInit
:
->
for
action
in
@
actions
for
action
in
@
actions
@
loaded
[
action
]
=
false
@
loaded
[
action
]
=
false
...
@@ -30,6 +33,9 @@ class @UserTabs
...
@@ -30,6 +33,9 @@ class @UserTabs
@
setTab
(
source
,
action
)
@
setTab
(
source
,
action
)
@
setCurrentAction
(
action
)
@
setCurrentAction
(
action
)
activateTab
:
(
action
)
->
$
(
".nav-links .
#{
action
}
-tab a"
).
tab
(
'show'
)
setTab
:
(
source
,
action
)
->
setTab
:
(
source
,
action
)
->
return
if
@
loaded
[
action
]
is
true
return
if
@
loaded
[
action
]
is
true
...
@@ -39,10 +45,10 @@ class @UserTabs
...
@@ -39,10 +45,10 @@ class @UserTabs
if
action
is
'groups'
if
action
is
'groups'
@
loadTab
(
source
,
action
)
@
loadTab
(
source
,
action
)
if
action
is
'contributed'
if
action
is
'contributed
_projects
'
@
loadTab
(
source
,
action
)
@
loadTab
(
source
,
action
)
if
action
is
'p
ersonal
'
if
action
is
'p
rojects
'
@
loadTab
(
source
,
action
)
@
loadTab
(
source
,
action
)
loadTab
:
(
source
,
action
)
->
loadTab
:
(
source
,
action
)
->
...
...
app/views/users/show.html.haml
View file @
48ae8ef1
...
@@ -70,17 +70,17 @@
...
@@ -70,17 +70,17 @@
=
@user
.
location
=
@user
.
location
%ul
.nav-links.center
%ul
.nav-links.center
%li
.activity-tab
.active
%li
.activity-tab
=
link_to
user_calendar_activities_path
,
data:
{
target:
'div#activity'
,
action:
'activity'
,
toggle:
'tab'
}
do
=
link_to
user_calendar_activities_path
,
data:
{
target:
'div#activity'
,
action:
'activity'
,
toggle:
'tab'
}
do
Activity
Activity
%li
.groups-tab
%li
.groups-tab
=
link_to
user_groups_path
,
data:
{
target:
'div#groups'
,
action:
'groups'
,
toggle:
'tab'
}
do
=
link_to
user_groups_path
,
data:
{
target:
'div#groups'
,
action:
'groups'
,
toggle:
'tab'
}
do
Groups
Groups
%li
.contributed-tab
%li
.contributed
_projects
-tab
=
link_to
user_contributed_projects_path
,
data:
{
target:
'div#contributed
'
,
action:
'contributed
'
,
toggle:
'tab'
}
do
=
link_to
user_contributed_projects_path
,
data:
{
target:
'div#contributed
_projects'
,
action:
'contributed_projects
'
,
toggle:
'tab'
}
do
Contributed projects
Contributed projects
%li
.p
ersonal
-tab
%li
.p
rojects
-tab
=
link_to
user_projects_path
,
data:
{
target:
'div#p
ersonal'
,
action:
'personal
'
,
toggle:
'tab'
}
do
=
link_to
user_projects_path
,
data:
{
target:
'div#p
rojects'
,
action:
'projects
'
,
toggle:
'tab'
}
do
Personal projects
Personal projects
%div
{
class:
container_class
}
%div
{
class:
container_class
}
...
@@ -99,10 +99,10 @@
...
@@ -99,10 +99,10 @@
#groups
.tab-pane
#groups
.tab-pane
-
# This tab is always loaded via AJAX
-
# This tab is always loaded via AJAX
#contributed
.tab-pane
#contributed
_projects
.tab-pane
-
# This tab is always loaded via AJAX
-
# This tab is always loaded via AJAX
#p
ersonal
.tab-pane
#p
rojects
.tab-pane
-
# This tab is always loaded via AJAX
-
# This tab is always loaded via AJAX
.loading-status
.loading-status
...
...
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