'use strict';


var ArticleSettingsController = angular.module('articles.controllers.settings', [
    'system'
])
    .controller('ArticleSettingsController', [
        '$scope',
        '$route',
        '$location',
        '$filter',
        'System',
        'ArticleService',
        function($scope, $route, $location, $filter, System, ArticleService) {
  
            $scope.refresh = function() {
                ArticleService.getSettings()
                    .then(function(data) {
                        $scope.settings = data;
                    });
            };
            
            $(".tooltip").tooltip();

            $scope.save = function() {
                ArticleService.saveSettings($scope.settings)
                    .then(function() {
                        System.Message.success($scope.$resource('utility.settingsSaved'));
                    });
            };

            $scope.back = function() {
                $location.url('/articles');
            };

            $scope.refresh();
        }
    ]);