Skip to content

Commit

Permalink
Add Browse Limit Change
Browse files Browse the repository at this point in the history
  • Loading branch information
plesigne committed Jul 27, 2018
1 parent 2aab711 commit b60afca
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions DependencyInjection/Configuration.php
Expand Up @@ -46,6 +46,12 @@ public function getConfigTreeBuilder()
->scalarNode('purger_interface_id')->end()
->end()
->end()
->arrayNode('form')
->info('Form settings')
->children()
->scalarNode('browse_limit')->defaultValue('100')->isRequired()->end()
->end()
->end()
->arrayNode('bundles')
->defaultValue($this->bundles)
->prototype('scalar')
Expand Down
2 changes: 2 additions & 0 deletions DependencyInjection/MasevSettingsExtension.php
Expand Up @@ -58,6 +58,8 @@ public function load(array $configs, ContainerBuilder $container)
if (!empty($config['varnish_purge']['purger_interface_id'])) {
$container->setParameter('masev_settings.varnish_purge.purger_interface_id', $config['varnish_purge']['purger_interface_id']);
}

$container->setParameter('masev_settings.config.form.browse_limit', $config['form']['browse_limit']);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -63,6 +63,9 @@ masev_settings:
enabled: true (to enable varnish purge)
purger_interface_id: mybundle.masev_settings.purger (id of service, it had to implement Masev\SettingsBundle\Purger\PurgerInterface
bundles: [ ... ]
form:
browse_limit: 500 (default 100) #change browse limit search

```
* bundles : list of bundles that will contains configurable settings

Expand Down
@@ -1,6 +1,5 @@
(function() {
var app = angular.module('masevSettings', ['xeditable']);

app.controller('BrowseController', ['$scope', '$http', '$element', function($scope, $http, $element) {
var $browseWidgetElmt = angular.element($element);
var $startLocationId = $browseWidgetElmt.parent().parent().parent().find("span").attr("data-start-location-id");
Expand All @@ -16,7 +15,7 @@
}

$scope.loadingData = true;
$http.get('/'+currentSiteAccess+'/ezjscore/call/ezjscnode::subtree::'+$startLocationId+'::100::0::priority::1::?ContentType=json').
$http.get('/'+currentSiteAccess+'/ezjscore/call/ezjscnode::subtree::'+$startLocationId+'::'+browseLimitConfig+'::0::priority::1::?ContentType=json').
then(function(response) {
if (response.data.content.total_count != 0) {
$scope.items = response.data.content.list;
Expand Down Expand Up @@ -116,7 +115,7 @@

$scope.browse = function($nodeId, $back) {
$scope.loadingData = true;
$http.get('/'+currentSiteAccess+'/ezjscore/call/ezjscnode::subtree::'+$nodeId+'::100::0::priority::1::?ContentType=json').
$http.get('/'+currentSiteAccess+'/ezjscore/call/ezjscnode::subtree::'+$nodeId+'::'+browseLimitConfig+'::0::priority::1::?ContentType=json').
then(function(response) {
if (response.data.content.total_count != 0) {
$scope.items = response.data.content.list;
Expand Down
Expand Up @@ -9,6 +9,7 @@
<script src="/extension/masev_settings/design/standard/javascript/xeditable.js"></script>
<script>
var currentSiteAccess = "{$siteaccess}";
var browseLimitConfig = "{$browseLimit}";
</script>

{literal}
Expand Down
Expand Up @@ -4,6 +4,9 @@
$http = eZHTTPTool::instance();
$tpl = eZTemplate::factory();
$tpl->setVariable("siteaccess", $GLOBALS['eZCurrentAccess']['name']);
$container = $container = ezpKernel::instance()->getServiceContainer();
$browseLimit = $container->getParameter('masev_settings.config.form.browse_limit');
$tpl->setVariable("browseLimit", $browseLimit);
$Result = array();
$Result['content'] = $tpl->fetch( "design:configuration/index.tpl" );
$Result['left_menu'] = "design:configuration/backoffice_left_menu.tpl";
Expand Down

0 comments on commit b60afca

Please sign in to comment.