<commit_before>define(function (require) {
	
	// Dependencies
	var $ = require('jquery')
		, _ = require('lodash')
		, Backbone = require('backbone')
	;
	
	/**
	 * Setup view 
	 */
	var View = {};
	View.initialize = function() {
		_.bindAll(this);

		// Cache
		this.$customize = this.$('[name="_custom_permissions"]');
		this.$permissions = this.$('.permissions-list');
		this.$permissions_inner = this.$('.permissions-list-inner');
		this.$controllers = this.$permissions.find('.controller');

		// Listen for clicks on the override checkbox
		this.$customize.on('change', this.togglePermissionsOptions);

	};

	/**
	 * Toggle the permissions options
	 */
	View.togglePermissionsOptions = function() {

		// Inspect the clicked box
		var show = this.$customize.is(':checked');

		// Manually set the height whenever it's moving and then clear it when
		// animation is done.  The animation is defined in CSS.
		this.$permissions.height(this.$permissions_inner.outerHeight());
		_.delay(_.bind(function() { this.$permissions.height(''); }, this), 300);

		// Toggle the open state of the permissions
		_.defer(_.bind(function() { this.$el.toggleClass('closed', !show); }, this));
	};
	
	// Return view class
	return Backbone.View.extend(View);
});<commit_msg>Clear the overriden permissions if the role is changed<commit_after>define(function (require) {
	
	// Dependencies
	var $ = require('jquery')
		, _ = require('lodash')
		, Backbone = require('backbone')
	;
	
	/**
	 * Setup view 
	 */
	var View = {};
	View.initialize = function() {
		_.bindAll(this);

		// Cache
		this.$role = $('[name="role"]');
		this.$customize = this.$('[name="_custom_permissions"]');
		this.$permissions = this.$('.permissions-list');
		this.$permissions_inner = this.$('.permissions-list-inner');
		this.$controllers = this.$permissions.find('.controller');		

		// Listen for clicks on the override checkbox
		this.$customize.on('change', this.togglePermissionsOptions);

		// Check for the role to change and clear the custom permissions
		this.$role.on('change', this.clearCustomPermissions);

	};

	/**
	 * Toggle the permissions options
	 */
	View.togglePermissionsOptions = function() {

		// Inspect the clicked box
		var show = this.$customize.is(':checked');

		// Manually set the height whenever it's moving and then clear it when
		// animation is done.  The animation is defined in CSS.
		this.$permissions.height(this.$permissions_inner.outerHeight());
		_.delay(_.bind(function() { this.$permissions.height(''); }, this), 300);

		// Toggle the open state of the permissions
		_.defer(_.bind(function() { this.$el.toggleClass('closed', !show); }, this));
	};
	
	/**
	 * Clear permissions customizations
	 */
	View.clearCustomPermissions = function() {
		this.$customize.attr('checked', false).trigger('change');
	};

	// Return view class
	return Backbone.View.extend(View);
});
{'fraction_non_alphanumeric': 0.16643502432244614, 'fraction_numerical': 0.0020847810979847115, 'mean_word_length': 3.9129692832764507, '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': '232058', 'n_tokens_mistral': 933, 'n_tokens_neox': 840, 'n_words': 206}