Merge pull request #76 from openHPI/markup-description
Markup description
This commit is contained in:
2
Gemfile
2
Gemfile
@ -28,6 +28,8 @@ gem 'rubytree'
|
|||||||
gem 'sass-rails', '~> 4.0.3'
|
gem 'sass-rails', '~> 4.0.3'
|
||||||
gem 'sdoc', '~> 0.4.0', group: :doc
|
gem 'sdoc', '~> 0.4.0', group: :doc
|
||||||
gem 'slim'
|
gem 'slim'
|
||||||
|
gem 'bootstrap_pagedown'
|
||||||
|
gem 'pagedown-rails', '~> 1.1.4'
|
||||||
gem 'sorcery'
|
gem 'sorcery'
|
||||||
gem 'thread_safe'
|
gem 'thread_safe'
|
||||||
gem 'turbolinks'
|
gem 'turbolinks'
|
||||||
|
@ -48,6 +48,8 @@ GEM
|
|||||||
debug_inspector (>= 0.0.1)
|
debug_inspector (>= 0.0.1)
|
||||||
bootstrap-will_paginate (0.0.10)
|
bootstrap-will_paginate (0.0.10)
|
||||||
will_paginate
|
will_paginate
|
||||||
|
bootstrap_pagedown (1.1.0)
|
||||||
|
rails (>= 3.2)
|
||||||
builder (3.2.2)
|
builder (3.2.2)
|
||||||
byebug (8.2.2)
|
byebug (8.2.2)
|
||||||
capistrano (3.3.5)
|
capistrano (3.3.5)
|
||||||
@ -175,6 +177,8 @@ GEM
|
|||||||
multi_json (~> 1.3)
|
multi_json (~> 1.3)
|
||||||
multi_xml (~> 0.5)
|
multi_xml (~> 0.5)
|
||||||
rack (>= 1.2, < 3)
|
rack (>= 1.2, < 3)
|
||||||
|
pagedown-rails (1.1.4)
|
||||||
|
railties (> 3.1)
|
||||||
parser (2.3.0.6)
|
parser (2.3.0.6)
|
||||||
ast (~> 2.2)
|
ast (~> 2.2)
|
||||||
pg (0.18.4)
|
pg (0.18.4)
|
||||||
@ -355,6 +359,7 @@ DEPENDENCIES
|
|||||||
better_errors
|
better_errors
|
||||||
binding_of_caller
|
binding_of_caller
|
||||||
bootstrap-will_paginate
|
bootstrap-will_paginate
|
||||||
|
bootstrap_pagedown
|
||||||
byebug
|
byebug
|
||||||
capistrano (~> 3.3.0)
|
capistrano (~> 3.3.0)
|
||||||
capistrano-rails
|
capistrano-rails
|
||||||
@ -382,6 +387,7 @@ DEPENDENCIES
|
|||||||
newrelic_rpm
|
newrelic_rpm
|
||||||
nokogiri
|
nokogiri
|
||||||
nyan-cat-formatter
|
nyan-cat-formatter
|
||||||
|
pagedown-rails (~> 1.1.4)
|
||||||
pg
|
pg
|
||||||
pry
|
pry
|
||||||
puma (~> 2.15.3)
|
puma (~> 2.15.3)
|
||||||
@ -411,3 +417,6 @@ DEPENDENCIES
|
|||||||
uglifier (>= 1.3.0)
|
uglifier (>= 1.3.0)
|
||||||
web-console (~> 2.0)
|
web-console (~> 2.0)
|
||||||
will_paginate (~> 3.0)
|
will_paginate (~> 3.0)
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
1.12.4
|
||||||
|
@ -21,3 +21,7 @@
|
|||||||
//= require turbolinks
|
//= require turbolinks
|
||||||
//= require_tree ../../../lib
|
//= require_tree ../../../lib
|
||||||
//= require_tree .
|
//= require_tree .
|
||||||
|
//= require bootstrap_pagedown
|
||||||
|
//= require markdown.converter
|
||||||
|
//= require markdown.sanitizer
|
||||||
|
//= require markdown.editor
|
@ -173,9 +173,10 @@ $(function() {
|
|||||||
} else if ($('.edit_exercise, .new_exercise').isPresent()) {
|
} else if ($('.edit_exercise, .new_exercise').isPresent()) {
|
||||||
execution_environments = $('form').data('execution-environments');
|
execution_environments = $('form').data('execution-environments');
|
||||||
file_types = $('form').data('file-types');
|
file_types = $('form').data('file-types');
|
||||||
// new MarkdownEditor('#exercise_instructions');
|
// new MarkdownEditor('#exercise_instructions');
|
||||||
new MarkdownEditor('#exercise_description');
|
// new MarkdownEditor('#exercise_description')
|
||||||
// todo: add an ace editor for each file
|
// todo: add an ace editor for each file
|
||||||
|
new PagedownEditor('#exercise_description');
|
||||||
|
|
||||||
enableInlineFileCreation();
|
enableInlineFileCreation();
|
||||||
inferFileAttributes();
|
inferFileAttributes();
|
||||||
|
16
app/assets/javascripts/markdown_ace_editor.js
Normal file
16
app/assets/javascripts/markdown_ace_editor.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
(function() {
|
||||||
|
var ACE_FILES_PATH = '/assets/ace/';
|
||||||
|
|
||||||
|
window.MarkdownEditor = function(selector) {
|
||||||
|
ace.config.set('modePath', ACE_FILES_PATH);
|
||||||
|
var editor = ace.edit($(selector).next()[0]);
|
||||||
|
editor.on('change', function() {
|
||||||
|
$(selector).val(editor.getValue());
|
||||||
|
});
|
||||||
|
editor.setShowPrintMargin(false);
|
||||||
|
var session = editor.getSession();
|
||||||
|
session.setMode('markdown');
|
||||||
|
session.setUseWrapMode(true);
|
||||||
|
session.setValue($(selector).val());
|
||||||
|
};
|
||||||
|
})();
|
@ -1,16 +0,0 @@
|
|||||||
(function() {
|
|
||||||
var ACE_FILES_PATH = '/assets/ace/';
|
|
||||||
|
|
||||||
window.MarkdownEditor = function(selector) {
|
|
||||||
ace.config.set('modePath', ACE_FILES_PATH);
|
|
||||||
var editor = ace.edit($(selector).next()[0]);
|
|
||||||
editor.on('change', function() {
|
|
||||||
$(selector).val(editor.getValue());
|
|
||||||
});
|
|
||||||
editor.setShowPrintMargin(false);
|
|
||||||
var session = editor.getSession();
|
|
||||||
session.setMode('markdown');
|
|
||||||
session.setUseWrapMode(true);
|
|
||||||
session.setValue($(selector).val());
|
|
||||||
};
|
|
||||||
})();
|
|
10
app/assets/javascripts/pagedown.js
Normal file
10
app/assets/javascripts/pagedown.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
(function() {
|
||||||
|
var ACE_FILES_PATH = '/assets/ace/';
|
||||||
|
|
||||||
|
window.PagedownEditor = function(selector) {
|
||||||
|
var converter = Markdown.getSanitizingConverter();
|
||||||
|
var editor = new Markdown.Editor( converter );
|
||||||
|
|
||||||
|
editor.run();
|
||||||
|
};
|
||||||
|
})();
|
@ -14,4 +14,6 @@
|
|||||||
*= require_tree ../../../lib
|
*= require_tree ../../../lib
|
||||||
*= require_tree ../../../vendor/assets/stylesheets/
|
*= require_tree ../../../vendor/assets/stylesheets/
|
||||||
*= require_self
|
*= require_self
|
||||||
*/
|
*= require bootstrap_pagedown
|
||||||
|
*= require markdown
|
||||||
|
*/
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
= f.text_field(:title, class: 'form-control', required: true)
|
= f.text_field(:title, class: 'form-control', required: true)
|
||||||
.form-group
|
.form-group
|
||||||
= f.label(:description)
|
= f.label(:description)
|
||||||
= f.hidden_field(:description)
|
= f.pagedown_editor :description
|
||||||
.form-control.markdown
|
|
||||||
.form-group
|
.form-group
|
||||||
= f.label(:execution_environment_id)
|
= f.label(:execution_environment_id)
|
||||||
= f.collection_select(:execution_environment_id, @execution_environments, :id, :name, {}, class: 'form-control')
|
= f.collection_select(:execution_environment_id, @execution_environments, :id, :name, {}, class: 'form-control')
|
||||||
|
Reference in New Issue
Block a user