forked from Archives/Athou_commafeed
settings page and custom css for users
This commit is contained in:
@@ -342,4 +342,22 @@ module.controller('ManageUserCtrl', function($scope, $state, $stateParams,
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
module.controller('SettingsCtrl', function($scope, $location, SettingsService) {
|
||||
$scope.settingsService = SettingsService;
|
||||
$scope.codeMirrorConfig = {
|
||||
mode : 'css',
|
||||
lineNumbers : true
|
||||
};
|
||||
$scope.cancel = function() {
|
||||
SettingsService.init(function() {
|
||||
$location.path('/');
|
||||
});
|
||||
};
|
||||
$scope.save = function() {
|
||||
SettingsService.save(function() {
|
||||
$location.path('/');
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -232,6 +232,9 @@ module.directive('toolbar', function($state, $stateParams, $route, $location,
|
||||
$scope.toAdmin = function() {
|
||||
$location.path('admin');
|
||||
};
|
||||
$scope.toSettings = function() {
|
||||
$location.path('settings');
|
||||
};
|
||||
},
|
||||
link : function($scope, element) {
|
||||
element.find('.read-mode button').bind('click', function() {
|
||||
|
||||
@@ -39,6 +39,12 @@ app.config(function($routeProvider, $stateProvider, $urlRouterProvider) {
|
||||
templateUrl : 'templates/admin.useredit.html',
|
||||
controller : 'ManageUserCtrl'
|
||||
});
|
||||
|
||||
$stateProvider.state('settings', {
|
||||
url : '/settings',
|
||||
templateUrl : 'templates/settings.html',
|
||||
controller : 'SettingsCtrl'
|
||||
});
|
||||
|
||||
$urlRouterProvider.when('/', '/feeds/view/category/all');
|
||||
$urlRouterProvider.when('/admin', '/admin/user/list');
|
||||
|
||||
@@ -162,12 +162,22 @@ module.factory('EntryService', function($resource, $http) {
|
||||
module.factory('SettingsService', function($resource) {
|
||||
var s = {};
|
||||
s.settings = {};
|
||||
$resource('rest/settings/get').get(function(data) {
|
||||
s.settings = data;
|
||||
});
|
||||
s.save = function() {
|
||||
$resource('rest/settings/save').save(s.settings);
|
||||
s.save = function(callback) {
|
||||
$resource('rest/settings/save').save(s.settings, function(data) {
|
||||
if (callback) {
|
||||
callback(data);
|
||||
}
|
||||
});
|
||||
};
|
||||
s.init = function(callback) {
|
||||
$resource('rest/settings/get').get(function(data) {
|
||||
s.settings = data;
|
||||
if (callback) {
|
||||
callback(data);
|
||||
}
|
||||
});
|
||||
};
|
||||
s.init();
|
||||
return s;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user