<commit_before>/*
 * Copyright (c) $year, <NAME> (DNT)
 *
 * https://github.com/Turistforeningen/turadmin
 */

define(function (require, exports, module) {
    "use strict";

    // Dependencies
    var $ = require('jquery'),
        _ = require('underscore'),
        Backbone = require('backbone'),
        NtbEditorView = require('views/ntb/editor'),
        MapWrapper = require('views/map/wrapper'),
        RouteModel = require('models/route'),
        RouteDrawView = require('views/routes/draw'),
        PictureCollection = require('collections/pictures'),
        PictureManager = require('views/pictures/manager'),
        PoiCollection = require('collections/pois'),
        PoiManager = require('views/pois/manager'),
        MarkingModel = require('models/marking'),
        MarkingEdit = require('views/marking/edit'),
        RouteDetailsView = require('views/routes/details');

    require('backbone-stickit');
    require('backbone-validation');
    require('bootstrap');
    require('jquery-ssr');

    // Module
    return NtbEditorView.extend({

        el: '[data-view="app"]',

        initialize: function (options) {

            // Create model
            this.model = new RouteModel(options.routeData);

            // Create collections
            this.pictures = new PictureCollection(options.picturesData);
            this.pois = new PoiCollection(options.poisData);

            this.relatedCollections = [
                {
                    field: 'bilder',
                    collection: this.pictures,
                    destroyRemoved: true
                },
                {
                    field: 'steder',
                    collection: this.pois,
                    destroyRemoved: true
                }
            ];

            if (this.model.get('rute')) {
                // Create models
                this.marking = new MarkingModel(options.routeData.rute);

                this.relatedModels = [
                    {
                        field: 'rute',
                        model: this.marking
                    }
                ];
            }

            // Set up views

            this.mapWrapper = new MapWrapper({
                el: '[data-view="route-map"]',
                route: this.model,
                pictures: this.pictures,
                pois: this.pois
            }).render();

            this.routeDrawView = new RouteDrawView({
                model: this.model,
                pictures: this.pictures,
                map: this.mapWrapper
            }).render();

            this.pictureManager = new PictureManager({
                el: '[data-view="route-pictures"]',
                pictures: this.pictures,
                map: this.mapWrapper,
                messages: {
                    empty: 'Husk å legge inn bilder fra turen din, slik at det blir synlig på forsiden av UT.no'
                }
            }).render();

            this.poiManager = new PoiManager({
                el: '[data-view="route-pois"]',
                pois: this.pois,
                pictures: this.pictures,
                map: this.mapWrapper
            }).render();

            this.routeDetailsView = new RouteDetailsView({
                el: '[data-view="route-details"]',
                route: this.model
            }).render();

            if (this.model.get('rute')) {
                this.markingEdit = new MarkingEdit({
                    el: '[data-view="route-marking"]',
                    model: this.marking
                }).render();
            }

            this.listenTo(this.model, 'change:status', $.proxy(this.updatePublishButtons, this));

            NtbEditorView.prototype.initialize.call(this, options);
        },

        render: function () {
            $('body').scrollspy({target: '.navbar-app'});

            this.updatePublishButtons();
        },<commit_msg>Pass a default status to picture manager<commit_after>/*
 * Copyright (c) $year, <NAME> Turistforening (DNT)
 *
 * https://github.com/Turistforeningen/turadmin
 */

define(function (require, exports, module) {
    "use strict";

    // Dependencies
    var $ = require('jquery'),
        _ = require('underscore'),
        Backbone = require('backbone'),
        NtbEditorView = require('views/ntb/editor'),
        MapWrapper = require('views/map/wrapper'),
        RouteModel = require('models/route'),
        RouteDrawView = require('views/routes/draw'),
        PictureCollection = require('collections/pictures'),
        PictureManager = require('views/pictures/manager'),
        PoiCollection = require('collections/pois'),
        PoiManager = require('views/pois/manager'),
        MarkingModel = require('models/marking'),
        MarkingEdit = require('views/marking/edit'),
        RouteDetailsView = require('views/routes/details');

    require('backbone-stickit');
    require('backbone-validation');
    require('bootstrap');
    require('jquery-ssr');

    // Module
    return NtbEditorView.extend({

        el: '[data-view="app"]',

        initialize: function (options) {

            // Create model
            this.model = new RouteModel(options.routeData);

            // Create collections
            this.pictures = new PictureCollection(options.picturesData);
            this.pois = new PoiCollection(options.poisData);

            this.relatedCollections = [
                {
                    field: 'bilder',
                    collection: this.pictures,
                    destroyRemoved: true
                },
                {
                    field: 'steder',
                    collection: this.pois,
                    destroyRemoved: true
                }
            ];

            if (this.model.get('rute')) {
                // Create models
                this.marking = new MarkingModel(options.routeData.rute);

                this.relatedModels = [
                    {
                        field: 'rute',
                        model: this.marking
                    }
                ];
            }

            // Set up views

            this.mapWrapper = new MapWrapper({
                el: '[data-view="route-map"]',
                route: this.model,
                pictures: this.pictures,
                pois: this.pois
            }).render();

            this.routeDrawView = new RouteDrawView({
                model: this.model,
                pictures: this.pictures,
                map: this.mapWrapper
            }).render();

            this.pictureManager = new PictureManager({
                el: '[data-view="route-pictures"]',
                pictures: this.pictures,
                map: this.mapWrapper,
                messages: {empty: 'Husk å legge inn bilder fra turen din, slik at det blir synlig på forsiden av UT.no'},
                defaults: {status: this.model.get('status')}
            }).render();

            this.poiManager = new PoiManager({
                el: '[data-view="route-pois"]',
                pois: this.pois,
                pictures: this.pictures,
                map: this.mapWrapper
            }).render();

            this.routeDetailsView = new RouteDetailsView({
                el: '[data-view="route-details"]',
                route: this.model
            }).render();

            if (this.model.get('rute')) {
                this.markingEdit = new MarkingEdit({
                    el: '[data-view="route-marking"]',
                    model: this.marking
                }).render();
            }

            this.listenTo(this.model, 'change:status', $.proxy(this.updatePublishButtons, this));

            NtbEditorView.prototype.initialize.call(this, options);
        },

        render: function () {
            $('body').scrollspy({target: '.navbar-app'});

            this.updatePublishButtons();
        },
{'fraction_non_alphanumeric': 0.12306717363751585, 'fraction_numerical': 0.0, 'mean_word_length': 1.4947834334492571, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '1994139', 'n_tokens_mistral': 2099, 'n_tokens_neox': 1959, 'n_words': 382}