Skip to content

Commit

Permalink
Merge pull request #19 from CarnezEnzo/master
Browse files Browse the repository at this point in the history
Moved button to the top and fixed issues when editing a selection
  • Loading branch information
zawaze authored Feb 20, 2020
2 parents 362ee8d + 8289a97 commit e273d84
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 22 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#Selection module changelog

###1.1.9
- Fixed title and language issues when editing a selection

###1.1.8
- Invisible products are not displayed anymore when editing a selection

Expand Down
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.1.8</version>
<version>1.1.9</version>
<authors>
<author>
<name>Maxime BRUCHET</name>
Expand Down
9 changes: 4 additions & 5 deletions Controller/SelectionUpdateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ public function saveSelection()
$selectionDescription = $data['selection_description'];
$selectionPostscriptum = $data['selection_postscriptum'];

$lang = $this->getRequest()->getSession()->get('thelia.current.lang');

$aSelection = SelectionI18nQuery::create()
->filterById($selectionID)
->filterByLocale($lang->getLocale())
->filterByLocale($this->getCurrentEditionLocale())
->findOne();

$aSelection
Expand Down Expand Up @@ -95,7 +93,7 @@ public function createSelection()
->setUpdatedAt($date->format('Y-m-d H:i:s'))
->setVisible(1)
->setPosition($position)
->setLocale($lang->getLocale())
->setLocale($this->getCurrentEditionLocale())
->setTitle($title)
->setChapo($chapo)
->setDescription($description)
Expand Down Expand Up @@ -240,6 +238,7 @@ protected function hydrateObjectForm($selection)
'selection_container' => $container,
'id' => $selection->getId(),
'locale' => $selection->getLocale(),
'selection_title' => $selection->getTitle(),
'selection_chapo' => $selection->getChapo(),
'selection_description' => $selection->getDescription(),
'selection_postscriptum'=> $selection->getPostscriptum(),
Expand Down Expand Up @@ -272,7 +271,7 @@ protected function getUpdateEvent($formData)
$event->setChapo($formData['selection_chapo']);
$event->setDescription($formData['selection_description']);
$event->setPostscriptum($formData['selection_postscriptum']);
$event->setLocale($this->getRequest()->getSession()->get('thelia.current.lang')->getLocale());
$event->setLocale($this->getCurrentEditionLocale());
return $event;
}

Expand Down
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This module allows you to create a selection of products or contents of similar
of those products or contents.

## Compatibility
* To use this module on Thelia 2.3.x, use the tag 1.1.8
* To use this module on Thelia 2.3.x, use the tag 1.1.9

## Installation

Expand All @@ -19,7 +19,7 @@ of those products or contents.
Add it in your main thelia composer.json file

```
composer require thelia/selection-module:~1.1.8
composer require thelia/selection-module:~1.1.9
```

## Usage
Expand Down
27 changes: 13 additions & 14 deletions templates/backOffice/default/selection-edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,19 @@

current_tab = "general"
}
<div class="row" style="margin: 0;">
<div class="row inner-toolbar">

<div class="col-md-12 inner-actions text-right">

{form_field form=$form field='save_mode'}
<button type="{$type}" value="stay" name="{$name}" class="form-submit-button btn btn-sm btn-default btn-success" title="{intl l='Save' d='selection.bo.default'}" id="{$label_attr.for}"> {intl l='Save'} <span class="glyphicon glyphicon-ok"></span></button>
{/form_field}

<a onclick="location.href='../../Selection'" class="page-close-button btn btn-sm btn-default" id="close">{intl l='Close' d='selection.bo.default'}<span class="glyphicon glyphicon-remove"></span></a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">

Expand All @@ -97,19 +109,6 @@
</div>
</div>
</div>
<div class="row" style="margin: 0;">
<div class="row inner-toolbar">

<div class="col-md-12 inner-actions text-right">

{form_field form=$form field='save_mode'}
<button type="{$type}" value="stay" name="{$name}" class="form-submit-button btn btn-sm btn-default btn-success" title="{intl l='Save' d='selection.bo.default'}" id="{$label_attr.for}"> {intl l='Save'} <span class="glyphicon glyphicon-ok"></span></button>
{/form_field}

<a onclick="location.href='../../Selection'" class="page-close-button btn btn-sm btn-default" id="close">{intl l='Close' d='selection.bo.default'}<span class="glyphicon glyphicon-remove"></span></a>
</div>
</div>
</div>
</form>
{/form}
</div>
Expand Down Expand Up @@ -338,4 +337,4 @@
{block name="javascript-last-call"}
{hook name="selection.edit-js" location="selection-edit-js" selection_id={$selection_id} }
{hook name="wysiwyg.js" location="wysiwyg-selection-edit-js" }
{/block}
{/block}

0 comments on commit e273d84

Please sign in to comment.