<commit_before>{% set apicall="/api/page/admin" %}
{% if dealer_id is not empty %}
{% set apicall="/api/page/"~dealer_id~"/dealer.json" %}
{% endif %}

var app = angular.module('app', ['angular-loading-bar', 'ngTouch', 'ngAnimate', 'ui.grid', 'ui.grid.moveColumns', 'ui.grid.resizeColumns', 'ui.grid.selection', 'ui.grid.expandable', 'ui.bootstrap', 'ui.grid.pinning']);

app.config(function ($interpolateProvider) {
    $interpolateProvider.startSymbol('{[{').endSymbol('}]}');
});

app.controller('MainCtrl', ['$scope', '$http', '$log', '$timeout', 'uiGridConstants', '$q', '$uibModal', function ($scope, $http, $log, $timeout, uiGridConstants, $q, $uibModal) {
    $scope.gridOptions = {
        enableSorting: true,
        showGridFooter: true,
        enableFiltering: true,
        enableRowSelection: true,
        enableSelectAll: true,
        selectionRowHeaderWidth: 35,
        rowHeight: 50,
        enableColumnResizing: true,
    };
    $scope.gridOptions.multiSelect = true;
    $scope.gridOptions.columnDefs = [
        {name: 'id', enableColumnResizing: true, width: 50},
        {name: 'description', enableColumnResizing: true, width: 100},
        {name: 'keywords', enableColumnResizing: true, width: 100},
        {name: 'title', enableColumnResizing: true, width: 250},
        {name: 'url', enableColumnResizing: true, width: 350
            ,cellTemplate:
                '<div ng-if="row.entity.is_manual==true"><span class="text-primary">{{ url }}</span>/page{[{row.entity.url}]}</div><div ng-if="row.entity.is_manual==false || row.entity.is_manual==undefined"><span class="text-primary">{{ url }}</span>{[{row.entity.url}]}</div>'},
        {
            name: 'Link',
            enableColumnResizing: true,
            enableFiltering: false,
            width: 90,
            cellTemplate: '<div ng-if="row.entity.is_manual==true"><a href="/page{[{row.entity.url}]}">Link to page</a></div><div ng-if="row.entity.is_manual==false || row.entity.is_manual==undefined"><a href="{[{row.entity.url}]}">Link to page</a></div>'
        },
        {
            name: 'Actions',
            width: 160,
            enableColumnMenu: false,
            enableSorting: false,
            enableFiltering: false,
            cellTemplate: '<a href="/dms/pages/{[{row.entity.id}]}/edit" class="btn btn-primary" data-toggle="tooltip" title="Edit"><span class="glyphicon glyphicon-edit"/></a><span ng-if="row.entity.component[0].id!== undefined"> <a href="/dms/component/{[{row.entity.component[0].id}]}/edit" class="btn btn-success" data-toggle="tooltip" title="Edit page content"><span class="glyphicon glyphicon-edit"/></a> <a confirm="Are you sure, ?" ng-click="grid.appScope.delete(row)" class="btn btn-danger" data-toggle="tooltip" title="Delete"><span class="glyphicon glyphicon-remove"/></a></span>'
        }
    ];
    function test(row){

        return '<select name="repeatSelect" id="repeatSelect" ><option ng-repeat="option in row.entity.component" value="{[{option.id}]}">{[{option.name}]}</option></select><button class="btn btn-ptimary">Show</button>';
    }
    $scope.test = function () {
        return "aaa";
    };

    $scope.items = ['item1', 'item2', 'item3'];

    $scope.animationsEnabled = true;

    $scope.delete = function (row) {
        console.log(row.entity.id);
        var modalInstance = $uibModal.open({
            animation: $scope.animationsEnabled,
            templateUrl: 'myModalContent.html',
            controller: 'ModalInstanceCtrl',

            resolve: {
                items: function () {
                    return $scope.items;
                }
            }
        });

        modalInstance.result.then(function (selectedItem) {
            //ok<commit_msg>Pages delete only manual created<commit_after>{% set apicall="/api/page/admin" %}
{% if dealer_id is not empty %}
{% set apicall="/api/page/"~dealer_id~"/dealer.json" %}
{% endif %}

var app = angular.module('app', ['angular-loading-bar', 'ngTouch', 'ngAnimate', 'ui.grid', 'ui.grid.moveColumns', 'ui.grid.resizeColumns', 'ui.grid.selection', 'ui.grid.expandable', 'ui.bootstrap', 'ui.grid.pinning']);

app.config(function ($interpolateProvider) {
    $interpolateProvider.startSymbol('{[{').endSymbol('}]}');
});

app.controller('MainCtrl', ['$scope', '$http', '$log', '$timeout', 'uiGridConstants', '$q', '$uibModal', function ($scope, $http, $log, $timeout, uiGridConstants, $q, $uibModal) {
    $scope.gridOptions = {
        enableSorting: true,
        showGridFooter: true,
        enableFiltering: true,
        enableRowSelection: true,
        enableSelectAll: true,
        selectionRowHeaderWidth: 35,
        rowHeight: 50,
        enableColumnResizing: true,
    };
    $scope.gridOptions.multiSelect = true;
    $scope.gridOptions.columnDefs = [
        {name: 'id', enableColumnResizing: true, width: 50},
        {name: 'description', enableColumnResizing: true, width: 100},
        {name: 'keywords', enableColumnResizing: true, width: 100},
        {name: 'title', enableColumnResizing: true, width: 250},
        {name: 'url', enableColumnResizing: true, width: 350
            ,cellTemplate:
                '<div ng-if="row.entity.is_manual==true"><span class="text-primary">{{ url }}</span>/page{[{row.entity.url}]}</div><div ng-if="row.entity.is_manual==false || row.entity.is_manual==undefined"><span class="text-primary">{{ url }}</span>{[{row.entity.url}]}</div>'},
        {
            name: 'Link',
            enableColumnResizing: true,
            enableFiltering: false,
            width: 90,
            cellTemplate: '<div ng-if="row.entity.is_manual==true"><a href="/page{[{row.entity.url}]}">Link to page</a></div><div ng-if="row.entity.is_manual==false || row.entity.is_manual==undefined"><a href="{[{row.entity.url}]}">Link to page</a></div>'
        },
        {
            name: 'Actions',
            width: 160,
            enableColumnMenu: false,
            enableSorting: false,
            enableFiltering: false,
            cellTemplate: '<a href="/dms/pages/{[{row.entity.id}]}/edit" class="btn btn-primary" data-toggle="tooltip" title="Edit"><span class="glyphicon glyphicon-edit"/></a><span ng-if="row.entity.component[0].id!== undefined"> <a href="/dms/component/{[{row.entity.component[0].id}]}/edit" class="btn btn-success" data-toggle="tooltip" title="Edit page content"><span class="glyphicon glyphicon-edit"/></a></span> <span ng-if="row.entity.is_manual == true"><a confirm="Are you sure, ?" ng-click="grid.appScope.delete(row)" class="btn btn-danger" data-toggle="tooltip" title="Delete"><span class="glyphicon glyphicon-remove"/></a></span>'
        }
    ];
    function test(row){

        return '<select name="repeatSelect" id="repeatSelect" ><option ng-repeat="option in row.entity.component" value="{[{option.id}]}">{[{option.name}]}</option></select><button class="btn btn-ptimary">Show</button>';
    }
    $scope.test = function () {
        return "aaa";
    };

    $scope.items = ['item1', 'item2', 'item3'];

    $scope.animationsEnabled = true;

    $scope.delete = function (row) {
        console.log(row.entity.id);
        var modalInstance = $uibModal.open({
            animation: $scope.animationsEnabled,
            templateUrl: 'myModalContent.html',
            controller: 'ModalInstanceCtrl',

            resolve: {
                items: function () {
                    return $scope.items;
                }
            }
        });

        modalInstance.result.then(function (selectedItem) {
            //ok
{'fraction_non_alphanumeric': 0.18558749503245464, 'fraction_numerical': 0.0074182010862365875, 'mean_word_length': 3.134720700985761, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6269602', 'n_tokens_mistral': 2403, 'n_tokens_neox': 2263, 'n_words': 423}