diff --git a/local/modules/Recettes/Config/config.xml b/local/modules/Recettes/Config/config.xml index 083a6bae..a4858f04 100644 --- a/local/modules/Recettes/Config/config.xml +++ b/local/modules/Recettes/Config/config.xml @@ -6,6 +6,7 @@
+ diff --git a/local/modules/Recettes/Controller/BackController.php b/local/modules/Recettes/Controller/BackController.php index 5db8e09d..aeb0d9d5 100755 --- a/local/modules/Recettes/Controller/BackController.php +++ b/local/modules/Recettes/Controller/BackController.php @@ -178,7 +178,7 @@ class BackController extends BaseAdminController ->setNbOfProducts($quantityProposed) ->save(); - return $this->render('ajax/related-products', [ 'content_id' => $contentId ]); + return $this->render('includes/related-products', [ 'content_id' => $contentId ]); } } diff --git a/local/modules/Recettes/Form/StepCreateForm.php b/local/modules/Recettes/Form/StepCreateForm.php new file mode 100644 index 00000000..4544d6f5 --- /dev/null +++ b/local/modules/Recettes/Form/StepCreateForm.php @@ -0,0 +1,44 @@ +formBuilder + ->add( + "step", + "number", + [ + "required" => true, + "label" => "Step", + "label_attr" => ['for' => 'step'] + ]) + ->add( + "description", + "textarea", + [ + "required" => true, + "label" => "Description", + "label_attr" => ['for' => 'description'] + ]); + } + + /** + * @inheritDoc + */ + public function getName() + { + return "recette-step-create"; + } +} diff --git a/local/modules/Recettes/I18n/fr_FR.php b/local/modules/Recettes/I18n/fr_FR.php index 0e94af20..2132dd59 100644 --- a/local/modules/Recettes/I18n/fr_FR.php +++ b/local/modules/Recettes/I18n/fr_FR.php @@ -20,7 +20,10 @@ return array( 'Add to cart' => 'Ajouter au panier', 'Print recipe' => 'Imprimer la recette', 'Some products may not be in stock' => '* ce produit n\'est plus en stock, désolé', + 'Step' => 'Etape', + 'Detail' => 'Description', 'Name' => 'Notre recette', 'Created on' => 'Rédigée le', 'Save recipe' => 'Sauvegarder la recette', + 'Create a new step' => 'Ajouter une étape à votre recette', ); diff --git a/local/modules/Recettes/Loop/StepsLoop.php b/local/modules/Recettes/Loop/StepsLoop.php index fc07427c..c60047e0 100644 --- a/local/modules/Recettes/Loop/StepsLoop.php +++ b/local/modules/Recettes/Loop/StepsLoop.php @@ -16,7 +16,7 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection; */ class StepsLoop extends BaseLoop implements PropelSearchLoopInterface { - public $countable = false; + public $countable = true; public $timestampable = false; public $versionable = false; diff --git a/local/modules/Recettes/templates/backOffice/default/ajax/steps.html b/local/modules/Recettes/templates/backOffice/default/ajax/steps.html deleted file mode 100644 index 7c380804..00000000 --- a/local/modules/Recettes/templates/backOffice/default/ajax/steps.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - {loop name="steps-loop" type="recipe_steps" recipe_id=$recipe_id} - - - - - {/loop} - -
{intl l="Step" d="recettes"}{intl l="Detail" d="recettes"}
{$STEP}{$DESCRIPTION}
\ No newline at end of file diff --git a/local/modules/Recettes/templates/backOffice/default/ajax/related-products.html b/local/modules/Recettes/templates/backOffice/default/includes/related-products.html similarity index 93% rename from local/modules/Recettes/templates/backOffice/default/ajax/related-products.html rename to local/modules/Recettes/templates/backOffice/default/includes/related-products.html index a821ca1c..f6eb006b 100644 --- a/local/modules/Recettes/templates/backOffice/default/ajax/related-products.html +++ b/local/modules/Recettes/templates/backOffice/default/includes/related-products.html @@ -1,8 +1,3 @@ -{loop type="recipe" name="recipe-loop" content_id=$content_id limit="1"} - {assign var="recipe_id" value="$ID"} - -{/loop} - diff --git a/local/modules/Recettes/templates/backOffice/default/includes/steps.html b/local/modules/Recettes/templates/backOffice/default/includes/steps.html new file mode 100644 index 00000000..2c543ca5 --- /dev/null +++ b/local/modules/Recettes/templates/backOffice/default/includes/steps.html @@ -0,0 +1,51 @@ +
{intl l="Product" d="recettes"}
+ + + + + + {assign var="last_step" value="0"} + {loop name="steps-loop" type="recipe_steps" recipe_id=$recipe_id} + + + + + + {if $LOOP_COUNT=$LOOP_TOTAL}{assign var="last_step" value="$STEP"}{/if} + {/loop} + +
{intl l="Step" d="recettes"}{intl l="Detail" d="recettes"}
+ {$STEP} + {if $LOOP_COUNT > 1} + + {/if} + {if $LOOP_COUNT < $LOOP_TOTAL} + + {/if}{$DESCRIPTION} + +
+ + + + + +{form name="recette-step-create"} + {capture "step_create"} + {include file="modal/step-edit.html" form_name="recette-step-create" next_step=($last_step+1)} + {/capture} + + {include file="includes/generic-create-dialog.html" + + dialog_id = "add-step-modal" + dialog_title = {intl l="Create a new step" d="recettes"} + dialog_body = {$smarty.capture.step_create nofilter} + + dialog_ok_label = {intl l="Create"} + dialog_cancel_label = {intl l="Cancel"} + + form_action = {$current_url} + form_enctype = {form_enctype form=$form} + } +{/form} \ No newline at end of file diff --git a/local/modules/Recettes/templates/backOffice/default/modal/step-edit.html b/local/modules/Recettes/templates/backOffice/default/modal/step-edit.html new file mode 100644 index 00000000..10bc56a1 --- /dev/null +++ b/local/modules/Recettes/templates/backOffice/default/modal/step-edit.html @@ -0,0 +1,26 @@ +{form name=$form_name} + + {form_hidden_fields form=$form} + + {render_form_field form=$form field="success_url" value={$success_url|default:{url path="/admin/content/update/$contentId?current_tab=recipe"}}} + + {form_field form=$form field="step"} +
+ + +
+ {/form_field} + + {form_field form=$form field="description"} +
+ + + {form_error form=$form field="description"}{$message}{/form_error} + +
+ {/form_field} + +{/form} \ No newline at end of file diff --git a/local/modules/Recettes/templates/backOffice/default/recette-tab.html b/local/modules/Recettes/templates/backOffice/default/recette-tab.html index 91ba7c2b..ccdc9da4 100644 --- a/local/modules/Recettes/templates/backOffice/default/recette-tab.html +++ b/local/modules/Recettes/templates/backOffice/default/recette-tab.html @@ -1,4 +1,5 @@ {loop type="recipe" name="recipe-loop" content_id=$content_id limit="1"} + {assign var="recipe_id" value=$ID} {assign var="title" value=$TITLE} {assign var="summary" value=$SUMMARY} {assign var="people" value=$PEOPLE} @@ -114,12 +115,12 @@

- {include file="ajax/steps.html" content_id=$content_id} + {include file="includes/steps.html" recipe_id="$recipe_id"}