Nuevo plugin Redmine CKEditor 1.1.5

This commit is contained in:
Manuel Cillero 2018-02-02 22:25:19 +01:00
parent 64924a6376
commit 698e4e7c3c
635 changed files with 24046 additions and 0 deletions

View file

@ -0,0 +1,36 @@
module RedmineCkeditor::Hooks
class JournalListener < Redmine::Hook::ViewListener
def view_journals_notes_form_after_notes(context)
return unless RedmineCkeditor.enabled?
project = context[:project]
journal = context[:journal]
javascript_tag <<-EOT
(function() {
var note_id = "journal_#{journal.id}_notes";
CKEDITOR.replace(note_id, #{RedmineCkeditor.options(project).to_json});
var note = $("#" + note_id);
var save_button = note.parent().find(":submit");
var preview_button = save_button.next();
var cancel_button = preview_button.next().get(0);
save_button.click(function() {
var editor = CKEDITOR.instances[note_id];
note.val(editor.getData());
editor.destroy();
});
preview_button.hide();
var cancel = cancel_button.onclick;
cancel_button.onclick = function() {
CKEDITOR.instances[note_id].destroy();
cancel();
return false;
};
})();
EOT
end
end
end