mirror of https://github.com/rancher/ui.git
36 lines
865 B
JavaScript
36 lines
865 B
JavaScript
import Ember from "ember";
|
|
|
|
export default Ember.Controller.extend({
|
|
navExpand: (parseInt($.cookie('navExpand'),10) !== 0),
|
|
error: null,
|
|
pageName: '',
|
|
|
|
navExpandChange: function() {
|
|
var inAYear = new Date();
|
|
inAYear.setYear(inAYear.getFullYear()+1);
|
|
|
|
$.cookie('navExpand', (this.get('navExpand') ? 1 : 0), {
|
|
expires: inAYear
|
|
});
|
|
}.observes('navExpand'),
|
|
|
|
|
|
absoluteEndpoint: function() {
|
|
var url = this.get('app.endpoint');
|
|
|
|
// If the URL is relative, add on the current base URL from the browser
|
|
if ( url.indexOf('http') !== 0 )
|
|
{
|
|
url = window.location.origin + '/' + url.replace(/^\/+/,'');
|
|
}
|
|
else if ( url.charAt(url.length-1) !== '/' ) {
|
|
url = url + "/";
|
|
}
|
|
|
|
// Url must end in a single slash
|
|
url = url.replace(/\/+$/,'') + '/';
|
|
|
|
return url;
|
|
}.property('app.endpoint'),
|
|
});
|