Skip to content

Commit 54ccd51

Browse files
WIP - fixing voting / p7
1 parent a6c2447 commit 54ccd51

File tree

5 files changed

+24
-28
lines changed

5 files changed

+24
-28
lines changed
Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
<div class="form-group">
2-
<label for="nodes">Parent</label>
3-
<select id="nodes"
2+
<label for="nodes">Parent:</label>
3+
{{item.parent.id}} / {{item.parent.name}}
4+
<select ng-model="item.parent"
5+
id="nodes"
46
class="form-control"
5-
ng-required="true"
6-
ng-model="item.parent.id"
7-
name="status">
8-
<option
9-
ng-repeat="node in availableNodes"
10-
ng-select="item.parent.id == node.id"
11-
value="{{node.id}}">
12-
{{node.id}} / {{node.name}}
13-
</option>
7+
ng-options="node.name for node in availableNodes">
148
</select>
159

16-
</div>
17-
18-
{{item.parent.id}}
19-
{{item.parent.name}}
10+
</div>

Aisel/backend/web/app/Aisel/Navigation/controllers/navigationDetails.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ define(['app'], function (app) {
3030
var itemService = new resourceService('navigation');
3131

3232

33-
//$scope.$watch('item.locale', function () {
34-
// if ($scope.item.locale) {
35-
// var filter = '{"locale":"' + $scope.item.locale + '"}';
36-
// itemService.getCollection(100000, 1, filter).success(
37-
// function (data, status) {
38-
// $scope.availableNodes = data.collection;
39-
// }
40-
// );
41-
// }
42-
//});
33+
$scope.$watch('item.locale', function () {
34+
if ($scope.item.locale) {
35+
var filter = '{"locale":"' + $scope.item.locale + '"}';
36+
itemService.getCollection(100000, 1, filter).success(
37+
function (data, status) {
38+
$scope.availableNodes = data.collection;
39+
}
40+
);
41+
}
42+
});
4343

4444
angular.extend(this, $controller('AbstractDetailsCtrl', {
4545
$scope: $scope,

Aisel/backend/web/app/Aisel/Navigation/views/edit-node.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
ng-required="true"
2020
ng-model="item.name">
2121
</div>
22-
<!--<ng-include src="'/app/Aisel/Kernel/views/edit/field/nodes-parent.html'"></ng-include>-->
22+
<ng-include src="'/app/Aisel/Kernel/views/edit/field/nodes-parent.html'"></ng-include>
2323
<ng-include src="'/app/Aisel/Kernel/views/edit/field/locale.html'"></ng-include>
2424
<ng-include src="'/app/Aisel/Kernel/views/edit/field/status.html'"></ng-include>
2525
</div>

Aisel/src/Aisel/NavigationBundle/Entity/Menu.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Menu extends BaseNode
3333
* @ORM\ManyToOne(targetEntity="Aisel\NavigationBundle\Entity\Menu", inversedBy="children")
3434
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
3535
* @JMS\Expose
36-
* @JMS\MaxDepth(1)
36+
* @JMS\MaxDepth(2)
3737
* @JMS\Type("Aisel\NavigationBundle\Entity\Menu")
3838
* @JMS\Groups({"collection","details"})
3939
*/
@@ -43,7 +43,7 @@ class Menu extends BaseNode
4343
* @ORM\OneToMany(targetEntity="Aisel\NavigationBundle\Entity\Menu", mappedBy="parent")
4444
* @ORM\OrderBy({"name" = "ASC"})
4545
* @JMS\Expose
46-
* @JMS\MaxDepth(1)
46+
* @JMS\MaxDepth(2)
4747
* @JMS\Type("ArrayCollection<Aisel\NavigationBundle\Entity\Menu>")
4848
* @JMS\Groups({"collection","details"})
4949
*/

Aisel/src/Aisel/NodeBundle/Entity/Node.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,12 @@ public function getChildren()
109109
*/
110110
public function setParent($parent = null)
111111
{
112+
if ($this->parent) {
113+
$this->parent->removeChild($this);
114+
}
115+
112116
$this->parent = $parent;
117+
$this->parent->addChild($this);
113118

114119
return $this;
115120
}

0 commit comments

Comments
 (0)