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
ebf91551
Commit
ebf91551
authored
Jun 23, 2017
by
Douwe Maan
Committed by
Fatih Acet
Jul 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add data required for note form
parent
e57093ff
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
5 deletions
+36
-5
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+6
-2
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+1
-1
app/serializers/issuable_entity.rb
app/serializers/issuable_entity.rb
+2
-0
app/serializers/issue_entity.rb
app/serializers/issue_entity.rb
+18
-2
app/serializers/user_serializer.rb
app/serializers/user_serializer.rb
+3
-0
app/views/projects/issues/_discussion.html.haml
app/views/projects/issues/_discussion.html.haml
+6
-0
No files found.
app/controllers/projects/issues_controller.rb
View file @
ebf91551
...
...
@@ -92,7 +92,7 @@ class Projects::IssuesController < Projects::ApplicationController
respond_to
do
|
format
|
format
.
html
format
.
json
do
render
json:
IssueSerializer
.
new
.
represent
(
@issue
)
render
json:
serializer
.
represent
(
@issue
)
end
end
end
...
...
@@ -152,7 +152,7 @@ class Projects::IssuesController < Projects::ApplicationController
format
.
json
do
if
@issue
.
valid?
render
json:
IssueSerializer
.
new
.
represent
(
@issue
)
render
json:
serializer
.
represent
(
@issue
)
else
render
json:
{
errors:
@issue
.
errors
.
full_messages
},
status: :unprocessable_entity
end
...
...
@@ -308,4 +308,8 @@ class Projects::IssuesController < Projects::ApplicationController
redirect_to
new_user_session_path
,
notice:
notice
end
def
serializer
IssueSerializer
.
new
(
current_user:
current_user
,
project:
issue
.
project
)
end
end
app/helpers/issuables_helper.rb
View file @
ebf91551
...
...
@@ -35,7 +35,7 @@ module IssuablesHelper
def
serialize_issuable
(
issuable
)
case
issuable
when
Issue
IssueSerializer
.
new
.
represent
(
issuable
).
to_json
IssueSerializer
.
new
(
current_user:
current_user
,
project:
issuable
.
project
)
.
represent
(
issuable
).
to_json
when
MergeRequest
MergeRequestSerializer
.
new
(
current_user:
current_user
,
project:
issuable
.
project
)
...
...
app/serializers/issuable_entity.rb
View file @
ebf91551
...
...
@@ -15,4 +15,6 @@ class IssuableEntity < Grape::Entity
expose
:total_time_spent
expose
:human_time_estimate
expose
:human_total_time_spent
expose
:milestone
,
using:
API
::
Entities
::
Milestone
expose
:labels
,
using:
LabelEntity
end
app/serializers/issue_entity.rb
View file @
ebf91551
...
...
@@ -7,10 +7,26 @@ class IssueEntity < IssuableEntity
expose
:due_date
expose
:moved_to_id
expose
:project_id
expose
:milestone
,
using:
API
::
Entities
::
Milestone
expose
:labels
,
using:
LabelEntity
expose
:web_url
do
|
issue
|
project_issue_path
(
issue
.
project
,
issue
)
end
expose
:current_user
do
expose
:can_create_note
do
|
issue
|
can?
(
request
.
current_user
,
:create_note
,
issue
.
project
)
end
expose
:can_update
do
|
issue
|
can?
(
request
.
current_user
,
:update_issue
,
issue
)
end
end
expose
:create_note_path
do
|
issue
|
namespace_project_notes_path
(
issue
.
project
.
namespace
,
issue
.
project
,
noteable_type:
'Issue'
,
noteable_id:
issue
.
id
,
target_type:
'issue'
,
target_id:
issue
.
id
)
end
expose
:preview_note_path
do
|
issue
|
preview_markdown_path
(
issue
.
project
,
quick_actions_target_type:
'Issue'
,
quick_actions_target_id:
issue
.
id
)
end
end
app/serializers/user_serializer.rb
0 → 100644
View file @
ebf91551
class
UserSerializer
<
BaseSerializer
entity
UserEntity
end
app/views/projects/issues/_discussion.html.haml
View file @
ebf91551
...
...
@@ -12,3 +12,9 @@
/ #notes{style: "margin-top: 150px"}
/ = render 'shared/notes/notes_with_form', :autocomplete => true
:javascript
window
.
gl
.
issueData
=
#{
serialize_issuable
(
@issue
)
}
;
window
.
gl
.
currentUserData
=
#{
UserSerializer
.
new
.
represent
(
current_user
).
to_json
}
;
%section
#note-form
{
data:
{
new_session_path:
new_session_path
(
:user
,
redirect_to_referer:
'yes'
)
}
}
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