<commit_before>app.controller('editController', ['$scope', '$http', '$upload', '$timeout', '$filter', function ($scope, $http, $upload, $timeout, $filter) {

    if (typeof itemModel != 'undefined') {
        itemModel.price = parseFloat(itemModel.price);
        itemModel.initial_units = parseFloat(itemModel.initial_units);
        itemModel.ship_price = parseFloat(itemModel.ship_price);
        itemModel.public = parseInt(itemModel.public);
    }


    var openFileBrowser = function () {
        document.getElementById('addFiles').click();
    };


    $scope.countries = countries;
    $scope.currencies = currencies;
    $scope.item = {};

    if (itemModel.ships_to.length < 1) {
        itemModel.ships_to = undefined;
    }
    $scope.item = itemModel;
    $scope.photos = [];
    $scope.dataUrls = [];

    if("photos" in $scope.item) {
        $scope.photos = $scope.item.photos;
    }

    /* Set the inital values for these fields as the data binding is a bit dodgy */
    document.getElementById('title-heading').innerText = $scope.item.title;
    document.getElementById('item-description').innerHTML = $scope.item.description;
    // document.getElementById('item-price').value = $scope.item.price;
    document.scope = $scope;

    $scope.buttonPressed = function () {
        console.log($scope.desc);
        console.log($scope);
    };

    $scope.saveChanges = function () {
        $scope.posting = true;

        var data = $scope.item;
        data._token = sessionToken;
        console.log('the data to be sent is ' + JSON.stringify(data));

        $http.put(updateURL, JSON.stringify(data))
            .success(function (data, status, headers, config) {
                $scope.posting = false;
                $scope.responseData = data;
                console.log('The response data is: ');
                console.log($scope.responseData);
                //window.location = $scope.responseData.redirect_url;
                $scope.item.description = data.description;

            })

            .error(function (data, status, headers, config) {
                $scope.posting = false;
                console.log(data);


            });

    };

    $scope.toggleVisibility = function () {
        $scope.saveChanges();
        $scope.posting = true;

        var data = {
            _token: sessionToken
        };

        console.log('the data to be sent is ' + JSON.stringify(data));

        $http.put(updateURL  + '/toggle-visibility', JSON.stringify(data))
            .success(function (data, status, headers, config) {
                $scope.item.public = data.public;
                $scope.posting = false;

                humane.log(data.message);
                console.log('The response data is: ');
                console.log(data);

            })

            .error(function (data, status, headers, config) {
                $scope.posting = false;
                console.log(data);

                if (data.message) {

                    humane.log(data.message);
                }

                if (data.errors) {
                    console.log('ERORROS ARE');
                    console.log(data.errors);
                    humane.log(data.errors);
                }



            });

    };

    $scope.isFileBrowserOpen = false;
    $scope.openFileBrowser = function () {
        if (!$scope.isFileBrowserOpen) {
            $scope.isFileBrowserOpen = true;
            document.getElementById('addFiles').click();
            $scope.isFileBrowserOpen = false;
        }
        console.log('BUTTON CLICKED');

    };<commit_msg>Removes $filter and openFileUpload functions from controller<commit_after>app.controller('editController', ['$scope', '$http', '$upload', '$timeout', function ($scope, $http, $upload, $timeout) {

    if (typeof itemModel != 'undefined') {
        itemModel.price = parseFloat(itemModel.price);
        itemModel.initial_units = parseFloat(itemModel.initial_units);
        itemModel.ship_price = parseFloat(itemModel.ship_price);
        itemModel.public = parseInt(itemModel.public);
    }

    $scope.countries = countries;
    $scope.currencies = currencies;
    $scope.item = {};

    if (itemModel.ships_to.length < 1) {
        itemModel.ships_to = undefined;
    }
    $scope.item = itemModel;
    $scope.photos = [];
    $scope.dataUrls = [];

    if("photos" in $scope.item) {
        $scope.photos = $scope.item.photos;
    }

    /* Set the inital values for these fields as the data binding is a bit dodgy */
    document.getElementById('title-heading').innerText = $scope.item.title;
    document.getElementById('item-description').innerHTML = $scope.item.description;
    // document.getElementById('item-price').value = $scope.item.price;
    document.scope = $scope;

    $scope.buttonPressed = function () {
        console.log($scope.desc);
        console.log($scope);
    };

    $scope.saveChanges = function () {
        $scope.posting = true;

        var data = $scope.item;
        data._token = sessionToken;
        console.log('the data to be sent is ' + JSON.stringify(data));

        $http.put(updateURL, JSON.stringify(data))
            .success(function (data, status, headers, config) {
                $scope.posting = false;
                $scope.responseData = data;
                console.log('The response data is: ');
                console.log($scope.responseData);
                //window.location = $scope.responseData.redirect_url;
                $scope.item.description = data.description;

            })

            .error(function (data, status, headers, config) {
                $scope.posting = false;
                console.log(data);


            });

    };

    $scope.toggleVisibility = function () {
        $scope.saveChanges();
        $scope.posting = true;

        var data = {
            _token: sessionToken
        };

        console.log('the data to be sent is ' + JSON.stringify(data));

        $http.put(updateURL  + '/toggle-visibility', JSON.stringify(data))
            .success(function (data, status, headers, config) {
                $scope.item.public = data.public;
                $scope.posting = false;

                humane.log(data.message);
                console.log('The response data is: ');
                console.log(data);

            })

            .error(function (data, status, headers, config) {
                $scope.posting = false;
                console.log(data);

                if (data.message) {

                    humane.log(data.message);
                }

                if (data.errors) {
                    console.log('ERORROS ARE');
                    console.log(data.errors);
                    humane.log(data.errors);
                }



            });

    };
{'fraction_non_alphanumeric': 0.13241338813857897, 'fraction_numerical': 0.0002935995302407516, 'mean_word_length': 1.8966836734693877, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7384703', 'n_tokens_mistral': 1934, 'n_tokens_neox': 1810, 'n_words': 351}