This commit is contained in:
Vincent Fiduccia 2016-03-22 23:35:57 -07:00
parent 64d8889976
commit e805ef7355
3 changed files with 5 additions and 36 deletions

View File

@ -101,6 +101,7 @@ export default Ember.Route.extend({
function filter(data, category, catalogIds) { function filter(data, category, catalogIds) {
data = data.filterBy('templateBase', (templateBase === 'cattle' ? '' : templateBase)); data = data.filterBy('templateBase', (templateBase === 'cattle' ? '' : templateBase));
let categories = uniqKeys(data, 'category');
if ( category !== 'all' ) { if ( category !== 'all' ) {
data = data.filterBy('category', category); data = data.filterBy('category', category);
@ -109,7 +110,7 @@ export default Ember.Route.extend({
data = data.sortBy('name'); data = data.sortBy('name');
return Ember.Object.create({ return Ember.Object.create({
categories: uniqKeys(data, 'category'), categories: categories,
uniqueCatalogIds: catalogIds, uniqueCatalogIds: catalogIds,
catalog: data, catalog: data,
templateBase: templateBase, templateBase: templateBase,

View File

@ -79,15 +79,15 @@ export default Ember.Component.extend({
bootstrapCatalogs: function() { bootstrapCatalogs: function() {
let defaultCatalogs = []; let defaultCatalogs = [];
let customCatalogs = []; let customCatalogs = [];
let catalogUrls = this.get('settings').get(C.SETTING.CATALOG_URL).split(','); let catalogUrls = (this.get('settings').get(C.SETTING.CATALOG_URL)||'').split(',');
catalogUrls.forEach((catalog) => { catalogUrls.forEach((catalog) => {
let tmp = {}; let tmp = {};
catalog = catalog.split('=')[0]; catalog = catalog.split('=')[0];
if (catalog === 'library' || catalog === 'community') { if (catalog === C.CATALOG.LIBRARY_KEY || catalog === C.CATALOG.COMMUNITY_KEY) {
if (catalog === 'library') { if (catalog === C.CATALOG.LIBRARY_KEY) {
if (this.get('settings.isPrivateLabel')) { if (this.get('settings.isPrivateLabel')) {
tmp.icon = 'icon-catalog'; tmp.icon = 'icon-catalog';

View File

@ -1,32 +0,0 @@
import Ember from 'ember';
const { getOwner } = Ember;
/*
* Many link-to and resource-action-menus components on the screen are pretty slow.
* So instead a static <a> and <button> are put in the template and this handles the clicks.
*/
export default Ember.Mixin.create({
needs : ['application'],
resourceActions : Ember.inject.service('resource-actions'),
currentPath : Ember.computed.alias('application.currentPath'),
pathObserver: Ember.observer('currentPath', function() {
// Make sure that when we change paths, close the action menu
Ember.$('body').trigger('click');
}),
click(event) {
var btn = $(event.target).closest('BUTTON');
if ( btn && btn.hasClass('more-actions') ) // Only menu buttons
{
this.get('resourceActions').show(this.get('model'), btn);
}
else if ( event.target.tagName === 'A' && $(event.target).data('transitionLink')) // Only links with data-transition-link
{
getOwner(this).lookup('router:main').transitionTo(event.target.pathname);
event.preventDefault();
return false;
}
}
});