-
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CookieBundle] Move cookie-bundle source to monorepo
- Loading branch information
Showing
162 changed files
with
8,297 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* eslint-env node */ | ||
|
||
import consoleArguments from './console-arguments'; | ||
|
||
import createScriptsTask from './tasks/scripts'; | ||
import createBundleTask, { getBabelLoaderOptions } from './tasks/bundle'; | ||
import path from 'path'; | ||
import { adminBundle } from './admin-bundle.tasks'; | ||
import TerserPlugin from 'terser-webpack-plugin'; | ||
|
||
export const cookieBundle = { | ||
config: { | ||
srcPath: './src/Kunstmaan/CookieBundle/Resources/ui/', | ||
distPath: './src/Kunstmaan/CookieBundle/Resources/public/', | ||
publicPath: '/bundles/kunstmaancookie' | ||
}, | ||
tasks: {} | ||
}; | ||
|
||
cookieBundle.tasks.bundleOptimized = createBundleTask({ | ||
config: { | ||
mode: 'production', | ||
entry: `${cookieBundle.config.srcPath}js/index.js`, | ||
output: { | ||
filename: 'cookie-bundle.min.js', | ||
path: path.resolve(__dirname, `.${cookieBundle.config.distPath}js`) | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
loader: 'babel-loader', | ||
options: getBabelLoaderOptions({ | ||
optimize: true | ||
}) | ||
}, | ||
], | ||
}, | ||
}, | ||
logStats: true | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.gitattributes export-ignore | ||
.gitignore export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
composer.lock | ||
vendor/* |
130 changes: 130 additions & 0 deletions
130
src/Kunstmaan/CookieBundle/AdminList/CookieAdminListConfigurator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
<?php | ||
|
||
namespace Kunstmaan\CookieBundle\AdminList; | ||
|
||
use Doctrine\ORM\EntityManager; | ||
use Doctrine\ORM\QueryBuilder; | ||
use Kunstmaan\AdminBundle\Helper\DomainConfigurationInterface; | ||
use Kunstmaan\AdminBundle\Helper\Security\Acl\AclHelper; | ||
use Kunstmaan\AdminListBundle\AdminList\Configurator\AbstractDoctrineORMAdminListConfigurator; | ||
use Kunstmaan\AdminListBundle\AdminList\FieldAlias; | ||
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM\EnumerationFilterType; | ||
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM\StringFilterType; | ||
use Kunstmaan\AdminListBundle\Entity\OverviewNavigationInterface; | ||
use Kunstmaan\CookieBundle\Form\CookieAdminType; | ||
|
||
/** | ||
* Class CookieAdminListConfigurator | ||
*/ | ||
class CookieAdminListConfigurator extends AbstractDoctrineORMAdminListConfigurator implements OverviewNavigationInterface | ||
{ | ||
/** | ||
* @var DomainConfigurationInterface | ||
*/ | ||
private $domainConfiguration; | ||
|
||
/** | ||
* @param EntityManager $em The entity manager | ||
* @param AclHelper $aclHelper The acl helper | ||
* @param DomainConfigurationInterface $domainConfiguration | ||
*/ | ||
public function __construct(EntityManager $em, AclHelper $aclHelper = null, DomainConfigurationInterface $domainConfiguration = null) | ||
{ | ||
parent::__construct($em, $aclHelper); | ||
|
||
$this->domainConfiguration = $domainConfiguration; | ||
|
||
$this->setAdminType(CookieAdminType::class); | ||
$this->setAdminTypeOptions(['domainConfiguration' => $domainConfiguration]); | ||
} | ||
|
||
/** | ||
* Configure the visible columns | ||
*/ | ||
public function buildFields() | ||
{ | ||
$this->addField('name', 'kuma.cookie.adminlists.cookie.name', true); | ||
$this->addField('t.name', 'kuma.cookie.adminlists.cookie.type', true, null, new FieldAlias('t', 'type')); | ||
if ($this->domainConfiguration->isMultiDomainHost()) { | ||
$this->addField('domain', 'kuma.cookie.adminlists.header.domain', true); | ||
} | ||
} | ||
|
||
/** | ||
* Build filters for admin list | ||
*/ | ||
public function buildFilters() | ||
{ | ||
$this->addFilter('name', new StringFilterType('name'), 'kuma.cookie.adminlists.cookie.name'); | ||
$this->addFilter('type', new EnumerationFilterType('id', 't'), 'kuma.cookie.adminlists.cookie.type', $this->getCookieTypes()); | ||
if ($this->domainConfiguration->isMultiDomainHost()) { | ||
$hosts = $this->domainConfiguration->getHosts(); | ||
$domains = array_combine($hosts, $hosts); | ||
$domains = array_merge(['' => 'kuma.cookie.adminlists.filter.all'], $domains); | ||
$this->addFilter('domain', new EnumerationFilterType('domain'), 'kuma.cookie.adminlist.filter.domain', $domains); | ||
} | ||
} | ||
|
||
public function adaptQueryBuilder(QueryBuilder $queryBuilder) | ||
{ | ||
$queryBuilder | ||
->addSelect('t') | ||
->innerJoin('b.type', 't'); | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
private function getCookieTypes() | ||
{ | ||
$cookieTypes = []; | ||
foreach ($this->em->getRepository('KunstmaanCookieBundle:CookieType')->findAll() as $cookieType) { | ||
$cookieTypes[$cookieType->getId()] = $cookieType->getName(); | ||
} | ||
|
||
return $cookieTypes; | ||
} | ||
|
||
/** | ||
* @param array|object $item The item | ||
* @param string $columnName The column name | ||
* | ||
* @return string | ||
*/ | ||
public function getValue($item, $columnName) | ||
{ | ||
if ($columnName == 'domain' && !$item->getDomain()) { | ||
return 'All domains'; | ||
} | ||
|
||
return parent::getValue($item, $columnName); | ||
} | ||
|
||
/** | ||
* Get bundle name | ||
* | ||
* @return string | ||
*/ | ||
public function getBundleName() | ||
{ | ||
return 'KunstmaanCookieBundle'; | ||
} | ||
|
||
/** | ||
* Get entity name | ||
* | ||
* @return string | ||
*/ | ||
public function getEntityName() | ||
{ | ||
return 'Cookie'; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getOverViewRoute() | ||
{ | ||
return 'kunstmaancookiebundle_admin_cookie'; | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
src/Kunstmaan/CookieBundle/AdminList/CookieTypeAdminListConfigurator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
namespace Kunstmaan\CookieBundle\AdminList; | ||
|
||
use Doctrine\ORM\EntityManager; | ||
use Kunstmaan\AdminBundle\Helper\Security\Acl\AclHelper; | ||
use Kunstmaan\AdminListBundle\AdminList\Configurator\AbstractDoctrineORMAdminListConfigurator; | ||
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM; | ||
use Kunstmaan\AdminListBundle\AdminList\SortableInterface; | ||
use Kunstmaan\CookieBundle\Form\CookieTypeAdminType; | ||
|
||
/** | ||
* Class CookieTypeAdminListConfigurator | ||
*/ | ||
class CookieTypeAdminListConfigurator extends AbstractDoctrineORMAdminListConfigurator implements SortableInterface | ||
{ | ||
/** | ||
* @param EntityManager $em The entity manager | ||
* @param AclHelper $aclHelper The acl helper | ||
*/ | ||
public function __construct(EntityManager $em, AclHelper $aclHelper = null) | ||
{ | ||
parent::__construct($em, $aclHelper); | ||
$this->setAdminType(CookieTypeAdminType::class); | ||
} | ||
|
||
/** | ||
* Configure the visible columns | ||
*/ | ||
public function buildFields() | ||
{ | ||
$this->addField('name', 'kuma.cookie.adminlists.cookie_type.name', true); | ||
$this->addField('internalName', 'kuma.cookie.adminlists.cookie_type.internal_name', true); | ||
} | ||
|
||
/** | ||
* Build filters for admin list | ||
*/ | ||
public function buildFilters() | ||
{ | ||
$this->addFilter('name', new ORM\StringFilterType('name'), 'kuma.cookie.adminlists.cookie_type.name'); | ||
$this->addFilter('internalName', new ORM\StringFilterType('internalName'), 'kuma.cookie.adminlists.cookie_type.internal_name'); | ||
} | ||
|
||
/** | ||
* Get bundle name | ||
* | ||
* @return string | ||
*/ | ||
public function getBundleName() | ||
{ | ||
return 'KunstmaanCookieBundle'; | ||
} | ||
|
||
/** | ||
* Get entity name | ||
* | ||
* @return string | ||
*/ | ||
public function getEntityName() | ||
{ | ||
return 'CookieType'; | ||
} | ||
|
||
/** | ||
* Get sortable field name | ||
* | ||
* @return string | ||
*/ | ||
public function getSortableField() | ||
{ | ||
return 'weight'; | ||
} | ||
} |
Oops, something went wrong.