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

NEW DESIGN - Reintroduce the Wipe ingredients button and the inline ingredients edit for moderators #7911

Open
teolemon opened this issue Dec 27, 2022 · 4 comments
Labels
🧽 Data quality https://wiki.openfoodfacts.org/Quality inline edit 👮 Moderation 🎨 New design Issues related to the Open Food Facts JS/CSS/HTML redesign. regression ⏰ Stale This issue hasn't seen activity in a while. You can try documenting more to unblock it.

Comments

@teolemon
Copy link
Member

What

  • Reintroduce the Wipe ingredients button and the inline ingredients edit for moderators
  • It seems to have disappeared during the redesign

Screenshot

image

Part of

@teolemon teolemon added ✨ Feature Features or enhancements to Open Food Facts server 🎨 New design Issues related to the Open Food Facts JS/CSS/HTML redesign. inline edit regression 🧽 Data quality https://wiki.openfoodfacts.org/Quality labels Dec 27, 2022
@diivi
Copy link
Member

diivi commented Jan 7, 2023

Can you give a mockup of what it should look like? Or a screenshot from the old design?

@alexgarel
Copy link
Member

Previously:

image

Note @diivi this is reserved to moderators.

@stephanegigandet
Copy link
Contributor

Previously, the generated code looked like this:

`

Edit ingredients (fr)


Save ingredients (fr)

        <div class="button_div" id="wipeingredientsbuttondiv"><button id="wipeingredients" class="small button" type="button">Ingredients (fr) are completely bogus, erase them.</button></div>
    

     <!-- Offer to add the ingredients in the language of the interface -->
     
        <p>
            If this product has an ingredients list in English, please add it.
            <a href="/cgi/product.pl?type=edit&amp;code=8710522682272#ingredients" class="button tiny"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="icon" aria-hidden="true" focusable="false"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg> Edit the page</a>
        </p>
    

    `
  • some generated JS code:

`
var editableText;

$("#editingredients").click({},function(event) {
	event.stopPropagation();
	event.preventDefault();

	var divHtml = $("#ingredients_list").html();
	var allergens = /(<span class="allergen">|<\/span>)/g;
	divHtml = divHtml.replace(allergens, '_');

	var editableText = $('<textarea id="ingredients_list" style="height:8rem" lang="fr" />');
	editableText.val(divHtml);
	$("#ingredients_list").replaceWith(editableText);
	editableText.focus();

	$("#editingredientsbuttondiv").hide();
	$("#saveingredientsbuttondiv").show();

	$(document).foundation('equalizer', 'reflow');

});


$("#saveingredients").click({},function(event) {
	event.stopPropagation();
	event.preventDefault();

	$('div[id="saveingredientsbuttondiv"]').hide();
	$('div[id="saveingredientsbuttondiv_status"]').html('<img src="/images/misc/loading2.gif"> Saving ingredients_texts_fr');
	$('div[id="saveingredientsbuttondiv_status"]').show();

	$.post('/cgi/product_jqm_multilingual.pl',
		{code: "8710522682272", ingredients_text_fr :  $("#ingredients_list").val(), comment: "Updated ingredients_texts_fr" },
		function(data) {

			$('div[id="saveingredientsbuttondiv_status"]').html('Saved ingredients_texts_fr');
			$('div[id="saveingredientsbuttondiv"]').show();

			$(document).foundation('equalizer', 'reflow');
		},
		'json'
	);

	$(document).foundation('equalizer', 'reflow');

});



$("#wipeingredients").click({},function(event) {
	event.stopPropagation();
	event.preventDefault();
	// alert(event.data.imagefield);
	$('div[id="wipeingredientsbuttondiv"]').html('<img src="/images/misc/loading2.gif"> Erasing ingredients_texts_fr');
	$.post('/cgi/product_jqm_multilingual.pl',
		{code: "8710522682272", ingredients_text_fr : "", comment: "Erased ingredients_texts_fr: too much bad data" },
		function(data) {

			$('div[id="wipeingredientsbuttondiv"]').html("Erased ingredients_texts_fr");
			$('div[id="ingredients_list"]').html("");

			$(document).foundation('equalizer', 'reflow');
		},
		'json'
	);

	$(document).foundation('equalizer', 'reflow');

});`

@github-actions
Copy link
Contributor

This issue is stale because it has been open 90 days with no activity.

@github-actions github-actions bot added the ⏰ Stale This issue hasn't seen activity in a while. You can try documenting more to unblock it. label Apr 12, 2023
@teolemon teolemon moved this to To discuss and validate in 🍊 Open Food Facts Server issues Apr 23, 2024
@teolemon teolemon removed the ✨ Feature Features or enhancements to Open Food Facts server label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧽 Data quality https://wiki.openfoodfacts.org/Quality inline edit 👮 Moderation 🎨 New design Issues related to the Open Food Facts JS/CSS/HTML redesign. regression ⏰ Stale This issue hasn't seen activity in a while. You can try documenting more to unblock it.
Projects
Status: To discuss and validate
Status: Backlog
Status: To do
Development

No branches or pull requests

4 participants