define('application/widgets/detail/buttons/record', [
'application/widgets/detail/iconbutton',
'rofl/lib/l10n'
], function (
IconButton,
L10N
) {
'use strict';
var l10n = L10N.getInstance(),
icon = ['icon', 'icon-record-new'],
iconUnable = ['icon', 'icon-record-unable'],
texts = {
CANCEL_RECORDING: l10n.get('details.buttons.cancel_recording'),
RECORD: l10n.get('details.buttons.record'),
RECORDING: l10n.get('details.buttons.recording')
};
return IconButton.extend({
/**
* Initialises the recording button.
*
*/
init: function init () {
init.base.call(this, 'record', texts.RECORD, icon);
},
/**
* Changes buttons icon and label to Cancel recording state.
*
*/
cancelRecording: function () {
this.removeClass('recording');
this._icon.addClass(iconUnable);
this._label.setText(texts.CANCEL_RECORDING);
},
/**
* Changes buttons label to Record state.
*
*/
record: function () {
this.removeClass('recording');
this._label.setText(texts.RECORD);
},
/**
* Changes buttons label to Recording state.
*
*/
recording: function () {
if (!this.hasClass('recording')) {
this.addClass('recording');
}
this._label.setText(texts.RECORDING);
}
});
});