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
Léo-Paul Géneau
gitlab-ce
Commits
243a74e9
Commit
243a74e9
authored
Oct 27, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8123 from cirosantilli/project-js-only-needed
Better js -> URL projects map to reduce unneeded execution
parents
08d361e8
3418f56a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
62 deletions
+66
-62
app/assets/javascripts/dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+8
-5
app/assets/javascripts/project.js.coffee
app/assets/javascripts/project.js.coffee
+18
-57
app/assets/javascripts/project_new.js.coffee
app/assets/javascripts/project_new.js.coffee
+25
-0
app/assets/javascripts/project_show.js.coffee
app/assets/javascripts/project_show.js.coffee
+15
-0
No files found.
app/assets/javascripts/dispatcher.js.coffee
View file @
243a74e9
...
...
@@ -58,11 +58,6 @@ class Dispatcher
when
'groups:show'
,
'projects:show'
new
Activities
()
shortcut_handler
=
new
ShortcutsNavigation
()
when
'projects:new'
new
Project
()
when
'projects:edit'
new
Project
()
shortcut_handler
=
new
ShortcutsNavigation
()
when
'projects:teams:members:index'
new
TeamMembers
()
when
'groups:members'
...
...
@@ -87,7 +82,15 @@ class Dispatcher
when
'dashboard'
shortcut_handler
=
new
ShortcutsDashboardNavigation
()
when
'projects'
new
Project
()
switch
path
[
1
]
when
'edit'
shortcut_handler
=
new
ShortcutsNavigation
()
new
ProjectNew
()
when
'new'
new
ProjectNew
()
when
'show'
new
ProjectShow
()
when
'wikis'
new
Wikis
()
shortcut_handler
=
new
ShortcutsNavigation
()
...
...
app/assets/javascripts/project.js.coffee
View file @
243a74e9
class
@
Project
constructor
:
->
$
(
'.project-edit-container'
).
on
'ajax:before'
,
=>
$
(
'.project-edit-container'
).
hide
()
$
(
'.save-project-loader'
).
show
()
@
initEvents
()
initEvents
:
->
disableButtonIfEmptyField
'#project_name'
,
'.project-submit'
$
(
'#project_issues_enabled'
).
change
->
if
(
$
(
this
).
is
(
':checked'
)
==
true
)
$
(
'#project_issues_tracker'
).
removeAttr
(
'disabled'
)
else
$
(
'#project_issues_tracker'
).
attr
(
'disabled'
,
'disabled'
)
$
(
'#project_issues_tracker'
).
change
()
$
(
'#project_issues_tracker'
).
change
->
if
(
$
(
this
).
val
()
==
gon
.
default_issues_tracker
||
$
(
this
).
is
(
':disabled'
))
$
(
'#project_issues_tracker_id'
).
attr
(
'disabled'
,
'disabled'
)
else
$
(
'#project_issues_tracker_id'
).
removeAttr
(
'disabled'
)
$
->
# Git clone panel switcher
scope
=
$
'.git-clone-holder'
if
scope
.
length
>
0
$
(
'a, button'
,
scope
).
click
->
$
(
'a, button'
,
scope
).
removeClass
'active'
$
(
@
).
addClass
'active'
$
(
'#project_clone'
,
scope
).
val
$
(
@
).
data
'clone'
$
(
".clone"
).
text
(
""
).
append
$
(
@
).
data
'clone'
# Ref switcher
$
(
'.project-refs-select'
).
on
'change'
,
->
$
(
@
).
parents
(
'form'
).
submit
()
$
(
'.hide-no-ssh-message'
).
on
'click'
,
(
e
)
->
path
=
'/'
$
.
cookie
(
'hide_no_ssh_message'
,
'false'
,
{
path
:
path
})
$
(
@
).
parents
(
'.no-ssh-key-message'
).
hide
()
e
.
preventDefault
()
$
(
'.project-home-panel .star'
).
on
'ajax:success'
,
(
e
,
data
,
status
,
xhr
)
->
$
(
@
).
toggleClass
(
'on'
).
find
(
'.count'
).
html
(
data
.
star_count
)
.
on
'ajax:error'
,
(
e
,
xhr
,
status
,
error
)
->
new
Flash
(
'Star toggle failed. Try again later.'
,
'alert'
)
$
(
"a[data-toggle='tab']"
).
on
"shown.bs.tab"
,
(
e
)
->
$
.
cookie
"default_view"
,
$
(
e
.
target
).
attr
(
"href"
)
defaultView
=
$
.
cookie
(
"default_view"
)
if
defaultView
$
(
"a[href="
+
defaultView
+
"]"
).
tab
"show"
else
$
(
"a[data-toggle='tab']:first"
).
tab
"show"
# Git clone panel switcher
scope
=
$
'.git-clone-holder'
if
scope
.
length
>
0
$
(
'a, button'
,
scope
).
click
->
$
(
'a, button'
,
scope
).
removeClass
'active'
$
(
@
).
addClass
'active'
$
(
'#project_clone'
,
scope
).
val
$
(
@
).
data
'clone'
$
(
".clone"
).
text
(
""
).
append
$
(
@
).
data
'clone'
# Ref switcher
$
(
'.project-refs-select'
).
on
'change'
,
->
$
(
@
).
parents
(
'form'
).
submit
()
$
(
'.hide-no-ssh-message'
).
on
'click'
,
(
e
)
->
path
=
'/'
$
.
cookie
(
'hide_no_ssh_message'
,
'false'
,
{
path
:
path
})
$
(
@
).
parents
(
'.no-ssh-key-message'
).
hide
()
e
.
preventDefault
()
app/assets/javascripts/project_new.js.coffee
0 → 100644
View file @
243a74e9
class
@
ProjectNew
constructor
:
->
$
(
'.project-edit-container'
).
on
'ajax:before'
,
=>
$
(
'.project-edit-container'
).
hide
()
$
(
'.save-project-loader'
).
show
()
@
initEvents
()
initEvents
:
->
disableButtonIfEmptyField
'#project_name'
,
'.project-submit'
$
(
'#project_issues_enabled'
).
change
->
if
(
$
(
this
).
is
(
':checked'
)
==
true
)
$
(
'#project_issues_tracker'
).
removeAttr
(
'disabled'
)
else
$
(
'#project_issues_tracker'
).
attr
(
'disabled'
,
'disabled'
)
$
(
'#project_issues_tracker'
).
change
()
$
(
'#project_issues_tracker'
).
change
->
if
(
$
(
this
).
val
()
==
gon
.
default_issues_tracker
||
$
(
this
).
is
(
':disabled'
))
$
(
'#project_issues_tracker_id'
).
attr
(
'disabled'
,
'disabled'
)
else
$
(
'#project_issues_tracker_id'
).
removeAttr
(
'disabled'
)
app/assets/javascripts/project_show.js.coffee
0 → 100644
View file @
243a74e9
class
@
ProjectShow
constructor
:
->
$
(
'.project-home-panel .star'
).
on
'ajax:success'
,
(
e
,
data
,
status
,
xhr
)
->
$
(
@
).
toggleClass
(
'on'
).
find
(
'.count'
).
html
(
data
.
star_count
)
.
on
'ajax:error'
,
(
e
,
xhr
,
status
,
error
)
->
new
Flash
(
'Star toggle failed. Try again later.'
,
'alert'
)
$
(
"a[data-toggle='tab']"
).
on
"shown.bs.tab"
,
(
e
)
->
$
.
cookie
"default_view"
,
$
(
e
.
target
).
attr
(
"href"
)
defaultView
=
$
.
cookie
(
"default_view"
)
if
defaultView
$
(
"a[href="
+
defaultView
+
"]"
).
tab
"show"
else
$
(
"a[data-toggle='tab']:first"
).
tab
"show"
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