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
4758b51e
Commit
4758b51e
authored
Aug 31, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crud views fulfill these tasks; list, add, show
edit is to be fixed grunt dev will not start server (for dev reasons)
parent
02894d54
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
209 additions
and
68 deletions
+209
-68
Gruntfile.js
Gruntfile.js
+7
-2
app.js
app/app.js
+3
-1
app_routes.js
app/app_routes.js
+12
-12
crud_controller.js
app/components/crud/crud_controller.js
+83
-0
crud_controller_test.js
app/components/crud/crud_controller_test.js
+35
-0
add.html
app/components/crud/templates/add.html
+3
-0
edit.html
app/components/crud/templates/edit.html
+6
-0
list.html
app/components/crud/templates/list.html
+19
-0
show.html
app/components/crud/templates/show.html
+1
-0
version.js
app/components/version/version.js
+1
-1
index.html
app/index.html
+2
-0
directives.js
app/shared/directives.js
+8
-1
sidebar.html
app/shared/templates/directives/sidebar.html
+18
-41
form_service.js
app/zetalib/forms/form_service.js
+9
-10
index.html
index.html
+2
-0
No files found.
Gruntfile.js
View file @
4758b51e
...
@@ -62,6 +62,10 @@ module.exports = function (grunt) {
...
@@ -62,6 +62,10 @@ module.exports = function (grunt) {
prod_branch
:
{
prod_branch
:
{
src
:
[
'app/components/**/*.html'
],
src
:
[
'app/components/**/*.html'
],
dest
:
'dist/<%= grunt.branchname %>/templates.js'
dest
:
'dist/<%= grunt.branchname %>/templates.js'
},
dev
:
{
src
:
[
'app/components/**/*.html'
,
'app/shared/templates/**/*.html'
],
dest
:
'tmp/templates.js'
}
}
},
},
copy
:
{
copy
:
{
...
@@ -175,7 +179,7 @@ module.exports = function (grunt) {
...
@@ -175,7 +179,7 @@ module.exports = function (grunt) {
watch
:
{
watch
:
{
dev
:
{
dev
:
{
files
:
[
'app/**/*.js'
,
'app/components/**/*.html'
,
'index.html'
],
files
:
[
'app/**/*.js'
,
'app/components/**/*.html'
,
'index.html'
],
tasks
:
[
'env:dev'
,
'preprocess:dev'
,
'
karma:unit
'
],
tasks
:
[
'env:dev'
,
'preprocess:dev'
,
'
html2js:dev
'
],
options
:
{
options
:
{
atBegin
:
false
atBegin
:
false
}
}
...
@@ -275,7 +279,8 @@ module.exports = function (grunt) {
...
@@ -275,7 +279,8 @@ module.exports = function (grunt) {
grunt
.
loadNpmTasks
(
'grunt-preprocess'
);
grunt
.
loadNpmTasks
(
'grunt-preprocess'
);
grunt
.
loadNpmTasks
(
'grunt-env'
);
grunt
.
loadNpmTasks
(
'grunt-env'
);
grunt
.
registerTask
(
'dev'
,
[
'env:dev'
,
'preprocess:dev'
,
'connect:server'
,
'watch:dev'
]);
//grunt.registerTask('dev', ['env:dev', 'preprocess:dev', 'html2js:dev', 'connect:server', 'watch:dev']);
grunt
.
registerTask
(
'dev'
,
[
'env:dev'
,
'preprocess:dev'
,
'html2js:dev'
,
'watch:dev'
]);
grunt
.
registerTask
(
'test'
,
[
'bower'
,
'karma:continuous'
]);
grunt
.
registerTask
(
'test'
,
[
'bower'
,
'karma:continuous'
]);
grunt
.
registerTask
(
'i18n'
,
[
'nggettext_extract'
,
'nggettext_compile'
]);
grunt
.
registerTask
(
'i18n'
,
[
'nggettext_extract'
,
'nggettext_compile'
]);
grunt
.
registerTask
(
'default'
,
[
grunt
.
registerTask
(
'default'
,
[
...
...
app/app.js
View file @
4758b51e
...
@@ -20,9 +20,11 @@ var app = angular.module(
...
@@ -20,9 +20,11 @@ var app = angular.module(
'ulakbus.auth'
,
'ulakbus.auth'
,
'ulakbus.staff'
,
'ulakbus.staff'
,
'ulakbus.student'
,
'ulakbus.student'
,
'ulakbus.crud'
,
//'ulakbus.version',
'schemaForm'
,
'schemaForm'
,
'gettext'
,
'gettext'
,
'templates-prod'
//
'templates-prod'
]).
]).
/**
/**
* RESTURL is the url of rest api to talk
* RESTURL is the url of rest api to talk
...
...
app/app_routes.js
View file @
4758b51e
...
@@ -10,21 +10,21 @@ app.config(['$routeProvider', function ($routeProvider) {
...
@@ -10,21 +10,21 @@ app.config(['$routeProvider', function ($routeProvider) {
templateUrl
:
'components/dashboard/dashboard.html'
,
templateUrl
:
'components/dashboard/dashboard.html'
,
controller
:
'DashCtrl'
controller
:
'DashCtrl'
})
})
.
when
(
'/
student
/add'
,
{
.
when
(
'/
crud/:model
/add'
,
{
templateUrl
:
'components/
student/student_add_template
.html'
,
templateUrl
:
'components/
crud/templates/add
.html'
,
controller
:
'
Student
AddEditCtrl'
controller
:
'
CRUD
AddEditCtrl'
})
})
.
when
(
'/
student
/edit/:id'
,
{
.
when
(
'/
crud/:model
/edit/:id'
,
{
templateUrl
:
'components/
student/student_add_template
.html'
,
templateUrl
:
'components/
crud/templates/edit
.html'
,
controller
:
'
Student
AddEditCtrl'
controller
:
'
CRUD
AddEditCtrl'
})
})
.
when
(
'/
students
'
,
{
.
when
(
'/
crud/:model
'
,
{
templateUrl
:
'components/
student/student_list_template
.html'
,
templateUrl
:
'components/
crud/templates/list
.html'
,
controller
:
'
Student
ListCtrl'
controller
:
'
CRUD
ListCtrl'
})
})
.
when
(
'/
student
/:id'
,
{
.
when
(
'/
crud/:model
/:id'
,
{
templateUrl
:
'components/
student/student_list_template
.html'
,
templateUrl
:
'components/
crud/templates/show
.html'
,
controller
:
'
Student
ShowCtrl'
controller
:
'
CRUD
ShowCtrl'
})
})
.
when
(
'/staff/add'
,
{
.
when
(
'/staff/add'
,
{
templateUrl
:
'components/staff/templates/add.html'
,
templateUrl
:
'components/staff/templates/add.html'
,
...
...
app/components/crud/crud_controller.js
0 → 100644
View file @
4758b51e
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
'use strict'
;
var
crud
=
angular
.
module
(
'ulakbus.crud'
,
[
'ngRoute'
,
'schemaForm'
,
'formService'
,
'ui.bootstrap'
]);
/**
* CRUDAddEditCtrl is a controller
* which provide a form with form generator.
*/
crud
.
controller
(
'CRUDAddEditCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$modal
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'crud'
;
$scope
.
form_params
=
{
'model'
:
$routeParams
.
model
};
if
(
$routeParams
.
id
)
{
$scope
.
form_params
[
'object_id'
]
=
$routeParams
.
id
;
$scope
.
form_params
[
'cmd'
]
=
'edit'
;
}
else
{
$scope
.
form_params
[
'cmd'
]
=
'add'
;
}
// to start in certain part of the workflow use clear_wf=1
//$scope.form_params['clear_wf'] = 1;
// get form with generator
Generator
.
get_form
(
$scope
);
$scope
.
onSubmit
=
function
(
form
)
{
$scope
.
$broadcast
(
'schemaFormValidate'
);
if
(
form
.
$valid
)
{
Generator
.
submit
(
$scope
)
.
success
(
function
(
data
){
$location
.
path
(
"/crud"
);
})
.
error
(
function
(
data
){
$scope
.
message
=
data
.
title
;
});
}
};
});
// todo: for single point of failure code a "get item" service and use it to
// retrieve list and single item
/**
* CRUD List Controller
*/
crud
.
controller
(
'CRUDListCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'crud'
;
$scope
.
form_params
=
{
"model"
:
$routeParams
.
model
};
// call generator's get_list func
Generator
.
get_list
(
$scope
)
.
then
(
function
(
res
)
{
debugger
;
var
data
=
res
.
data
.
objects
;
for
(
var
item
in
data
){
delete
data
[
item
].
data
[
'deleted'
];
delete
data
[
item
].
data
[
'timestamp'
];
}
$scope
.
objects
=
data
;
$scope
.
model
=
$routeParams
.
model
;
});
});
/**
* CRUD Show Controller
*/
crud
.
controller
(
'CRUDShowCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'crud'
;
$scope
.
form_params
=
{
"object_id"
:
$routeParams
.
id
,
"cmd"
:
"show"
,
"model"
:
$routeParams
.
model
};
// call generator's get_single_itemfunc
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
)
{
$scope
.
object
=
res
.
data
.
object
;
})
});
\ No newline at end of file
app/components/crud/crud_controller_test.js
0 → 100644
View file @
4758b51e
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
'use strict'
;
describe
(
'crud controller module'
,
function
()
{
beforeEach
(
module
(
'ulakbus'
));
beforeEach
(
module
(
'ulakbus.crud'
));
var
$controller
;
beforeEach
(
inject
(
function
(
_$controller_
)
{
$controller
=
_$controller_
;
}));
describe
(
'crud add controller'
,
function
()
{
it
(
'should get form'
,
function
()
{
var
$scope
=
{};
var
controller
=
$controller
(
'CRUDAddEditCtrl'
,
{
$scope
:
$scope
});
expect
(
$scope
).
not
.
toEqual
(
null
);
});
});
describe
(
'crud add controller'
,
function
()
{
it
(
'should have CRUDAddEditCtrl'
,
inject
(
function
(
$controller
)
{
expect
(
$controller
).
toBeDefined
();
}));
});
});
\ No newline at end of file
app/components/crud/templates/add.html
0 → 100644
View file @
4758b51e
<div
ng-app=
"ulakbus.crud"
>
<ng-include
src=
"'shared/templates/add.html'"
></ng-include>
</div>
\ No newline at end of file
app/components/crud/templates/edit.html
0 → 100644
View file @
4758b51e
<div
ng-app=
"ulakbus.crud"
>
<div
class=
"col-md-6"
>
<h1>
{{ schema.title }}
</h1>
<form
name=
"formgenerated"
sf-schema=
"schema"
sf-form=
"form"
sf-model=
"model"
ng-submit=
"onSubmit(formgenerated)"
></form>
</div>
</div>
\ No newline at end of file
app/components/crud/templates/list.html
0 → 100644
View file @
4758b51e
<table
class=
"table table-bordered table-responsive"
>
<thead>
<tr>
<!--<th>{{ objects[0].key }}</th>-->
<th
ng-repeat=
"(key,value) in objects[0].data"
>
{{ key }}
</th>
<th>
action
</th>
</tr>
</thead>
<tbody>
<tr
ng-repeat=
"object in objects"
>
<!--<td><a ng-href="#/object/{{object.id}}">{{object.name}}</a></td>-->
<td
ng-repeat=
"(key,value) in object.data"
>
{{value}}
</td>
<td>
<a
ng-href=
"#/crud/{{model}}/edit/{{object.key}}"
>
Edit
</a><br>
<a
ng-href=
"#/crud/{{model}}/{{object.key}}"
>
Show
</a>
</td>
</tr>
</tbody>
</table>
\ No newline at end of file
app/components/crud/templates/show.html
0 → 100644
View file @
4758b51e
<p
ng-repeat=
"(key, value) in object"
><span
class=
"col-md-3"
>
{{ key }}:
</span>
{{value}}
</p>
\ No newline at end of file
app/components/version/version.js
View file @
4758b51e
...
@@ -5,4 +5,4 @@ angular.module('ulakbus.version', [
...
@@ -5,4 +5,4 @@ angular.module('ulakbus.version', [
'ulakbus.version.version-directive'
'ulakbus.version.version-directive'
])
])
.
value
(
'version'
,
'0.
1
'
);
.
value
(
'version'
,
'0.
3
'
);
app/index.html
View file @
4758b51e
...
@@ -97,8 +97,10 @@
...
@@ -97,8 +97,10 @@
<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_controller.js"
></script>
<script
src=
"components/dashboard/dashboard_controller.js"
></script>
<script
src=
"components/crud/crud_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/version/version.js"
></script>
<!--<script src="bower_components/quantumui/dist/js/quantumui-nojq.js"></script>-->
<!--<script src="bower_components/quantumui/dist/js/quantumui-nojq.js"></script>-->
</body>
</body>
...
...
app/shared/directives.js
View file @
4758b51e
...
@@ -20,7 +20,14 @@ app.directive('sidebar',['$location',function() {
...
@@ -20,7 +20,14 @@ app.directive('sidebar',['$location',function() {
replace
:
true
,
replace
:
true
,
scope
:
{
scope
:
{
},
},
controller
:
function
(
$scope
){
controller
:
function
(
$scope
,
$http
,
RESTURL
){
$http
.
post
(
RESTURL
.
url
+
'crud/'
).
success
(
function
(
data
){
//debugger;
$scope
.
menuItems
=
data
.
models
;
});
$scope
.
menuItems
=
'dsadkal'
;
$scope
.
selectedMenu
=
'dashboard'
;
$scope
.
selectedMenu
=
'dashboard'
;
$scope
.
collapseVar
=
0
;
$scope
.
collapseVar
=
0
;
$scope
.
multiCollapseVar
=
0
;
$scope
.
multiCollapseVar
=
0
;
...
...
app/shared/templates/directives/sidebar.html
View file @
4758b51e
...
@@ -5,44 +5,24 @@
...
@@ -5,44 +5,24 @@
<li
ui-sref-active=
"active"
>
<li
ui-sref-active=
"active"
>
<a
ui-sref=
"dashboard.home"
><i
class=
"fa fa-dashboard fa-fw"
></i>
Dashboard
</a>
<a
ui-sref=
"dashboard.home"
><i
class=
"fa fa-dashboard fa-fw"
></i>
Dashboard
</a>
</li>
</li>
<li
ui-sref-active=
"active"
><a
href=
"#/staffs"
translate
>
Staffs
</a></li>
<!--<li ui-sref-active="active"><a href="#/staffs" translate>Staffs</a></li>-->
<li
ui-sref-active=
"active"
><a
href=
"#/staff/add"
translate
>
New Staff
</a></li>
<!--<li ui-sref-active="active"><a href="#/staff/add" translate>New Staff</a></li>-->
<!--<li ui-sref-active="active">-->
<!--<li ui-sref-active="active"-->
<!--ng-repeat="item in menuItems"><a href="#">{{ item }}</a></li>-->
<!--<a ui-sref="dashboard.chart"><i class="fa fa-bar-chart-o fa-fw"></i> Charts<span></span></a>-->
<li
ng-repeat=
"(key, item) in menuItems"
ng-class=
"{active: collapseVar == key}"
>
{{dropDown}}
<a
href=
""
ng-click=
"check(key)"
><i
class=
"fa fa-wrench fa-fw"
></i>
{{ item }}
<span
<!--</li>-->
class=
"fa arrow"
></span></a>
<!--<li ui-sref-active="active">-->
<ul
class=
"nav nav-second-level"
collapse=
"collapseVar!={{key}}"
>
<!--<a ui-sref="dashboard.table"><i class="fa fa-table fa-fw"></i> Tables</a>-->
<li
ui-sref-active=
"active"
>
<!--</li>-->
<a
href=
"#/crud/{{item}}"
>
List
</a>
<!--<li ui-sref-active="active">-->
</li>
<!--<a ui-sref="dashboard.form"><i class="fa fa-edit fa-fw"></i> Forms</a>-->
<li
ui-sref-active=
"active"
>
<!--</li>-->
<a
href=
"#/crud/{{item}}/add"
>
Add
</a>
<!--<li ng-class="{active: collapseVar==1}">{{dropDown}}-->
</li>
<!--<a href="" ng-click="check(1)"><i class="fa fa-wrench fa-fw"></i> UI Elements<span-->
</ul>
<!--class="fa arrow"></span></a>-->
<!-- /.nav-second-level -->
<!--<ul class="nav nav-second-level" collapse="collapseVar!=1">-->
</li>
<!--<li ui-sref-active="active">-->
<!--<a ui-sref="dashboard.panels-wells">Panels and Wells</a>-->
<!--</li>-->
<!--<li ui-sref-active="active">-->
<!--<a ui-sref="dashboard.buttons">Buttons</a>-->
<!--</li>-->
<!--<li ui-sref-active="active">-->
<!--<a ui-sref="dashboard.notifications">Notifications</a>-->
<!--</li>-->
<!--<li ui-sref-active="active">-->
<!--<a ui-sref="dashboard.typography">Typography</a>-->
<!--</li>-->
<!--<li ui-sref-active="active">-->
<!--<a ui-sref="dashboard.icons"> Icons</a>-->
<!--</li>-->
<!--<li ui-sref-active="active">-->
<!--<a ui-sref="dashboard.grid">Grid</a>-->
<!--</li>-->
<!--</ul>-->
<!--<!– /.nav-second-level –>-->
<!--</li>-->
<!--<li ng-class="{active: collapseVar==2}">-->
<!--<li ng-class="{active: collapseVar==2}">-->
<!--<a href="" ng-click="check(2)"><i class="fa fa-sitemap fa-fw"></i> Multi-Level Dropdown<span-->
<!--<a href="" ng-click="check(2)"><i class="fa fa-sitemap fa-fw"></i> Multi-Level Dropdown<span-->
<!--class="fa arrow"></span></a>-->
<!--class="fa arrow"></span></a>-->
...
@@ -91,7 +71,4 @@
...
@@ -91,7 +71,4 @@
</ul>
</ul>
</div>
</div>
<!-- /.sidebar-collapse -->
<!-- /.sidebar-collapse -->
</div>
</div>
app/zetalib/forms/form_service.js
View file @
4758b51e
...
@@ -13,10 +13,10 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
...
@@ -13,10 +13,10 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
return
RESTURL
.
url
+
url
;
return
RESTURL
.
url
+
url
;
};
};
generator
.
generate
=
function
(
scope
,
forms
)
{
generator
.
generate
=
function
(
scope
,
forms
)
{
if
(
!
forms
){
return
scope
;}
for
(
var
key
in
forms
)
for
(
var
key
in
forms
)
scope
[
key
]
=
forms
[
key
];
scope
[
key
]
=
forms
[
key
];
scope
.
initialModel
=
angular
.
copy
(
scope
.
model
);
scope
.
initialModel
=
angular
.
copy
(
scope
.
model
);
//debugger;
scope
.
form
.
push
(
scope
.
form
.
push
(
{
{
type
:
"submit"
,
type
:
"submit"
,
...
@@ -25,6 +25,11 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
...
@@ -25,6 +25,11 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
);
);
// if fieldset in form, make it collapsable with template
// if fieldset in form, make it collapsable with template
scope
.
listnodeform
=
{};
scope
.
listnodeform
=
{};
angular
.
forEach
(
scope
.
schema
.
properties
,
function
(
k
,
v
){
// check if type date and if type date found change it to string
// and give it 'format':'date' property
if
(
k
.
type
==
'date'
)
{
k
.
type
=
'string'
;
k
.
format
=
'date'
}
});
if
((
scope
.
listnode
&&
scope
.
listnodes
[
0
])
||
(
scope
.
nodes
&&
scope
.
nodes
[
0
]))
{
if
((
scope
.
listnode
&&
scope
.
listnodes
[
0
])
||
(
scope
.
nodes
&&
scope
.
nodes
[
0
]))
{
angular
.
forEach
(
scope
.
form
,
function
(
key
,
val
)
{
angular
.
forEach
(
scope
.
form
,
function
(
key
,
val
)
{
if
(
typeof
key
==
"object"
&&
key
.
type
==
"fieldset"
)
{
if
(
typeof
key
==
"object"
&&
key
.
type
==
"fieldset"
)
{
...
@@ -51,7 +56,6 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
...
@@ -51,7 +56,6 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
scope
.
listnodeform
[
key
.
title
][
"form"
]
=
[
angular
.
copy
(
key
)];
scope
.
listnodeform
[
key
.
title
][
"form"
]
=
[
angular
.
copy
(
key
)];
scope
.
listnodeform
[
key
.
title
][
"model"
]
=
{};
scope
.
listnodeform
[
key
.
title
][
"model"
]
=
{};
key
.
type
=
"list"
;
key
.
type
=
"list"
;
debugger
;
delete
key
.
templateUrl
;
delete
key
.
templateUrl
;
delete
key
.
items
;
delete
key
.
items
;
}
}
...
@@ -80,7 +84,6 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
...
@@ -80,7 +84,6 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
modalInstance
.
result
.
then
(
function
(
childmodel
,
key
)
{
modalInstance
.
result
.
then
(
function
(
childmodel
,
key
)
{
angular
.
forEach
(
childmodel
,
function
(
v
,
k
){
angular
.
forEach
(
childmodel
,
function
(
v
,
k
){
debugger
;
if
(
scope
.
model
[
k
]){
if
(
scope
.
model
[
k
]){
scope
.
model
[
k
][
v
.
idx
]
=
v
;
scope
.
model
[
k
][
v
.
idx
]
=
v
;
}
else
{
}
else
{
...
@@ -89,7 +92,6 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
...
@@ -89,7 +92,6 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
}
}
scope
.
$broadcast
(
'schemaFormRedraw'
);
scope
.
$broadcast
(
'schemaFormRedraw'
);
});
});
debugger
;
});
});
};
};
return
generator
.
group
(
scope
);
return
generator
.
group
(
scope
);
...
@@ -139,19 +141,16 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
...
@@ -139,19 +141,16 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
}
}
};
};
generator
.
submit
=
function
(
$scope
)
{
generator
.
submit
=
function
(
$scope
)
{
data
=
{
"form"
:
$scope
.
model
,
"cmd"
:
$scope
.
form_params
.
cmd
,
"subcmd"
:
"do_list"
,
"model"
:
$scope
.
form_params
.
model
};
if
(
$scope
.
object_id
)
{
if
(
$scope
.
object_id
)
{
var
get_diff
=
FormDiff
.
get_diff
(
$scope
.
model
,
$scope
.
initialModel
);
var
get_diff
=
FormDiff
.
get_diff
(
$scope
.
model
,
$scope
.
initialModel
);
var
data
=
{
var
data
=
{
"object_id"
:
$scope
.
object_id
,
"object_id"
:
$scope
.
object_id
,
"form"
:
get_diff
,
"form"
:
get_diff
"cmd"
:
"do"
};
};
}
}
else
{
data
=
{
"form"
:
$scope
.
model
,
"cmd"
:
"do"
};
}
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
...
...
index.html
View file @
4758b51e
...
@@ -103,8 +103,10 @@
...
@@ -103,8 +103,10 @@
<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_controller.js"
></script>
<script
src=
"components/dashboard/dashboard_controller.js"
></script>
<script
src=
"components/crud/crud_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/version/version.js"
></script>
<!--<script src="bower_components/quantumui/dist/js/quantumui-nojq.js"></script>-->
<!--<script src="bower_components/quantumui/dist/js/quantumui-nojq.js"></script>-->
<!-- @endif -->
<!-- @endif -->
...
...
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