Permalink
Browse files

many improvements [juzna]

  • Loading branch information...
1 parent 8060385 commit 73eb0bdb407cc47d457f399ef7dae1521e85c0fd @holubj committed Oct 13, 2012
Showing with 438 additions and 55 deletions.
  1. +23 −0 README.md
  2. +30 −0 composer.json
  3. +5 −2 { → libs/NiftyGrid}/Components/Action.php
  4. +1 −1 { → libs/NiftyGrid}/Components/Button.php
  5. +18 −13 { → libs/NiftyGrid}/Components/Column.php
  6. +1 −1 { → libs/NiftyGrid}/Components/GlobalButton.php
  7. +5 −1 { → libs/NiftyGrid}/Components/SubGrid.php
  8. 0 { → libs/NiftyGrid}/DataSource/DibiFluentDataSource.php
  9. +1 −1 { → libs/NiftyGrid}/DataSource/DoctrineDataSource.php
  10. +1 −1 { → libs/NiftyGrid}/DataSource/IDataSource.php
  11. +10 −10 { → libs/NiftyGrid}/DataSource/NDataSource.php
  12. 0 { → libs/NiftyGrid}/FilterCondition.php
  13. +29 −24 { → libs/NiftyGrid}/Grid.php
  14. 0 { → libs/NiftyGrid}/GridExceptions.php
  15. +2 −1 { → libs/NiftyGrid}/GridPaginator.php
  16. 0 { → resources}/css/example.css
  17. 0 { → resources}/css/grid.css
  18. BIN { → resources}/css/images/add.png
  19. BIN { → resources}/css/images/calendar.png
  20. BIN { → resources}/css/images/cancel_white.png
  21. BIN { → resources}/css/images/cross.png
  22. BIN { → resources}/css/images/delete.png
  23. BIN { → resources}/css/images/edit.png
  24. BIN { → resources}/css/images/fast_edit.png
  25. BIN { → resources}/css/images/link.png
  26. BIN { → resources}/css/images/publish.png
  27. BIN { → resources}/css/images/restore.png
  28. BIN { → resources}/css/images/subgrid_close.png
  29. BIN { → resources}/css/images/subgrid_open.png
  30. BIN { → resources}/css/images/trash.png
  31. BIN { → resources}/css/images/triangle-down-red.png
  32. BIN { → resources}/css/images/triangle-down.png
  33. BIN { → resources}/css/images/triangle-up-red.png
  34. BIN { → resources}/css/images/triangle-up.png
  35. BIN { → resources}/css/images/unpublish.png
  36. BIN { → resources}/css/jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png
  37. BIN { → resources}/css/jquery-ui/images/ui-bg_glass_95_fef1ec_1x400.png
  38. BIN { → resources}/css/jquery-ui/images/ui-bg_gloss-wave_16_121212_500x100.png
  39. BIN { → resources}/css/jquery-ui/images/ui-bg_highlight-hard_15_888888_1x100.png
  40. BIN { → resources}/css/jquery-ui/images/ui-bg_highlight-hard_55_555555_1x100.png
  41. BIN { → resources}/css/jquery-ui/images/ui-bg_highlight-soft_35_adadad_1x100.png
  42. BIN { → resources}/css/jquery-ui/images/ui-bg_highlight-soft_60_dddddd_1x100.png
  43. BIN { → resources}/css/jquery-ui/images/ui-bg_inset-soft_15_121212_1x100.png
  44. BIN { → resources}/css/jquery-ui/images/ui-icons_666666_256x240.png
  45. BIN { → resources}/css/jquery-ui/images/ui-icons_aaaaaa_256x240.png
  46. BIN { → resources}/css/jquery-ui/images/ui-icons_bbbbbb_256x240.png
  47. BIN { → resources}/css/jquery-ui/images/ui-icons_c98000_256x240.png
  48. BIN { → resources}/css/jquery-ui/images/ui-icons_cccccc_256x240.png
  49. BIN { → resources}/css/jquery-ui/images/ui-icons_cd0a0a_256x240.png
  50. BIN { → resources}/css/jquery-ui/images/ui-icons_f29a00_256x240.png
  51. 0 { → resources}/css/jquery-ui/jquery-ui.css
  52. +2 −0 { → resources}/js/grid.js
  53. 0 { → resources}/js/jquery-ui.js
  54. +310 −0 resources/js/netteForms.js
View
@@ -0,0 +1,23 @@
+# NiftyGrid
+
+Simple and light-weight **datagrid** for *Nette framework*.
+
+
+## Install
+Add as *composer* dependancy to your `composer.json` file:
+
+```
+{
+ "require": {
+ "php" : ">=5.3.0",
+ "nette/nette" : "*",
+ "nifty/nifty-grid": "*"
+ }
+}
+```
+
+Copy resources from `resources/` directory to your public www dir and include them in template (usually in `@layout.latte`).
+
+## Usage
+
+See manual on http://addons.nette.org/cs/niftygrid
View
@@ -0,0 +1,30 @@
+{
+ "name": "nifty/nifty-grid",
+ "type": "nette-addon",
+ "description": "Simple & lightweight datagrid for nette",
+ "keywords": ["datagrid", "nette"],
+ "homepage": "http://addons.nette.org/cs/niftygrid",
+ "license": ["BSD-3"],
+ "authors": [
+ {
+ "name": "Jakub Holub"
+ }
+ ],
+ "require": {
+ "php" : ">=5.3.2",
+ "nette/nette" : "*",
+ "nette/addon-installer": "@dev"
+ },
+ "autoload": {
+ "psr-0": { "NiftyGrid": "libs/" },
+ "classmap": [ "libs/NiftyGrid/GridExceptions.php" ]
+ },
+ "extra": {
+ "nette-addon": {
+ "assets": {
+ "css": [ "resources/css/" ],
+ "javascript": [ "resources/js/" ]
+ }
+ }
+ }
+}
@@ -7,7 +7,10 @@
* @license New BSD Licence
* @link http://addons.nette.org/cs/niftygrid
*/
-namespace NiftyGrid;
+namespace NiftyGrid\Components;
+
+use Nette;
+use NiftyGrid;
class Action extends \Nette\Application\UI\PresenterComponent
{
@@ -92,7 +95,7 @@ public function setAjax($ajax)
/**
* @return mixed
- * @throws UnknownActionCallbackException
+ * @throws NiftyGrid\UnknownActionCallbackException
*/
public function getAction()
{
@@ -7,7 +7,7 @@
* @license New BSD Licence
* @link http://addons.nette.org/cs/niftygrid
*/
-namespace NiftyGrid;
+namespace NiftyGrid\Components;
use Nette\Utils\Html;
use NiftyGrid\Grid; // For constant only
@@ -7,7 +7,12 @@
* @license New BSD Licence
* @link http://addons.nette.org/cs/niftygrid
*/
-namespace NiftyGrid;
+namespace NiftyGrid\Components;
+
+use Nette;
+use NiftyGrid,
+ NiftyGrid\Grid,
+ NiftyGrid\FilterCondition;
class Column extends \Nette\Application\UI\PresenterComponent
@@ -190,15 +195,15 @@ public function hasCellRenderer()
/**
* @param int $numOfResults
* @return Column
- * @throws InvalidFilterException
- * @throws UnknownFilterException
+ * @throws NiftyGrid\InvalidFilterException
+ * @throws NiftyGrid\UnknownFilterException
*/
public function setAutocomplete($numOfResults = 10)
{
if(empty($this->filterType)){
- throw new UnknownFilterException("Autocomplete can't be used without filter.");
+ throw new NiftyGrid\UnknownFilterException("Autocomplete can't be used without filter.");
}elseif($this->filterType != FilterCondition::TEXT){
- throw new InvalidFilterException("Autocomplete can be used only with Text filter.");
+ throw new NiftyGrid\InvalidFilterException("Autocomplete can be used only with Text filter.");
}
$this->parent['gridForm'][$this->parent->name]['filter'][$this->name]->getControlPrototype()
->addClass("grid-autocomplete")
@@ -225,13 +230,13 @@ public function getAutocompleteResults()
* @param bool $textarea
* @param null|int $cols
* @param null|int $rows
+ * @throws NiftyGrid\DuplicateEditableColumnException
* @return Column
- * @throws DuplicateEditableColumnException
*/
public function setTextEditable($textarea = FALSE, $cols = NULL, $rows = NULL)
{
if($this->editable){
- throw new DuplicateEditableColumnException("Column $this->name is already editable.");
+ throw new NiftyGrid\DuplicateEditableColumnException("Column $this->name is already editable.");
}
if($textarea){
@@ -251,12 +256,12 @@ public function setTextEditable($textarea = FALSE, $cols = NULL, $rows = NULL)
* @param array $values
* @param string|null $prompt
* @return Column
- * @throws DuplicateEditableColumnException
+ * @throws NiftyGrid\DuplicateEditableColumnException
*/
public function setSelectEditable(array $values, $prompt = NULL)
{
if($this->editable){
- throw new DuplicateEditableColumnException("Column $this->name is already editable.");
+ throw new NiftyGrid\DuplicateEditableColumnException("Column $this->name is already editable.");
}
$this->parent['gridForm'][$this->parent->name]['rowForm']->addSelect($this->name, NULL, $values)->getControlPrototype()->addClass("grid-editable");
if($prompt){
@@ -270,12 +275,12 @@ public function setSelectEditable(array $values, $prompt = NULL)
/**
* @return Column
- * @throws DuplicateEditableColumnException
+ * @throws NiftyGrid\DuplicateEditableColumnException
*/
public function setBooleanEditable()
{
if($this->editable){
- throw new DuplicateEditableColumnException("Column $this->name is already editable.");
+ throw new NiftyGrid\DuplicateEditableColumnException("Column $this->name is already editable.");
}
$this->parent['gridForm'][$this->parent->name]['rowForm']->addCheckbox($this->name, NULL)->getControlPrototype()->addClass("grid-editable");
@@ -286,12 +291,12 @@ public function setBooleanEditable()
/**
* @return Column
- * @throws DuplicateEditableColumnException
+ * @throws NiftyGrid\DuplicateEditableColumnException
*/
public function setDateEditable()
{
if($this->editable){
- throw new DuplicateEditableColumnException("Column $this->name is already editable.");
+ throw new NiftyGrid\DuplicateEditableColumnException("Column $this->name is already editable.");
}
$this->parent['gridForm'][$this->parent->name]['rowForm']->addText($this->name, NULL)->getControlPrototype()->addClass("grid-datepicker")->addClass("grid-editable");
@@ -7,7 +7,7 @@
* @license New BSD Licence
* @link http://addons.nette.org/cs/niftygrid
*/
-namespace NiftyGrid;
+namespace NiftyGrid\Components;
use Nette\Utils\Html,
NiftyGrid\Grid; // For constant only
@@ -7,7 +7,11 @@
* @license New BSD Licence
* @link http://addons.nette.org/cs/niftygrid
*/
-namespace NiftyGrid;
+namespace NiftyGrid\Components;
+
+use Nette;
+use NiftyGrid,
+ NiftyGrid\Grid;
class SubGrid extends \Nette\Application\UI\PresenterComponent
{
@@ -7,7 +7,7 @@
* @license New BSD Licence
* @link http://addons.nette.org/cs/niftygrid
*/
-namespace NiftyGrid;
+namespace NiftyGrid\DataSource;
use NiftyGrid\FilterCondition,
Nette\Utils\Strings;
@@ -7,7 +7,7 @@
* @license New BSD Licence
* @link http://addons.nette.org/cs/niftygrid
*/
-namespace NiftyGrid;
+namespace NiftyGrid\DataSource;
interface IDataSource
{
@@ -7,42 +7,42 @@
* @license New BSD Licence
* @link http://addons.nette.org/cs/niftygrid
*/
-namespace NiftyGrid;
+namespace NiftyGrid\DataSource;
use NiftyGrid\FilterCondition;
class NDataSource implements IDataSource
{
- private $data;
+ private $table;
- public function __construct($data)
+ public function __construct($table)
{
- $this->data = $data;
+ $this->table = $table;
}
public function getData()
{
- return $this->data;
+ return $this->table;
}
public function getPrimaryKey()
{
- return $this->data->getPrimary();
+ return $this->table->getPrimary();
}
public function getCount($column = "*")
{
- return $this->data->count($column);
+ return $this->table->count($column);
}
public function orderData($by, $way)
{
- $this->data->order($by." ".$way);
+ $this->table->order($by." ".$way);
}
public function limitData($limit, $offset)
{
- $this->data->limit($limit, $offset);
+ $this->table->limit($limit, $offset);
}
public function filterData(array $filters)
@@ -58,7 +58,7 @@ public function filterData(array $filters)
if(!empty($filter["valueFunction"])){
$column .= $filter["valueFunction"]."(?)";
}
- $this->data->where($column, $value);
+ $this->table->where($column, $value);
}
}
}
File renamed without changes.
Oops, something went wrong.

0 comments on commit 73eb0bd

Please sign in to comment.