<commit_before>

define([

	'underscore',
	'backbone',
	'marionette',
	'bootstrap',
	'templates',
	'text!icons.json',
],
function (

	_,
	Backbone,
	Marionette,
	Bootstrap,
	templates,
	icons
) {

	'use strict';

	return Marionette.ItemView.extend({

		template: JST['editPoiMarkerModal.html'],

		behaviors: {

			'l20n': {},
			'modal': {},
		},

		ui: {

			'modal': '#edit_poi_marker_modal',
			'colorButtons': '.colorButtons .btn',
			'shapeButtons': '.shapeButtons .btn',
			'closeButton': '.close_btn',
		},

		events: {

			'mouseover @ui.colorButtons': 'onOverColorButtons',
			'mouseleave @ui.colorButtons': 'onLeaveColorButtons',
			'click @ui.colorButtons': 'onClickColorButtons',

			'mouseover @ui.shapeButtons': 'onOverShapeButtons',
			'mouseleave @ui.shapeButtons': 'onLeaveShapeButtons',
			'click @ui.shapeButtons': 'onClickShapeButtons',

			'submit': 'onSubmit',
			'reset': 'onReset',
		},

		initialize: function () {

			var self = this;

			this._radio = Backbone.Wreqr.radio.channel('global');

			this._oldModel = this.model.clone();

			this._icons = JSON.parse(icons);
		},

		onRender: function () {

			this.ui.colorButtons
			.filter( '.'+ this.model.get('markerColor') )
			.find('i')
			.addClass('fa-check');

			this.ui.shapeButtons
			.filter( '.'+ this.model.get('markerShape') )
			.addClass('active');
		},

		close: function () {

			this.triggerMethod('close');
		},

		onReset: function () {

			this.model.set( this._oldModel.toJSON() );

			this.close();
		},

		onSubmit: function (e) {

			e.preventDefault();

			var self = this;

			this._radio.commands.execute('map:updatePoiLayerIcons', this.model);

			this.model.save({}, {

				'success': function () {

					self._oldModel = self.model.clone();

					self.close();
				},
				'error': function () {

					// FIXME
					console.error('nok');
				},
			});
		},

		onOverColorButtons: function (e) {

		},

		onLeaveColorButtons: function (e) {

		},

		onClickColorButtons: function (e) {

			$('i', this.ui.colorButtons).removeClass('fa-check');

			e.target.querySelector('i').classList.add('fa-check');

			this.model.set('markerColor', e.target.dataset.color);
		},

		onOverShapeButtons: function (e) {

		},

		onLeaveShapeButtons: function (e) {

		},

		onClickShapeButtons: function (e) {

			this.ui.shapeButtons.removeClass('active');

			e.target.classList.add('active');

			this.model.set('markerShape', e.target.dataset.shape);
		},
	});
});<commit_msg>Remove useless functions<commit_after>

define([

	'underscore',
	'backbone',
	'marionette',
	'bootstrap',
	'templates',
	'text!icons.json',
],
function (

	_,
	Backbone,
	Marionette,
	Bootstrap,
	templates,
	icons
) {

	'use strict';

	return Marionette.ItemView.extend({

		template: JST['editPoiMarkerModal.html'],

		behaviors: {

			'l20n': {},
			'modal': {},
		},

		ui: {

			'modal': '#edit_poi_marker_modal',
			'colorButtons': '.colorButtons .btn',
			'shapeButtons': '.shapeButtons .btn',
			'closeButton': '.close_btn',
		},

		events: {

			'click @ui.colorButtons': 'onClickColorButtons',
			'click @ui.shapeButtons': 'onClickShapeButtons',

			'submit': 'onSubmit',
			'reset': 'onReset',
		},

		initialize: function () {

			var self = this;

			this._radio = Backbone.Wreqr.radio.channel('global');

			this._oldModel = this.model.clone();

			this._icons = JSON.parse(icons);
		},

		onRender: function () {

			this.ui.colorButtons
			.filter( '.'+ this.model.get('markerColor') )
			.find('i')
			.addClass('fa-check');

			this.ui.shapeButtons
			.filter( '.'+ this.model.get('markerShape') )
			.addClass('active');
		},

		close: function () {

			this.triggerMethod('close');
		},

		onReset: function () {

			this.model.set( this._oldModel.toJSON() );

			this.close();
		},

		onSubmit: function (e) {

			e.preventDefault();

			var self = this;

			this._radio.commands.execute('map:updatePoiLayerIcons', this.model);

			this.model.save({}, {

				'success': function () {

					self._oldModel = self.model.clone();

					self.close();
				},
				'error': function () {

					// FIXME
					console.error('nok');
				},
			});
		},

		onClickColorButtons: function (e) {

			$('i', this.ui.colorButtons).removeClass('fa-check');

			e.target.querySelector('i').classList.add('fa-check');

			this.model.set('markerColor', e.target.dataset.color);
		},

		onClickShapeButtons: function (e) {

			this.ui.shapeButtons.removeClass('active');

			e.target.classList.add('active');

			this.model.set('markerShape', e.target.dataset.shape);
		},
	});
});
{'fraction_non_alphanumeric': 0.18804920913884007, 'fraction_numerical': 0.0008787346221441124, 'mean_word_length': 3.3694817658349328, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1201422', 'n_tokens_mistral': 1898, 'n_tokens_neox': 1606, 'n_words': 244}