BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
bb1eb4b5
Commit
bb1eb4b5
authored
Mar 02, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set actions dinamically and offer defaultAction as a optional parameter
parent
3c9e860f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
user_tabs.js.coffee
app/assets/javascripts/user_tabs.js.coffee
+11
-11
No files found.
app/assets/javascripts/user_tabs.js.coffee
View file @
bb1eb4b5
...
...
@@ -50,11 +50,10 @@
# </div>
#
class
@
UserTabs
actions
:
[
'activity'
,
'groups'
,
'contributed'
,
'projects'
],
defaultAction
:
'activity'
,
constructor
:
(
opts
)
->
{
@
action
=
'activity'
@
defaultAction
=
'activity'
@
parentEl
=
$
(
document
)
}
=
opts
...
...
@@ -63,16 +62,21 @@ class @UserTabs
# Store the `location` object, allowing for easier stubbing in tests
@
_location
=
location
# Set tab states
@
loaded
=
{}
for
item
in
@
parentEl
.
find
(
'.nav-links a'
)
@
loaded
[
$
(
item
).
attr
'data-action'
]
=
false
@
bindEvents
()
@
tabStateInit
()
# Actions
@
actions
=
Object
.
keys
@
loaded
currAction
=
@
defaultAction
if
@
action
is
'show'
@
bindEvents
()
# Set active tab
source
=
$
(
".
#{
currAction
}
-tab a"
).
attr
(
'href'
)
@
activateTab
(
currAction
)
@
action
=
@
defaultAction
if
@
action
is
'show'
source
=
$
(
".
#{
@
action
}
-tab a"
).
attr
(
'href'
)
@
activateTab
(
@
action
)
bindEvents
:
->
# Turn off existing event listeners
...
...
@@ -81,10 +85,6 @@ class @UserTabs
# Set event listeners
@
parentEl
.
on
'shown.bs.tab'
,
'.nav-links a[data-toggle="tab"]'
,
@
tabShown
tabStateInit
:
->
for
action
in
@
actions
@
loaded
[
action
]
=
false
tabShown
:
(
event
)
=>
$target
=
$
(
event
.
target
)
action
=
$target
.
data
(
'action'
)
...
...
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