|
|
|
@ -109,6 +109,7 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
|
|
|
|
|
|
|
|
|
|
app.controller('cmsAddArticleCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', function ($scope, $http, $state, $stateParams, commonDialog) {
|
|
|
|
|
$scope.saveArticle = function () {
|
|
|
|
|
$scope.article.reference =$scope.reference;
|
|
|
|
|
$http.post('/app/cms/categories/' + $stateParams.catId + '/articles', $scope.article).then(function (resp) {
|
|
|
|
|
$state.go('^.article_view', {articleId: resp.data.article_id});
|
|
|
|
|
}, function (resp) {
|
|
|
|
@ -119,7 +120,10 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
|
|
|
|
|
|
|
|
|
|
app.controller('cmsArticleEditCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', 'article', function ($scope, $http, $state, $stateParams, commonDialog, article) {
|
|
|
|
|
$scope.article = article.data;
|
|
|
|
|
$scope.reference = JSON.parse($scope.article.reference);
|
|
|
|
|
|
|
|
|
|
$scope.saveArticle = function () {
|
|
|
|
|
$scope.article.reference =$scope.reference;
|
|
|
|
|
$http.put('/app/cms/categories/' + $stateParams.catId + '/articles/' + $stateParams.articleId, $scope.article).then(function (resp) {
|
|
|
|
|
$state.go('^.article_view', {articleId: $stateParams.articleId});
|
|
|
|
|
}, function (resp) {
|
|
|
|
|