codecombat/app/views/teachers/MarkdownResourceView.coffee

19 lines
631 B
CoffeeScript
Raw Normal View History

2016-08-19 17:05:21 -04:00
RootView = require 'views/core/RootView'
module.exports = class MarkdownResourceView extends RootView
id: 'markdown-resource-view'
template: require 'templates/teachers/markdown-resource-view'
initialize: (options, @name) ->
super(options)
@content = ''
$.get '/markdown/' + @name + '.md', (data) =>
if data.indexOf('<!doctype html>') is -1
2016-08-23 21:12:44 -04:00
i = 0
@content = marked(data, sanitize: false).replace /<\/h5/g, () ->
if i++ == 0
'</h5'
else
'<a class="pull-right btn btn-md btn-navy back-to-top" href="#logo-img">Back to top</a></h5'
2016-08-19 17:05:21 -04:00
@render()