Skip to content

Commit

Permalink
1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBeckers committed Apr 29, 2020
1 parent fdf166f commit b265a17
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 5 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Expand Up @@ -66,4 +66,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## 1.2.1 - 2020-02-26
### Fixed
- Fixed documentation link in plugin overview.
- Fixed documentation link in plugin overview.

## 1.3.0 - 2020-04-29
### Added
- Modal position setting.

### Fixed
- Fixed namespace.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -2,7 +2,7 @@
"name": "dutchheight/craft-cookie-boss",
"description": "Allow your visitors to set their cookie preference.",
"type": "craft-plugin",
"version": "1.2.0",
"version": "1.3.0",
"keywords": [
"craft",
"cms",
Expand Down
2 changes: 1 addition & 1 deletion src/assetbundles/cookieboss/CookieBossAsset.php
Expand Up @@ -8,7 +8,7 @@
* @copyright Copyright (c) 2019 Dutch Height
*/

namespace dutchheight\cookieboss\assetbundles\CookieBoss;
namespace dutchheight\cookieboss\assetbundles\cookieBoss;

use Craft;
use craft\web\AssetBundle;
Expand Down
14 changes: 14 additions & 0 deletions src/assetbundles/cookieboss/dist/css/CookieBoss.css
Expand Up @@ -174,6 +174,9 @@
}

@media (min-width: 768px) {
#cookie-boss {

}
#cookie-boss-modal {
z-index: 999;

Expand Down Expand Up @@ -210,6 +213,17 @@
bottom: 2rem;
}

#cookie-boss-modal.bottom-center {
left: 50%;
transform: translateX(-50%);
}

#cookie-boss-modal.center {
top: 50%;
left: 50%;
transform: translateX(-50%);
}

#cookie-boss-modal>#container {
display: flex;
flex-wrap: wrap;
Expand Down
2 changes: 2 additions & 0 deletions src/controllers/SettingsController.php
Expand Up @@ -43,6 +43,7 @@ public function actionPluginSettings($settings = null): Response
$variables['cookies'] = CookieBoss::getInstance()->cookieDescriptions->getAll();

$variables['settings'] = $settings;
// Craft::dump($settings);
$variables['tabs'] = [
'general' => [
'label' => Craft::t('app', 'General'),
Expand Down Expand Up @@ -117,6 +118,7 @@ private function saveSettings($forceReconsent = false) {
$settings['settingsButtonText'] = Craft::$app->getRequest()->getRequiredBodyParam('settingsButtonText');
$settings['cookiesPageId'] = Craft::$app->getRequest()->getRequiredBodyParam('contactPage');
$settings['acceptAfterSeconds'] = Craft::$app->getRequest()->getRequiredBodyParam('acceptAfterSeconds');
$settings['position'] = Craft::$app->getRequest()->getRequiredBodyParam('position');

if ($forceReconsent) {
$settings['lastSettingsUpdate'] = time();
Expand Down
7 changes: 7 additions & 0 deletions src/models/Settings.php
Expand Up @@ -115,6 +115,13 @@ class Settings extends Model
*/
public $lastSettingsUpdate = null;

/**
* The position (css class) of the modal
*
* @var string
*/
public $position = "bottom-right";

// Public Methods
// =========================================================================

Expand Down
2 changes: 1 addition & 1 deletion src/templates/askConsent/_index.twig
Expand Up @@ -20,7 +20,7 @@
{% endif %}

{% if settings.presentGroups %}
<div id="cookie-boss-modal" class="{{ templateSettings.position }}">
<div id="cookie-boss-modal" class="{{ templateSettings.position }}" :style=" !settingsOpen ? 'height: 150px;' : '' ">
<div id="container" v-if="!settingsOpen">
<h3 class="item-wrapper item-wrapper-padding noselect" style="width: 100%;">{{ settings.title }}</h3>
<p class="item-wrapper item-wrapper-padding noselect" style="width: 100%;">{{ settings.message }}</p>
Expand Down
16 changes: 16 additions & 0 deletions src/templates/settings.twig
Expand Up @@ -142,6 +142,22 @@
min: 0,
value: settings['acceptAfterSeconds']
}) }}

{{ forms.selectField({
label: 'Position' |t('cookie-boss'),
instructions: 'Set the popup position.' |t('cookie-boss'),
id: 'position',
name: 'position',
options: {
"top-left": "Top left" |t('cookie-boss'),
"top-right": "Top right" |t('cookie-boss'),
"bottom-left": "Bottom left" |t('cookie-boss'),
"bottom-right": "Bottom right" |t('cookie-boss'),
"bottom-center": "Bottom center" |t('cookie-boss'),
"center": "Center" |t('cookie-boss'),
},
value: settings['position']
}) }}
</div>

<div id="list-consent-groups" class="hidden">
Expand Down
Expand Up @@ -193,7 +193,7 @@ public function getCookiesRaw($consentGroupHandle = null)

private function getDefaultTemplateSettings() {
return [
'position' => 'bottom-right'
'position' => CookieBoss::$settings["position"]
];
}
}

0 comments on commit b265a17

Please sign in to comment.