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
Tatuya Kamada
gitlab-ce
Commits
e5adca1b
Commit
e5adca1b
authored
Aug 29, 2012
by
randx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preview as button. Disable note submit unless content
parent
b9b63fc3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
app/assets/javascripts/note.js
app/assets/javascripts/note.js
+11
-0
app/views/notes/_form.html.haml
app/views/notes/_form.html.haml
+5
-4
No files found.
app/assets/javascripts/note.js
View file @
e5adca1b
...
@@ -24,6 +24,16 @@ init:
...
@@ -24,6 +24,16 @@ init:
$
(
'
.delete-note
'
).
live
(
'
ajax:success
'
,
function
()
{
$
(
'
.delete-note
'
).
live
(
'
ajax:success
'
,
function
()
{
$
(
this
).
closest
(
'
li
'
).
fadeOut
();
});
$
(
this
).
closest
(
'
li
'
).
fadeOut
();
});
$
(
'
#note_note
'
).
on
(
'
keyup
'
,
function
(){
var
field
=
$
(
this
);
var
closest_submit
=
field
.
closest
(
"
form
"
).
find
(
"
.submit_note
"
);
if
(
field
.
val
()
==
""
)
{
closest_submit
.
attr
(
"
disabled
"
,
"
disabled
"
).
addClass
(
"
disabled
"
);
}
else
{
closest_submit
.
removeAttr
(
"
disabled
"
).
removeClass
(
"
disabled
"
);
}
})
$
(
"
#new_note
"
).
live
(
"
ajax:before
"
,
function
(){
$
(
"
#new_note
"
).
live
(
"
ajax:before
"
,
function
(){
$
(
"
.submit_note
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.submit_note
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
})
})
...
@@ -35,6 +45,7 @@ init:
...
@@ -35,6 +45,7 @@ init:
$
(
"
#note_note
"
).
live
(
"
focus
"
,
function
(){
$
(
"
#note_note
"
).
live
(
"
focus
"
,
function
(){
$
(
this
).
css
(
"
height
"
,
"
80px
"
);
$
(
this
).
css
(
"
height
"
,
"
80px
"
);
$
(
'
.note_advanced_opts
'
).
show
();
$
(
'
.note_advanced_opts
'
).
show
();
$
(
this
).
closest
(
"
form
"
).
find
(
"
.submit_note
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
});
});
$
(
"
#note_attachment
"
).
change
(
function
(
e
){
$
(
"
#note_attachment
"
).
change
(
function
(
e
){
...
...
app/views/notes/_form.html.haml
View file @
e5adca1b
...
@@ -10,12 +10,13 @@
...
@@ -10,12 +10,13 @@
=
f
.
text_area
:note
,
size:
255
=
f
.
text_area
:note
,
size:
255
#preview-note
.well.hide
#preview-note
.well.hide
.hint
.hint
=
link_to
'Preview'
,
preview_project_notes_path
(
@project
),
id:
'preview-link'
.right
Comments are parsed with
#{
link_to
"Gitlab Flavored Markdown"
,
help_markdown_path
,
target:
'_blank'
}
.
.right
Comments are parsed with
#{
link_to
"Gitlab Flavored Markdown"
,
help_markdown_path
,
target:
'_blank'
}
.
.clearfix
.row.note_advanced_opts.hide
.row.note_advanced_opts.hide
.span2
.span3
=
f
.
submit
'Add Comment'
,
class:
"btn primary submit_note"
,
id:
"submit_note"
=
f
.
submit
'Add Comment'
,
class:
"btn primary submit_note grouped"
,
id:
"submit_note"
=
link_to
'Preview'
,
preview_project_notes_path
(
@project
),
class:
'btn grouped'
,
id:
'preview-link'
.span4.notify_opts
.span4.notify_opts
%h6
.left
Notify via email:
%h6
.left
Notify via email:
=
label_tag
:notify
do
=
label_tag
:notify
do
...
@@ -26,7 +27,7 @@
...
@@ -26,7 +27,7 @@
=
label_tag
:notify_author
do
=
label_tag
:notify_author
do
=
check_box_tag
:notify_author
,
1
,
@note
.
noteable_type
==
"Commit"
=
check_box_tag
:notify_author
,
1
,
@note
.
noteable_type
==
"Commit"
%span
Commit author
%span
Commit author
.span
6
.attachments
.span
5
.attachments
%h6
.left
Attachment:
%h6
.left
Attachment:
%span
.file_name
File name...
%span
.file_name
File name...
...
...
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