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
0b981eb9
Commit
0b981eb9
authored
May 02, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coffescript refactoring pt.1
parent
37f3d0f2
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
158 additions
and
145 deletions
+158
-145
app/assets/javascripts/commit.js.coffee
app/assets/javascripts/commit.js.coffee
+3
-2
app/assets/javascripts/dashboard.js.coffee
app/assets/javascripts/dashboard.js.coffee
+44
-39
app/assets/javascripts/dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+17
-6
app/assets/javascripts/project.js.coffee
app/assets/javascripts/project.js.coffee
+37
-0
app/assets/javascripts/projects.js.coffee
app/assets/javascripts/projects.js.coffee
+0
-35
app/assets/javascripts/wall.js.coffee
app/assets/javascripts/wall.js.coffee
+22
-20
app/assets/javascripts/wikis.js.coffee
app/assets/javascripts/wikis.js.coffee
+19
-0
app/views/graph/show.html.haml
app/views/graph/show.html.haml
+6
-7
app/views/layouts/project_resource.html.haml
app/views/layouts/project_resource.html.haml
+1
-1
app/views/merge_requests/_show.html.haml
app/views/merge_requests/_show.html.haml
+8
-10
app/views/walls/show.html.haml
app/views/walls/show.html.haml
+0
-5
app/views/wikis/_new.html.haml
app/views/wikis/_new.html.haml
+1
-20
No files found.
app/assets/javascripts/commit.js.coffee
View file @
0b981eb9
@
Commit
=
init
:
->
class
Commit
constructor
:
->
$
(
'.files .file'
).
each
->
new
CommitFile
(
this
)
@
Commit
=
Commit
app/assets/javascripts/dashboard.js.coffee
View file @
0b981eb9
window
.
dashboardPage
=
->
class
Dashboard
constructor
:
->
Pager
.
init
20
,
true
initSidebarTab
()
$
(
".event_filter_link"
).
bind
"click"
,
(
event
)
->
@
initSidebarTab
()
$
(
".event_filter_link"
).
bind
"click"
,
(
event
)
=>
event
.
preventDefault
()
toggleFilter
$
(
this
)
reloadActivities
()
@
toggleFilter
(
$
(
event
.
currentTarget
)
)
@
reloadActivities
()
reloadActivities
=
->
reloadActivities
:
->
$
(
".content_list"
).
html
''
Pager
.
init
20
,
true
toggleFilter
=
(
sender
)
->
toggleFilter
:
(
sender
)
->
sender
.
parent
().
toggleClass
"inactive"
event_filters
=
$
.
cookie
(
"event_filter"
)
filter
=
sender
.
attr
(
"id"
).
split
(
"_"
)[
0
]
...
...
@@ -27,7 +29,7 @@ toggleFilter = (sender) ->
$
.
cookie
"event_filter"
,
event_filters
.
join
(
","
)
initSidebarTab
=
->
initSidebarTab
:
->
key
=
"dashboard_sidebar_filter"
# store selection in cookie
...
...
@@ -37,3 +39,6 @@ initSidebarTab = ->
# show tab from cookie
sidebar_filter
=
$
.
cookie
(
key
)
$
(
"#"
+
sidebar_filter
).
tab
(
'show'
)
if
sidebar_filter
@
Dashboard
=
Dashboard
app/assets/javascripts/dispatcher.js.coffee
View file @
0b981eb9
...
...
@@ -4,16 +4,27 @@ $ ->
class
Dispatcher
constructor
:
()
->
page
=
$
(
'body'
).
attr
(
'data-page'
)
project_id
=
$
(
'body'
).
attr
(
'data-project-id'
)
console
.
log
(
page
)
path
=
page
.
split
(
':'
)
switch
page
when
'issues:index'
then
Issues
.
init
()
when
'dashboard:show'
then
dashboardPage
()
when
'commit:show'
then
Commit
.
init
()
when
'issues:index'
Issues
.
init
()
when
'dashboard:show'
new
Dashboard
()
when
'commit:show'
new
Commit
()
when
'groups:show'
,
'teams:show'
,
'projects:show'
Pager
.
init
(
20
,
true
)
when
'projects:new'
,
'projects:edit'
new
Projects
()
when
'admin:teams:show'
,
'admin:groups:show'
,
'admin:logs:show'
,
'admin:users:new'
Admin
.
init
()
new
Project
()
when
'walls:show'
new
Wall
(
project_id
)
switch
path
.
first
()
when
'admin'
then
Admin
.
init
()
when
'wikis'
then
new
Wikis
()
app/assets/javascripts/project.js.coffee
0 → 100644
View file @
0b981eb9
class
Project
constructor
:
->
$
(
'.new_project, .edit_project'
).
on
'ajax:before'
,
->
$
(
'.project_new_holder, .project_edit_holder'
).
hide
()
$
(
'.save-project-loader'
).
show
()
$
(
'form #project_default_branch'
).
chosen
()
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'
)
@
Project
=
Project
$
->
# Git clone panel switcher
scope
=
$
'.project_clone_holder'
if
scope
.
length
>
0
$
(
'a, button'
,
scope
).
click
->
$
(
'a, button'
,
scope
).
removeClass
'active'
$
(
@
).
addClass
'active'
$
(
'#project_clone'
,
scope
).
val
$
(
@
).
data
'clone'
# Ref switcher
$
(
'.project-refs-select'
).
on
'change'
,
->
$
(
@
).
parents
(
'form'
).
submit
()
app/assets/javascripts/projects.js.coffee
deleted
100644 → 0
View file @
37f3d0f2
window
.
Projects
=
->
$
(
'.new_project, .edit_project'
).
on
'ajax:before'
,
->
$
(
'.project_new_holder, .project_edit_holder'
).
hide
()
$
(
'.save-project-loader'
).
show
()
$
(
'form #project_default_branch'
).
chosen
()
disableButtonIfEmptyField
'#project_name'
,
'.project-submit'
$
->
# Git clone panel switcher
scope
=
$
'.project_clone_holder'
if
scope
.
length
>
0
$
(
'a, button'
,
scope
).
click
->
$
(
'a, button'
,
scope
).
removeClass
'active'
$
(
@
).
addClass
'active'
$
(
'#project_clone'
,
scope
).
val
$
(
@
).
data
'clone'
# Ref switcher
$
(
'.project-refs-select'
).
on
'change'
,
->
$
(
@
).
parents
(
'form'
).
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/wall.js.coffee
View file @
0b981eb9
@
Wall
=
note_ids
:
[]
project_id
:
null
init
:
(
project_id
)
->
Wall
.
project_id
=
project_id
Wall
.
getContent
()
Wall
.
initRefresh
()
Wall
.
initForm
()
class
Wall
constructor
:
(
project_id
)
->
@
project_id
=
project_id
@
note_ids
=
[]
@
getContent
()
@
initRefresh
()
@
initForm
()
#
# Gets an initial set of notes.
#
getContent
:
->
Api
.
notes
Wall
.
project_id
,
(
notes
)
-
>
$
.
each
notes
,
(
i
,
note
)
-
>
Api
.
notes
@
project_id
,
(
notes
)
=
>
$
.
each
notes
,
(
i
,
note
)
=
>
# render note if it not present in loaded list
# or skip if rendered
if
$
.
inArray
(
note
.
id
,
Wall
.
note_ids
)
==
-
1
Wall
.
note_ids
.
push
(
note
.
id
)
Wall
.
renderNote
(
note
)
Wall
.
scrollDown
()
if
$
.
inArray
(
note
.
id
,
@
note_ids
)
==
-
1
@
note_ids
.
push
(
note
.
id
)
@
renderNote
(
note
)
@
scrollDown
()
$
(
"abbr.timeago"
).
timeago
()
initRefresh
:
->
setInterval
(
"Wall.refresh()"
,
10000
)
setInterval
=>
@
refresh
()
,
10000
refresh
:
->
Wall
.
getContent
()
@
getContent
()
scrollDown
:
->
notes
=
$
(
'ul.notes'
)
...
...
@@ -36,8 +36,8 @@
form
=
$
(
'.wall-note-form'
)
form
.
find
(
"#target_type"
).
val
(
'wall'
)
form
.
on
'ajax:success'
,
-
>
Wall
.
refresh
()
form
.
on
'ajax:success'
,
=
>
@
refresh
()
form
.
find
(
".js-note-text"
).
val
(
""
).
trigger
(
"input"
)
form
.
on
'ajax:complete'
,
->
...
...
@@ -58,7 +58,7 @@
form
.
show
()
renderNote
:
(
note
)
->
template
=
Wall
.
noteTemplate
()
template
=
@
noteTemplate
()
template
=
template
.
replace
(
'{{author_name}}'
,
note
.
author
.
name
)
template
=
template
.
replace
(
'{{created_at}}'
,
note
.
created_at
)
template
=
template
.
replace
(
'{{text}}'
,
linkify
(
sanitize
(
note
.
body
)))
...
...
@@ -81,3 +81,5 @@
</span>
<abbr class="timeago" title="{{created_at}}">{{created_at}}</abbr>
</li>'
@
Wall
=
Wall
app/assets/javascripts/wikis.js.coffee
0 → 100644
View file @
0b981eb9
class
Wikis
constructor
:
->
modal
=
$
(
'#modal-new-wiki'
).
modal
({
modal
:
true
,
show
:
false
})
$
(
'.add-new-wiki'
).
bind
"click"
,
->
modal
.
show
()
$
(
'.build-new-wiki'
).
bind
"click"
,
->
field
=
$
(
'#new_wiki_path'
)
slug
=
field
.
val
()
path
=
field
.
attr
(
'data-wikis-path'
)
if
(
slug
.
length
>
0
)
location
.
href
=
path
+
"/"
+
slug
$
(
'.modal-header .close'
).
bind
"click"
,
->
modal
.
hide
()
@
Wikis
=
Wikis
app/views/graph/show.html.haml
View file @
0b981eb9
...
...
@@ -7,11 +7,10 @@
:javascript
var
branch_graph
;
$
(
function
(){
branch_graph
=
new
BranchGraph
(
$
(
"
#holder
"
),
{
url
:
'
#{
project_graph_path
(
@project
,
@ref
,
q:
@q
,
format: :json
)
}
'
,
commit_url
:
'
#{
project_commit_path
(
@project
,
'ae45ca32'
).
gsub
(
"ae45ca32"
,
"%s"
)
}
'
,
ref
:
'
#{
@ref
}
'
,
commit_id
:
'
#{
@commit
.
id
}
'
});
});
app/views/layouts/project_resource.html.haml
View file @
0b981eb9
!!! 5
%html
{
lang:
"en"
}
=
render
"layouts/head"
,
title:
@project
.
name_with_namespace
%body
{
class:
"#{app_theme} project"
,
:'data-page'
=>
body_data_page
}
%body
{
class:
"#{app_theme} project"
,
:'data-page'
=>
body_data_page
,
:'data-project-id'
=>
@project
.
id
}
=
render
"layouts/head_panel"
,
title:
project_title
(
@project
)
=
render
"layouts/flash"
-
if
can?
(
current_user
,
:download_code
,
@project
)
...
...
app/views/merge_requests/_show.html.haml
View file @
0b981eb9
...
...
@@ -26,7 +26,7 @@
:javascript
var
merge_request
;
$
(
function
(){
merge_request
=
new
MergeRequest
({
url_to_automerge_check
:
"
#{
automerge_check_project_merge_request_path
(
@project
,
@merge_request
)
}
"
,
check_enable
:
#{
@merge_request
.
unchecked?
?
"true"
:
"false"
}
,
...
...
@@ -35,5 +35,3 @@
current_status
:
"
#{
@merge_request
.
merge_status_name
}
"
,
action
:
"
#{
controller
.
action_name
}
"
});
});
app/views/walls/show.html.haml
View file @
0b981eb9
...
...
@@ -21,8 +21,3 @@
.hint.pull-right
CTRL + Enter to send message
.clearfix
:javascript
$
(
function
(){
Wall
.
init
(
#{
@project
.
id
}
);
});
app/views/wikis/_new.html.haml
View file @
0b981eb9
...
...
@@ -5,27 +5,8 @@
.modal-body
=
label_tag
:new_wiki_path
do
%span
Page slug
=
text_field_tag
:new_wiki_path
,
nil
,
placeholder:
'how-to-setup'
,
class:
'input-xlarge'
,
required:
true
=
text_field_tag
:new_wiki_path
,
nil
,
placeholder:
'how-to-setup'
,
class:
'input-xlarge'
,
required:
true
,
:'data-wikis-path'
=>
project_wikis_path
(
@project
)
%p
.hint
Please dont use spaces and slashes
.modal-footer
=
link_to
'Build'
,
'#'
,
class:
'build-new-wiki btn btn-create'
:javascript
$
(
function
(){
var
modal
=
$
(
'
#modal-new-wiki
'
).
modal
({
modal
:
true
,
show
:
false
});
$
(
'
.add-new-wiki
'
).
bind
(
"
click
"
,
function
(){
modal
.
show
();
});
$
(
'
.build-new-wiki
'
).
bind
(
"
click
"
,
function
(){
var
slug
=
$
(
'
#new_wiki_path
'
).
val
();
if
(
slug
.
length
>
0
)
{
location
.
href
=
"
#{
project_wikis_path
(
@project
)
}
/
"
+
slug
;
}
});
$
(
'
.modal-header .close
'
).
bind
(
"
click
"
,
function
(){
modal
.
hide
();
})
})
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