Skip to content
Snippets Groups Projects
Commit 1ec3bd3f authored by Nihad Abbasov's avatar Nihad Abbasov
Browse files

ability to preview notes

parent 34ba4e13
No related branches found
No related tags found
1 merge request!1198ability to preview notes
Loading
Loading
@@ -18,6 +18,7 @@
//= require chosen-jquery
//= require raphael
//= require branch-graph
//= require Markdown.Converter
//= require_tree .
 
$(document).ready(function(){
Loading
Loading
@@ -26,7 +27,6 @@ $(document).ready(function(){
$(this).select();
});
 
$('body').on('ajax:complete, ajax:beforeSend, submit', 'form', function(e){
var buttons = $('[type="submit"]', this);
switch( e.type ){
Loading
Loading
@@ -70,6 +70,24 @@ $(document).ready(function(){
$(".supp_diff_link").bind("click", function() {
showDiff(this);
});
/**
* Note markdown preview
*
*/
$('#preview-link').on('click', function(e) {
var note = $('#note_note').val();
if (note.trim().length === 0) { note = 'Nothing to preview'; }
var converter = new Markdown.Converter();
var md_preview = converter.makeHtml(note);
$('#preview-note').html(md_preview);
var previewLinkText = ($(this).text() == 'Preview' ? 'Edit' : 'Preview');
$(this).text(previewLinkText);
$('#preview-note, #note_note').toggle();
e.preventDefault();
});
});
 
function focusSearch() {
Loading
Loading
@@ -108,6 +126,6 @@ function showDiff(link) {
})(jQuery);
 
 
function ajaxGet(url) {
$.ajax({type: "GET", url: url, dataType: "script"});
function ajaxGet(url) {
$.ajax({type: "GET", url: url, dataType: "script"});
}
Loading
Loading
@@ -7,10 +7,12 @@
 
= f.hidden_field :noteable_id
= f.hidden_field :noteable_type
= f.text_area :note, :size => 255
= f.text_area :note, :size => 255
#preview-note.well.hide
%p.hint
= link_to "Gitlab Markdown", help_markdown_path, :target => '_blank'
is enabled.
= link_to 'Preview', '#', :id => 'preview-link'
 
.row.note_advanced_opts.hide
.span4
Loading
Loading
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment