On attaque la partie steps, dans la Recette
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<forms>
|
<forms>
|
||||||
<form name="recette_create_form" class="Recettes\Form\RecetteCreateForm" />
|
<form name="recette_create_form" class="Recettes\Form\RecetteCreateForm" />
|
||||||
|
<form name="recette-step-create" class="Recettes\Form\StepCreateForm"/>
|
||||||
</forms>
|
</forms>
|
||||||
|
|
||||||
<hooks>
|
<hooks>
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ class BackController extends BaseAdminController
|
|||||||
->setNbOfProducts($quantityProposed)
|
->setNbOfProducts($quantityProposed)
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
return $this->render('ajax/related-products', [ 'content_id' => $contentId ]);
|
return $this->render('includes/related-products', [ 'content_id' => $contentId ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
44
local/modules/Recettes/Form/StepCreateForm.php
Normal file
44
local/modules/Recettes/Form/StepCreateForm.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Recettes\Form;
|
||||||
|
|
||||||
|
use Thelia\Form\BaseForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class StepCreateForm
|
||||||
|
* @package Recettes\Form
|
||||||
|
*/
|
||||||
|
class StepCreateForm extends BaseForm
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
protected function buildForm()
|
||||||
|
{
|
||||||
|
$this->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";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,7 +20,10 @@ return array(
|
|||||||
'Add to cart' => 'Ajouter au panier',
|
'Add to cart' => 'Ajouter au panier',
|
||||||
'Print recipe' => 'Imprimer la recette',
|
'Print recipe' => 'Imprimer la recette',
|
||||||
'Some products may not be in stock' => '* ce produit n\'est plus en stock, désolé',
|
'Some products may not be in stock' => '* ce produit n\'est plus en stock, désolé',
|
||||||
|
'Step' => 'Etape',
|
||||||
|
'Detail' => 'Description',
|
||||||
'Name' => 'Notre recette',
|
'Name' => 'Notre recette',
|
||||||
'Created on' => 'Rédigée le',
|
'Created on' => 'Rédigée le',
|
||||||
'Save recipe' => 'Sauvegarder la recette',
|
'Save recipe' => 'Sauvegarder la recette',
|
||||||
|
'Create a new step' => 'Ajouter une étape à votre recette',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
|||||||
*/
|
*/
|
||||||
class StepsLoop extends BaseLoop implements PropelSearchLoopInterface
|
class StepsLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||||
{
|
{
|
||||||
public $countable = false;
|
public $countable = true;
|
||||||
public $timestampable = false;
|
public $timestampable = false;
|
||||||
public $versionable = false;
|
public $versionable = false;
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
<input type="hidden" id="recipe_id" value="{$recipe_id}">
|
|
||||||
|
|
||||||
<table class="table table-condensed">
|
|
||||||
<thead>
|
|
||||||
<th>{intl l="Step" d="recettes"}</th>
|
|
||||||
<th colspan="2">{intl l="Detail" d="recettes"}</th>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{loop name="steps-loop" type="recipe_steps" recipe_id=$recipe_id}
|
|
||||||
<tr>
|
|
||||||
<td>{$STEP}</td>
|
|
||||||
<td>{$DESCRIPTION}</td>
|
|
||||||
</tr>
|
|
||||||
{/loop}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
{loop type="recipe" name="recipe-loop" content_id=$content_id limit="1"}
|
|
||||||
{assign var="recipe_id" value="$ID"}
|
|
||||||
<input type="hidden" id="recipe_id" value="{$ID}">
|
|
||||||
{/loop}
|
|
||||||
|
|
||||||
<table class="table table-condensed">
|
<table class="table table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<th>{intl l="Product" d="recettes"}</th>
|
<th>{intl l="Product" d="recettes"}</th>
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<table class="table table-condensed">
|
||||||
|
<thead>
|
||||||
|
<th>{intl l="Step" d="recettes"}</th>
|
||||||
|
<th colspan="2">{intl l="Detail" d="recettes"}</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{assign var="last_step" value="0"}
|
||||||
|
{loop name="steps-loop" type="recipe_steps" recipe_id=$recipe_id}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{$STEP}
|
||||||
|
{if $LOOP_COUNT > 1}
|
||||||
|
<a href="{url path='/admin/module/Recettes/update-position?mode=up&step=%step' step=$STEP}" class="u-position-up"><i class="glyphicon glyphicon-arrow-up"></i></a>
|
||||||
|
{/if}
|
||||||
|
{if $LOOP_COUNT < $LOOP_TOTAL}
|
||||||
|
<a href="{url path='/admin/module/Recettes/update-position?mode=down&step=%step' step=$STEP}" class="u-position-down"><i class="glyphicon glyphicon-arrow-down"></i></a>
|
||||||
|
{/if}</td>
|
||||||
|
<td>{$DESCRIPTION}</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<a href="{url path='/admin/module/Recettes/remove-step/%recipeId/%step/%contentId' recipeId=$recipe_id step=$STEP contentId=$content_id}" class="delete-step"><i class="glyphicon glyphicon-trash"></i></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{if $LOOP_COUNT=$LOOP_TOTAL}{assign var="last_step" value="$STEP"}{/if}
|
||||||
|
{/loop}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<a class="btn btn-default btn-primary"
|
||||||
|
title="{intl l='Add a new step' d='recettes'}"
|
||||||
|
data-target="#add-step-modal" data-toggle="modal">
|
||||||
|
<i class="glyphicon glyphicon-plus-sign"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
{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}
|
||||||
@@ -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"}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">{intl l=$label d="recettes"}</label>
|
||||||
|
<input type="text" class="etroit" name="{$name}" id="{$label_attr.for}" value="{$next_step}" disabled />
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field="description"}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="{$label_attr.for}">
|
||||||
|
{intl l=$label d="recettes"}
|
||||||
|
{if $required}<span class="required">*</span>{/if}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
{form_error form=$form field="description"}{$message}{/form_error}
|
||||||
|
<textarea id="attr-description" name="{$name}" rows="10" class="form-control wysiwyg">{$DESCRIPTION}</textarea>
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{/form}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
{loop type="recipe" name="recipe-loop" content_id=$content_id limit="1"}
|
{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="title" value=$TITLE}
|
||||||
{assign var="summary" value=$SUMMARY}
|
{assign var="summary" value=$SUMMARY}
|
||||||
{assign var="people" value=$PEOPLE}
|
{assign var="people" value=$PEOPLE}
|
||||||
@@ -114,12 +115,12 @@
|
|||||||
<div class="col-md-4 form-group">
|
<div class="col-md-4 form-group">
|
||||||
<label class="control-label">Produits attachés</label>
|
<label class="control-label">Produits attachés</label>
|
||||||
<div id="related-products-block">
|
<div id="related-products-block">
|
||||||
{include file="ajax/related-products.html" content_id=$content_id}
|
{include file="includes/related-products.html" recipe_id="$recipe_id"}
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<label class="control-label">Etapes de la recette</label>
|
<label class="control-label">Etapes de la recette</label>
|
||||||
<div id="steps-block">
|
<div id="steps-block">
|
||||||
{include file="ajax/steps.html" content_id=$content_id}
|
{include file="includes/steps.html" recipe_id="$recipe_id"}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user