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
2422dc50
Commit
2422dc50
authored
Dec 17, 2016
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove inter-dependencies on vue.
parent
e5ae6a9f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
21 deletions
+29
-21
Gemfile.lock
Gemfile.lock
+1
-1
app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6
app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6
+0
-2
app/assets/javascripts/merge_request_widget/approvals/services/approvals_api.js.es6
...ge_request_widget/approvals/services/approvals_api.js.es6
+4
-6
app/assets/javascripts/merge_request_widget/approvals/stores/approvals_store.js.es6
...ge_request_widget/approvals/stores/approvals_store.js.es6
+3
-3
app/assets/javascripts/subbable_resource.js.es6
app/assets/javascripts/subbable_resource.js.es6
+14
-4
app/assets/javascripts/vue_common_component/link_to_member_avatar.js.es6
...scripts/vue_common_component/link_to_member_avatar.js.es6
+1
-1
app/assets/javascripts/vue_common_component/loading_icon.js.es6
...sets/javascripts/vue_common_component/loading_icon.js.es6
+2
-1
app/views/layouts/_head.html.haml
app/views/layouts/_head.html.haml
+2
-0
spec/javascripts/vue_common_components/link_to_member_avatar_spec.js.es6
...s/vue_common_components/link_to_member_avatar_spec.js.es6
+2
-3
No files found.
Gemfile.lock
View file @
2422dc50
...
...
@@ -872,8 +872,8 @@ DEPENDENCIES
gollum-rugged_adapter (~> 0.4.2)
gon (~> 6.1.0)
grape (~> 0.15.0)
gssapi
grape-entity (~> 0.6.0)
gssapi
haml_lint (~> 0.18.2)
hamlit (~> 2.6.1)
health_check (~> 2.2.0)
...
...
app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6
View file @
2422dc50
/* eslint-disable */
//= require vue
//= require vue-resource
//= require_directory ./models
//= require_directory ./stores
//= require_directory ./services
...
...
app/assets/javascripts/merge_request_widget/approvals/services/approvals_api.js.es6
View file @
2422dc50
//= require ../stores/approvals_store
//= require subbable_resource
(() => {
class ApprovalsApi {
...
...
@@ -9,25 +8,24 @@
}
init(mergeRequestEndpoint) {
const approvalsEndpoint = `${mergeRequestEndpoint}/approvals`;
const approvalsEndpoint = `${mergeRequestEndpoint}/approvals
.json
`;
this.resource = gl.ApprovalsResource = new gl.SubbableResource(approvalsEndpoint);
}
fetchApprovals() {
return this.resource.get().fail((err) => {
return this.resource.get(
{ type: 'GET' }
).fail((err) => {
console.error(`Error fetching approvals. ${err}`);
});
}
approveMergeRequest() {
return this.resource.post().fail((err) => {
return this.resource.post(
{ type: 'POST' }
).fail((err) => {
console.error(`Error approving merge request. ${err}`);
});
}
unapproveMergeRequest() {
return this.resource.delete().fail((err) => {
return this.resource.delete(
{ type: 'DELETE' }
).fail((err) => {
console.error(`Error unapproving merge request. ${err}`);
});
}
...
...
app/assets/javascripts/merge_request_widget/approvals/stores/approvals_store.js.es6
View file @
2422dc50
...
...
@@ -22,17 +22,17 @@
}
fetch() {
return this.api.fetchApprovals(
{ type: 'GET' }
)
return this.api.fetchApprovals()
.then((data) => this.rootStore.assignToData(data));
}
approve() {
return this.api.approveMergeRequest(
{ type: 'POST' }
)
return this.api.approveMergeRequest()
.then((data) => this.rootStore.assignToData(data));
}
unapprove() {
return this.api.unapproveMergeRequest(
{ type: 'DELETE' }
)
return this.api.unapproveMergeRequest()
.then((data) => this.rootStore.assignToData(data));
}
}
...
...
app/assets/javascripts/subbable_resource.js.es6
View file @
2422dc50
(() => {
/*
* SubbableResource can be extended to provide a pubsub-style service for one-off REST
* SubbableResource can be extended to provide a pubsub-style service for one-off REST
* calls. Subscribe by passing a callback or render method you will use to handle responses.
*
* TODO: Provide support for matchers
*
* */
class SubbableResource {
constructor(resourcePath) {
constructor(resourcePath
, test
) {
this.endpoint = resourcePath;
// TODO: Switch to axios.create
this.defaultPayload = { url: resourcePath };
// TODO: Switch to axios.create
asap
this.resource = $.ajax;
this.subscribers = [];
}
extendDefaultPayload(payload) {
return Object.assign(payload, this.defaultPayload);
}
subscribe(callback) {
this.subscribers.push(callback);
}
...
...
@@ -27,21 +33,25 @@
}
get(payload) {
this.extendDefaultPayload(payload);
return this.resource(payload)
.then(data => this.publish(data));
}
post(payload) {
this.extendDefaultPayload(payload);
return this.resource(payload)
.then(data => this.publish(data));
}
put(payload) {
this.extendDefaultPayload(payload);
return this.resource(payload)
.then(data => this.publish(data));
}
delete(payload) {
this.extendDefaultPayload(payload);
return this.resource(payload)
.then(data => this.publish(data));
}
...
...
app/assets/javascripts/vue_common_component/link_to_member_avatar.js.es6
View file @
2422dc50
/* Analogue of link_to_member_avatar in app/helpers/projects_helper.rb
/* Analogue of link_to_member_avatar in app/helpers/projects_helper.rb
TODO: Support gravatar link generation, adding name text, username text
TODO: 1:1 configuration compared to link_to_member_avatar
TODO: Backport to CE
...
...
app/assets/javascripts/vue_common_component/loading_icon.js.es6
View file @
2422dc50
...
...
@@ -4,4 +4,5 @@
<i class="fa fa-spinner fa-spin loading-icon"></i>
`,
});
})();
\ No newline at end of file
})();
app/views/layouts/_head.html.haml
View file @
2422dc50
...
...
@@ -30,6 +30,8 @@
=
javascript_include_tag
"application"
%script
(
src=
"https://cdnjs.cloudflare.com/ajax/libs/jquery-mockjax/1.6.2/jquery.mockjax.js"
)
-
if
content_for?
(
:page_specific_javascripts
)
=
yield
:page_specific_javascripts
...
...
spec/javascripts/vue_common_components/link_to_member_avatar_spec.js.es6
View file @
2422dc50
/* eslint-disable */
//= require jquery
//= require vue
//= require vue_common_component/link_to_member_avatar
((gl) => {
...
...
@@ -104,10 +103,10 @@
describe('Interaction', function() {
it('should remove approval', function() {
});
it('should give approval', function() {
});
// click link and handler fires
});
...
...
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