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
d9338219
Commit
d9338219
authored
Aug 19, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
css files concatenation order fix
parent
a0b04376
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
158 additions
and
18 deletions
+158
-18
Gruntfile.js
Gruntfile.js
+1
-1
index.html
app/index.html
+1
-1
form_service.js
app/zetalib/forms/form_service.js
+155
-16
index.html
index.html
+1
-0
No files found.
Gruntfile.js
View file @
d9338219
...
@@ -77,7 +77,7 @@ module.exports = function (grunt) {
...
@@ -77,7 +77,7 @@ module.exports = function (grunt) {
dest
:
'dist/bower_components/components.js'
dest
:
'dist/bower_components/components.js'
},
},
css
:
{
css
:
{
src
:
[
'app/
app.css'
,
'app/bower_components/**/**/*
.css'
],
src
:
[
'app/
bower_components/**/**/*.css'
,
'app/app
.css'
],
dest
:
'dist/app.css'
dest
:
'dist/app.css'
}
}
},
},
...
...
app/index.html
View file @
d9338219
...
@@ -112,7 +112,7 @@
...
@@ -112,7 +112,7 @@
<script
src=
"components/auth/auth_controller.js"
></script>
<script
src=
"components/auth/auth_controller.js"
></script>
<script
src=
"components/auth/auth_service.js"
></script>
<script
src=
"components/auth/auth_service.js"
></script>
<script
src=
"components/dashboard/dashboard.js"
></script>
<script
src=
"components/dashboard/dashboard
_controller
.js"
></script>
<script
src=
"components/staff/staff_controller.js"
></script>
<script
src=
"components/staff/staff_controller.js"
></script>
<script
src=
"components/student/student_controller.js"
></script>
<script
src=
"components/student/student_controller.js"
></script>
<script
src=
"components/dashboard/dashboard.js"
></script>
<script
src=
"components/dashboard/dashboard.js"
></script>
...
...
app/zetalib/forms/form_service.js
View file @
d9338219
...
@@ -5,24 +5,119 @@
...
@@ -5,24 +5,119 @@
* (GPLv3). See LICENSE.txt for details.
* (GPLv3). See LICENSE.txt for details.
*/
*/
var
form_generator
=
angular
.
module
(
'formService'
,
[
'general'
]);
var
form_generator
=
angular
.
module
(
'formService'
,
[
'general'
,
'ui.bootstrap'
]);
form_generator
.
factory
(
'Generator'
,
function
(
$http
,
$q
,
$log
,
$timeout
,
RESTURL
,
FormDiff
)
{
form_generator
.
factory
(
'Generator'
,
function
(
$http
,
$q
,
$log
,
$
modal
,
$
timeout
,
RESTURL
,
FormDiff
)
{
var
generator
=
{};
var
generator
=
{};
generator
.
makeUrl
=
function
(
url
)
{
generator
.
makeUrl
=
function
(
url
)
{
return
RESTURL
.
url
+
url
;
return
RESTURL
.
url
+
url
;
};
};
generator
.
generate
=
function
(
modelObject
)
{
generator
.
generate
=
function
(
scope
,
forms
)
{
return
generator
.
group
(
modelObject
);
for
(
var
key
in
forms
)
scope
[
key
]
=
forms
[
key
];
scope
.
initialModel
=
angular
.
copy
(
scope
.
model
);
//debugger;
scope
.
form
.
push
(
{
type
:
"submit"
,
title
:
"Save"
}
);
// if fieldset in form, make it collapsable with template
scope
.
listnodeform
=
{};
if
((
scope
.
listnode
&&
scope
.
listnodes
[
0
])
||
(
scope
.
listnode
&&
scope
.
nodes
[
0
]))
{
angular
.
forEach
(
scope
.
form
,
function
(
key
,
val
)
{
if
(
typeof
key
==
"object"
&&
key
.
type
==
"fieldset"
)
{
// change type to use shared template for form
key
.
type
=
"template"
;
key
.
templateUrl
=
"shared/templates/fieldset.html"
;
// check if fieldset in listnodes
if
(
scope
.
listnodes
.
indexOf
(
key
.
title
)
>=
0
)
{
scope
.
listnodeform
[
key
.
title
]
=
{};
scope
.
listnodeform
[
key
.
title
][
"schema"
]
=
{
"title"
:
angular
.
copy
(
key
.
title
),
"type"
:
"object"
,
"properties"
:
{},
"required"
:
[]
};
angular
.
forEach
(
scope
.
schema
.
properties
,
function
(
k
,
v
){
angular
.
forEach
(
key
.
items
,
function
(
item
){
if
(
item
.
key
==
v
){
scope
.
listnodeform
[
key
.
title
][
"schema"
][
"properties"
][
v
]
=
angular
.
copy
(
k
);
}
});
});
key
.
setType
=
"ListNode"
;
scope
.
listnodeform
[
key
.
title
][
"form"
]
=
[
angular
.
copy
(
key
)];
scope
.
listnodeform
[
key
.
title
][
"model"
]
=
{};
key
.
type
=
"list"
;
debugger
;
delete
key
.
templateUrl
;
delete
key
.
items
;
}
}
});
}
scope
.
isCollapsed
=
true
;
scope
.
object_id
=
scope
.
form_params
[
'object_id'
];
// open modal with given items and controller
scope
.
openmodal
=
function
(
listnode
,
nodeID
){
var
modalInstance
=
$modal
.
open
({
animation
:
false
,
templateUrl
:
'shared/templates/listnodeModalContent.html'
,
controller
:
'ListNodeModalCtrl'
,
size
:
'lg'
,
resolve
:
{
items
:
function
()
{
if
(
nodeID
){
scope
.
listnodeform
[
listnode
].
model
=
1
;
}
return
scope
.
listnodeform
[
listnode
];
}
}
});
modalInstance
.
result
.
then
(
function
(
childmodel
,
key
)
{
angular
.
forEach
(
childmodel
,
function
(
v
,
k
){
debugger
;
if
(
scope
.
model
[
k
]){
scope
.
model
[
k
][
v
.
idx
]
=
v
;
}
else
{
scope
.
model
[
k
]
=
{};
scope
.
model
[
k
][
v
.
idx
]
=
v
;
}
scope
.
$broadcast
(
'schemaFormRedraw'
);
});
debugger
;
});
};
return
generator
.
group
(
scope
);
};
generator
.
group
=
function
(
formObject
)
{
return
formObject
;
};
};
generator
.
group
=
function
(
form_items
)
{
generator
.
get_form
=
function
(
scope
)
{
return
form_items
;
return
$http
.
post
(
generator
.
makeUrl
(
scope
.
url
),
scope
.
form_params
)
.
then
(
function
(
res
)
{
return
generator
.
generate
(
scope
,
res
.
data
.
forms
);
// todo: cover all other exceptions (4xx, 5xx)
});
};
};
generator
.
get_
form
=
function
(
url
,
getParams
)
{
generator
.
get_
list
=
function
(
scope
)
{
return
$http
return
$http
.
post
(
generator
.
makeUrl
(
url
),
getParams
)
.
post
(
generator
.
makeUrl
(
scope
.
url
),
scope
.
form_params
)
.
success
(
function
(
res
)
{
.
then
(
function
(
res
)
{
return
generator
.
generate
(
res
.
data
);
return
res
;
// todo: cover all other exceptions (4xx, 5xx)
});
};
generator
.
get_single_item
=
function
(
scope
)
{
return
$http
.
post
(
generator
.
makeUrl
(
scope
.
url
),
scope
.
form_params
)
.
then
(
function
(
res
)
{
return
res
;
// todo: cover all other exceptions (4xx, 5xx)
// todo: cover all other exceptions (4xx, 5xx)
});
});
};
};
...
@@ -57,11 +152,55 @@ form_generator.factory('Generator', function ($http, $q, $log, $timeout, RESTURL
...
@@ -57,11 +152,55 @@ form_generator.factory('Generator', function ($http, $q, $log, $timeout, RESTURL
}
}
return
$http
return
$http
.
post
(
generator
.
makeUrl
(
$scope
.
url
),
data
)
.
post
(
generator
.
makeUrl
(
$scope
.
url
),
data
)
//.then(function (res) {
//.then(function (res) {
// // todo: for now fake rest api returns 'ok' no data to
// // todo: for now fake rest api returns 'ok' no data to
// // manipulate on ui. therefor used just a log
// // manipulate on ui. therefor used just a log
// $log.info(res);
// $log.info(res);
//});
//});
};
};
return
generator
;
return
generator
;
});
});
\ No newline at end of file
/**
* ListNodeModalCtrl
* controller to use with openmodal function of Generator
* @params: $scope, $modalInstance, items
* @returns: return value used in openmodal's result function
*/
form_generator
.
controller
(
'ListNodeModalCtrl'
,
function
(
$scope
,
$modalInstance
,
items
)
{
for
(
var
key
in
items
)
$scope
[
key
]
=
items
[
key
];
$scope
.
onSubmit
=
function
(
form
){
// send form to modalinstance result function
$modalInstance
.
close
(
$scope
.
model
,
$scope
.
form
.
title
);
};
$scope
.
cancel
=
function
()
{
$modalInstance
.
dismiss
(
'cancel'
);
};
});
// todo: generic modal directive for all forms
//form_generator.directive('openmodal', ['Generator', function (Generator, $modal) {
// return {
// link: function ($modal) {
// var modalInstance = $modal.open({
// animation: false,
// templateUrl: 'shared/templates/modalContent.html',
// controller: 'ModalInstanceCtrl',
// size: 'lg',
// resolve: {
// items: function () {
// return "";
// }
// }
// });
//
// modalInstance.result.then(function (selectedItem) {
// $scope.selected = selectedItem;
// }, function () {
// $log.info('Modal dismissed at: ' + new Date());
// });
// }
// }
//}]);
\ No newline at end of file
index.html
View file @
d9338219
...
@@ -103,6 +103,7 @@
...
@@ -103,6 +103,7 @@
<script
src=
"bower_components/angular-schema-form-datepicker/bootstrap-datepicker.js"
></script>
<script
src=
"bower_components/angular-schema-form-datepicker/bootstrap-datepicker.js"
></script>
<script
src=
"bower_components/angular-gettext/dist/angular-gettext.min.js"
></script>
<script
src=
"bower_components/angular-gettext/dist/angular-gettext.min.js"
></script>
<script
src=
"shared/translations.js"
></script>
<script
src=
"shared/translations.js"
></script>
<script
src=
"../tmp/templates.js"
></script>
<script
src=
"app.js"
></script>
<script
src=
"app.js"
></script>
<script
src=
"app_routes.js"
></script>
<script
src=
"app_routes.js"
></script>
...
...
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