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
d136b928
Commit
d136b928
authored
Nov 03, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crud views edit according to new structure of api
parent
012529d5
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
108 additions
and
87 deletions
+108
-87
app_routes.js
app/app_routes.js
+11
-15
crud_controller.js
app/components/crud/crud_controller.js
+22
-12
add.html
app/components/crud/templates/add.html
+1
-1
list.html
app/components/crud/templates/list.html
+9
-4
directives.js
app/shared/directives.js
+0
-1
sidebar.html
app/shared/templates/directives/sidebar.html
+4
-1
form_service.js
app/zetalib/forms/form_service.js
+61
-53
No files found.
app/app_routes.js
View file @
d136b928
...
@@ -10,29 +10,25 @@ app.config(['$routeProvider', function ($routeProvider, $route) {
...
@@ -10,29 +10,25 @@ app.config(['$routeProvider', function ($routeProvider, $route) {
templateUrl
:
'components/dashboard/dashboard.html'
,
templateUrl
:
'components/dashboard/dashboard.html'
,
controller
:
'DashCtrl'
controller
:
'DashCtrl'
})
})
.
when
(
'/crud/
:model
/:id'
,
{
.
when
(
'/crud/
add/:model/:param
/:id'
,
{
templateUrl
:
'components/crud/templates/add.html'
,
templateUrl
:
'components/crud/templates/add.html'
,
controller
:
'CRUDAddEditCtrl'
,
controller
:
'CRUDAddEditCtrl'
reloadOnSearch
:
true
})
})
.
when
(
'/crud/edit/:model/:param/:id/:key'
,
{
//.when('/crud/:model/edit/:id', {
templateUrl
:
'components/crud/templates/add.html'
,
// templateUrl: 'components/crud/templates/add.html',
controller
:
'CRUDAddEditCtrl'
// controller: 'CRUDAddEditCtrl'
//})
.
when
(
'/crud/:model'
,
{
templateUrl
:
'components/crud/templates/list.html'
,
controller
:
'CRUDListCtrl'
,
reloadOnSearch
:
true
})
})
.
when
(
'/crud/:model/:param/:id'
,
{
.
when
(
'/crud/:model/:param/:id'
,
{
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'
reloadOnSearch
:
true
})
})
.
when
(
'/:model/'
,
{
.
when
(
'/:model/'
,
{
templateUrl
:
'components/wf/templates/add.html'
,
templateUrl
:
'components/wf/templates/add.html'
,
controller
:
'WFAddEditCtrl'
,
controller
:
'WFAddEditCtrl'
reloadOnSearch
:
true
})
})
.
otherwise
({
redirectTo
:
'/dashboard'
});
.
otherwise
({
redirectTo
:
'/dashboard'
});
}])
}])
...
...
app/components/crud/crud_controller.js
View file @
d136b928
...
@@ -17,10 +17,10 @@ var crud = angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formSe
...
@@ -17,10 +17,10 @@ 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
};
$scope
.
form_params
=
{
'model'
:
$routeParams
.
model
,
param
:
$routeParams
.
param
,
id
:
$routeParams
.
id
};
if
(
$routeParams
.
id
)
{
if
(
$routeParams
.
key
)
{
$scope
.
form_params
[
'
object_id'
]
=
$routeParams
.
id
;
$scope
.
form_params
[
'
key'
]
=
$routeParams
.
key
;
$scope
.
form_params
[
'cmd'
]
=
'edit'
;
$scope
.
form_params
[
'cmd'
]
=
'edit'
;
}
}
else
{
else
{
...
@@ -37,10 +37,10 @@ crud.controller('CRUDAddEditCtrl', function ($scope, $rootScope, $location, $htt
...
@@ -37,10 +37,10 @@ crud.controller('CRUDAddEditCtrl', function ($scope, $rootScope, $location, $htt
if
(
form
.
$valid
)
{
if
(
form
.
$valid
)
{
Generator
.
submit
(
$scope
)
Generator
.
submit
(
$scope
)
.
success
(
function
(
data
)
{
.
success
(
function
(
data
)
{
$location
.
path
(
'/crud/'
+
$scope
.
form_params
.
model
).
search
(
data
);
$location
.
path
(
'/crud/'
+
$scope
.
form_params
.
model
).
search
(
data
);
})
})
.
error
(
function
(
data
)
{
.
error
(
function
(
data
)
{
$scope
.
message
=
data
.
title
;
$scope
.
message
=
data
.
title
;
});
});
}
}
...
@@ -56,7 +56,7 @@ crud.controller('CRUDListCtrl', function ($scope, $rootScope, Generator, $routeP
...
@@ -56,7 +56,7 @@ crud.controller('CRUDListCtrl', function ($scope, $rootScope, Generator, $routeP
$scope
.
url
=
'crud/'
;
$scope
.
url
=
'crud/'
;
$scope
.
form_params
=
$routeParams
;
$scope
.
form_params
=
$routeParams
;
if
(
$routeParams
.
nobjects
){
if
(
$routeParams
.
nobjects
)
{
$scope
.
nobjects
=
$routeParams
.
nobjects
;
$scope
.
nobjects
=
$routeParams
.
nobjects
;
$scope
.
model
=
$routeParams
.
model
;
$scope
.
model
=
$routeParams
.
model
;
}
else
{
}
else
{
...
@@ -72,16 +72,26 @@ crud.controller('CRUDListCtrl', function ($scope, $rootScope, Generator, $routeP
...
@@ -72,16 +72,26 @@ crud.controller('CRUDListCtrl', function ($scope, $rootScope, Generator, $routeP
/**
/**
* CRUD Show Controller
* CRUD Show Controller
*/
*/
crud
.
controller
(
'CRUDShowCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
crud
.
controller
(
'CRUDShowCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'crud/'
;
$scope
.
url
=
'crud/'
;
$scope
.
form_params
=
{
"object_id"
:
$routeParams
.
id
,
"cmd"
:
"show"
,
"model"
:
$routeParams
.
model
};
$scope
.
form_params
=
{
// call generator's get_single_itemfunc
"object_id"
:
$routeParams
.
id
,
"cmd"
:
"show"
,
param
:
$routeParams
.
param
,
"model"
:
$routeParams
.
model
};
// call generator's get_single_item func
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
)
{
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
)
{
console
.
log
(
res
.
data
.
nobjects
);
// 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
.
object_id
+
'/edit'
);
}
$scope
.
listobjects
=
{};
$scope
.
listobjects
=
{};
$scope
.
object
=
res
.
data
.
object
;
$scope
.
object
=
res
.
data
.
object
;
angular
.
forEach
(
$scope
.
object
,
function
(
value
,
key
)
{
angular
.
forEach
(
$scope
.
object
,
function
(
value
,
key
)
{
if
(
typeof
value
==
'object'
)
{
if
(
typeof
value
==
'object'
)
{
$scope
.
listobjects
[
key
]
=
value
;
$scope
.
listobjects
[
key
]
=
value
;
delete
$scope
.
object
[
key
];
delete
$scope
.
object
[
key
];
}
}
...
...
app/components/crud/templates/add.html
View file @
d136b928
<h1>
{{ schema.title }}
</h1>
<h1>
{{ schema.title }}
</h1>
<form
id=
"formgenerated"
name=
"formgenerated"
sf-schema=
"schema"
sf-form=
"form"
sf-model=
"model"
></form>
<form
id=
"formgenerated"
name=
"formgenerated"
sf-schema=
"schema"
sf-form=
"form"
sf-model=
"model"
ng-submit=
"onSubmit(formgenerated)"
></form>
<div
ng-repeat=
"node in Node"
>
<div
ng-repeat=
"node in Node"
>
<h3>
{{ node.title }}
<h3>
{{ node.title }}
...
...
app/components/crud/templates/list.html
View file @
d136b928
<div
class=
"starter-template"
>
<div
class=
"starter-template"
>
<h1>
{{model}}
<a
href=
"#/crud/{{model}}/add"
><button
type=
"button"
class=
"btn btn-primary"
>
Ekle
</button></a></h1>
<h1>
{{model}}
<a
href=
"#/crud/add/{{model}}/{{form_params.param}}/{{form_params.id}}"
>
<button
type=
"button"
class=
"btn btn-primary"
>
Ekle
</button>
</a>
</h1>
<div
class=
"row"
ng-if=
"!nobjects[1]"
>
<div
class=
"row"
ng-if=
"!nobjects[1]"
>
<div
class=
"col-md-12"
>
<div
class=
"col-md-12"
>
<p
class=
"no-content"
>
Listelenecek içerik yok.
</p>
<p
class=
"no-content"
>
Listelenecek içerik yok.
</p>
...
@@ -29,15 +33,16 @@
...
@@ -29,15 +33,16 @@
</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"
>
<td
ng-repeat=
"k in object track by $index"
ng-if=
"nobjects[0]=='-1' && $index>0"
>
<a
ng-href=
"#/crud/
{{model}}/
{{object[0]}}"
>
{{object[1]}}
</a>
<a
ng-href=
"#/crud/
edit/{{model}}/{{form_params.param}}/{{form_params.id}}
{{object[0]}}"
>
{{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>0"
>
<a
ng-href=
"#/crud/
{{model}}/
{{object[0]}}"
ng-if=
"$index==1"
>
{{object[key]}}
</a>
<a
ng-href=
"#/crud/
edit/{{model}}/{{form_params.param}}/{{form_params.id}}
{{object[0]}}"
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/{{model}}/edit/{{object[0]}}"
>
Edit
</a><br>
<a
ng-href=
"#/crud/edit/{{model}}/{{form_params.param}}/{{form_params.id}}{{object[0]}}"
>
Edit
</a>
<br>
</td>
</td>
</tr>
</tr>
</tbody>
</tbody>
...
...
app/shared/directives.js
View file @
d136b928
...
@@ -43,7 +43,6 @@ app.directive('headerNotification', function ($http, $rootScope, $interval, REST
...
@@ -43,7 +43,6 @@ app.directive('headerNotification', function ($http, $rootScope, $interval, REST
$scope
.
notifications
[
value
.
type
].
push
(
value
);
$scope
.
notifications
[
value
.
type
].
push
(
value
);
});
});
$rootScope
.
$broadcast
(
"notifications"
,
$scope
.
notifications
);
$rootScope
.
$broadcast
(
"notifications"
,
$scope
.
notifications
);
console
.
log
(
$scope
.
notifications
);
});
});
},
5000
);
},
5000
);
}
}
...
...
app/shared/templates/directives/sidebar.html
View file @
d136b928
...
@@ -24,7 +24,10 @@
...
@@ -24,7 +24,10 @@
</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=
"v in item"
>
<a
ng-href=
"#{{v.url}}{{$root.selectedUser.key}}"
<a
ng-if=
"key == 'other'"
ng-href=
"#{{v.url}}/{{$root.selectedUser.key}}"
ng-click=
"breadcrumb([key, v.text], $event)"
>
{{v.text}}
</a>
<a
ng-if=
"key == 'ogrenci' || key == 'personel'"
ng-href=
"#{{v.url}}{{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>
...
...
app/zetalib/forms/form_service.js
View file @
d136b928
This diff is collapsed.
Click to expand it.
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