File tree Expand file tree Collapse file tree 5 files changed +24
-28
lines changed Expand file tree Collapse file tree 5 files changed +24
-28
lines changed Original file line number Diff line number Diff line change 1
1
< 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 "
4
6
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 ">
14
8
</ select >
15
9
16
- </ div >
17
-
18
- {{item.parent.id}}
19
- {{item.parent.name}}
10
+ </ div >
Original file line number Diff line number Diff line change @@ -30,16 +30,16 @@ define(['app'], function (app) {
30
30
var itemService = new resourceService ( 'navigation' ) ;
31
31
32
32
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
+ } ) ;
43
43
44
44
angular . extend ( this , $controller ( 'AbstractDetailsCtrl' , {
45
45
$scope : $scope ,
Original file line number Diff line number Diff line change 19
19
ng-required ="true "
20
20
ng-model ="item.name ">
21
21
</ 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 >
23
23
< ng-include src ="'/app/Aisel/Kernel/views/edit/field/locale.html' "> </ ng-include >
24
24
< ng-include src ="'/app/Aisel/Kernel/views/edit/field/status.html' "> </ ng-include >
25
25
</ div >
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ class Menu extends BaseNode
33
33
* @ORM\ManyToOne(targetEntity="Aisel\NavigationBundle\Entity\Menu", inversedBy="children")
34
34
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
35
35
* @JMS\Expose
36
- * @JMS\MaxDepth(1 )
36
+ * @JMS\MaxDepth(2 )
37
37
* @JMS\Type("Aisel\NavigationBundle\Entity\Menu")
38
38
* @JMS\Groups({"collection","details"})
39
39
*/
@@ -43,7 +43,7 @@ class Menu extends BaseNode
43
43
* @ORM\OneToMany(targetEntity="Aisel\NavigationBundle\Entity\Menu", mappedBy="parent")
44
44
* @ORM\OrderBy({"name" = "ASC"})
45
45
* @JMS\Expose
46
- * @JMS\MaxDepth(1 )
46
+ * @JMS\MaxDepth(2 )
47
47
* @JMS\Type("ArrayCollection<Aisel\NavigationBundle\Entity\Menu>")
48
48
* @JMS\Groups({"collection","details"})
49
49
*/
Original file line number Diff line number Diff line change @@ -109,7 +109,12 @@ public function getChildren()
109
109
*/
110
110
public function setParent ($ parent = null )
111
111
{
112
+ if ($ this ->parent ) {
113
+ $ this ->parent ->removeChild ($ this );
114
+ }
115
+
112
116
$ this ->parent = $ parent ;
117
+ $ this ->parent ->addChild ($ this );
113
118
114
119
return $ this ;
115
120
}
You can’t perform that action at this time.
0 commit comments