Skip to content
Snippets Groups Projects
Commit ef9c018b authored by Iain Bryson's avatar Iain Bryson
Browse files

Move content folders. Refactoring rendering a bit. Simplify bower file. ...

Move content folders.  Refactoring rendering a bit. Simplify bower file.  Enable MD-rendering in the enote environment.
parent 4a9ef7b5
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,10 @@ COPY . /dtu-course/app
RUN rm -rf tmp
RUN mkdir tmp
# install bower
RUN npm install -g bower
RUN bower install --allow-root
#RUN mkdir -p ~/.ssh
#RUN cp /dtu-data/known_hosts ~/.ssh
#RUN ssh-keygen -R github.com
......
......@@ -10,7 +10,6 @@
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require underscore
//= require jquery
//= require jquery-ujs
//= require MathJax
......@@ -20,6 +19,8 @@
//= require pagedown-extra/pagedown/Markdown.Editor.js
//= require pagedown-extra/Markdown.Extra.js
//= require turbolinks
//= require_tree .
//= require bootstrap
//= require mathjax
//= require_tree .
//= require render
\ No newline at end of file
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
function renderPage() {
"use strict";
console.log("rendering");
MathJax.Hub.Config({
skipStartupTypeset: true,
"HTML-CSS": {
preferredFont: "TeX",
availableFonts: [
"TeX"
],
linebreaks: {
automatic: true
},
EqnChunk: 10,
imageFont: null
},
root: '/assets/MathJax',
tex2jax: {
inlineMath: [
["$", "$"],
["\\\\\\\\(", "\\\\\\\\)"]
],
displayMath: [
["$$", "$$"],
["\\\\[", "\\\\]"]
],
processEscapes: true
},
TeX: {
noUndefined: {
attributes: {
mathcolor: "red",
mathbackground: "#FFEEEE",
mathsize: "90%"
}
},
Safe: {
allow: {
URLs: "safe",
classes: "safe",
cssIDs: "safe",
styles: "safe",
fontsize: "all"
}
}
},
messageStyle: "none"
});
var converter = new Markdown.Converter();
Markdown.Extra.init(converter, {
table_class: "table table-striped"
});
mathJax.onPagedownConfigure(converter);
converter.hooks.chain("postConversion", function(x) {
return x
});
if (typeof renderCoursePage === "function") {
renderCoursePage(converter);
}
MathJax.Hub.Queue(
["Typeset", MathJax.Hub, "content"]
);
};
$(document).on('ready page:load', renderPage);
\ No newline at end of file
......@@ -5,9 +5,15 @@ class HomeController < ApplicationController
:right_md,
:course)
def index
@course = "00000"
@course = Rails.configuration.dtu_data[:course]
@left_md = File.read(File.join(DTUAuth::AuthorizationManager.instance.dtu_data_root, @course+'-content', 'Frontpage-left.md'))
@right_md = File.read(File.join(DTUAuth::AuthorizationManager.instance.dtu_data_root, @course+'-content', 'Frontpage-right.md'))
@left_path = File.join(DTUAuth::AuthorizationManager.instance.dtu_data_root, @course+'-content', 'Frontpage-left.md')
@right_path = File.join(DTUAuth::AuthorizationManager.instance.dtu_data_root, @course+'-content', 'Frontpage-right.md')
Rails.logger.debug(@left_path)
Rails.logger.debug(@right_path)
@left_md = File.read(@left_path)
@right_md = File.read(@right_path)
end
end
......@@ -67,60 +67,12 @@
</div>
<script>
$(document).on('ready page:load', function() {
"use strict";
MathJax.Hub.Config({
skipStartupTypeset: true,
"HTML-CSS": {
preferredFont: "TeX",
availableFonts: [
"TeX"
],
linebreaks: {
automatic: true
},
EqnChunk: 10,
imageFont: null
},
root: '/assets/MathJax',
tex2jax: { inlineMath: [["$","$"],["\\\\\\\\(","\\\\\\\\)"]], displayMath: [["$$","$$"],["\\\\[","\\\\]"]], processEscapes: true },
TeX: {
noUndefined: {
attributes: {
mathcolor: "red",
mathbackground: "#FFEEEE",
mathsize: "90%"
}
},
Safe: {
allow: {
URLs: "safe",
classes: "safe",
cssIDs: "safe",
styles: "safe",
fontsize: "all"
}
}
},
messageStyle: "none"
});
var converter = new Markdown.Converter();
Markdown.Extra.init(converter, {
table_class: "table table-striped"
});
mathJax.onPagedownConfigure(converter);
converter.hooks.chain("postConversion", function(x) {
return x
});
function renderCoursePage(converter) {
$('.panel-body').html(converter.makeHtml("<%== escape_javascript @left_md %>)"));
$('#content').html(converter.makeHtml("<%== escape_javascript @right_md %>)"));
MathJax.Hub.Queue(
["Typeset", MathJax.Hub, "content"]
);
});
}
</script>
</div>
......@@ -23,8 +23,6 @@
"bootstrap": "3.0.3",
"jquery": "2.0.3",
"jquery-ujs": "1.2.1",
"underscore": "1.5.1",
"requirejs": "~2.1.11",
"require-css": "0.1.5",
"require-less": "0.1.2",
"pagedown-extra": "https://github.com/jmcmanus/pagedown-extra.git#ea782c3d11eb78f57d00aa819527338996a70721",
......
......@@ -31,5 +31,7 @@ module DTUCourseWebsite
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.dtu_data = {:course => ENV['COURSE_NAME'], :root_path => ENV['DTU_DATA_ROOT'] || "/dtu-data"}
end
end
......@@ -19,7 +19,7 @@ module DTUAuth
def load
self.dtu_data_root = Rails.root.join('../dtu-data/')
self.dtu_data_root = Rails.root.join(Rails.configuration.dtu_data[:root_path])
Rails.logger.debug "Initializing auth module"
Rails.logger.info "Using auth data from #{dtu_data_root}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment