Skip to content

Commit

Permalink
Merge pull request #1 from sasule/devel
Browse files Browse the repository at this point in the history
Compatibility update
  • Loading branch information
darkWolf-PR authored Oct 8, 2018
2 parents 254f363 + 0223a79 commit bb30bda
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 13 deletions.
7 changes: 5 additions & 2 deletions assets/js/grido.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@
*/
initFilters: function()
{
var that = this;
$('.filter select, .filter [type=checkbox]', this.$element)
.off('change.grido')
.on('change.grido', this.sendFilterForm);
.on('change.grido', function(){
that.sendFilterForm();
});


var that = this;
$('.filter input, .filter textarea', this.$element)
.off('focus.grido')
.on('focus.grido', function() {
Expand Down
6 changes: 5 additions & 1 deletion src/Components/Filters/Condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Grido\Components\Filters;

use Grido\Exception;
use Nette;

/**
* Builds filter condition.
Expand All @@ -25,8 +26,11 @@
* @property mixed $value
* @property-read callable $callback
*/
class Condition extends \Nette\Object
class Condition
{

use Nette\SmartObject;

const OPERATOR_OR = 'OR';
const OPERATOR_AND = 'AND';

Expand Down
7 changes: 4 additions & 3 deletions src/Customization.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

namespace Grido;

use Grido\Grid;
use Nette\Object;
use Nette;

/**
* Customization.
Expand All @@ -23,9 +22,11 @@
* @property string|array $buttonClass
* @property string|array $iconClass
*/
class Customization extends Object
class Customization
{

use Nette\SmartObject;

const TEMPLATE_DEFAULT = 'default';
const TEMPLATE_BOOTSTRAP = 'bootstrap';

Expand Down
6 changes: 4 additions & 2 deletions src/DataSources/ArraySource.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

use Grido\Exception;
use Grido\Components\Filters\Condition;

use Nette\Utils\Strings;
use Nette;

/**
* Array data source.
Expand All @@ -27,8 +27,10 @@
* @property-read array $data
* @property-read int $count
*/
class ArraySource extends \Nette\Object implements IDataSource
class ArraySource implements IDataSource
{
use Nette\SmartObject;

/** @var array */
protected $data;

Expand Down
5 changes: 4 additions & 1 deletion src/DataSources/DibiFluent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Grido\DataSources;

use Grido\Exception;
use Nette;

/**
* Dibi Fluent data source.
Expand All @@ -26,8 +27,10 @@
* @property-read int $count
* @property-read array $data
*/
class DibiFluent extends \Nette\Object implements IDataSource
class DibiFluent implements IDataSource
{
use Nette\SmartObject;

/** @var \DibiFluent */
protected $fluent;

Expand Down
5 changes: 4 additions & 1 deletion src/DataSources/Doctrine.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Nette\Utils\Strings;
use Nette\Utils\Random;
use Doctrine\ORM\Tools\Pagination\Paginator;
use Nette;

/**
* Doctrine data source.
Expand All @@ -32,8 +33,10 @@
* @property-read int $count
* @property-read array $data
*/
class Doctrine extends \Nette\Object implements IDataSource
class Doctrine implements IDataSource
{
use Nette\SmartObject;

/** @var \Doctrine\ORM\QueryBuilder */
protected $qb;

Expand Down
5 changes: 4 additions & 1 deletion src/DataSources/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Grido\DataSources;

use Grido\Exception;
use Nette;

/**
* Model of data source.
Expand All @@ -22,8 +23,10 @@
*
* @property-read IDataSource $dataSource
*/
class Model extends \Nette\Object
class Model
{
use Nette\SmartObject;

/** @var array */
public $callback = [];

Expand Down
5 changes: 4 additions & 1 deletion src/DataSources/NetteDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Grido\Exception;
use Grido\Components\Filters\Condition;
use Nette;

/**
* Nette Database data source.
Expand All @@ -25,8 +26,10 @@
* @property-read int $count
* @property-read array $data
*/
class NetteDatabase extends \Nette\Object implements IDataSource
class NetteDatabase implements IDataSource
{
use Nette\SmartObject;

/** @var \Nette\Database\Table\Selection */
protected $selection;

Expand Down
16 changes: 16 additions & 0 deletions src/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,22 @@ class Grid extends Components\Container
/** @var Customization */
protected $customization;

/**
* Grid constructor.
*/
public function __construct()
{
parent::__construct();
list($parent, $name) = func_get_args() + [null, null];
if ($parent !== null) {
$parent->addComponent($this, $name);

} elseif (is_string($name)) {
$this->name = $name;
}
}


/**
* Sets a model that implements the interface Grido\DataSources\IDataSource or data-source object.
* @param mixed $model
Expand Down
5 changes: 4 additions & 1 deletion src/Translations/FileTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Grido\Translations;

use Grido\Exception;
use Nette;

/**
* Simple file translator.
Expand All @@ -20,8 +21,10 @@
* @subpackage Translations
* @author Petr Bugyík
*/
class FileTranslator extends \Nette\Object implements \Nette\Localization\ITranslator
class FileTranslator implements \Nette\Localization\ITranslator
{
use Nette\SmartObject;

/** @var array */
protected $translations = [];

Expand Down

0 comments on commit bb30bda

Please sign in to comment.