define('application/widgets/guide/prevdayasset', [
'rofl/widgets/button',
'rofl/widgets/label',
'application/widgets/pointerfocusableasset'
], function (
Button,
Label,
PointerFocusableButton
) {
'use strict';
return PointerFocusableButton.extend({
/**
* Initialises the button.
*
* @param {string} [id] - The id. Optional.
*/
init: function init (id) {
init.base.call(this, id);
this.addClass('prev-day-button');
this._buildPrevAsset();
},
/**
* Returns string of date.
*
* @returns {string} - Date in string form.
*/
getText: function () {
if (this._dateLabel) {
return this._dateLabel.getText();
}
},
/**
* Sets buttons date label.
*
* @param {string} date - Previous date string.
*/
setDate: function (date) {
var dateLabel = this._dateLabel = new Label({ text: date, classNames: ['date-label'] });
this._assetbutton.appendChildWidget(dateLabel);
},
/**
* Builds next asset button.
*
* @private
*/
_buildPrevAsset: function () {
var assetButton = this._assetbutton = new Button(),
icon = new Label({ text: '', classNames: ['icon', 'icon-chevron-left'] });
assetButton.addClass('assetbutton');
assetButton.appendChildWidget(icon);
this.appendChildWidget(assetButton);
}
});
});