From 619f40df971d1970e35f82a6cc3eead1fe3cfbca Mon Sep 17 00:00:00 2001 From: OldHawk Date: Sat, 17 Mar 2018 10:00:01 +0800 Subject: [PATCH] feat(core): timely replace configure variable value in template content when edit it online --- .../controllers/about.client.controller.js | 8 +++++- .../systems-config.client.controller.js | 26 ++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/modules/about/client/controllers/about.client.controller.js b/modules/about/client/controllers/about.client.controller.js index 793007d8..93941fb7 100644 --- a/modules/about/client/controllers/about.client.controller.js +++ b/modules/about/client/controllers/about.client.controller.js @@ -53,8 +53,14 @@ vm.getTemplateMarkedContent = function () { var tmp = $filter('fmt')(vm.templateFileContent, { appConfig: vm.appConfig, + announceConfig: vm.announce, scoreConfig: vm.scoreConfig, - requestsConfig: vm.requestsConfig + rssConfig: vm.rssConfig, + ircConfig: vm.ircConfig, + signConfig: vm.signConfig, + inviteConfig: vm.inviteConfig, + requestsConfig: vm.requestsConfig, + hnrConfig: vm.hnrConfig }); return marked(tmp, {sanitize: false}); }; diff --git a/modules/systems/client/controllers/systems-config.client.controller.js b/modules/systems/client/controllers/systems-config.client.controller.js index b130bebe..2827fb65 100644 --- a/modules/systems/client/controllers/systems-config.client.controller.js +++ b/modules/systems/client/controllers/systems-config.client.controller.js @@ -6,14 +6,23 @@ .controller('SystemConfigController', SystemConfigController); SystemConfigController.$inject = ['$scope', '$state', '$timeout', '$translate', 'Authentication', 'SystemsService', 'ModalConfirmService', 'NotifycationService', 'marked', - 'DebugConsoleService', 'MeanTorrentConfig']; + 'DebugConsoleService', 'MeanTorrentConfig', '$filter']; function SystemConfigController($scope, $state, $timeout, $translate, Authentication, SystemsService, ModalConfirmService, NotifycationService, marked, - mtDebug, MeanTorrentConfig) { + mtDebug, MeanTorrentConfig, $filter) { var vm = this; vm.user = Authentication.user; vm.selectedFilename = 'null'; vm.shellCommandConfig = MeanTorrentConfig.meanTorrentConfig.shellCommand; + vm.appConfig = MeanTorrentConfig.meanTorrentConfig.app; + vm.scoreConfig = MeanTorrentConfig.meanTorrentConfig.score; + vm.announce = MeanTorrentConfig.meanTorrentConfig.announce; + vm.rssConfig = MeanTorrentConfig.meanTorrentConfig.rss; + vm.ircConfig = MeanTorrentConfig.meanTorrentConfig.ircAnnounce; + vm.signConfig = MeanTorrentConfig.meanTorrentConfig.sign; + vm.inviteConfig = MeanTorrentConfig.meanTorrentConfig.invite; + vm.requestsConfig = MeanTorrentConfig.meanTorrentConfig.requests; + vm.hnrConfig = MeanTorrentConfig.meanTorrentConfig.hitAndRun; /** * cmOption @@ -215,7 +224,18 @@ * @returns {*} */ vm.getMarkedConfigContent = function () { - return marked(vm.systemConfigContentValue, {sanitize: true}); + var tmp = $filter('fmt')(vm.systemConfigContentValue, { + appConfig: vm.appConfig, + announceConfig: vm.announce, + scoreConfig: vm.scoreConfig, + rssConfig: vm.rssConfig, + ircConfig: vm.ircConfig, + signConfig: vm.signConfig, + inviteConfig: vm.inviteConfig, + requestsConfig: vm.requestsConfig, + hnrConfig: vm.hnrConfig + }); + return marked(tmp, {sanitize: true}); }; /**