Prateeksha Singh c5a9972785 [refactor][major] Separate out Components
- item_card
- item_card_container
- detail_view
- search_bar
- reviews
- skeleton_state
- empty_state
- empty_state
2018-08-13 21:36:07 +05:30

27 lines
622 B
JavaScript

import SubPage from './subpage';
import { get_item_card_container_html } from '../components/items_container';
erpnext.hub.Category = class Category extends SubPage {
refresh() {
this.category = frappe.get_route()[2];
this.get_items_for_category(this.category)
.then(items => {
this.render(items);
});
}
get_items_for_category(category) {
this.$wrapper.find('.hub-card-container').empty();
return hub.call('get_items', {
filters: {
hub_category: category
}
});
}
render(items) {
const html = get_item_card_container_html(items, __(this.category));
this.$wrapper.append(html)
}
}