Rajout du module View pour pouvoir afficher dans les menus la liste des marques

This commit is contained in:
2023-12-02 15:42:11 +01:00
parent fc6a693f1c
commit 97a75fbf2a
37 changed files with 4471 additions and 5 deletions

View File

@@ -0,0 +1,12 @@
{include
file="view-includes/generic-view-selector.html"
sourceType = 'category'
sourceId = $category_id
successUrl = {url path="/admin/categories/update?category_id=$category_id&current_tab=modules"}
hasSubTree = 1
objectLabel = {intl d='view.bo.default' l='cette catégorie'}
subTreeObjectLabel = {intl d='view.bo.default' l='sous-catégories'}
childrenObjectLabel = {intl d='view.bo.default' l='produits'}
childrenSourceType = 'product'
}

View File

@@ -0,0 +1,8 @@
{include
file="view-includes/generic-view-selector.html"
sourceType = 'content'
sourceId = $content_id
successUrl = {url path="/admin/content/update/$content_id?current_tab=modules"}
hasSubTree = 0
objectLabel = {intl d='view.bo.default' l='ce contenu'}
}

View File

@@ -0,0 +1,12 @@
{include
file="view-includes/generic-view-selector.html"
sourceType = 'folder'
sourceId = $folder_id
successUrl = {url path="/admin/folders/update/$folder_id?current_tab=modules"}
hasSubTree = 1
objectLabel = {intl d='view.bo.default' l='ce dossier'}
subTreeObjectLabel = {intl d='view.bo.default' l='sous-dossiers'}
childrenObjectLabel = {intl d='view.bo.default' l='contenus'}
childrenSourceType = 'content'
}

View File

@@ -0,0 +1,8 @@
{include
file="view-includes/generic-view-selector.html"
sourceType = 'product'
sourceId = $product_id
successUrl = {url path="/admin/products/update?product_id=$product_id&current_tab=modules"}
hasSubTree = 0
objectLabel = {intl d='view.bo.default' l='ce produit'}
}

View File

@@ -0,0 +1,174 @@
{$useDefault = "<span class=\"text-muted\">{intl l='Default view' d='view.bo.default'}</span>"}
<div class="row">
<div class="col-md-12 general-block-decorator">
<div class="title title-without-tabs">
{intl d='view.bo.default' l="List of specific views"}
</div>
<div class="general-block-decorator">
<table class="table table-striped table-condensed table-left-aligned">
<caption class="clearfix">{intl l="Categories" d="view.bo.default"}</caption>
{ifloop rel="views"}
<thead>
<tr>
<th>ID</th>-
<th>Title</th>
<th>This category view</th>
<th>Children categories view</th>
<th>Products view</th>
</tr>
</thead>
<tbody>
{loop name="views" type="view" source="category"}
{ifloop rel="info"}
<tr>
{loop name="info" type="category" id=$SOURCE_ID}
<td><a href="{url path="/admin/categories/update" category_id=$ID current_tab='modules'}">{$ID}</a></td>
<td><a href="{url path="/admin/categories/update" category_id=$ID current_tab='modules'}">{$TITLE}</a></td>
{/loop}
<td>{$VIEW|default:$useDefault nofilter}</td>
<td>{$SUBTREE_VIEW|default:$useDefault nofilter}</td>
<td>{$CHILDREN_VIEW|default:$useDefault nofilter}</td>
</tr>
{/ifloop}
{/loop}
</tbody>
{/ifloop}
{elseloop rel="views"}
<thead>
<tr>
<td>
<div class="alert alert-info">{intl l="Aucune vue spécifique trouvée." d="view.bo.default"}</div>
</td>
</tr>
</thead>
{/elseloop}
</table>
</div>
<div class="general-block-decorator">
<table class="table table-striped table-condensed table-left-aligned">
<caption class="clearfix">{intl l="Products" d="view.bo.default"}</caption>
{ifloop rel="views"}
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>This product view</th>
</tr>
</thead>
<tbody>
{loop name="views" type="view" source="product"}
{ifloop rel="info"}
<tr>
{loop name="info" type="product" id=$SOURCE_ID}
<td><a href="{url path="/admin/products/update" product_id=$ID current_tab='modules'}">{$ID}</a></td>
<td><a href="{url path="/admin/products/update" product_id=$ID current_tab='modules'}">{$TITLE}</a></td>
{/loop}
<td>{$VIEW|default:$useDefault nofilter}</td>
</tr>
{/ifloop}
{/loop}
</tbody>
{/ifloop}
{elseloop rel="views"}
<thead>
<tr>
<td>
<div class="alert alert-info">{intl l="Aucune vue spécifique trouvée." d="view.bo.default"}</div>
</td>
</tr>
</thead>
{/elseloop}
</table>
</div>
<div class="general-block-decorator">
<table class="table table-striped table-condensed table-left-aligned">
<caption class="clearfix">{intl l="Folders" d="view.bo.default"}</caption>
{ifloop rel="views"}
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>This folder view</th>
<th>Children folders view</th>
<th>Contents view</th>
</tr>
</thead>
<tbody>
{loop name="views" type="view" source="folder"}
{ifloop rel="info"}
<tr>
{loop name="info" type="folder" id=$SOURCE_ID}
<td><a href="{url path="/admin/folders/update/$ID" current_tab='modules'}">{$ID}</a></td>
<td><a href="{url path="/admin/folders/update/$ID" current_tab='modules'}">{$TITLE}</a></td>
{/loop}
<td>{$VIEW|default:$useDefault nofilter}</td>
<td>{$SUBTREE_VIEW|default:$useDefault nofilter}</td>
<td>{$CHILDREN_VIEW|default:$useDefault nofilter}</td>
</tr>
{/ifloop}
{/loop}
</tbody>
{/ifloop}
{elseloop rel="views"}
<thead>
<tr>
<td>
<div class="alert alert-info">{intl l="Aucune vue spécifique trouvée." d="view.bo.default"}</div>
</td>
</tr>
</thead>
{/elseloop}
</table>
</div>
<div class="general-block-decorator">
<table class="table table-striped table-condensed table-left-aligned">
<caption class="clearfix">{intl l="Contents" d="view.bo.default"}</caption>
{ifloop rel="views"}
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>This content view</th>
</tr>
</thead>
<tbody>
{loop name="views" type="view" source="content"}
{ifloop rel="info"}
<tr>
{loop name="info" type="content" id=$SOURCE_ID}
<td><a href="{url path="/admin/content/update/$ID" current_tab='modules'}">{$ID}</a></td>
<td><a href="{url path="/admin/content/update/$ID" current_tab='modules'}">{$TITLE}</a></td>
{/loop}
<td>{$VIEW|default:$useDefault nofilter}</td>
</tr>
{/ifloop}
{/loop}
</tbody>
{/ifloop}
{elseloop rel="views"}
<thead>
<tr>
<td>
<div class="alert alert-info">{intl l="Aucune vue spécifique trouvée." d="view.bo.default"}</div>
</td>
</tr>
</thead>
{/elseloop}
</table>
</div>
</div>
</div>

View File

@@ -0,0 +1,133 @@
{*
$sourceType : la source de la vue: folder, product, cateogry, product
$sourceId : identifiant de la source de la vue
$successUrl : the form success url
*}
<div class="general-block-decorator">
<div class="row">
<div class="col-md-12">
<p class="title title-without-tabs">{intl d="view.bo.default" l="Vue à utiliser pour %label" label=$objectLabel}</p>{form name="view.create"}
{loop type="frontview" name="front_view" source=$sourceType source_id=$sourceId}
{loop type="view" name="view" id=$VIEW_ID}
{loop type=$SOURCE name="obj_title" id=$SOURCE_ID}
{$frontView = {intl d="view.bo.default" l='<strong>%view</strong> (définie dans %title)' view=$FRONT_VIEW title=$TITLE}}
{/loop}
{/loop}
{/loop}
{if empty($frontView)}
{$frontView = {intl d="view.bo.default" l="la vue par défaut"}}
{/if}
<p>{intl d="view.bo.default" l="La vue actuellement utilisée par %label est %view." label=$objectLabel view=$frontView}</p>
<form action="{url path="/admin/view/add/$sourceId"}" method="POST" {form_enctype form=$form}>
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
{* Pour gérer les erreurs *}
<input type="hidden" name="source_type" value="{$sourceType}">
{form_hidden_fields form=$form}
{form_field form=$form field="success_url"}
<input type="hidden" name="{$name}" value="{$successUrl}">
{/form_field}
{form_field form=$form field="view"}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">
{intl d="view.bo.default" l="Choisissez une vue :"}
</label>
{loop type="view" name="viewselected" source=$sourceType source_id=$sourceId}
{$viewSelected = $VIEW}
{/loop}
<select id="{$label_attr.for}" name="{$name}" class="submit-on-change form-control">
<option value="">{intl d="view.bo.default" l='Utiliser la vue par défaut' view=$sourceType}</option>
{loop type="frontfiles" name="translate-fo-templates"}
<option value="{$NAME}"{if $NAME == $viewSelected} selected="selected"{/if}>{$FILE}</option>
{/loop}
</select>
</div>
{/form_field}
{form_field form=$form field="has_subtree"}
<input type="hidden" name="{$name}" value="{$hasSubTree}">
{/form_field}
{if $hasSubTree}
<div class="row">
<div class="col-md-6">
<p class="title title-without-tabs">{intl d="view.bo.default" l="Vue à utiliser par les %label" label=$subTreeObjectLabel}</p>
{form_field form=$form field="subtree_view"}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">
{intl d="view.bo.default" l="Choisissez une vue :"}
</label>
{loop type="view" name="viewselected" source=$sourceType source_id=$sourceId}
{$viewSelected = $SUBTREE_VIEW}
{/loop}
<select id="{$label_attr.for}" name="{$name}" class="submit-on-change form-control">
<option value="">{intl d="view.bo.default" l='Utiliser la vue par défaut' view=$sourceType}</option>
{loop type="frontfiles" name="translate-fo-templates"}
<option value="{$NAME}"{if $NAME == $viewSelected} selected="selected"{/if}>{$FILE}</option>
{/loop}
</select>
</div>
{/form_field}
</div>
<div class="col-md-6">
<p class="title title-without-tabs">{intl d="view.bo.default" l="Vue à utiliser par les %label" label=$childrenObjectLabel}</p>
{form_field form=$form field="children_view"}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">
{intl d="view.bo.default" l="Choisissez une vue :"}
</label>
{loop type="view" name="viewselected" source=$sourceType source_id=$sourceId}
{$viewSelected = $CHILDREN_VIEW}
{/loop}
<select id="{$label_attr.for}" name="{$name}" class="submit-on-change form-control">
<option value="">{intl d="view.bo.default" l='Utiliser la vue par défaut' view=$childrenSourceType}</option>
{loop type="frontfiles" name="translate-fo-templates"}
<option value="{$NAME}"{if $NAME == $viewSelected} selected="selected"{/if}>{$FILE}</option>
{/loop}
</select>
</div>
{/form_field}
</div>
</div>
{/if}
{form_field form=$form field="source"}
<input type="hidden" name="{$name}" value="{$sourceType}">
{/form_field}
{form_field form=$form field="source_id"}
<input type="hidden" name="{$name}" value="{$sourceId}">
{/form_field}
<div class="form-group">
<p class="form-control-static pull-left">
<a href="{url path="/admin/module/View"}">
<span class="glyphicon glyphicon-eye-open"></span>
{intl d="view.bo.default" l="List of all specific views"}
</a>
</p>
<button type="submit" name="save_mode" value="stay" class="form-submit-button btn btn-success pull-right">
{intl d="view.bo.default" l='Enregistrer'} <span class="glyphicon glyphicon-ok"></span>
</button>
</div>
</form>
{/form}
</div>
</div>
</div>