<commit_before>import { Component, Inject, Input } from 'ng-metadata/core';
import { FormDashboardGameDevStageSelectorConfirm } from './confirm-service';
import template from 'html!./dev-stage-selector.html';

@Component({
	selector: 'gj-form-dashboard-game-dev-stage-selector',
	template,
})
export class DevStageSelectorComponent
{
	@Input( '<' ) game: any;

	constructor(
		@Inject( 'Game' ) public gameModel: any,
		@Inject( 'FormDashboardGameDevStageSelectorConfirm' ) private confirm: FormDashboardGameDevStageSelectorConfirm
	)
	{
	}

	select( stage: number )
	{
		if ( !this.isEnabled( stage ) || stage == this.game.development_status ) {
			return;
		}

		this.confirm.show( this.game, stage )
			.then( () =>
			{
				this.game.$setDevStage( stage );
			} );
	}

	isEnabled( stage: number )
	{
		if ( (stage == this.gameModel.DEVELOPMENT_STATUS_WIP || stage == this.gameModel.DEVELOPMENT_STATUS_FINISHED) && !this.game.has_active_builds ) {
			return false;
		}
		return true;
	}
}<commit_msg>Add a growl when switching your dev stage.<commit_after>import { Component, Inject, Input } from 'ng-metadata/core';
import { FormDashboardGameDevStageSelectorConfirm } from './confirm-service';
import template from 'html!./dev-stage-selector.html';

@Component({
	selector: 'gj-form-dashboard-game-dev-stage-selector',
	template,
})
export class DevStageSelectorComponent
{
	@Input( '<' ) game: any;

	constructor(
		@Inject( 'Game' ) public gameModel: any,
		@Inject( 'FormDashboardGameDevStageSelectorConfirm' ) private confirm: FormDashboardGameDevStageSelectorConfirm,
		@Inject( 'Growls' ) private growls: any,
		@Inject( 'gettextCatalog' ) private gettextCatalog: ng.gettext.gettextCatalog,
	)
	{
	}

	select( stage: number )
	{
		if ( !this.isEnabled( stage ) || stage == this.game.development_status ) {
			return;
		}

		this.confirm.show( this.game, stage )
			.then( () => this.game.$setDevStage( stage ) )
			.then( () =>
			{
				this.growls.success(
					this.gettextCatalog.getString( "Your game's development stage has been changed!" ),
					this.gettextCatalog.getString( 'Stage Changed' ),
				);
			} );
	}

	isEnabled( stage: number )
	{
		if ( (stage == this.gameModel.DEVELOPMENT_STATUS_WIP || stage == this.gameModel.DEVELOPMENT_STATUS_FINISHED) && !this.game.has_active_builds ) {
			return false;
		}
		return true;
	}
}
{'fraction_non_alphanumeric': 0.14005959982971478, 'fraction_numerical': 0.0, 'mean_word_length': 4.2690582959641254, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '381126', 'n_tokens_mistral': 849, 'n_tokens_neox': 792, 'n_words': 156}