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
Jérome Perrin
gitlab-ce
Commits
2d31568b
Commit
2d31568b
authored
Jun 25, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor issue and merge request sidebar
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
d315d1eb
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
89 additions
and
112 deletions
+89
-112
app/assets/javascripts/dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+0
-2
app/assets/javascripts/issuable_context.js.coffee
app/assets/javascripts/issuable_context.js.coffee
+22
-0
app/assets/javascripts/issue.js.coffee
app/assets/javascripts/issue.js.coffee
+0
-17
app/assets/javascripts/merge_request.js.coffee
app/assets/javascripts/merge_request.js.coffee
+0
-18
app/helpers/gitlab_routing_helper.rb
app/helpers/gitlab_routing_helper.rb
+8
-0
app/views/projects/issues/_discussion.html.haml
app/views/projects/issues/_discussion.html.haml
+1
-1
app/views/projects/issues/_issue_context.html.haml
app/views/projects/issues/_issue_context.html.haml
+0
-47
app/views/projects/issues/show.html.haml
app/views/projects/issues/show.html.haml
+1
-1
app/views/projects/issues/update.js.haml
app/views/projects/issues/update.js.haml
+2
-16
app/views/projects/merge_requests/_discussion.html.haml
app/views/projects/merge_requests/_discussion.html.haml
+1
-1
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+1
-1
app/views/projects/merge_requests/update.js.haml
app/views/projects/merge_requests/update.js.haml
+3
-8
app/views/shared/issuable/_context.html.haml
app/views/shared/issuable/_context.html.haml
+50
-0
No files found.
app/assets/javascripts/dispatcher.js.coffee
View file @
2d31568b
...
@@ -135,8 +135,6 @@ class Dispatcher
...
@@ -135,8 +135,6 @@ class Dispatcher
new
ProjectNew
()
new
ProjectNew
()
when
'show'
when
'show'
new
ProjectShow
()
new
ProjectShow
()
when
'issues'
,
'merge_requests'
new
UsersSelect
()
when
'wikis'
when
'wikis'
new
Wikis
()
new
Wikis
()
shortcut_handler
=
new
ShortcutsNavigation
()
shortcut_handler
=
new
ShortcutsNavigation
()
...
...
app/assets/javascripts/issuable_context.js.coffee
0 → 100644
View file @
2d31568b
#= require jquery.waitforimages
class
@
IssuableContext
constructor
:
->
new
UsersSelect
()
$
(
'select.select2'
).
select2
({
width
:
'resolve'
,
dropdownAutoWidth
:
true
})
$
(
".context .inline-update"
).
on
"change"
,
"select"
,
->
$
(
this
).
submit
()
$
(
".context .inline-update"
).
on
"change"
,
".js-assignee"
,
->
$
(
this
).
submit
()
$
(
'.issuable-details'
).
waitForImages
->
$
(
'.issuable-affix'
).
affix
offset
:
top
:
->
@
top
=
(
$
(
'.issuable-affix'
).
offset
().
top
-
70
)
bottom
:
->
@
bottom
=
$
(
'.footer'
).
outerHeight
(
true
)
$
(
'.issuable-affix'
).
on
'affix.bs.affix'
,
->
$
(
@
).
width
(
$
(
@
).
outerWidth
())
.
on
'affixed-top.bs.affix affixed-bottom.bs.affix'
,
->
$
(
@
).
width
(
''
)
app/assets/javascripts/issue.js.coffee
View file @
2d31568b
...
@@ -3,29 +3,12 @@
...
@@ -3,29 +3,12 @@
class
@
Issue
class
@
Issue
constructor
:
->
constructor
:
->
$
(
'.edit-issue.inline-update input[type="submit"]'
).
hide
()
$
(
".context .inline-update"
).
on
"change"
,
"select"
,
->
$
(
this
).
submit
()
$
(
".context .inline-update"
).
on
"change"
,
"#issue_assignee_id"
,
->
$
(
this
).
submit
()
# Prevent duplicate event bindings
# Prevent duplicate event bindings
@
disableTaskList
()
@
disableTaskList
()
if
$
(
"a.btn-close"
).
length
if
$
(
"a.btn-close"
).
length
@
initTaskList
()
@
initTaskList
()
$
(
'.issue-details'
).
waitForImages
->
$
(
'.issuable-affix'
).
affix
offset
:
top
:
->
@
top
=
(
$
(
'.issuable-affix'
).
offset
().
top
-
70
)
bottom
:
->
@
bottom
=
$
(
'.footer'
).
outerHeight
(
true
)
$
(
'.issuable-affix'
).
on
'affix.bs.affix'
,
->
$
(
@
).
width
(
$
(
@
).
outerWidth
())
.
on
'affixed-top.bs.affix affixed-bottom.bs.affix'
,
->
$
(
@
).
width
(
''
)
initTaskList
:
->
initTaskList
:
->
$
(
'.issue-details .js-task-list-container'
).
taskList
(
'enable'
)
$
(
'.issue-details .js-task-list-container'
).
taskList
(
'enable'
)
$
(
document
).
on
'tasklist:changed'
,
'.issue-details .js-task-list-container'
,
@
updateTaskList
$
(
document
).
on
'tasklist:changed'
,
'.issue-details .js-task-list-container'
,
@
updateTaskList
...
...
app/assets/javascripts/merge_request.js.coffee
View file @
2d31568b
...
@@ -26,28 +26,10 @@ class @MergeRequest
...
@@ -26,28 +26,10 @@ class @MergeRequest
if
$
(
"a.btn-close"
).
length
if
$
(
"a.btn-close"
).
length
@
initTaskList
()
@
initTaskList
()
$
(
'.merge-request-details'
).
waitForImages
->
$
(
'.issuable-affix'
).
affix
offset
:
top
:
->
@
top
=
(
$
(
'.issuable-affix'
).
offset
().
top
-
70
)
bottom
:
->
@
bottom
=
$
(
'.footer'
).
outerHeight
(
true
)
$
(
'.issuable-affix'
).
on
'affix.bs.affix'
,
->
$
(
@
).
width
(
$
(
@
).
outerWidth
())
.
on
'affixed-top.bs.affix affixed-bottom.bs.affix'
,
->
$
(
@
).
width
(
''
)
# Local jQuery finder
# Local jQuery finder
$
:
(
selector
)
->
$
:
(
selector
)
->
this
.
$el
.
find
(
selector
)
this
.
$el
.
find
(
selector
)
initContextWidget
:
->
$
(
'.edit-merge_request.inline-update input[type="submit"]'
).
hide
()
$
(
".context .inline-update"
).
on
"change"
,
"select"
,
->
$
(
this
).
submit
()
$
(
".context .inline-update"
).
on
"change"
,
"#merge_request_assignee_id"
,
->
$
(
this
).
submit
()
showAllCommits
:
->
showAllCommits
:
->
this
.
$
(
'.first-commits'
).
remove
()
this
.
$
(
'.first-commits'
).
remove
()
this
.
$
(
'.all-commits'
).
removeClass
'hide'
this
.
$
(
'.all-commits'
).
removeClass
'hide'
...
...
app/helpers/gitlab_routing_helper.rb
View file @
2d31568b
...
@@ -52,4 +52,12 @@ module GitlabRoutingHelper
...
@@ -52,4 +52,12 @@ module GitlabRoutingHelper
def
project_snippet_url
(
entity
,
*
args
)
def
project_snippet_url
(
entity
,
*
args
)
namespace_project_snippet_url
(
entity
.
project
.
namespace
,
entity
.
project
,
entity
,
*
args
)
namespace_project_snippet_url
(
entity
.
project
.
namespace
,
entity
.
project
,
entity
,
*
args
)
end
end
def
toggle_subscription_path
(
entity
,
*
args
)
if
entity
.
is_a?
(
Issue
)
toggle_subscription_namespace_project_issue_path
(
entity
.
project
.
namespace
,
entity
.
project
,
entity
)
else
toggle_subscription_namespace_project_merge_request_path
(
entity
.
project
.
namespace
,
entity
.
project
,
entity
)
end
end
end
end
app/views/projects/issues/_discussion.html.haml
View file @
2d31568b
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
=
cross_project_reference
(
@project
,
@issue
)
=
cross_project_reference
(
@project
,
@issue
)
%hr
%hr
.context
.context
=
render
partial:
'issue_context'
,
locals:
{
issue:
@issue
}
=
render
'shared/issuable/context'
,
issuable:
@issue
-
if
@issue
.
labels
.
any?
-
if
@issue
.
labels
.
any?
.issuable-context-title
.issuable-context-title
...
...
app/views/projects/issues/_issue_context.html.haml
deleted
100644 → 0
View file @
d315d1eb
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@issue
],
remote:
true
,
html:
{
class:
'edit-issue inline-update js-issue-update'
}
do
|
f
|
%div
.prepend-top-20
.issuable-context-title
%label
Assignee:
-
if
issue
.
assignee
%strong
=
link_to_member
(
@project
,
@issue
.
assignee
,
size:
24
)
-
else
none
-
if
can?
(
current_user
,
:modify_issue
,
@issue
)
=
users_select_tag
(
'issue[assignee_id]'
,
placeholder:
'Select assignee'
,
class:
'custom-form-control js-select2 js-assignee'
,
selected:
@issue
.
assignee_id
,
null_user:
true
,
first_user:
true
)
%div
.prepend-top-20.clearfix
.issuable-context-title
%label
Milestone:
-
if
issue
.
milestone
%span
.back-to-milestone
=
link_to
namespace_project_milestone_path
(
@project
.
namespace
,
@project
,
@issue
.
milestone
)
do
%strong
%i
.fa.fa-clock-o
=
@issue
.
milestone
.
title
-
else
none
-
if
can?
(
current_user
,
:modify_issue
,
@issue
)
=
f
.
select
(
:milestone_id
,
milestone_options
(
@issue
),
{
include_blank:
"Select milestone"
},
{
class:
'select2 select2-compact js-select2 js-milestone'
})
=
hidden_field_tag
:issue_context
=
f
.
submit
class:
'btn'
-
if
current_user
-
subscribed
=
@issue
.
subscribed?
(
current_user
)
%div
.prepend-top-20.clearfix
.issuable-context-title
%label
Subscription:
%button
.btn.btn-block.subscribe-button
{
:type
=>
'button'
}
%i
.fa.fa-eye
%span
=
subscribed
?
"Unsubscribe"
:
"Subscribe"
-
subscribtion_status
=
subscribed
?
"subscribed"
:
"unsubscribed"
.subscription-status
{
"data-status"
=>
subscribtion_status
}
.description-block.unsubscribed
{
class:
(
"hidden"
if
subscribed
)}
You're not receiving notifications from this thread.
.description-block.subscribed
{
class:
(
"hidden"
unless
subscribed
)}
You're receiving notifications because you're subscribed to this thread.
:coffeescript
new Subscription("
#{
toggle_subscription_namespace_project_issue_path
(
@issue
.
project
.
namespace
,
@project
,
@issue
)
}
")
app/views/projects/issues/show.html.haml
View file @
2d31568b
-
page_title
"
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
,
"Issues"
-
page_title
"
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
,
"Issues"
.issue
.issue
.issue-details
.issue-details
.issuable-details
%h4
.page-title
%h4
.page-title
.issue-box
{
class:
issue_box_class
(
@issue
)
}
.issue-box
{
class:
issue_box_class
(
@issue
)
}
-
if
@issue
.
closed?
-
if
@issue
.
closed?
...
...
app/views/projects/issues/update.js.haml
View file @
2d31568b
-
if
params
[
:status_only
]
$('.context').html("
#{
escape_javascript
(
render
'shared/issuable/context'
,
issuable:
@issue
)
}
");
-
if
@issue
.
valid?
$('.context').effect('highlight')
:plain
$("##{dom_id(@issue)}").fadeOut();
-
elsif
params
[
:issue_context
]
$('.context').html("
#{
escape_javascript
(
render
partial:
'issue_context'
,
locals:
{
issue:
@issue
})
}
");
$('.context').effect('highlight');
-
if
@issue
.
milestone
$('.milestone-nav-link').replaceWith("
<span
class=
'milestone-nav-link'
>
|
<span
class=
'light'
>
Milestone
</span>
#{
escape_javascript
(
link_to
@issue
.
milestone
.
title
,
namespace_project_milestone_path
(
@issue
.
project
.
namespace
,
@issue
.
project
,
@issue
.
milestone
))
}
</span>
")
-
else
$('.milestone-nav-link').html('')
$('select.select2').select2({width: 'resolve', dropdownAutoWidth: true})
$('.edit-issue.inline-update input[type="submit"]').hide();
new UsersSelect()
new Issue();
new Issue();
app/views/projects/merge_requests/_discussion.html.haml
View file @
2d31568b
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
=
cross_project_reference
(
@project
,
@merge_request
)
=
cross_project_reference
(
@project
,
@merge_request
)
%hr
%hr
.context
.context
=
render
partial:
'projects/merge_requests/show/context'
,
locals:
{
merge_request:
@merge_request
}
=
render
'shared/issuable/context'
,
issuable:
@merge_request
-
if
@merge_request
.
labels
.
any?
-
if
@merge_request
.
labels
.
any?
.issuable-context-title
.issuable-context-title
...
...
app/views/projects/merge_requests/_show.html.haml
View file @
2d31568b
-
page_title
"
#{
@merge_request
.
title
}
(#
#{
@merge_request
.
iid
}
)"
,
"Merge Requests"
-
page_title
"
#{
@merge_request
.
title
}
(#
#{
@merge_request
.
iid
}
)"
,
"Merge Requests"
.merge-request
{
'data-url'
=>
merge_request_path
(
@merge_request
)}
.merge-request
{
'data-url'
=>
merge_request_path
(
@merge_request
)}
.merge-request-details
.merge-request-details
.issuable-details
=
render
"projects/merge_requests/show/mr_title"
=
render
"projects/merge_requests/show/mr_title"
%hr
%hr
=
render
"projects/merge_requests/show/mr_box"
=
render
"projects/merge_requests/show/mr_box"
...
...
app/views/projects/merge_requests/update.js.haml
View file @
2d31568b
-
if
params
[
:merge_request_context
]
$('.context').html("
#{
escape_javascript
(
render
'shared/issuable/context'
,
issuable:
@merge_request
)
}
");
$('.context').html("
#{
escape_javascript
(
render
partial:
'projects/merge_requests/show/context'
,
locals:
{
issue:
@issue
})
}
");
$('.context').effect('highlight')
$('.context').effect('highlight');
merge_request = new MergeRequest();
new UsersSelect()
$('select.select2').select2({width: 'resolve', dropdownAutoWidth: true});
merge_request = new MergeRequest();
app/views/
projects/merge_requests/show
/_context.html.haml
→
app/views/
shared/issuable
/_context.html.haml
View file @
2d31568b
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@merge_request
],
remote:
true
,
html:
{
class:
'edit-merge_request
inline-update js-merge-request-update'
}
do
|
f
|
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
issuable
],
remote:
true
,
html:
{
class:
'issuable-context-form
inline-update js-merge-request-update'
}
do
|
f
|
%div
.prepend-top-20
%div
.prepend-top-20
.issuable-context-title
.issuable-context-title
%label
%label
Assignee:
Assignee:
-
if
@merge_request
.
assignee
-
if
issuable
.
assignee
%strong
=
link_to_member
(
@project
,
@merge_request
.
assignee
,
size:
24
)
%strong
=
link_to_member
(
@project
,
issuable
.
assignee
,
size:
24
)
-
else
-
else
none
none
.issuable-context-selectbox
.issuable-context-selectbox
-
if
can?
(
current_user
,
:
modify_merge_request
,
@merge_reques
t
)
-
if
can?
(
current_user
,
:
set_assignee
,
@projec
t
)
=
users_select_tag
(
'merge_request[assignee_id]'
,
placeholder:
'Select assignee'
,
class:
'custom-form-control js-select2 js-assignee'
,
selected:
@merge_request
.
assignee_id
,
project:
@target_project
,
null_user:
true
)
=
users_select_tag
(
"
#{
issuable
.
class
.
table_name
.
singularize
}
[assignee_id]"
,
placeholder:
'Select assignee'
,
class:
'custom-form-control js-select2 js-assignee'
,
selected:
issuable
.
assignee_id
,
project:
@target_project
,
null_user:
true
)
%div
.prepend-top-20.clearfix
%div
.prepend-top-20.clearfix
.issuable-context-title
.issuable-context-title
%label
%label
Milestone:
Milestone:
-
if
@merge_request
.
milestone
-
if
issuable
.
milestone
%span
.back-to-milestone
%span
.back-to-milestone
=
link_to
namespace_project_milestone_path
(
@project
.
namespace
,
@project
,
@merge_request
.
milestone
)
do
=
link_to
namespace_project_milestone_path
(
@project
.
namespace
,
@project
,
issuable
.
milestone
)
do
%strong
%strong
=
icon
(
'clock-o'
)
=
icon
(
'clock-o'
)
=
@merge_request
.
milestone
.
title
=
issuable
.
milestone
.
title
-
else
-
else
none
none
.issuable-context-selectbox
.issuable-context-selectbox
-
if
can?
(
current_user
,
:
modify_merge_request
,
@merge_reques
t
)
-
if
can?
(
current_user
,
:
set_milestone
,
@projec
t
)
=
f
.
select
(
:milestone_id
,
milestone_options
(
@merge_request
),
{
include_blank:
'Select milestone'
},
{
class:
'select2 select2-compact js-select2 js-milestone'
})
=
f
.
select
(
:milestone_id
,
milestone_options
(
issuable
),
{
include_blank:
'Select milestone'
},
{
class:
'select2 select2-compact js-select2 js-milestone'
})
=
hidden_field_tag
:
merge_request
_context
=
hidden_field_tag
:
issuable
_context
=
f
.
submit
class:
'btn'
=
f
.
submit
class:
'btn
hide
'
-
if
current_user
-
if
current_user
-
subscribed
=
@merge_request
.
subscribed?
(
current_user
)
-
subscribed
=
issuable
.
subscribed?
(
current_user
)
%div
.prepend-top-20.clearfix
%div
.prepend-top-20.clearfix
.issuable-context-title
.issuable-context-title
%label
%label
...
@@ -46,4 +46,5 @@
...
@@ -46,4 +46,5 @@
You're receiving notifications because you're subscribed to this thread.
You're receiving notifications because you're subscribed to this thread.
:coffeescript
:coffeescript
new Subscription("
#{
toggle_subscription_namespace_project_merge_request_path
(
@merge_request
.
project
.
namespace
,
@project
,
@merge_request
)
}
")
new Subscription("
#{
toggle_subscription_path
(
issuable
)
}
")
new IssuableContext()
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