2015-03-20 18:31:49 +09:00
|
|
|
Template[getTemplate('dropdownComponent')].helpers({
|
|
|
|
dropdownClass: function () {
|
|
|
|
var dropdownClass = this.dropdownName;
|
|
|
|
// only use dropdowns for top nav
|
|
|
|
if (this.length > 3) {
|
|
|
|
dropdownClass += " long-dropdown";
|
|
|
|
}
|
|
|
|
if (getSetting('navLayout', 'top-nav') == 'top-nav' && getThemeSetting('useDropdowns', true)) {
|
|
|
|
dropdownClass += " has-dropdown";
|
|
|
|
} else {
|
|
|
|
dropdownClass += " no-dropdown";
|
|
|
|
}
|
|
|
|
return dropdownClass;
|
|
|
|
},
|
|
|
|
dropdownLabel: function () {
|
|
|
|
// if label is defined, use this. Else default to dropdown name
|
|
|
|
return !!this.dropdownLabel ? this.dropdownLabel : i18n.t(this.dropdownName);
|
|
|
|
},
|
|
|
|
hasMoreThanThreeItems: function () {
|
|
|
|
return this.length > 3;
|
|
|
|
},
|
|
|
|
itemLabel: function () {
|
2015-03-21 09:43:51 +09:00
|
|
|
// case 1: if label is a String, return it
|
2015-03-20 18:31:49 +09:00
|
|
|
if (typeof this.label == "string") {
|
|
|
|
return i18n.t(this.label);
|
|
|
|
}
|
2015-03-21 09:43:51 +09:00
|
|
|
// case 2: if label is a Function return its result
|
2015-03-20 18:31:49 +09:00
|
|
|
if (typeof this.label == "function") {
|
|
|
|
return this.label()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
itemPath: function () {
|
2015-03-21 09:43:51 +09:00
|
|
|
// case 1: if route is a String, apply Router.path() to it
|
2015-03-20 18:31:49 +09:00
|
|
|
if (typeof this.route == "string") {
|
|
|
|
return Router.path(this.route);
|
|
|
|
}
|
2015-03-21 09:43:51 +09:00
|
|
|
// case 2: if route is a Function return its result
|
|
|
|
if (typeof this.route == "function") {
|
2015-03-20 18:31:49 +09:00
|
|
|
return this.route()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|