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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
124a5e27
Commit
124a5e27
authored
Mar 19, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add attachemnts support for wall
parent
4d378f3c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
6 deletions
+56
-6
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+0
-1
app/assets/javascripts/wall.js.coffee
app/assets/javascripts/wall.js.coffee
+41
-2
app/assets/stylesheets/sections/wall.scss
app/assets/stylesheets/sections/wall.scss
+11
-1
app/views/layouts/project_resource.html.haml
app/views/layouts/project_resource.html.haml
+1
-1
app/views/walls/show.html.haml
app/views/walls/show.html.haml
+2
-1
lib/api/entities.rb
lib/api/entities.rb
+1
-0
No files found.
app/assets/javascripts/notes.js
View file @
124a5e27
...
@@ -4,7 +4,6 @@ var NoteList = {
...
@@ -4,7 +4,6 @@ var NoteList = {
target_params
:
null
,
target_params
:
null
,
target_id
:
0
,
target_id
:
0
,
target_type
:
null
,
target_type
:
null
,
loading_more_disabled
:
false
,
init
:
function
(
tid
,
tt
,
path
)
{
init
:
function
(
tid
,
tt
,
path
)
{
NoteList
.
notes_path
=
path
+
"
.js
"
;
NoteList
.
notes_path
=
path
+
"
.js
"
;
...
...
app/assets/javascripts/wall.js.coffee
View file @
124a5e27
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
Wall
.
notes_path
=
"/api/"
+
gon
.
api_version
+
"/projects/"
+
project_id
+
"/notes.json"
Wall
.
notes_path
=
"/api/"
+
gon
.
api_version
+
"/projects/"
+
project_id
+
"/notes.json"
Wall
.
getContent
()
Wall
.
getContent
()
Wall
.
initRefresh
()
Wall
.
initRefresh
()
Wall
.
initForm
()
#
#
# Gets an initial set of notes.
# Gets an initial set of notes.
...
@@ -28,6 +29,7 @@
...
@@ -28,6 +29,7 @@
if
$
.
inArray
(
note
.
id
,
Wall
.
note_ids
)
==
-
1
if
$
.
inArray
(
note
.
id
,
Wall
.
note_ids
)
==
-
1
Wall
.
note_ids
.
push
(
note
.
id
)
Wall
.
note_ids
.
push
(
note
.
id
)
Wall
.
renderNote
(
note
)
Wall
.
renderNote
(
note
)
Wall
.
scrollDown
()
complete
:
->
complete
:
->
$
(
'.js-notes-busy'
).
removeClass
(
"loading"
)
$
(
'.js-notes-busy'
).
removeClass
(
"loading"
)
...
@@ -35,8 +37,15 @@
...
@@ -35,8 +37,15 @@
$
(
'.js-notes-busy'
).
addClass
(
"loading"
)
$
(
'.js-notes-busy'
).
addClass
(
"loading"
)
renderNote
:
(
note
)
->
renderNote
:
(
note
)
->
author
=
'<strong>'
+
note
.
author
.
name
+
': </strong>'
author
=
'<strong class="wall-author">'
+
note
.
author
.
name
+
'</strong>'
html
=
'<li>'
+
author
+
note
.
body
+
'</li>'
body
=
'<span class="wall-text">'
+
note
.
body
+
'</span>'
file
=
''
if
note
.
attachment
file
=
'<span class="wall-file"><a href="/files/note/'
+
note
.
id
+
'/'
+
note
.
attachment
+
'">'
+
note
.
attachment
+
'</a></span>'
html
=
'<li>'
+
author
+
body
+
file
+
'</li>'
$
(
'ul.notes'
).
append
(
html
)
$
(
'ul.notes'
).
append
(
html
)
initRefresh
:
->
initRefresh
:
->
...
@@ -44,3 +53,33 @@
...
@@ -44,3 +53,33 @@
refresh
:
->
refresh
:
->
Wall
.
getContent
()
Wall
.
getContent
()
scrollDown
:
->
notes
=
$
(
'ul.notes'
)
$
(
'body'
).
scrollTop
(
notes
.
height
())
initForm
:
->
form
=
$
(
'.new_note'
)
form
.
find
(
"#target_type"
).
val
(
'wall'
)
# remove unnecessary fields and buttons
form
.
find
(
"#note_line_code"
).
remove
()
form
.
find
(
".js-close-discussion-note-form"
).
remove
()
form
.
find
(
'.js-notify-commit-author'
).
remove
()
form
.
on
'ajax:success'
,
->
Wall
.
refresh
()
form
.
find
(
".js-note-text"
).
val
(
""
).
trigger
(
"input"
)
form
.
on
'ajax:complete'
,
->
form
.
find
(
".js-comment-button"
).
removeAttr
(
'disabled'
)
form
.
find
(
".js-comment-button"
).
removeClass
(
'disabled'
)
form
.
on
"click"
,
".js-choose-note-attachment-button"
,
->
form
.
find
(
".js-note-attachment-input"
).
click
()
form
.
on
"change"
,
".js-note-attachment-input"
,
->
filename
=
$
(
this
).
val
().
replace
(
/^.*[\\\/]/
,
''
)
form
.
find
(
".js-attachment-filename"
).
text
(
filename
)
form
.
show
()
app/assets/stylesheets/sections/wall.scss
View file @
124a5e27
...
@@ -10,10 +10,20 @@
...
@@ -10,10 +10,20 @@
padding
:
3px
;
padding
:
3px
;
padding-bottom
:
25px
;
padding-bottom
:
25px
;
border
:
1px
solid
#DDD
;
border
:
1px
solid
#DDD
;
display
:
block
;
}
}
.notes
{
.notes
{
margin-bottom
:
160px
;
margin-bottom
:
160px
;
.wall-author
{
color
:
#666
;
margin-right
:
10px
;
border-right
:
1px
solid
#CCC
;
padding-right
:
5px
}
.wall-file
{
float
:
right
;
}
}
}
}
}
app/views/layouts/project_resource.html.haml
View file @
124a5e27
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
=
link_to
'Wiki'
,
project_wiki_path
(
@project
,
:home
)
=
link_to
'Wiki'
,
project_wiki_path
(
@project
,
:home
)
-
if
@project
.
wall_enabled
-
if
@project
.
wall_enabled
=
nav_link
(
path:
'projects#wall'
)
do
=
nav_link
(
controller: :walls
)
do
=
link_to
'Wall'
,
project_wall_path
(
@project
)
=
link_to
'Wall'
,
project_wall_path
(
@project
)
-
if
@project
.
snippets_enabled
-
if
@project
.
snippets_enabled
...
...
app/views/walls/show.html.haml
View file @
124a5e27
...
@@ -3,7 +3,8 @@
...
@@ -3,7 +3,8 @@
.notes-busy.js-notes-busy
.notes-busy.js-notes-busy
.js-main-target-form
.js-main-target-form
=
render
"notes/form"
-
if
can?
current_user
,
:write_note
,
@project
=
render
"notes/form"
:javascript
:javascript
$
(
function
(){
$
(
function
(){
...
...
lib/api/entities.rb
View file @
124a5e27
...
@@ -95,6 +95,7 @@ module Gitlab
...
@@ -95,6 +95,7 @@ module Gitlab
class
Note
<
Grape
::
Entity
class
Note
<
Grape
::
Entity
expose
:id
expose
:id
expose
:note
,
as: :body
expose
:note
,
as: :body
expose
:attachment_identifier
,
as: :attachment
expose
:author
,
using:
Entities
::
UserBasic
expose
:author
,
using:
Entities
::
UserBasic
expose
:created_at
expose
:created_at
end
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