From 318cca8caecc1ac0526bcd31bf84e9bc4cdce9f4 Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Tue, 7 Aug 2018 12:41:21 +0530 Subject: [PATCH] [hub] Add 'See All' for Category items - Also remove special `cursor: pointer` style - Set it for all elements having a data-route --- erpnext/public/js/hub/helpers.js | 5 +++-- erpnext/public/js/hub/pages/home.js | 11 +++++++++-- erpnext/public/less/hub.less | 19 ++++++++++++------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/erpnext/public/js/hub/helpers.js b/erpnext/public/js/hub/helpers.js index 85143b75b51..7c4c9193e0d 100644 --- a/erpnext/public/js/hub/helpers.js +++ b/erpnext/public/js/hub/helpers.js @@ -5,11 +5,12 @@ function get_empty_state(message, action) { `; } -function get_item_card_container_html(items, title='', get_item_html = get_item_card_html) { +function get_item_card_container_html(items, title='', get_item_html = get_item_card_html, action='') { const items_html = (items || []).map(item => get_item_html(item)).join(''); const title_html = title - ? `
+ ? `

${title}

+ ${action}
` : ''; diff --git a/erpnext/public/js/hub/pages/home.js b/erpnext/public/js/hub/pages/home.js index b8e6f01fd7c..eefe3b87977 100644 --- a/erpnext/public/js/hub/pages/home.js +++ b/erpnext/public/js/hub/pages/home.js @@ -1,5 +1,5 @@ import SubPage from './subpage'; -import { make_search_bar, get_item_card_container_html } from '../helpers'; +import { make_search_bar, get_item_card_container_html, get_item_card_html } from '../helpers'; erpnext.hub.Home = class Home extends SubPage { make_wrapper() { @@ -43,7 +43,14 @@ erpnext.hub.Home = class Home extends SubPage { if (category_items) { Object.keys(category_items).map(category => { const items = category_items[category]; - html = get_item_card_container_html(items, __(category)); + const see_all_link = `

See All

`; + + html = get_item_card_container_html( + items, + __(category), + get_item_card_html, + see_all_link + ); this.$wrapper.append(html); }); } diff --git a/erpnext/public/less/hub.less b/erpnext/public/less/hub.less index b0ddec413b5..d8ac9dd9c9d 100644 --- a/erpnext/public/less/hub.less +++ b/erpnext/public/less/hub.less @@ -6,6 +6,10 @@ body[data-route^="marketplace/"] { padding-right: 25px; } + [data-route] { + cursor: pointer; + } + .layout-main-section { border: none; font-size: @text-medium; @@ -60,7 +64,6 @@ body[data-route^="marketplace/"] { border: 1px solid @border-color; border-radius: 4px; overflow: hidden; - cursor: pointer; &:hover .hub-card-overlay { display: block; @@ -146,8 +149,6 @@ body[data-route^="marketplace/"] { border-radius: 4px; border: 1px solid transparent; - cursor: pointer; - &.active, &:hover:not(.is-title) { border-color: @border-color; } @@ -211,9 +212,14 @@ body[data-route^="marketplace/"] { } .hub-card-container { - h4 { - font-weight: 500; - margin-top: 32px + .hub-card-container-header { + margin-top: 32px; + justify-content: space-between; + align-items: baseline; + + h4 { + font-weight: 500; + } } } @@ -235,7 +241,6 @@ body[data-route^="marketplace/"] { display: flex; align-items: center; padding: 8px 12px; - cursor: pointer; &:not(.active) { filter: grayscale(1);