2012-08-30 20:31:55 +02:00
|
|
|
.note-form-holder
|
|
|
|
= form_for [@project, @note], remote: "true", multipart: true do |f|
|
|
|
|
%h3.page_title Leave a comment
|
|
|
|
-if @note.errors.any?
|
|
|
|
.alert-message.block-message.error
|
|
|
|
- @note.errors.full_messages.each do |msg|
|
|
|
|
%div= msg
|
2011-10-08 23:36:38 +02:00
|
|
|
|
2012-08-30 20:31:55 +02:00
|
|
|
= f.hidden_field :noteable_id
|
|
|
|
= f.hidden_field :noteable_type
|
2012-10-09 14:48:20 +02:00
|
|
|
= f.text_area :note, size: 255, class: 'note-text gfm-input'
|
2012-08-30 20:31:55 +02:00
|
|
|
#preview-note.preview_note.hide
|
|
|
|
.hint
|
2012-09-06 09:50:47 +02:00
|
|
|
.right Comments are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
|
2012-08-30 20:31:55 +02:00
|
|
|
.clearfix
|
2011-10-08 23:36:38 +02:00
|
|
|
|
2012-09-18 07:54:17 +02:00
|
|
|
.row.note_advanced_opts
|
2012-08-30 20:31:55 +02:00
|
|
|
.span3
|
|
|
|
= f.submit 'Add Comment', class: "btn success submit_note grouped", id: "submit_note"
|
|
|
|
= link_to 'Preview', preview_project_notes_path(@project), class: 'btn grouped', id: 'preview-link'
|
|
|
|
.span4.notify_opts
|
|
|
|
%h6.left Notify via email:
|
|
|
|
= label_tag :notify do
|
|
|
|
= check_box_tag :notify, 1, @note.noteable_type != "Commit"
|
|
|
|
%span Project team
|
2011-11-15 09:34:30 +01:00
|
|
|
|
2012-08-30 20:31:55 +02:00
|
|
|
- if @note.notify_only_author?(current_user)
|
|
|
|
= label_tag :notify_author do
|
|
|
|
= check_box_tag :notify_author, 1 , @note.noteable_type == "Commit"
|
|
|
|
%span Commit author
|
|
|
|
.span5.attachments
|
|
|
|
%h6.left Attachment:
|
|
|
|
%span.file_name File name...
|
2012-08-30 08:26:45 +02:00
|
|
|
|
2012-08-30 20:31:55 +02:00
|
|
|
.input.input_file
|
|
|
|
%a.file_upload.btn.small Upload File
|
|
|
|
= f.file_field :attachment, class: "input-file"
|
|
|
|
%span.hint Any file less than 10 MB
|
2011-10-08 23:36:38 +02:00
|
|
|
|
2012-09-23 18:52:01 +02:00
|
|
|
:javascript
|
|
|
|
$(function(){
|
2012-10-09 14:48:35 +02:00
|
|
|
// init auto-completion of team members
|
|
|
|
var membersUrl = "#{root_url}/api/v2/projects/#{@project.code}/members";
|
|
|
|
var membersParams = {
|
|
|
|
private_token: "#{current_user.authentication_token}",
|
|
|
|
page: 1,
|
|
|
|
};
|
|
|
|
var membersData = [];
|
|
|
|
$('.gfm-input').atWho('@', function(query, callback) {
|
|
|
|
(function getMoreMembers() {
|
|
|
|
$.getJSON(membersUrl, membersParams).
|
|
|
|
success(function(members) {
|
|
|
|
// pick the data we need
|
|
|
|
var newMembersData = $.map(members, function(member) { return member.name });
|
|
|
|
|
|
|
|
// add the new page of data to the rest
|
|
|
|
$.merge(membersData, newMembersData);
|
|
|
|
|
|
|
|
// show the pop-up with a copy of the current data
|
|
|
|
callback(membersData.slice(0));
|
|
|
|
|
|
|
|
// are we past the last page?
|
|
|
|
if (newMembersData.length == 0) {
|
|
|
|
// set static data and stop callbacks
|
|
|
|
$('.gfm-input').atWho('@', { data: membersData, callback: null });
|
|
|
|
} else {
|
|
|
|
// get next page
|
|
|
|
getMoreMembers();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// next request will get the next page
|
|
|
|
membersParams.page += 1;
|
|
|
|
})();
|
|
|
|
});
|
|
|
|
|
|
|
|
// init auto-completion of emoji
|
|
|
|
var emoji = #{emoji_for_completion};
|
|
|
|
// convert the list so that the items have the right format for completion
|
|
|
|
emoji = $.map(emoji, function(value) {return { key: value+':', name: value }});
|
|
|
|
$('.gfm-input').atWho(':', {
|
|
|
|
data: emoji,
|
|
|
|
tpl: "<li data-value='${key}'>${name} #{escape_javascript image_tag('emoji/${name}.png', :size => '20x20')}</li>"
|
|
|
|
});
|
2012-09-23 18:52:01 +02:00
|
|
|
});
|