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
471888d6
Commit
471888d6
authored
Apr 28, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved sort endpoints into data attributes
parent
4b812d97
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
13 deletions
+21
-13
app/assets/javascripts/milestone.js
app/assets/javascripts/milestone.js
+17
-10
app/views/shared/milestones/_tabs.html.haml
app/views/shared/milestones/_tabs.html.haml
+3
-3
spec/support/milestone_tabs_examples.rb
spec/support/milestone_tabs_examples.rb
+1
-0
No files found.
app/assets/javascripts/milestone.js
View file @
471888d6
...
@@ -19,12 +19,10 @@
...
@@ -19,12 +19,10 @@
});
});
};
};
Milestone
.
sortIssues
=
function
(
data
)
{
Milestone
.
sortIssues
=
function
(
url
,
data
)
{
var
sort_issues_url
;
sort_issues_url
=
location
.
pathname
+
"
/sort_issues
"
;
return
$
.
ajax
({
return
$
.
ajax
({
type
:
"
PUT
"
,
type
:
"
PUT
"
,
url
:
sort_issues_url
,
url
,
data
:
data
,
data
:
data
,
success
:
function
(
_data
)
{
success
:
function
(
_data
)
{
return
Milestone
.
successCallback
(
_data
);
return
Milestone
.
successCallback
(
_data
);
...
@@ -36,12 +34,10 @@
...
@@ -36,12 +34,10 @@
});
});
};
};
Milestone
.
sortMergeRequests
=
function
(
data
)
{
Milestone
.
sortMergeRequests
=
function
(
url
,
data
)
{
var
sort_mr_url
;
sort_mr_url
=
location
.
pathname
+
"
/sort_merge_requests
"
;
return
$
.
ajax
({
return
$
.
ajax
({
type
:
"
PUT
"
,
type
:
"
PUT
"
,
url
:
sort_mr_url
,
url
,
data
:
data
,
data
:
data
,
success
:
function
(
_data
)
{
success
:
function
(
_data
)
{
return
Milestone
.
successCallback
(
_data
);
return
Milestone
.
successCallback
(
_data
);
...
@@ -81,6 +77,9 @@
...
@@ -81,6 +77,9 @@
};
};
function
Milestone
()
{
function
Milestone
()
{
this
.
issuesSortEndpoint
=
$
(
'
#tab-issues
'
).
data
(
'
sort-endpoint
'
);
this
.
mergeRequestsSortEndpoint
=
$
(
'
#tab-merge-requests
'
).
data
(
'
sort-endpoint
'
);
this
.
bindIssuesSorting
();
this
.
bindIssuesSorting
();
this
.
bindTabsSwitching
();
this
.
bindTabsSwitching
();
...
@@ -92,12 +91,16 @@
...
@@ -92,12 +91,16 @@
}
}
Milestone
.
prototype
.
bindIssuesSorting
=
function
()
{
Milestone
.
prototype
.
bindIssuesSorting
=
function
()
{
if
(
!
this
.
issuesSortEndpoint
)
return
;
$
(
'
#issues-list-unassigned, #issues-list-ongoing, #issues-list-closed
'
).
each
(
function
(
i
,
el
)
{
$
(
'
#issues-list-unassigned, #issues-list-ongoing, #issues-list-closed
'
).
each
(
function
(
i
,
el
)
{
this
.
createSortable
(
el
,
{
this
.
createSortable
(
el
,
{
group
:
'
issue-list
'
,
group
:
'
issue-list
'
,
listEls
:
$
(
'
.issues-sortable-list
'
),
listEls
:
$
(
'
.issues-sortable-list
'
),
fieldName
:
'
issue
'
,
fieldName
:
'
issue
'
,
sortCallback
:
Milestone
.
sortIssues
,
sortCallback
:
(
data
)
=>
{
Milestone
.
sortIssues
(
this
.
issuesSortEndpoint
,
data
);
},
updateCallback
:
Milestone
.
updateIssue
,
updateCallback
:
Milestone
.
updateIssue
,
});
});
}.
bind
(
this
));
}.
bind
(
this
));
...
@@ -113,12 +116,16 @@
...
@@ -113,12 +116,16 @@
};
};
Milestone
.
prototype
.
bindMergeRequestSorting
=
function
()
{
Milestone
.
prototype
.
bindMergeRequestSorting
=
function
()
{
if
(
!
this
.
mergeRequestsSortEndpoint
)
return
;
$
(
"
#merge_requests-list-unassigned, #merge_requests-list-ongoing, #merge_requests-list-closed
"
).
each
(
function
(
i
,
el
)
{
$
(
"
#merge_requests-list-unassigned, #merge_requests-list-ongoing, #merge_requests-list-closed
"
).
each
(
function
(
i
,
el
)
{
this
.
createSortable
(
el
,
{
this
.
createSortable
(
el
,
{
group
:
'
merge-request-list
'
,
group
:
'
merge-request-list
'
,
listEls
:
$
(
"
.merge_requests-sortable-list:not(#merge_requests-list-merged)
"
),
listEls
:
$
(
"
.merge_requests-sortable-list:not(#merge_requests-list-merged)
"
),
fieldName
:
'
merge_request
'
,
fieldName
:
'
merge_request
'
,
sortCallback
:
Milestone
.
sortMergeRequests
,
sortCallback
:
(
data
)
=>
{
Milestone
.
sortMergeRequests
(
this
.
mergeRequestsSortEndpoint
,
data
);
},
updateCallback
:
Milestone
.
updateMergeRequest
,
updateCallback
:
Milestone
.
updateMergeRequest
,
});
});
}.
bind
(
this
));
}.
bind
(
this
));
...
...
app/views/shared/milestones/_tabs.html.haml
View file @
471888d6
...
@@ -30,13 +30,13 @@
...
@@ -30,13 +30,13 @@
.tab-content.milestone-content
.tab-content.milestone-content
-
if
milestone
.
is_a?
(
GlobalMilestone
)
||
can?
(
current_user
,
:read_issue
,
@project
)
-
if
milestone
.
is_a?
(
GlobalMilestone
)
||
can?
(
current_user
,
:read_issue
,
@project
)
.tab-pane.active
#tab-issues
.tab-pane.active
#tab-issues
{
data:
{
sort_endpoint:
(
sort_issues_namespace_project_milestone_path
(
@project
.
namespace
,
@project
,
@milestone
)
if
@project
&&
current_user
)
}
}
=
render
'shared/milestones/issues_tab'
,
issues:
milestone
.
issues_visible_to_user
(
current_user
).
include_associations
,
show_project_name:
show_project_name
,
show_full_project_name:
show_full_project_name
=
render
'shared/milestones/issues_tab'
,
issues:
milestone
.
issues_visible_to_user
(
current_user
).
include_associations
,
show_project_name:
show_project_name
,
show_full_project_name:
show_full_project_name
.tab-pane
#tab-merge-requests
.tab-pane
#tab-merge-requests
{
data:
{
sort_endpoint:
(
sort_merge_requests_namespace_project_milestone_path
(
@project
.
namespace
,
@project
,
@milestone
)
if
@project
&&
current_user
)
}
}
-# loaded async
-# loaded async
=
render
"shared/milestones/tab_loading"
=
render
"shared/milestones/tab_loading"
-
else
-
else
.tab-pane.active
#tab-merge-requests
.tab-pane.active
#tab-merge-requests
{
data:
{
sort_endpoint:
(
sort_merge_requests_namespace_project_milestone_path
(
@project
.
namespace
,
@project
,
@milestone
)
if
@project
&&
current_user
)
}
}
-# loaded async
-# loaded async
=
render
"shared/milestones/tab_loading"
=
render
"shared/milestones/tab_loading"
.tab-pane
#tab-participants
.tab-pane
#tab-participants
...
...
spec/support/milestone_tabs_examples.rb
View file @
471888d6
...
@@ -8,6 +8,7 @@ shared_examples 'milestone tabs' do
...
@@ -8,6 +8,7 @@ shared_examples 'milestone tabs' do
get
path
,
params
.
merge
(
extra_params
)
get
path
,
params
.
merge
(
extra_params
)
end
end
describe
'#merge_requests'
do
describe
'#merge_requests'
do
context
'as html'
do
context
'as html'
do
before
{
go
(
:merge_requests
,
format:
'html'
)
}
before
{
go
(
:merge_requests
,
format:
'html'
)
}
...
...
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