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
866ae95e
Commit
866ae95e
authored
Nov 10, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
version 0.4.2
CHANGELOG crud sub page links bug fixes
parent
be981d93
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
14 deletions
+44
-14
VERSION
VERSION
+1
-1
crud_controller.js
app/components/crud/crud_controller.js
+2
-2
list.html
app/components/crud/templates/list.html
+1
-1
form_service.js
app/zetalib/forms/form_service.js
+40
-10
No files found.
VERSION
View file @
866ae95e
0.4.1
0.4.2
\ No newline at end of file
\ No newline at end of file
app/components/crud/crud_controller.js
View file @
866ae95e
...
@@ -43,7 +43,6 @@ crud.controller('CRUDAddEditCtrl', function ($scope, $rootScope, $location, $htt
...
@@ -43,7 +43,6 @@ 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
+
'/'
+
$scope
.
form_params
.
param
+
'/'
+
$scope
.
form_params
.
id
).
search
(
data
);
})
})
.
error
(
function
(
data
)
{
.
error
(
function
(
data
)
{
...
@@ -67,18 +66,19 @@ crud.controller('CRUDListCtrl', function ($scope, $rootScope, Generator, $routeP
...
@@ -67,18 +66,19 @@ crud.controller('CRUDListCtrl', function ($scope, $rootScope, Generator, $routeP
$scope
.
param_id
=
value
;
$scope
.
param_id
=
value
;
}
}
});
});
//$scope.form_params = $routeParams;
$scope
.
form_params
=
{
'model'
:
$routeParams
.
model
,
param
:
$scope
.
param
,
id
:
$scope
.
param_id
};
$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
;
$scope
.
model
=
$routeParams
.
model
;
$scope
.
model
=
$routeParams
.
model
;
$scope
.
addLink
=
$routeParams
.
addLink
;
}
else
{
}
else
{
// call generator's get_list func
// call generator's get_list func
Generator
.
get_list
(
$scope
)
Generator
.
get_list
(
$scope
)
.
then
(
function
(
res
)
{
.
then
(
function
(
res
)
{
$scope
.
nobjects
=
res
.
data
.
nobjects
;
$scope
.
nobjects
=
res
.
data
.
nobjects
;
$scope
.
model
=
$routeParams
.
model
;
$scope
.
model
=
$routeParams
.
model
;
$scope
.
addLink
=
res
.
data
.
addLink
;
});
});
}
}
});
});
...
...
app/components/crud/templates/list.html
View file @
866ae95e
<div
class=
"starter-template"
>
<div
class=
"starter-template"
>
<h1>
{{model}}
<h1>
{{model}}
<a
href=
"{{
nobjects.
addLink}}"
>
<a
href=
"{{addLink}}"
>
<button
type=
"button"
class=
"btn btn-primary"
>
Ekle
</button>
<button
type=
"button"
class=
"btn btn-primary"
>
Ekle
</button>
</a>
</a>
</h1>
</h1>
...
...
app/zetalib/forms/form_service.js
View file @
866ae95e
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
var
form_generator
=
angular
.
module
(
'formService'
,
[
'general'
]);
var
form_generator
=
angular
.
module
(
'formService'
,
[
'general'
]);
form_generator
.
factory
(
'Generator'
,
function
(
$http
,
$q
,
$timeout
,
RESTURL
,
FormDiff
,
$rootScope
)
{
form_generator
.
factory
(
'Generator'
,
function
(
$http
,
$q
,
$timeout
,
$location
,
RESTURL
,
FormDiff
,
$rootScope
)
{
var
generator
=
{};
var
generator
=
{};
generator
.
makeUrl
=
function
(
scope
)
{
generator
.
makeUrl
=
function
(
scope
)
{
var
getparams
=
scope
.
form_params
.
param
?
"?"
+
scope
.
form_params
.
param
+
"="
+
scope
.
form_params
.
id
:
""
;
var
getparams
=
scope
.
form_params
.
param
?
"?"
+
scope
.
form_params
.
param
+
"="
+
scope
.
form_params
.
id
:
""
;
...
@@ -51,6 +51,13 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
...
@@ -51,6 +51,13 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
/**
/**
* prepareforms checks input types and convert if necessary
* prepareforms checks input types and convert if necessary
*/
*/
//delete scope.form[7];
//scope.schema.properties.ulke.type = 'select';
//scope.schema.properties.ulke.titleMap = scope.form[7].titleMap;
//scope.schema.properties.ulke.replace = true;
//scope.form[7] = {key: "ulke", title: "Ulke"};
//scope.schema.properties.ulke.enum = [1, 2, 3, 4];
//scope.form.push('ulke');
angular
.
forEach
(
scope
.
schema
.
properties
,
function
(
v
,
k
)
{
angular
.
forEach
(
scope
.
schema
.
properties
,
function
(
v
,
k
)
{
// generically change _id fields model value
// generically change _id fields model value
...
@@ -62,11 +69,24 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
...
@@ -62,11 +69,24 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
return
;
return
;
}
}
//if (v.type === 'select') {
// scope.form[scope.form.indexOf(k)] = {
// type: "template",
// title: v.title,
// templateUrl: "shared/templates/select.html",
// name: "ulke",
// model_name: "ulke",
// titleMap: [{name: "belcika", value: 1}, {name: "almanya", value: 2}, {name: "fransa", value: 3}, {name: "fransa1", value: 4}, {name: "fransa2", value: 5}]
// }
//}
if
(
v
.
type
===
'submit'
||
v
.
type
===
'button'
)
{
if
(
v
.
type
===
'submit'
||
v
.
type
===
'button'
)
{
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
{
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
{
type
:
v
.
type
,
type
:
v
.
type
,
title
:
v
.
title
,
title
:
v
.
title
,
onClick
:
function
(){
onClick
:
function
(){
delete
scope
.
form_params
.
cmd
;
if
(
v
.
cmd
)
{
if
(
v
.
cmd
)
{
// todo: cmd property to form_params, test it!
// todo: cmd property to form_params, test it!
scope
.
form_params
[
"cmd"
]
=
v
.
cmd
;
scope
.
form_params
[
"cmd"
]
=
v
.
cmd
;
...
@@ -198,11 +218,8 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
...
@@ -198,11 +218,8 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
scope
[
v
.
type
][
k
][
'lengthModels'
]
=
scope
.
model
[
k
]
?
1
:
0
;
scope
[
v
.
type
][
k
][
'lengthModels'
]
=
scope
.
model
[
k
]
?
1
:
0
;
}
}
});
});
console
.
log
(
scope
.
form
);
return
scope
;
return
scope
;
};
};
generator
.
dateformatter
=
function
(
formObject
)
{
generator
.
dateformatter
=
function
(
formObject
)
{
...
@@ -215,12 +232,12 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
...
@@ -215,12 +232,12 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
}
}
};
};
generator
.
itemLinksGenerator
=
function
(
scope
,
itemlist
)
{
generator
.
itemLinksGenerator
=
function
(
scope
,
itemlist
)
{
angular
.
forEach
(
itemlist
.
data
.
nobjects
,
function
(
value
,
key
)
{
angular
.
forEach
(
itemlist
.
nobjects
,
function
(
value
,
key
)
{
function
makelink
(
page
)
{
function
makelink
(
page
)
{
if
(
value
===
'-1'
)
{
if
(
value
===
'-1'
&&
page
!==
'add/'
)
{
return
;
return
;
}
}
var
link
=
"#"
+
scope
.
url
+
scope
.
form_params
.
model
;
var
link
=
"#"
+
scope
.
url
+
scope
.
form_params
.
model
;
if
(
page
===
'edit/'
||
page
===
'detail/'
)
{
if
(
page
===
'edit/'
||
page
===
'detail/'
)
{
...
@@ -235,7 +252,11 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
...
@@ -235,7 +252,11 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
return
link
;
return
link
;
}
}
itemlist
.
data
.
nobjects
.
addLink
=
makelink
(
"add/"
);
// call add link once
if
(
!
itemlist
.
addLink
)
{
itemlist
.
addLink
=
makelink
(
"add/"
);
}
if
(
value
!==
'-1'
)
{
if
(
value
!==
'-1'
)
{
value
[
2
]
=
{
detailLink
:
makelink
(
"detail/"
),
editLink
:
makelink
(
"edit/"
)};
value
[
2
]
=
{
detailLink
:
makelink
(
"detail/"
),
editLink
:
makelink
(
"edit/"
)};
}
}
...
@@ -253,7 +274,7 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
...
@@ -253,7 +274,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
);
generator
.
itemLinksGenerator
(
scope
,
res
.
data
);
return
res
;
return
res
;
});
});
};
};
...
@@ -312,7 +333,7 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
...
@@ -312,7 +333,7 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
var
data
=
{
var
data
=
{
"form"
:
$scope
.
model
,
"form"
:
$scope
.
model
,
"cmd"
:
$scope
.
form_params
.
cmd
,
"cmd"
:
$scope
.
form_params
.
cmd
,
//
"subcmd": "do_list",
"subcmd"
:
"do_list"
,
"model"
:
$scope
.
form_params
.
model
,
"model"
:
$scope
.
form_params
.
model
,
"token"
:
$scope
.
token
"token"
:
$scope
.
token
};
};
...
@@ -329,6 +350,15 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
...
@@ -329,6 +350,15 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
generator
.
generate
(
$scope
,
data
);
generator
.
generate
(
$scope
,
data
);
$scope
.
$broadcast
(
'schemaFormRedraw'
)
$scope
.
$broadcast
(
'schemaFormRedraw'
)
}
}
// if submit returns nobjects after save
if
(
data
.
nobjects
)
{
generator
.
itemLinksGenerator
(
$scope
,
data
);
data
[
$scope
.
form_params
.
param
]
=
$scope
.
form_params
.
id
;
$location
.
path
(
'/crud/'
+
$scope
.
form_params
.
model
+
'/list'
).
search
(
angular
.
fromJson
(
data
));
}
});
});
};
};
return
generator
;
return
generator
;
...
...
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