Skip to content

Commit

Permalink
Merge pull request #538 from jlove-nz/bug/265-landing-page-product-list
Browse files Browse the repository at this point in the history
[OPALSUP-265] Fix public marketplace view
  • Loading branch information
Adam Abdelaziz authored Aug 17, 2018
2 parents 88733d6 + 42298cb commit 9885086
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/app/components/mno-apps/mno-app-listing.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ angular.module 'mnoEnterpriseAngular'
vm.searchTerm = ''
vm.currentSelectedCategory = if vm.publicPage then vm.selectedPublicCategory.label else vm.selectedCategory
if (vm.currentSelectedCategory?.length > 0)
vm.filteredApps = (app for app in vm.apps when vm.currentSelectedCategory in app.categories)
vm.filteredApps = _.filter(vm.apps, (app) -> _.includes(app.categories, vm.currentSelectedCategory))
else
vm.filteredApps = vm.apps

Expand Down Expand Up @@ -84,11 +84,12 @@ angular.module 'mnoEnterpriseAngular'
response = response.plain()

vm.categories = response.categories
vm.publicCategories = _.map(response.categories, (c) -> {label: c, active: ''})
vm.apps = response.apps
vm.filteredApps = vm.apps
if vm.publicPage
vm.apps = _.filter(vm.apps, (app) -> _.includes(MnoeConfig.publicApplications(), app.nid))
categoriesWithProduct = _.uniq(_.flatten(_.map(vm.apps, (app) -> app.categories)))
vm.publicCategories = _.map(categoriesWithProduct, (c) -> {label: c, active: ''})
vm.filteredApps = vm.apps
).finally(-> vm.isLoading = false)

$scope.$watch MnoeOrganizations.getSelectedId, (val) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ angular.module 'mnoEnterpriseAngular'
# Post-Initialization
#====================================
$scope.$watch MnoeOrganizations.getSelectedId, (val) ->
vm.initialize() if val?
vm.initialize()

return
})
5 changes: 1 addition & 4 deletions src/app/views/public/landing/landing.controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,23 @@ angular.module 'mnoEnterpriseAngular'

vm = @
vm.isLoading = true
vm.localProductLoading = true
vm.highlightedApps = []
vm.localProducts = []

vm.carouselImageStyle = (app) ->
# Products does not have a picture
# Select appropriate image for carousel - logo or picture
picture = if app.pictures then app.pictures[0] else app.logo
{
"background-image": "url(#{picture})"
}

MnoeMarketplace.getApps().then(
(response) ->
vm.products = _.filter(response.apps, (app) -> _.includes(MnoeConfig.publicApplications(), app.nid))
vm.highlightedApps = _.filter(response.apps, (app) -> _.includes(MnoeConfig.publicHighlightedApplications(), app.nid))
if MnoeConfig.areLocalProductsEnabled
vm.localProducts = _.filter(response.products, (product) -> product.local && _.includes(MnoeConfig.publicLocalProducts(), product.nid))
localHighlightedApp = _.filter(response.products, (product) -> _.includes(MnoeConfig.publicHighlightedLocalProducts(), product.nid))
vm.highlightedApps = vm.highlightedApps.concat(localHighlightedApp) if localHighlightedApp
vm.categories = response.categories
).finally(-> vm.isLoading = false)

vm.highlightHref = (app) ->
Expand Down

0 comments on commit 9885086

Please sign in to comment.