mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Move markdown parsing to notification service
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
/* Make user and settings available for everyone through root scope.
|
||||
*/
|
||||
|
||||
habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$http', '$state', '$stateParams', 'Notification', 'Groups', 'Shared', 'Content', '$modal', '$timeout', 'ApiUrl', 'Payments','$sce','$window', '$filter',
|
||||
function($scope, $rootScope, $location, User, $http, $state, $stateParams, Notification, Groups, Shared, Content, $modal, $timeout, ApiUrl, Payments, $sce, $window, $filter) {
|
||||
habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$http', '$state', '$stateParams', 'Notification', 'Groups', 'Shared', 'Content', '$modal', '$timeout', 'ApiUrl', 'Payments','$sce','$window',
|
||||
function($scope, $rootScope, $location, User, $http, $state, $stateParams, Notification, Groups, Shared, Content, $modal, $timeout, ApiUrl, Payments, $sce, $window) {
|
||||
var user = User.user;
|
||||
|
||||
var initSticky = _.once(function(){
|
||||
@@ -278,7 +278,7 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
||||
case 'user': msg = window.env.t('youCastTarget', {spell: spell.text(), target: target.profile.name});break;
|
||||
case 'party': msg = window.env.t('youCastParty', {spell: spell.text()});break;
|
||||
}
|
||||
Notification.text($filter("markdown")(msg));
|
||||
Notification.markdown(msg);
|
||||
User.sync();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Set up "+1 Exp", "Level Up", etc notifications
|
||||
*/
|
||||
angular.module("habitrpg").factory("Notification",
|
||||
[function() {
|
||||
['$filter', function($filter) {
|
||||
var stack_topright = {"dir1": "down", "dir2": "left", "spacing1": 15, "spacing2": 15, "firstpos1": 60};
|
||||
function notify(html, type, icon) {
|
||||
var notice = $.pnotify({
|
||||
@@ -62,6 +62,12 @@ angular.module("habitrpg").factory("Notification",
|
||||
notify(val, 'info');
|
||||
}
|
||||
},
|
||||
markdown: function(val){
|
||||
if (val) {
|
||||
var parsed_markdown = $filter("markdown")(val);
|
||||
notify(parsed_markdown, 'info');
|
||||
}
|
||||
},
|
||||
lvl: function(){
|
||||
notify(window.env.t('levelUp'), 'lvl', 'glyphicon glyphicon-chevron-up');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user