Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add more actions #7304

Merged
merged 23 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9385a96
start by listing all the actions that are possible in the app
teolemon Sep 6, 2022
59a7003
feat: add related strings
teolemon Sep 6, 2022
624adb7
feat: add Origins actions in origins missing sub-panel
teolemon Sep 6, 2022
932023f
feat: add packaging image on packaging eco-score subpanel
teolemon Sep 6, 2022
b4f52bd
clarify that some of those sections do not exist on web yet
teolemon Sep 6, 2022
ead0b06
Apply suggestions from code review
teolemon Sep 6, 2022
f1ae13b
Apply suggestions from code review
teolemon Sep 6, 2022
f531000
Update common.pot
teolemon Sep 6, 2022
80b9a27
add stub for photo refresh
teolemon Sep 6, 2022
4d8c5ea
Update lib/ProductOpener/Products.pm
teolemon Oct 10, 2022
cab73ae
Merge branch 'main' into add-more-actions
teolemon Oct 23, 2022
8cf4b02
Merge branch 'main' into add-more-actions
teolemon Oct 26, 2022
8a4d892
Merge branch 'main' into add-more-actions
teolemon Oct 31, 2022
890cbb9
feat: add stub for NOVA action
teolemon Nov 27, 2022
c8346f2
Update templates/api/knowledge-panels/health/ingredients/nova.tt.json
teolemon Nov 27, 2022
38091ca
Update lib/ProductOpener/Products.pm
teolemon Nov 27, 2022
12f4853
Update lib/ProductOpener/Products.pm
teolemon Nov 27, 2022
04d636c
Update lib/ProductOpener/Products.pm
teolemon Nov 27, 2022
bf5c5a6
Update lib/ProductOpener/Products.pm
teolemon Nov 27, 2022
c7cdc7c
Update nova.tt.json
teolemon Nov 27, 2022
3beed55
Update nova.tt.json
teolemon Nov 27, 2022
3d07d58
Merge branch 'main' into add-more-actions
alexgarel Dec 5, 2022
4f45ae2
fix: fix actions in knowledge panels templates
alexgarel Dec 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions lib/ProductOpener/Products.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2497,12 +2497,41 @@ sub product_action_url ($code, $action) {
if ($action eq "add_categories") {
$url .= "#categories";
}
elsif ($action eq "add_ingredients_image") {
$url .= "#ingredients";
}
elsif ($action eq "add_ingredients_text") {
$url .= "#ingredients";
}
elsif ($action eq "add_nutrition_facts_image") {
$url .= "#nutrition";
}
elsif ($action eq "add_nutrition_facts") {
$url .= "#nutrition";
}
elsif ($action eq "add_packaging_image") {
$url .= "#packaging";
}
elsif ($action eq "add_packaging_text") {
$url .= "#packaging";
}
# will do nothing unless a custom section is added
teolemon marked this conversation as resolved.
Show resolved Hide resolved
elsif ($action eq "add_origins") {
$url .= "#origins";
}
elsif ($action eq "add_stores") {
$url .= "#stores";
}
elsif ($action eq "add_packager_codes_image") {
$url .= "#packager_codes";
}
elsif ($action eq "add_labels") {
$url .= "#labels";
}
elsif ($action eq "add_countries") {
$url .= "#countries";
}
# END will do nothing unless a custom section is added
else {
$log->error("unknown product action", {code => $code, action => $action});
}
Expand Down
63 changes: 63 additions & 0 deletions po/common/common.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6202,6 +6202,69 @@ msgctxt "action_add_nutrition_facts"
msgid "Add nutrition facts"
msgstr "Add nutrition facts"

msgctxt "action_add_origins"
msgid "Add the origins of ingredients for this product"
msgstr "Add the origins of ingredients for this product"

msgctxt "action_add_packaging_image"
msgid "Take a photo of the recycling information"
msgstr "Take a photo of the recycling information"

# this is not used yet
msgctxt "action_add_basic_details"
msgid "Add basic details"
msgstr "Add basic details"

# this is not used yet
msgctxt "action_add_portion_size"
msgid "Add portion size"
msgstr "Add portion size"

# this is not used yet
msgctxt "action_add_ingredients_image"
msgid "Take a photo of the ingredients"
msgstr "Take a photo of the ingredients"

# this is not used yet
msgctxt "action_add_nutrition_image"
msgid "Take a photo of the nutrition facts"
msgstr "Take a photo of the nutrition facts"

# this is not used yet
msgctxt "action_refresh_ingredients_image"
msgid "Refresh the photo of the ingredients"
msgstr "Refresh the photo of the ingredients"

# this is not used yet
msgctxt "action_refresh_nutrition_image"
msgid "Refresh the photo of the nutrition facts"
msgstr "Refresh the photo of the nutrition facts"

# this is not used yet
msgctxt "action_add_packaging_text"
msgid "Extract and check the recycling information"
msgstr "Extract and check the recycling information"

# this is not used yet
msgctxt "action_add_stores"
msgid "Add the store where you found this product"
msgstr "Add the store where you found this product"

# this is not used yet
msgctxt "action_labels"
msgid "Add any label present on this product"
msgstr "Add any label present on this product"

# this is not used yet
msgctxt "action_countries"
msgid "Add the country where you found this product"
msgstr "Add the country where you found this product"

# this is not used yet
msgctxt "action_packager_codes_image"
msgid "Take a photo of traceability codes"
msgstr "Take a photo of traceability codes"

# Used as a header for key facts
msgctxt "knowledge_panels_facts"
msgid "What you need to know"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
"icon_color_from_evaluation": true,
"icon_url": "[% static_subdomain %]/images/icons/dist/public.svg",
},
{
"element_type": "action",
"action_element": {
"html": `[% lang("action_add_origins") %]`,
"actions": [
"add_origins",
]
}
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You broke the json here ;-) (it should be included after "elements")
I'm fixing it.

"elements": [
{
"element_type": "text",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
`
}
},
{
"element_type": "action",
"action_element": {
"html": `[% lang("action_add_packaging_image") %]`,
"actions": [
"add_packaging_image"
]
}
},
],
[% ELSE %]
[% IF product.ecoscore_data.adjustments.packaging.value <= -15 %]
Expand Down
14 changes: 13 additions & 1 deletion templates/api/knowledge-panels/health/ingredients/nova.tt.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@
<p>&rarr; <a href="/nova">[% lang("nova_classification_learn_more") %]</a></p>
`
},
},
},
[% IF product.nova_group_error = 'missing_ingredients' %]
{
"element_type": "action",
"action_element": {
"html": `[% lang("action_add_ingredients_image") %]`,
"actions": [
"add_ingredients_image"
]
}
},
[% ENDIF %]

]
}