mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-05-07 07:16:27 +02:00
feat(about): add templates of back-end modify online in admin control panel.
This commit is contained in:
@@ -86,6 +86,7 @@ module.exports = {
|
||||
'public/lib/angular-ui-codemirror/ui-codemirror.js',
|
||||
'public/lib/codemirror/mode/javascript/javascript.js',
|
||||
'public/lib/codemirror/mode/markdown/markdown.js',
|
||||
'public/lib/codemirror/mode/xml/xml.js',
|
||||
//angular-lazy-img
|
||||
'public/lib/angular-lazy-img/release/angular-lazy-img.js'
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ module.exports = {
|
||||
'public/lib/angular-ui-codemirror/ui-codemirror.min.js',
|
||||
'public/lib/codemirror/mode/javascript/javascript.js',
|
||||
'public/lib/codemirror/mode/markdown/markdown.js',
|
||||
'public/lib/codemirror/mode/xml/xml.js',
|
||||
//angular-lazy-img
|
||||
'public/lib/angular-lazy-img/release/angular-lazy-img.min.js'
|
||||
|
||||
|
||||
@@ -1274,7 +1274,8 @@
|
||||
SYSTEMS: {
|
||||
ASSETS_CONFIG: 'System assets configure',
|
||||
ENV_CONFIG: 'System env configure',
|
||||
TEMPLATES_EDIT: 'Templates editor',
|
||||
TEMPLATES_EDIT_FRONTEND: 'Front-end templates editor',
|
||||
TEMPLATES_EDIT_BACKEND: 'Back-end templates editor',
|
||||
DATABASE_BACKUP: 'Database backup files',
|
||||
TRANS_EDIT: 'Translate strings editor',
|
||||
COMMANDS_EXECUTE: 'Server commands execute',
|
||||
|
||||
@@ -1274,7 +1274,8 @@
|
||||
SYSTEMS: {
|
||||
ASSETS_CONFIG: 'Assets 资源配置调整',
|
||||
ENV_CONFIG: 'Env 环境配置调整',
|
||||
TEMPLATES_EDIT: '模板在线编辑',
|
||||
TEMPLATES_EDIT_FRONTEND: '前端模板在线编辑',
|
||||
TEMPLATES_EDIT_BACKEND: '后端模板在线编辑',
|
||||
DATABASE_BACKUP: '数据库备份文件',
|
||||
TRANS_EDIT: '多语言字符串在线编辑',
|
||||
COMMANDS_EXECUTE: '服务器命令在线执行',
|
||||
|
||||
@@ -27,9 +27,13 @@
|
||||
url: '/env',
|
||||
templateUrl: '/modules/systems/client/views/env.client.view.html'
|
||||
})
|
||||
.state('admin.systems.templates', {
|
||||
url: '/templates',
|
||||
templateUrl: '/modules/systems/client/views/templates.client.view.html'
|
||||
.state('admin.systems.templatesFront', {
|
||||
url: '/templatesFront',
|
||||
templateUrl: '/modules/systems/client/views/templatesFront.client.view.html'
|
||||
})
|
||||
.state('admin.systems.templatesBack', {
|
||||
url: '/templatesBack',
|
||||
templateUrl: '/modules/systems/client/views/templatesBack.client.view.html'
|
||||
})
|
||||
.state('admin.systems.trans', {
|
||||
url: '/trans',
|
||||
|
||||
@@ -80,6 +80,10 @@
|
||||
case 'md':
|
||||
_cm.setOption('mode', 'markdown');
|
||||
break;
|
||||
case 'html':
|
||||
_cm.setOption('mode', 'xml');
|
||||
_cm.setOption('htmlMode', true);
|
||||
break;
|
||||
default:
|
||||
_cm.setOption('mode', {name: 'javascript', json: true});
|
||||
}
|
||||
@@ -126,10 +130,10 @@
|
||||
$scope.$on('$stateChangeStart', function () {
|
||||
if (vm.contentChanged) {
|
||||
var modalOptions = {
|
||||
closeButtonText: $translate.instant('SYSTEMS.CONFIG_CHANGED_CONFIRM_CANCEL'),
|
||||
closeButtonText: $translate.instant('SYSTEMS.CONFIRM_CANCEL'),
|
||||
actionButtonText: $translate.instant('SYSTEMS.CONFIG_CHANGED_CONFIRM_SAVE'),
|
||||
headerText: $translate.instant('SYSTEMS.CONFIG_CHANGED_HEADER_TEXT'),
|
||||
bodyText: $translate.instant('SYSTEMS.CONFIG_CHANGED_BODY_TEXT')
|
||||
headerText: $translate.instant('SYSTEMS.CONFIG_CHANGED_CONFIRM_HEADER_TEXT'),
|
||||
bodyText: $translate.instant('SYSTEMS.CONFIG_CHANGED_CONFIRM_BODY_TEXT')
|
||||
};
|
||||
|
||||
ModalConfirmService.showModal({}, modalOptions)
|
||||
@@ -187,11 +191,20 @@
|
||||
};
|
||||
|
||||
/**
|
||||
* getTemplateConfigFiles
|
||||
* getTemplateFrontConfigFiles
|
||||
*/
|
||||
vm.getTemplateConfigFiles = function () {
|
||||
SystemsService.getSystemTemplateConfigFiles(function (res) {
|
||||
vm.templateConfigFiles = res;
|
||||
vm.getTemplateFrontConfigFiles = function () {
|
||||
SystemsService.getSystemTemplateFrontConfigFiles(function (res) {
|
||||
vm.templateFrontConfigFiles = res;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* getTemplateBackConfigFiles
|
||||
*/
|
||||
vm.getTemplateBackConfigFiles = function () {
|
||||
SystemsService.getSystemTemplateBackConfigFiles(function (res) {
|
||||
vm.templateBackConfigFiles = res;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -26,9 +26,13 @@
|
||||
method: 'GET',
|
||||
url: '/api/systems/systemTransConfigFiles'
|
||||
},
|
||||
getSystemTemplateConfigFiles: {
|
||||
getSystemTemplateFrontConfigFiles: {
|
||||
method: 'GET',
|
||||
url: '/api/systems/systemTemplateConfigFiles'
|
||||
url: '/api/systems/systemTemplateFrontConfigFiles'
|
||||
},
|
||||
getSystemTemplateBackConfigFiles: {
|
||||
method: 'GET',
|
||||
url: '/api/systems/systemTemplateBackConfigFiles'
|
||||
},
|
||||
getSystemConfigContent: {
|
||||
method: 'GET',
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
ui-sref-active="active">{{'SYSTEMS.ASSETS_CONFIG' | translate}}</a>
|
||||
<a ui-sref="admin.systems.trans" class="list-group-item"
|
||||
ui-sref-active="active">{{'SYSTEMS.TRANS_EDIT' | translate}}</a>
|
||||
<a ui-sref="admin.systems.templates" class="list-group-item"
|
||||
ui-sref-active="active">{{'SYSTEMS.TEMPLATES_EDIT' | translate}}</a>
|
||||
<a ui-sref="admin.systems.templatesFront" class="list-group-item"
|
||||
ui-sref-active="active">{{'SYSTEMS.TEMPLATES_EDIT_FRONTEND' | translate}}</a>
|
||||
<a ui-sref="admin.systems.templatesBack" class="list-group-item"
|
||||
ui-sref-active="active">{{'SYSTEMS.TEMPLATES_EDIT_BACKEND' | translate}}</a>
|
||||
<a ui-sref="admin.systems.examination" class="list-group-item divider"
|
||||
ui-sref-active="active">{{'SYSTEMS.EXAMINATION_MANAGE' | translate}}</a>
|
||||
<a ui-sref="admin.systems.backup" class="list-group-item divider"
|
||||
|
||||
27
modules/systems/client/views/templatesBack.client.view.html
Normal file
27
modules/systems/client/views/templatesBack.client.view.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<div class="panel panel-default system-panel" ng-controller="SystemConfigController as vm" ng-init="vm.getTemplateBackConfigFiles()">
|
||||
<div class="panel-heading">{{'SYSTEMS.TEMPLATES_EDIT_BACKEND' | translate}}
|
||||
<small> - {{vm.loadedFilename}}</small>
|
||||
</div>
|
||||
<div class="panel-desc" ng-bind-html="vm.getDescConfig()"></div>
|
||||
<div class="panel-filelist" ng-class="{'show-border-bottom': vm.showBody, 'hide-border-bottom': !vm.showBody}">
|
||||
<select class="form-control" ng-model="vm.selectedFilename" ng-change="vm.onSelectedFileChanged();" autofocus>
|
||||
<option value="null">{{'SYSTEMS.SELECT_FILE' | translate}}
|
||||
</option>
|
||||
<option ng-repeat="t in vm.templateBackConfigFiles.files"
|
||||
value="{{t}}">{{t}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="panel-loading" ng-class="vm.showLoading ? 'show-loading' : 'hide-loading'" translate="SYSTEMS.CONFIG_LOADING"></div>
|
||||
<div class="panel-body" ng-class="{'content-dirty': vm.contentChanged, 'show-body': vm.showBody, 'hide-body': !vm.showBody}">
|
||||
<textarea class="form-control config-content" id="configContent" name="configContent" ng-model="vm.systemConfigContentValue"
|
||||
ui-codemirror="vm.cmOption"></textarea>
|
||||
</div>
|
||||
<div class="panel-footer" ng-class="vm.showFooter ? 'show-footer' : 'hide-footer'">
|
||||
<div class="text-right">
|
||||
<button class="btn btn-success btn-width-100" ng-disabled="!vm.contentChanged"
|
||||
ng-click="vm.saveConfigFileContent()">{{'BUTTON_SAVE' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="panel panel-default system-panel" ng-controller="SystemConfigController as vm" ng-init="vm.getTemplateConfigFiles()">
|
||||
<div class="panel-heading">{{'SYSTEMS.TEMPLATES_EDIT' | translate}}
|
||||
<div class="panel panel-default system-panel" ng-controller="SystemConfigController as vm" ng-init="vm.getTemplateFrontConfigFiles()">
|
||||
<div class="panel-heading">{{'SYSTEMS.TEMPLATES_EDIT_FRONTEND' | translate}}
|
||||
<small> - {{vm.loadedFilename}}</small>
|
||||
</div>
|
||||
<div class="panel-desc" ng-bind-html="vm.getDescConfig()"></div>
|
||||
@@ -7,7 +7,7 @@
|
||||
<select class="form-control" ng-model="vm.selectedFilename" ng-change="vm.onSelectedFileChanged();" autofocus>
|
||||
<option value="null">{{'SYSTEMS.SELECT_FILE' | translate}}
|
||||
</option>
|
||||
<option ng-repeat="t in vm.templateConfigFiles.files"
|
||||
<option ng-repeat="t in vm.templateFrontConfigFiles.files"
|
||||
value="{{t}}">{{t}}
|
||||
</option>
|
||||
</select>
|
||||
@@ -78,11 +78,11 @@ exports.getSystemTransConfigFiles = function (req, res) {
|
||||
};
|
||||
|
||||
/**
|
||||
* getSystemTemplateConfigFiles
|
||||
* getSystemTemplateFrontConfigFiles
|
||||
* @param req
|
||||
* @param res
|
||||
*/
|
||||
exports.getSystemTemplateConfigFiles = function (req, res) {
|
||||
exports.getSystemTemplateFrontConfigFiles = function (req, res) {
|
||||
var files = shell.ls('./modules/*/client/templates/*.md');
|
||||
|
||||
if (req.user.isAdmin) {
|
||||
@@ -96,6 +96,25 @@ exports.getSystemTemplateConfigFiles = function (req, res) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* getSystemTemplateBackConfigFiles
|
||||
* @param req
|
||||
* @param res
|
||||
*/
|
||||
exports.getSystemTemplateBackConfigFiles = function (req, res) {
|
||||
var files = shell.ls('./modules/*/server/templates/*');
|
||||
|
||||
if (req.user.isAdmin) {
|
||||
res.json({
|
||||
files: files
|
||||
});
|
||||
} else {
|
||||
return res.status(403).json({
|
||||
message: 'SERVER.USER_IS_NOT_AUTHORIZED'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* getSystemConfigContent
|
||||
* @param req
|
||||
|
||||
@@ -19,7 +19,8 @@ exports.invokeRolesPolicies = function () {
|
||||
{resources: '/api/systems/systemEnvConfigFiles', permissions: '*'},
|
||||
{resources: '/api/systems/systemAssetsConfigFiles', permissions: '*'},
|
||||
{resources: '/api/systems/systemTransConfigFiles', permissions: '*'},
|
||||
{resources: '/api/systems/systemTemplateConfigFiles', permissions: '*'},
|
||||
{resources: '/api/systems/systemTemplateFrontConfigFiles', permissions: '*'},
|
||||
{resources: '/api/systems/systemTemplateBackConfigFiles', permissions: '*'},
|
||||
{resources: '/api/systems/shellCommand', permissions: '*'},
|
||||
{resources: '/api/systems/initExaminationData', permissions: '*'},
|
||||
{resources: '/api/systems/getExaminationStatus', permissions: '*'},
|
||||
|
||||
@@ -16,8 +16,11 @@ module.exports = function (app) {
|
||||
app.route('/api/systems/systemTransConfigFiles').all(systemsPolicy.isAllowed)
|
||||
.get(systems.getSystemTransConfigFiles);
|
||||
|
||||
app.route('/api/systems/systemTemplateConfigFiles').all(systemsPolicy.isAllowed)
|
||||
.get(systems.getSystemTemplateConfigFiles);
|
||||
app.route('/api/systems/systemTemplateFrontConfigFiles').all(systemsPolicy.isAllowed)
|
||||
.get(systems.getSystemTemplateFrontConfigFiles);
|
||||
|
||||
app.route('/api/systems/systemTemplateBackConfigFiles').all(systemsPolicy.isAllowed)
|
||||
.get(systems.getSystemTemplateBackConfigFiles);
|
||||
|
||||
app.route('/api/systems/systemConfigContent').all(systemsPolicy.isAllowed)
|
||||
.get(systems.getSystemConfigContent)
|
||||
|
||||
Reference in New Issue
Block a user