Moved out directives into separate file.

Preparing to bring back web client into rest of rookeri.es.
This commit is contained in:
Dorian 2013-07-22 16:29:05 -04:00
parent 585bebfd25
commit e0c974c3f4
2 changed files with 25 additions and 27 deletions

View File

@ -1,11 +1,10 @@
/** /**
* Rookeries AngularJS v0.2.0. * Rookeries AngularJS v0.2.0 -- Application
* *
* (c) Copyright 2013 Dorian Pula * (c) Copyright 2013 Dorian Pula
* @License: AGPL * @license: AGPL v3+
* @author: Dorian Pula [dorian.pula@amber-penguin-software.ca] * @author: Dorian Pula [dorian.pula@amber-penguin-software.ca]
* *
* Created with PyCharm. Date: 2013-June-30 @ 23:58
*/ */
// The location of the API server. // The location of the API server.
@ -103,26 +102,4 @@ var rookeriesApp = angular.module('rookeries.app',
} }
} }
}) })
}); });
// Rendering Markdown into an HTML div element.
// Borrowed from:
// http://stackoverflow.com/questions/14982422/markdown-with-angularjs-directives
// http://jsfiddle.net/x97BJ/2/
rookeriesApp.directive("markdown", function () {
return {
restrict: 'E',
require: 'model',
scope: {
value: "=model"
},
template: '<div ng-bind-html-unsafe="value | markdown"></div>'
};
})
.filter('markdown', function () {
var converter = new Showdown.converter();
return function (value) {
return converter.makeHtml(value || '');
};
});

View File

@ -2,8 +2,29 @@
* rookeri.es AngularJS client -- Directives * rookeri.es AngularJS client -- Directives
* *
* (c) Copyright 2013 Dorian Pula * (c) Copyright 2013 Dorian Pula
* @License: AGPL * @license: AGPL v3+
* @author: Dorian Pula [dorian.pula@amber-penguin-software.ca] * @author: Dorian Pula [dorian.pula@amber-penguin-software.ca]
* @version: 0.2.0 * @version: 0.2.0
*/ */
// Rendering Markdown into an HTML div element.
// Borrowed from:
// http://stackoverflow.com/questions/14982422/markdown-with-angularjs-directives
// http://jsfiddle.net/x97BJ/2/
rookeriesApp.directive("markdown", function () {
return {
restrict: 'E',
require: 'model',
scope: {
value: "=model"
},
template: '<div ng-bind-html-unsafe="value | markdown"></div>'
};
})
.filter('markdown', function () {
var converter = new Showdown.converter();
return function (value) {
return converter.makeHtml(value || '');
};
});