<commit_before>/*
 * Copyright (c) 2015 Kagilum SAS.
 *
 * This file is part of iceScrum.
 *
 * iceScrum is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License.
 *
 * iceScrum is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with iceScrum.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *
 * <NAME> (<EMAIL>)
 * <NAME> (<EMAIL>)
 * <NAME> (<EMAIL>)
 *
 */

controllers.controller('featureCtrl', ['$scope', '$filter', 'ProjectService', 'FeatureService', 'postitSize', 'screenSize', function($scope, $filter, ProjectService, FeatureService, postitSize, screenSize) {
    // Functions
    $scope.retrieveTags = function() {
        if (_.isEmpty($scope.tags)) {
            ProjectService.getTags().then(function(tags) {
                $scope.tags = tags;
            });
        }
    };
    $scope.authorizedFeature = function(action) {
        return FeatureService.authorizedFeature(action);
    };
    $scope['delete'] = function(feature) {
        FeatureService.delete(feature).then(function() {
            $scope.notifySuccess('todo.is.ui.deleted');
        });
    };
    $scope.copyToBacklog = function(feature) {
        FeatureService.copyToBacklog(feature).then(function() {
            $scope.notifySuccess('todo.is.ui.feature.copied.to.backlog');
        });
    };
    $scope.menus = [
        {
            name: 'todo.is.ui.context.set',
            visible: function(feature) { return true; },
            url: $scope.featureContextUrl
        },
        {
            name: 'is.ui.feature.menu.copy',
            visible: function(feature) { return $scope.authorizedFeature('copyToBacklog'); },
            action: function(feature) { $scope.copyToBacklog(feature); }
        },
        {
            name: 'todo.is.ui.permalink.copy',
            visible: function(feature) { return $scope.authorizedFeature('copyToBacklog'); },
            action: function(feature) { $scope.showCopyModal($scope.message('is.permalink'), ($filter('permalink')(feature.uid, 'feature'))); }
        },
        {
            name: 'is.ui.feature.menu.delete',
            visible: function(feature) { return $scope.authorizedFeature('delete'); },
            action: function(feature) { $scope.confirmDelete({callback: $scope.delete, args: [feature]}); }
        }
    ];
    // Init
    $scope.tags = [];
    var getPostitClass = function() {
        $scope.postitClass = postitSize.postitClass($scope.viewName, 'grid-group size-sm');
    };
    getPostitClass();
    screenSize.on('xs, sm', getPostitClass, $scope);
    $scope.$watch(function() { return postitSize.currentPostitSize($scope.viewName); }, getPostitClass);
}]);

controllers.controller('featureDetailsCtrl', ['$scope', '$state', '$controller', 'Session', 'FeatureStatesByName', 'FeatureService', 'FormService', 'detailsFeature', 'StoryStatesByName', 'features', 'project', function($scope, $state, $controller, Session, FeatureStatesByName, FeatureService, FormService, detailsFeature, StoryStatesByName, features, project) {<commit_msg>T344-0 Sort portfolio features by project<commit_after>/*
 * Copyright (c) 2015 <NAME>.
 *
 * This file is part of iceScrum.
 *
 * iceScrum is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License.
 *
 * iceScrum is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with iceScrum.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *
 * <NAME> (<EMAIL>)
 * <NAME> (<EMAIL>)
 * <NAME> (<EMAIL>)
 *
 */

controllers.controller('featureCtrl', ['$scope', '$filter', 'ProjectService', 'FeatureService', 'postitSize', 'screenSize', function($scope, $filter, ProjectService, FeatureService, postitSize, screenSize) {
    // Functions
    $scope.retrieveTags = function() {
        if (_.isEmpty($scope.tags)) {
            ProjectService.getTags().then(function(tags) {
                $scope.tags = tags;
            });
        }
    };
    $scope.authorizedFeature = function(action) {
        return FeatureService.authorizedFeature(action);
    };
    $scope['delete'] = function(feature) {
        FeatureService.delete(feature).then(function() {
            $scope.notifySuccess('todo.is.ui.deleted');
        });
    };
    $scope.copyToBacklog = function(feature) {
        FeatureService.copyToBacklog(feature).then(function() {
            $scope.notifySuccess('todo.is.ui.feature.copied.to.backlog');
        });
    };
    $scope.menus = [
        {
            name: 'todo.is.ui.context.set',
            visible: function(feature) { return $scope.workspaceType == 'project' },
            url: $scope.featureContextUrl
        },
        {
            name: 'is.ui.feature.menu.copy',
            visible: function(feature) { return $scope.authorizedFeature('copyToBacklog'); },
            action: function(feature) { $scope.copyToBacklog(feature); }
        },
        {
            name: 'todo.is.ui.permalink.copy',
            visible: function(feature) { return $scope.authorizedFeature('copyToBacklog'); },
            action: function(feature) { $scope.showCopyModal($scope.message('is.permalink'), ($filter('permalink')(feature.uid, 'feature'))); }
        },
        {
            name: 'is.ui.feature.menu.delete',
            visible: function(feature) { return $scope.authorizedFeature('delete'); },
            action: function(feature) { $scope.confirmDelete({callback: $scope.delete, args: [feature]}); }
        }
    ];
    // Init
    $scope.tags = [];
    var getPostitClass = function() {
        $scope.postitClass = postitSize.postitClass($scope.viewName, 'grid-group size-sm');
    };
    getPostitClass();
    screenSize.on('xs, sm', getPostitClass, $scope);
    $scope.$watch(function() { return postitSize.currentPostitSize($scope.viewName); }, getPostitClass);
}]);

controllers.controller('featureDetailsCtrl', ['$scope', '$state', '$controller', 'Session', 'FeatureStatesByName', 'FeatureService', 'FormService', 'detailsFeature', 'StoryStatesByName', 'features', 'project', function($scope, $state, $controller, Session, FeatureStatesByName, FeatureService, FormService, detailsFeature, StoryStatesByName, features, project) {
{'fraction_non_alphanumeric': 0.14461315979754158, 'fraction_numerical': 0.002024584237165582, 'mean_word_length': 3.168776371308017, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3022115', 'n_tokens_mistral': 1953, 'n_tokens_neox': 1935, 'n_words': 455}