Skip to content

Commit

Permalink
category icons
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-dvorak committed Mar 12, 2024
1 parent 910d870 commit 51687b1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/OpenIntranet/plugins/store/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def post(self):
'$limit' : int(page_len)
},{
"$lookup":{
"from": "category",
"from": "category_complete",
"localField": "category",
"foreignField": "_id",
"as": "category"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
-->
<div class="product_list_element card mt-1 mb-0" style="font-size: 13px;">
<div class="card-body d-flex ">
<span class="d-flex justify-content-start align-self-center" style="min-width: 120px;">
<span class="d-flex justify-content-start align-self-center" style="width: 120px; position: relative">
<img class="component_image img-thumbnail" src="/static/img/image-alt.svg" style="width: 120px">
<img class="component_image_category" src="" style="position: absolute; top: -5px; right: -10px; height: 40px; width: 40px; border-radius: 50%; display: none" >
</span>

<div class="align-self-stretch" style="padding-left: 20px; padding-right: 20px; flex-warp:wrap;">
Expand Down
2 changes: 1 addition & 1 deletion src/OpenIntranet/templates/store/store.component.card.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function select_package_formatter(data) {
</div>

<div class="row">
<div class="col editable editable-categories">Categories: {% for cat in component['categories'] %} <span class="badge bg-info">{{'/'.join(cat.get('path_string', [])+[cat['name']])}}</span>{% end %} </div>
<div class="col editable editable-categories">Categories: {% for cat in component['categories'] %} <span class="badge text-bg-light">{% if cat.get('icon_url') and cat.get('icon_url') != 'null'%} <img src="{{cat.get('icon_url')}}" style="height: 1.25 em;"> {% end %} {{'/'.join(cat.get('path_string', [])+[cat['name']])}}</span>{% end %} </div>
</div>


Expand Down
7 changes: 7 additions & 0 deletions src/OpenIntranet/templates/store/store.home.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,13 @@ function update_view(){
try{ tmpl.querySelector('.component_image').setAttribute('src', element['img_title']['url']) } catch(e){};
try{
if(element['category'][0]['icon_url'].length > 2){
tmpl.querySelector('.component_image_category').setAttribute('src', element['category'][0]['icon_url'])
tmpl.querySelector('.component_image_category').style.display = 'block';
}
} catch(e){};
// zaskrtavatko vybaraných polozek
if(selected.indexOf(element['_id'].$oid) >= 0){
tmpl.querySelector('.product_list-select').checked = true;
Expand Down

0 comments on commit 51687b1

Please sign in to comment.