Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
ulakbus-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ulakbus
ulakbus-ui
Commits
249c92e4
Commit
249c92e4
authored
Nov 06, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'route_fixes'
parents
ed7dbd75
3e2708ab
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
121 additions
and
31 deletions
+121
-31
app.css
app/app.css
+1
-0
app_routes.js
app/app_routes.js
+27
-7
crud_controller.js
app/components/crud/crud_controller.js
+26
-11
list.html
app/components/crud/templates/list.html
+7
-7
directives.js
app/shared/directives.js
+15
-0
sidebar.html
app/shared/templates/directives/sidebar.html
+12
-6
form_service.js
app/zetalib/forms/form_service.js
+33
-0
No files found.
app/app.css
View file @
249c92e4
...
@@ -492,6 +492,7 @@ select {
...
@@ -492,6 +492,7 @@ select {
.sidebar
.nav-third-level
li
a
{
.sidebar
.nav-third-level
li
a
{
padding-left
:
52px
;
padding-left
:
52px
;
font-size
:
12px
;
}
}
.sidebar-person-info
{
.sidebar-person-info
{
...
...
app/app_routes.js
View file @
249c92e4
...
@@ -10,22 +10,42 @@ app.config(['$routeProvider', function ($routeProvider, $route) {
...
@@ -10,22 +10,42 @@ app.config(['$routeProvider', function ($routeProvider, $route) {
templateUrl
:
'components/dashboard/dashboard.html'
,
templateUrl
:
'components/dashboard/dashboard.html'
,
controller
:
'DashCtrl'
controller
:
'DashCtrl'
})
})
.
when
(
'/crud/add/:model/:param/:id'
,
{
//.when('/crud/:model/:param/:id/add', {
// templateUrl: 'components/crud/templates/add.html',
// controller: 'CRUDAddEditCtrl'
//})
//.when('/crud/:model/:param/:id/edit/:key', {
// templateUrl: 'components/crud/templates/add.html',
// controller: 'CRUDAddEditCtrl'
//})
//.when('/crud/:model/:param/:id/list', {
// templateUrl: 'components/crud/templates/list.html',
// controller: 'CRUDListCtrl'
//})
//.when('/crud/:model/:param/:id/detail/:key', {
// templateUrl: 'components/crud/templates/show.html',
// controller: 'CRUDShowCtrl'
//})
// use crud without selected user
.
when
(
'/crud/:model/list'
,
{
templateUrl
:
'components/crud/templates/list.html'
,
controller
:
'CRUDListCtrl'
})
.
when
(
'/crud/:model/add'
,
{
templateUrl
:
'components/crud/templates/add.html'
,
templateUrl
:
'components/crud/templates/add.html'
,
controller
:
'CRUDAddEditCtrl'
controller
:
'CRUDAddEditCtrl'
})
})
.
when
(
'/crud/
edit/:model/:param/:id
/:key'
,
{
.
when
(
'/crud/
:model/edit
/:key'
,
{
templateUrl
:
'components/crud/templates/add.html'
,
templateUrl
:
'components/crud/templates/add.html'
,
controller
:
'CRUDAddEditCtrl'
controller
:
'CRUDAddEditCtrl'
})
})
.
when
(
'/crud/:model/:param/:id'
,
{
.
when
(
'/crud/:model/detail/:key'
,
{
templateUrl
:
'components/crud/templates/list.html'
,
controller
:
'CRUDListCtrl'
})
.
when
(
'/crud/detail/:model/:param/:id/:key'
,
{
templateUrl
:
'components/crud/templates/show.html'
,
templateUrl
:
'components/crud/templates/show.html'
,
controller
:
'CRUDShowCtrl'
controller
:
'CRUDShowCtrl'
})
})
// wf links just need model
.
when
(
'/:model/'
,
{
.
when
(
'/:model/'
,
{
templateUrl
:
'components/wf/templates/add.html'
,
templateUrl
:
'components/wf/templates/add.html'
,
controller
:
'WFAddEditCtrl'
controller
:
'WFAddEditCtrl'
...
...
app/components/crud/crud_controller.js
View file @
249c92e4
...
@@ -7,10 +7,8 @@
...
@@ -7,10 +7,8 @@
'use strict'
;
'use strict'
;
var
crud
=
angular
.
module
(
'ulakbus.crud'
,
[
'ui.bootstrap'
,
'schemaForm'
,
'formService'
]);
var
crud
=
angular
.
module
(
'ulakbus.crud'
,
[
'ui.bootstrap'
,
'schemaForm'
,
'formService'
]);
/**
/**
* CRUDAddEditCtrl is a controller
* CRUDAddEditCtrl is a controller
* which provide a form with form generator.
* which provide a form with form generator.
...
@@ -18,7 +16,14 @@ var crud = angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formSe
...
@@ -18,7 +16,14 @@ var crud = angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formSe
crud
.
controller
(
'CRUDAddEditCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$modal
,
$timeout
,
Generator
,
$routeParams
)
{
crud
.
controller
(
'CRUDAddEditCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$modal
,
$timeout
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'crud/'
;
$scope
.
url
=
'crud/'
;
$scope
.
form_params
=
{
'model'
:
$routeParams
.
model
,
param
:
$routeParams
.
param
,
id
:
$routeParams
.
id
};
angular
.
forEach
(
$routeParams
,
function
(
value
,
key
)
{
if
(
key
.
indexOf
(
'_id'
)
>
-
1
)
{
$scope
.
param
=
key
;
$scope
.
param_id
=
value
;
}
});
$scope
.
form_params
=
{
'model'
:
$routeParams
.
model
,
param
:
$scope
.
param
,
id
:
$scope
.
param_id
};
if
(
$routeParams
.
key
)
{
if
(
$routeParams
.
key
)
{
$scope
.
form_params
[
'object_id'
]
=
$routeParams
.
key
;
$scope
.
form_params
[
'object_id'
]
=
$routeParams
.
key
;
$scope
.
form_params
[
'cmd'
]
=
'edit'
;
$scope
.
form_params
[
'cmd'
]
=
'edit'
;
...
@@ -56,7 +61,14 @@ crud.controller('CRUDAddEditCtrl', function ($scope, $rootScope, $location, $htt
...
@@ -56,7 +61,14 @@ crud.controller('CRUDAddEditCtrl', function ($scope, $rootScope, $location, $htt
crud
.
controller
(
'CRUDListCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
crud
.
controller
(
'CRUDListCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'crud/'
;
$scope
.
url
=
'crud/'
;
$scope
.
form_params
=
$routeParams
;
angular
.
forEach
(
$routeParams
,
function
(
value
,
key
)
{
if
(
key
.
indexOf
(
'_id'
)
>
-
1
)
{
$scope
.
param
=
key
;
$scope
.
param_id
=
value
;
}
});
//$scope.form_params = $routeParams;
$scope
.
form_params
=
{
'model'
:
$routeParams
.
model
,
param
:
$scope
.
param
,
id
:
$scope
.
param_id
};
if
(
$routeParams
.
nobjects
)
{
if
(
$routeParams
.
nobjects
)
{
$scope
.
nobjects
=
$routeParams
.
nobjects
;
$scope
.
nobjects
=
$routeParams
.
nobjects
;
...
@@ -76,19 +88,23 @@ crud.controller('CRUDListCtrl', function ($scope, $rootScope, Generator, $routeP
...
@@ -76,19 +88,23 @@ crud.controller('CRUDListCtrl', function ($scope, $rootScope, Generator, $routeP
*/
*/
crud
.
controller
(
'CRUDShowCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
Generator
,
$routeParams
)
{
crud
.
controller
(
'CRUDShowCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'crud/'
;
$scope
.
url
=
'crud/'
;
angular
.
forEach
(
$routeParams
,
function
(
value
,
key
)
{
if
(
key
.
indexOf
(
'_id'
)
>
-
1
)
{
$scope
.
param
=
key
;
$scope
.
param_id
=
value
;
}
});
$scope
.
form_params
=
{
$scope
.
form_params
=
{
"id"
:
$
routeParams
.
id
,
"id"
:
$
scope
.
param_
id
,
"object_id"
:
$routeParams
.
key
,
"object_id"
:
$routeParams
.
key
,
"cmd"
:
"show"
,
"cmd"
:
"show"
,
param
:
$
routeParams
.
param
,
param
:
$
scope
.
param
,
"model"
:
$routeParams
.
model
"model"
:
$routeParams
.
model
};
};
// call generator's get_single_item func
// call generator's get_single_item func
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
)
{
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
)
{
// if no data to show redirect to add/edit view
//if (res.data.nobjects[0] === "-1") {
// $location.path('crud/' + $scope.form_params.model + '/' + $scope.form_params.param + '/' + $scope.form_params.id + '/edit');
//}
$scope
.
listobjects
=
{};
$scope
.
listobjects
=
{};
$scope
.
object
=
res
.
data
.
object
;
$scope
.
object
=
res
.
data
.
object
;
...
@@ -99,7 +115,6 @@ crud.controller('CRUDShowCtrl', function ($scope, $rootScope, $location, Generat
...
@@ -99,7 +115,6 @@ crud.controller('CRUDShowCtrl', function ($scope, $rootScope, $location, Generat
}
}
});
});
$scope
.
model
=
$routeParams
.
model
;
$scope
.
model
=
$routeParams
.
model
;
});
});
});
});
\ No newline at end of file
app/components/crud/templates/list.html
View file @
249c92e4
<div
class=
"starter-template"
>
<div
class=
"starter-template"
>
<h1>
{{model}}
<h1>
{{model}}
<a
href=
"
#/crud/add/{{model}}/{{form_params.param}}/{{form_params.id
}}"
>
<a
href=
"
{{nobjects.addLink
}}"
>
<button
type=
"button"
class=
"btn btn-primary"
>
Ekle
</button>
<button
type=
"button"
class=
"btn btn-primary"
>
Ekle
</button>
</a>
</a>
</h1>
</h1>
...
@@ -32,17 +32,17 @@
...
@@ -32,17 +32,17 @@
</label>
</label>
</td>
</td>
<th
scope=
"row"
style=
"text-align:center"
>
{{$index}}
</th>
<th
scope=
"row"
style=
"text-align:center"
>
{{$index}}
</th>
<td
ng-repeat=
"k in object track by $index"
ng-if=
"nobjects[0]=='-1' && $index>0"
>
<!-- below 2 of object will not be listed there for ng repeat loops 2 less -->
<a
ng-href=
"#/crud/detail/{{model}}/{{form_params.param}}/{{form_params.id}}/{{object[0]}}"
>
{{object[1]}}
</a>
<td
ng-repeat=
"k in object track by $index"
ng-if=
"nobjects[0]=='-1' && $index>1"
>
<a
ng-href=
"{{object[2].detailLink}}"
>
{{object[1]}}
</a>
</td>
</td>
<td
ng-repeat=
"(key,value) in object track by $index"
ng-if=
"nobjects[0]!='-1' && $index>0"
>
<td
ng-repeat=
"(key,value) in object track by $index"
ng-if=
"nobjects[0]!='-1' && $index>1"
>
<a
ng-href=
"#/crud/detail/{{model}}/{{form_params.param}}/{{form_params.id}}/{{object[0]}}"
<a
ng-href=
"{{object[2].detailLink}}"
ng-if=
"$index==1"
>
{{object[key]}}
</a>
ng-if=
"$index==1"
>
{{object[key]}}
</a>
<span
ng-if=
"$index!=1"
>
{{object[key]}}
</span>
<span
ng-if=
"$index!=1"
>
{{object[key]}}
</span>
</td>
</td>
<td>
<td>
<a
ng-href=
"
#/crud/edit/{{model}}/{{form_params.param}}/{{form_params.id}}/{{object[0]
}}"
>
Edit
</a>
<a
ng-href=
"
{{object[2].editLink
}}"
>
Edit
</a>
<br>
<br>
</td>
</td>
</tr>
</tr>
...
...
app/shared/directives.js
View file @
249c92e4
...
@@ -183,6 +183,21 @@ app.directive('sidebar', ['$location', function () {
...
@@ -183,6 +183,21 @@ app.directive('sidebar', ['$location', function () {
.
success
(
function
(
data
)
{
.
success
(
function
(
data
)
{
$scope
.
allMenuItems
=
angular
.
copy
(
data
);
$scope
.
allMenuItems
=
angular
.
copy
(
data
);
function
reGroupMenuItems
(
items
)
{
var
newItems
=
{};
angular
.
forEach
(
items
,
function
(
value
,
key
)
{
newItems
[
value
.
kategori
]
=
newItems
[
value
.
kategori
]
||
[];
newItems
[
value
.
kategori
].
push
(
value
);
});
return
newItems
;
}
angular
.
forEach
(
$scope
.
allMenuItems
,
function
(
value
,
key
)
{
$scope
.
allMenuItems
[
key
]
=
reGroupMenuItems
(
value
);
});
console
.
log
(
$scope
.
allMenuItems
);
// broadcast for authorized menu items, consume in dashboard
// broadcast for authorized menu items, consume in dashboard
$rootScope
.
$broadcast
(
"authz"
,
data
);
$rootScope
.
$broadcast
(
"authz"
,
data
);
...
...
app/shared/templates/directives/sidebar.html
View file @
249c92e4
...
@@ -23,14 +23,20 @@
...
@@ -23,14 +23,20 @@
<span
class=
"fa arrow"
ng-class=
"{hidden: $root.collapsed}"
></span>
<span
class=
"fa arrow"
ng-class=
"{hidden: $root.collapsed}"
></span>
</a>
</a>
<ul
class=
"nav nav-second-level"
ng-class=
"{hidden: $root.collapsed}"
>
<ul
class=
"nav nav-second-level"
ng-class=
"{hidden: $root.collapsed}"
>
<li
ng-repeat=
"v in item"
>
<li
ng-repeat=
"(key2, item2) in item"
>
<a
href=
"#"
>
{{key2}}
<span
class=
"fa arrow"
></span></a>
<ul
class=
"nav nav-third-level collapse in"
aria-expanded=
"true"
>
<li
ng-repeat=
"(k,v) in item2"
>
<a
ng-if=
"key == 'other'"
ng-href=
"#{{v.url}}"
<a
ng-if=
"key == 'other'"
ng-href=
"#{{v.url}}"
ng-click=
"breadcrumb([key, v.text], $event)"
>
{{v.text}}
</a>
ng-click=
"breadcrumb([key, v.text], $event)"
>
{{v.text}}
</a>
<a
ng-if=
"key == 'ogrenci' || key == 'personel'"
<a
ng-if=
"key == 'ogrenci' || key == 'personel'"
ng-href=
"#{{v.url}}/{{v.param}}/
{{$root.selectedUser.key}}"
ng-href=
"#{{v.url}}/list?{{v.param}}=
{{$root.selectedUser.key}}"
ng-click=
"breadcrumb([key, v.text], $event)"
>
{{v.text}}
</a>
ng-click=
"breadcrumb([key, v.text], $event)"
>
{{v.text}}
</a>
</li>
</li>
</ul>
</ul>
<!-- /.nav-third-level -->
</li>
</ul>
<!-- /.nav-second-level -->
<!-- /.nav-second-level -->
</li>
</li>
</ul>
</ul>
...
...
app/zetalib/forms/form_service.js
View file @
249c92e4
...
@@ -213,6 +213,38 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
...
@@ -213,6 +213,38 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
return
newdatearray
.
join
(
'.'
);
return
newdatearray
.
join
(
'.'
);
}
}
};
};
generator
.
itemLinksGenerator
=
function
(
scope
,
itemlist
)
{
angular
.
forEach
(
itemlist
.
data
.
nobjects
,
function
(
value
,
key
)
{
//var detailLink = "#/" + scope.url + "detail/" + scope.form_params.model;
//var addLink = "#/" + scope.url + "add/" + scope.form_params.model;
//var editLink = "#/" + scope.url + "edit/" + scope.form_params.model;
function
makelink
(
page
)
{
if
(
value
===
'-1'
)
{
return
;
}
var
link
=
"#"
+
scope
.
url
+
scope
.
form_params
.
model
;
if
(
page
===
'edit/'
||
page
===
'detail/'
)
{
link
+=
"/"
+
page
+
value
[
0
];
}
if
(
page
===
'add/'
)
{
link
+=
"/add"
;
}
if
(
scope
.
form_params
.
param
)
{
link
+=
"?"
+
scope
.
form_params
.
param
+
"="
+
scope
.
form_params
.
id
;
}
return
link
;
}
itemlist
.
data
.
nobjects
.
addLink
=
makelink
(
"add/"
);
value
[
2
]
=
{
detailLink
:
makelink
(
"detail/"
),
editLink
:
makelink
(
"edit/"
)};
});
};
generator
.
get_form
=
function
(
scope
)
{
generator
.
get_form
=
function
(
scope
)
{
return
$http
return
$http
.
post
(
generator
.
makeUrl
(
scope
),
scope
.
form_params
)
.
post
(
generator
.
makeUrl
(
scope
),
scope
.
form_params
)
...
@@ -225,6 +257,7 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
...
@@ -225,6 +257,7 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
.
get
(
generator
.
makeUrl
(
scope
))
.
get
(
generator
.
makeUrl
(
scope
))
.
then
(
function
(
res
)
{
.
then
(
function
(
res
)
{
//generator.dateformatter(res);
//generator.dateformatter(res);
generator
.
itemLinksGenerator
(
scope
,
res
);
return
res
;
return
res
;
});
});
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment