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
6a84d926
Commit
6a84d926
authored
Jun 25, 2013
by
Jack Weeden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added update and delete_attachment actions to note controller
parent
5ffc90d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
app/controllers/notes_controller.rb
app/controllers/notes_controller.rb
+26
-0
config/routes.rb
config/routes.rb
+4
-1
No files found.
app/controllers/notes_controller.rb
View file @
6a84d926
...
...
@@ -38,6 +38,32 @@ class NotesController < ProjectResourceController
end
end
def
update
@note
=
@project
.
notes
.
find
(
params
[
:id
])
return
access_denied!
unless
can?
(
current_user
,
:admin_note
,
@note
)
@note
.
update_attributes
(
params
[
:note
])
respond_to
do
|
format
|
format
.
js
do
render
js:
{
success:
@note
.
valid?
,
id:
@note
.
id
,
note:
view_context
.
markdown
(
@note
.
note
)
}.
to_json
end
format
.
html
do
redirect_to
:back
end
end
end
def
delete_attachment
@note
=
@project
.
notes
.
find
(
params
[
:id
])
@note
.
remove_attachment!
@note
.
update_attribute
(
:attachment
,
nil
)
respond_to
do
|
format
|
format
.
js
{
render
nothing:
true
}
end
end
def
preview
render
text:
view_context
.
markdown
(
params
[
:note
])
end
...
...
config/routes.rb
View file @
6a84d926
...
...
@@ -319,7 +319,10 @@ Gitlab::Application.routes.draw do
end
end
resources
:notes
,
only:
[
:index
,
:create
,
:destroy
]
do
resources
:notes
,
only:
[
:index
,
:create
,
:destroy
,
:update
]
do
member
do
delete
:delete_attachment
end
collection
do
post
:preview
end
...
...
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