Skip to content

Commit

Permalink
Updates to release v1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Dec 27, 2015
1 parent c7e3a93 commit 0fd506d
Show file tree
Hide file tree
Showing 28 changed files with 107 additions and 75 deletions.
3 changes: 2 additions & 1 deletion CHANGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ Change Log: `yii2-tree-manager`

## Version 1.0.5

**Date:** 15-Dec-2015
**Date:** 28-Dec-2015

- (enh #92): Ability to control auto loading of bootstrap plugin assets.
- (enh #94): Enhancements and fixes to `movable` node validations.

## Version 1.0.4

Expand Down
2 changes: 1 addition & 1 deletion Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015
* @package yii2-tree
* @version 1.0.4
* @version 1.0.5
*/

namespace kartik\tree;
Expand Down
29 changes: 21 additions & 8 deletions TreeView.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015
* @package yii2-tree-manager
* @version 1.0.4
* @version 1.0.5
*/

namespace kartik\tree;
Expand Down Expand Up @@ -1099,13 +1099,13 @@ public function renderTree()
'data-lft' => $nodeLeft,
'data-rgt' => $nodeRight,
'data-lvl' => $nodeDepth,
'data-readonly' => (int)$node->isReadonly(),
'data-movable-u' => (int)$node->isMovable('u'),
'data-movable-d' => (int)$node->isMovable('d'),
'data-movable-l' => (int)$node->isMovable('l'),
'data-movable-r' => (int)$node->isMovable('r'),
'data-removable' => (int)$node->isRemovable(),
'data-removable-all' => (int)$node->isRemovableAll(),
'data-readonly' => static::parseBool($node->isReadonly()),
'data-movable-u' => static::parseBool($node->isMovable('u')),
'data-movable-d' => static::parseBool($node->isMovable('d')),
'data-movable-l' => static::parseBool($node->isMovable('l')),
'data-movable-r' => static::parseBool($node->isMovable('r')),
'data-removable' => static::parseBool($node->isRemovable()),
'data-removable-all' => static::parseBool($node->isRemovableAll()),
];
if (!$isChild) {
$css = ' kv-parent ';
Expand Down Expand Up @@ -1148,6 +1148,19 @@ public function renderTree()
return Html::tag('div', $this->renderRoot() . $out, $this->treeOptions);
}

/**
* Parses a boolean variable and returns as integer
*
* @param bool $var the variable to parse
*
* @return int
*/
protected static function parseBool($var)
{
return $var ? 1 : 0;
}


/**
* Renders the markup for the detail form to edit/view the selected tree node
*
Expand Down
2 changes: 1 addition & 1 deletion TreeViewAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015
* @package yii2-tree-manager
* @version 1.0.4
* @version 1.0.5
*/

namespace kartik\tree;
Expand Down
2 changes: 1 addition & 1 deletion TreeViewInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015
* @package yii2-tree-manager
* @version 1.0.4
* @version 1.0.5
*/

namespace kartik\tree;
Expand Down
2 changes: 1 addition & 1 deletion TreeViewInputAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015
* @package yii2-tree-manager
* @version 1.0.4
* @version 1.0.5
*/

namespace kartik\tree;
Expand Down
2 changes: 1 addition & 1 deletion assets/css/kv-tree-input.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015
* @package yii2-tree-manager
* @version 1.0.4
* @version 1.0.5
*
* Tree View Input Widget Style Sheet
*
Expand Down
2 changes: 1 addition & 1 deletion assets/css/kv-tree-input.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/css/kv-tree.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015
* @package yii2-tree-manager
* @version 1.0.4
* @version 1.0.5
*
* Tree View Style Sheet
*
Expand Down
2 changes: 1 addition & 1 deletion assets/css/kv-tree.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/kv-tree-input.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015
* @package yii2-tree-manager
* @version 1.0.4
* @version 1.0.5
*
* Tree View Input Widget Validation Module.
*
Expand Down
2 changes: 1 addition & 1 deletion assets/js/kv-tree-input.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions assets/js/kv-tree.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015
* @package yii2-tree-manager
* @version 1.0.4
* @version 1.0.5
*
* Tree View Validation Module.
*
Expand Down Expand Up @@ -255,16 +255,16 @@
self.disable('trash');
}
if (!$sel.data('movable-u')) {
self.disable('movable-u');
self.disable('moveU');
}
if (!$sel.data('movable-d')) {
self.disable('movable-d');
self.disable('moveD');
}
if (!$sel.data('movable-l')) {
self.disable('movable-l');
self.disable('moveL');
}
if (!$sel.data('movable-r')) {
self.disable('movable-r');
self.disable('moveR');
}
self.parseParentFlag(key);
},
Expand Down
4 changes: 2 additions & 2 deletions assets/js/kv-tree.min.js

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions controllers/NodeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015
* @package yii2-tree-manager
* @version 1.0.4
* @version 1.0.5
*/

namespace kartik\tree\controllers;
Expand Down Expand Up @@ -253,8 +253,14 @@ public function actionMove()
extract(static::getPostData());
$nodeFrom = $class::findOne($idFrom);
$nodeTo = $class::findOne($idTo);
$callback = function () use ($dir, $nodeFrom, $nodeTo, $allowNewRoots) {
$isMovable = $nodeFrom->isMovable($dir);
$errorMsg = $isMovable ? Yii::t('kvtree', 'Error while moving the node. Please try again later.') :
Yii::t('kvtree', 'The selected node cannot be moved.');
$callback = function () use ($dir, $nodeFrom, $nodeTo, $allowNewRoots, $isMovable) {
if (!empty($nodeFrom) && !empty($nodeTo)) {
if (!$isMovable) {
return false;
}
if ($dir == 'u') {
$nodeFrom->insertBefore($nodeTo);
} elseif ($dir == 'd') {
Expand All @@ -272,11 +278,7 @@ public function actionMove()
}
return true;
};
return self::process(
$callback,
Yii::t('kvtree', 'Error while moving the node. Please try again later.'),
Yii::t('kvtree', 'The node was moved successfully.')
);
return self::process($callback, $errorMsg, Yii::t('kvtree', 'The node was moved successfully.'));
}

/**
Expand Down
6 changes: 4 additions & 2 deletions messages/de/kvtree.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Message translations.
*
* This file is automatically generated by 'yii message' command.
* This file is automatically generated by 'yii message/extract' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
Expand All @@ -17,6 +17,8 @@
* NOTE: this file must be saved in UTF-8 encoding.
*/
return [
'Error removing the node. Please try again later.' => '',
'The selected node cannot be moved.' => '',
'(new)' => '(Neu)',
'Active' => 'Aktiv',
'Add new' => 'Neuer Eintrag',
Expand Down Expand Up @@ -75,4 +77,4 @@
'This operation is not allowed.' => 'Aktion ist nicht erlaubt.',
'Untitled' => 'Unbenannt',
'Visible' => 'Sichtbar',
];
];
6 changes: 4 additions & 2 deletions messages/en/kvtree.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Message translations.
*
* This file is automatically generated by 'yii message' command.
* This file is automatically generated by 'yii message/extract' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
Expand Down Expand Up @@ -35,6 +35,7 @@
'Delete' => '',
'Depth' => '',
'Disabled' => '',
'Error removing the node. Please try again later.' => '',
'Error while creating the node. Please try again later.' => '',
'Error while moving the node. Please try again later.' => '',
'Error while removing the node. Please try again later.' => '',
Expand Down Expand Up @@ -71,8 +72,9 @@
'The node was moved successfully.' => '',
'The node was removed successfully.' => '',
'The node was successfully created.' => '',
'The selected node cannot be moved.' => '',
'The untitled node was removed.' => '',
'This operation is not allowed.' => '',
'Untitled' => '',
'Visible' => '',
];
];
4 changes: 3 additions & 1 deletion messages/fr/kvtree.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Message translations.
*
* This file is automatically generated by 'yii message' command.
* This file is automatically generated by 'yii message/extract' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
Expand Down Expand Up @@ -35,6 +35,7 @@
'Delete' => '',
'Depth' => '',
'Disabled' => '',
'Error removing the node. Please try again later.' => '',
'Error while creating the node. Please try again later.' => '',
'Error while moving the node. Please try again later.' => '',
'Error while removing the node. Please try again later.' => '',
Expand Down Expand Up @@ -71,6 +72,7 @@
'The node was moved successfully.' => '',
'The node was removed successfully.' => '',
'The node was successfully created.' => '',
'The selected node cannot be moved.' => '',
'The untitled node was removed.' => '',
'This operation is not allowed.' => '',
'Untitled' => '',
Expand Down
54 changes: 28 additions & 26 deletions messages/id/kvtree.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Message translations.
*
* This file is automatically generated by 'yii message' command.
* This file is automatically generated by 'yii message/extract' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
Expand All @@ -17,11 +17,37 @@
* NOTE: this file must be saved in UTF-8 encoding.
*/
return [
'Admin Settings' => '',
'Collapsed' => '',
'Default' => '',
'Disabled' => '',
'Error removing the node. Please try again later.' => '',
'ID' => '',
'Icon' => '',
'Icon Type' => '',
'Movable Down' => '',
'Movable Left' => '',
'Movable Right' => '',
'Movable Up' => '',
'Move Down' => '',
'Move Left' => '',
'Move Right' => '',
'Move Up' => '',
'Node # {id} - \'{name}\': {error}' => '',
'Read Only' => '',
'Removable' => '',
'Removable (with children)' => '',
'Reset' => '',
'Root' => '',
'Select...' => '',
'Selected' => '',
'The selected node cannot be moved.' => '',
'Untitled' => '',
'Visible' => '',
'(new)' => '(baru)',
'Active' => 'Aktif',
'Add new' => 'Tambah baru',
'Add new root' => 'Tambah root baru',
'Admin Settings' => '',
'Already at bottom-most node in the hierarchy.' => 'Node sudah dalam hirarki yang paling bawah.',
'Already at left-most node in the hierarchy.' => 'Node sudah dalam hirarki yang paling kiri.',
'Already at right-most node in the hierarchy.' => 'Node sudah dalam hirarki yang paling kanan.',
Expand All @@ -30,49 +56,25 @@
'Cannot create node. Parent node is not saved or is invalid.' => 'Tidak bisa membuat node. Parent node tidak disimpan atau tidak valid.',
'Cannot move this node as the node details are not saved yet.' => 'Tidak bisa memindahkan node, sebagai rincian node masih belum tersimpan.',
'Clear search results' => 'Bersihkan hasil pencarian',
'Collapsed' => '',
'Default' => '',
'Delete' => 'Hapus',
'Depth' => 'Kedalaman',
'Disabled' => '',
'Error while creating the node. Please try again later.' => 'Kesalahan saat membuat node. Silakan coba lagi nanti.',
'Error while moving the node. Please try again later.' => 'Kesalahan saat memindahkan node. Silakan coba lagi nanti.',
'Error while removing the node. Please try again later.' => 'Kesalahan saat menghapus node. Silakan coba lagi nanti.',
'Error while saving the node. Please try again later.' => 'Kesalahan saat menyimpan node. Silakan coba lagi nanti.',
'Error while viewing the node. Please try again later.' => 'Kesalahan saat menampilkan node. Silakan coba lagi nanti.',
'ID' => '',
'Icon' => '',
'Icon Type' => '',
'Left' => 'Kiri',
'Movable Down' => '',
'Movable Left' => '',
'Movable Right' => '',
'Movable Up' => '',
'Move Down' => '',
'Move Left' => '',
'Move Right' => '',
'Move Up' => '',
'Name' => 'Nama',
'No valid tree nodes are available for display. Use toolbar buttons to add tree nodes.' => 'Tidak ada tree node yang bisa ditampilkan. Gunakan tombol di toolbar untuk menambahkan node.',
'Node # {id} - \'{name}\': {error}' => '',
'Read Only' => '',
'Refresh' => 'Segarkan',
'Removable' => '',
'Removable (with children)' => '',
'Reset' => '',
'Right' => 'Kanan',
'Root' => '',
'Save' => 'Simpan',
'Saved the node details successfully.' => 'Berhasil menyimpan detail node',
'Search...' => 'Cari...',
'Select a node by clicking on one of the tree items.' => 'Pilih node dengan meng-klik salah satu tree items.',
'Select...' => '',
'Selected' => '',
'The node was moved successfully.' => 'Node telah berhasil dipindahkan.',
'The node was removed successfully.' => 'Node telah berhasil dihapus.',
'The node was successfully created.' => 'Node telah berhasil dibuat.',
'The untitled node was removed.' => 'Untitled node sudah dihapus.',
'This operation is not allowed.' => 'Operasi ini tidak diperbolehkan.',
'Untitled' => '',
'Visible' => '',
];
Loading

0 comments on commit 0fd506d

Please sign in to comment.