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
Boxiang Sun
gitlab-ce
Commits
0273b118
Commit
0273b118
authored
Jun 10, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial version of main component, Vuex store and service of issue discussions refactor.
parent
4b87ecd3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
8 deletions
+95
-8
app/assets/javascripts/notes/components/issue_notes.vue
app/assets/javascripts/notes/components/issue_notes.vue
+37
-0
app/assets/javascripts/notes/index.js
app/assets/javascripts/notes/index.js
+8
-6
app/assets/javascripts/notes/services/issue_notes_service.js
app/assets/javascripts/notes/services/issue_notes_service.js
+10
-0
app/assets/javascripts/notes/stores/issue_notes_store.js
app/assets/javascripts/notes/stores/issue_notes_store.js
+37
-0
app/views/projects/issues/_discussion.html.haml
app/views/projects/issues/_discussion.html.haml
+3
-2
No files found.
app/assets/javascripts/notes/components/issue_notes.vue
0 → 100644
View file @
0273b118
<
script
>
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
storeOptions
from
'
../stores/issue_notes_store
'
;
Vue
.
use
(
Vuex
);
const
store
=
new
Vuex
.
Store
(
storeOptions
);
export
default
{
name
:
'
IssueNotes
'
,
store
,
data
()
{
return
{
isLoading
:
true
,
};
},
mounted
()
{
const
path
=
this
.
$el
.
parentNode
.
dataset
.
discussionsPath
;
this
.
$store
.
dispatch
(
'
fetchNotes
'
,
path
)
.
finally
(()
=>
{
this
.
isLoading
=
false
;
});
},
};
</
script
>
<
template
>
<div
id=
"notes"
>
<div
v-if=
"isLoading"
class=
"loading"
>
<i
aria-hidden=
"true"
class=
"fa fa-spinner fa-spin"
/>
</div>
</div>
</
template
>
app/assets/javascripts/notes/index.js
View file @
0273b118
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
IssueNotes
from
'
./components/issue_notes.vue
'
;
Vue
.
use
(
Vuex
);
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
new
Vue
({
el
:
'
#js-notes
'
,
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
components
:
{
IssueNotes
},
// instantiate Vue here...
template
:
`
});
<issue-notes />
`
,
}));
app/assets/javascripts/notes/services/issue_notes_service.js
0 → 100644
View file @
0273b118
import
Vue
from
'
vue
'
;
import
VueResource
from
'
vue-resource
'
;
Vue
.
use
(
VueResource
);
export
default
{
fetchNotes
(
endpoint
)
{
return
Vue
.
http
.
get
(
endpoint
);
},
};
app/assets/javascripts/notes/stores/issue_notes_store.js
0 → 100644
View file @
0273b118
/* global Flash */
/* eslint-disable no-param-reassign */
import
service
from
'
../services/issue_notes_service
'
;
const
state
=
{
notes
:
[],
};
const
getters
=
{};
const
mutations
=
{
setNotes
(
vmState
,
notes
)
{
vmState
.
notes
=
notes
;
},
};
const
actions
=
{
fetchNotes
(
context
,
path
)
{
return
service
.
fetchNotes
(
path
)
.
then
(
res
=>
res
.
json
())
.
then
((
res
)
=>
{
context
.
commit
(
'
setNotes
'
,
res
);
})
.
catch
(()
=>
{
new
Flash
(
'
Something went while fetching issue comments. Please try again.
'
);
// eslint-disable-line
});
},
};
export
default
{
state
,
getters
,
mutations
,
actions
,
};
app/views/projects/issues/_discussion.html.haml
View file @
0273b118
...
@@ -3,10 +3,11 @@
...
@@ -3,10 +3,11 @@
=
link_to
'Reopen issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :reopen
},
format:
'json'
),
data:
{
original_text:
"Reopen issue"
,
alternative_text:
"Comment & reopen issue"
},
class:
"btn btn-nr btn-reopen btn-comment js-note-target-reopen
#{
issue_button_visibility
(
@issue
,
false
)
}
"
,
title:
'Reopen issue'
=
link_to
'Reopen issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :reopen
},
format:
'json'
),
data:
{
original_text:
"Reopen issue"
,
alternative_text:
"Comment & reopen issue"
},
class:
"btn btn-nr btn-reopen btn-comment js-note-target-reopen
#{
issue_button_visibility
(
@issue
,
false
)
}
"
,
title:
'Reopen issue'
=
link_to
'Close issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :close
},
format:
'json'
),
data:
{
original_text:
"Close issue"
,
alternative_text:
"Comment & close issue"
},
class:
"btn btn-nr btn-close btn-comment js-note-target-close
#{
issue_button_visibility
(
@issue
,
true
)
}
"
,
title:
'Close issue'
=
link_to
'Close issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :close
},
format:
'json'
),
data:
{
original_text:
"Close issue"
,
alternative_text:
"Comment & close issue"
},
class:
"btn btn-nr btn-close btn-comment js-note-target-close
#{
issue_button_visibility
(
@issue
,
true
)
}
"
,
title:
'Close issue'
#js-notes
%section
{
data:
{
discussions_path:
discussions_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
@issue
,
format: :json
)
}
}
#js-notes
-
content_for
:page_specific_javascripts
do
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
'common_vue'
=
webpack_bundle_tag
'common_vue'
=
webpack_bundle_tag
'notes'
=
webpack_bundle_tag
'notes'
#notes
{
data:
{
discussions_path:
discussions_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
@issue
,
format: :json
)
}
}
#notes
=
render
'shared/notes/notes_with_form'
,
:autocomplete
=>
true
=
render
'shared/notes/notes_with_form'
,
:autocomplete
=>
true
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