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
21d02d95
Commit
21d02d95
authored
May 06, 2016
by
bahadircyildiz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CHANGE rref #5257. Confirm field attached.
parent
ebee8ca7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
114 additions
and
47 deletions
+114
-47
uitemplates.js
app/components/uitemplates/uitemplates.js
+16
-14
confirm.html
app/shared/templates/confirm.html
+11
-9
confirmprev.html
app/shared/templates/confirmprev.html
+20
-0
form_service.js
app/zetalib/form_service.js
+67
-24
No files found.
app/components/uitemplates/uitemplates.js
View file @
21d02d95
...
@@ -6,19 +6,15 @@
...
@@ -6,19 +6,15 @@
* (GPLv3). See LICENSE.txt for details.
* (GPLv3). See LICENSE.txt for details.
*/
*/
var
app
=
angular
.
module
(
'ulakbus.uitemplates'
,
[
'ngRoute'
,
'ulakbus.formService'
]);
angular
.
module
(
'ulakbus.uitemplates'
,
[
'ngRoute'
,
'ulakbus.formService'
])
app
.
controller
(
'NewDesignsCtrl'
,
function
(
$scope
)
{
.
controller
(
'NewDesignsCtrl'
,
function
(
$scope
)
{
$scope
.
items
=
[
'student'
,
'staff'
,
'academician'
];
$scope
.
items
=
[
'student'
,
'staff'
,
'academician'
];
$scope
.
selection
=
$scope
.
items
[
0
];
$scope
.
selection
=
$scope
.
items
[
0
];
})
})
/*
.
controller
(
'FormServicePg'
,
function
(
$scope
,
Generator
)
{
This controller is for testing new SchemaForm components. In addition, forms need to have the attribute:
"name" for defining the name shown in dropdown box. Paste the JSON of form as a member of $scope.forms.
*/
app
.
controller
(
'FormServicePg'
,
function
(
$scope
,
Generator
)
{
$scope
.
forms
=
[
$scope
.
forms
=
[
{
{
name
:
'Deneme Form 1'
,
name
:
'Deneme Form 1'
,
...
@@ -44,7 +40,16 @@ var app=angular.module('ulakbus.uitemplates', ['ngRoute', 'ulakbus.formService']
...
@@ -44,7 +40,16 @@ var app=angular.module('ulakbus.uitemplates', ['ngRoute', 'ulakbus.formService']
email
:
{
title
:
'email'
,
type
:
'string'
},
email
:
{
title
:
'email'
,
type
:
'string'
},
id
:
{
title
:
'id'
,
type
:
'number'
},
id
:
{
title
:
'id'
,
type
:
'number'
},
name
:
{
title
:
'name'
,
type
:
'string'
},
name
:
{
title
:
'name'
,
type
:
'string'
},
confirm
:
{
title
:
'Confirm Form'
,
style
:
"btn-success"
,
type
:
'confirm'
,
confirm_message
:
"zaaa xDê"
,
cmd
:
"list_user"
,
readonly
:
"true"
}
confirm
:
{
title
:
'Confirm Form'
,
style
:
"btn-success"
,
type
:
'confirm'
,
confirm_message
:
"kelmangeeeeeeee kakooooo kakoooo şugarkeeeeee mageee kakoooo yandan geeeelll mage kakooooo kakoooo candan geeelll magee kakoooo mo kak kamiloooo biya westeee mo kak kamiloooo biya westeee me türbayyy dicaaa vilesgeee me haraaayy dicaaaa vilesgeeee voşdikeeelll mage kakoooo kakooo yandan geeeelll mage kakooo şugarkeeeee mageeee kakooo kakooooo candan geeell magee kakoooo gel mageeeee kakooo kakoooo şugarkeeee maneee kakooo yandan geeell mageee kakooo kakoooo candan geellll mane kakoooo mo kak kamiloooo biya westeee mo kak kamiloooo biya westeee me türbayyy dicaaa vilesgeee me haraaayy dicaaaa vilesgeeee voşdikeeelll mage kakoooo kakooo yandan geeeelll mage kakooo şugarkeeeee mageeee kakooo kakooooo candan geeell magee kakoooo."
,
buttons
:
[
{
text
:
"button 1"
,
style
:
"btn-warning"
,
dismiss
:
true
},
{
text
:
"button 2"
,
cmd
:
"cmd1"
,
style
:
"btn-success"
},
],
readonly
:
"true"
}
},
required
:
[],
type
:
'object'
,
title
:
'servicetest'
},
required
:
[],
type
:
'object'
,
title
:
'servicetest'
},
},
model
:
{
model
:
{
...
@@ -58,9 +63,6 @@ var app=angular.module('ulakbus.uitemplates', ['ngRoute', 'ulakbus.formService']
...
@@ -58,9 +63,6 @@ var app=angular.module('ulakbus.uitemplates', ['ngRoute', 'ulakbus.formService']
$scope
.
selectform
=
function
(
index
)
{
$scope
.
selectform
=
function
(
index
)
{
var
form
=
$scope
.
forms
[
index
];
var
form
=
$scope
.
forms
[
index
];
$scope
=
Generator
.
generate
(
$scope
,
{
forms
:
form
});
$scope
=
Generator
.
generate
(
$scope
,
{
forms
:
form
});
$timeout
(
function
(){
$scope
.
$apply
();
})
};
};
$scope
.
selectform
(
$scope
.
selection
);
$scope
.
selectform
(
$scope
.
selection
);
});
});
\ No newline at end of file
app/shared/templates/confirm.html
View file @
21d02d95
...
@@ -2,17 +2,19 @@
...
@@ -2,17 +2,19 @@
<button
class=
"btn {{ form.style || 'btn-default' }}"
<button
class=
"btn {{ form.style || 'btn-default' }}"
type=
"button"
type=
"button"
ng-disabled=
"form.readonly"
ng-disabled=
"form.readonly"
uib-popover-template=
"'confirmPopoverTemplate.html'"
ng-click=
"form.openModal(form)"
>
popover-title=
"{{form.title}}"
popover-trigger=
"focus"
popover-placement=
"bottom"
>
<span
ng-if=
"form.icon"
class=
"{{form.icon}}"
></span>
<span
ng-if=
"form.icon"
class=
"{{form.icon}}"
></span>
{{form.title}}
{{form.title}}
</button>
</button>
<script
type=
"text/ng-template"
id=
"confirmPopoverTemplate.html"
>
<script
type=
"text/ng-template"
id=
"confirmModalTemplate.html"
>
<
div
class
=
"form-group"
>
<
div
class
=
"modal-header"
>
<
p
>
{{
form
.
confirm_message
}}
<
/p
>
<
h3
class
=
"modal-title"
>
{{
form
.
title
}}
<
/h3
>
<
button
class
=
"btn btn-default"
ng
-
click
=
"form.confirm()"
>
Confirm
<
/button
>
<
/div
>
<
/div
>
<
div
class
=
"modal-body"
>
<
p
>
{{
form
.
confirm_message
}}
<
/p
>
<
/div
>
<
div
class
=
"modal-footer"
>
<
button
ng
-
repeat
=
"b in form.buttons"
class
=
"btn {{b.style || 'btn-default'}}"
type
=
"button"
ng
-
click
=
"form.send(b.cmd,(b.dismiss || false))"
>
{{
b
.
text
}}
<
/button
>
<
/div
>
</script>
</script>
</div>
</div>
\ No newline at end of file
app/shared/templates/confirmprev.html
0 → 100644
View file @
21d02d95
<div
class=
"form-group schema-form-submit {{form.htmlClass}}"
>
<button
class=
"btn {{ form.style || 'btn-default' }}"
type=
"button"
ng-disabled=
"form.readonly"
uib-popover-template=
"'confirmPopoverTemplate.html'"
popover-title=
"{{form.title}}"
popover-trigger=
"none"
popover-placement=
"bottom"
popover-is-open=
"form.isOpen"
ng-click=
"form.clickHandler()"
>
<span
ng-if=
"form.icon"
class=
"{{form.icon}}"
></span>
{{form.title}}
</button>
<script
type=
"text/ng-template"
id=
"confirmPopoverTemplate.html"
>
<
div
class
=
"form-group"
>
<
p
>
{{
form
.
confirm_message
}}
<
/p
>
<
button
class
=
"btn btn-default"
ng
-
click
=
"form.confirm()"
>
Confirm
<
/button
>
<
/div
>
</script>
</div>
\ No newline at end of file
app/zetalib/form_service.js
View file @
21d02d95
...
@@ -29,7 +29,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -29,7 +29,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @name Generator
* @name Generator
* @description form service's Generator factory service handles all generic form operations
* @description form service's Generator factory service handles all generic form operations
*/
*/
.
factory
(
'Generator'
,
function
(
$http
,
$q
,
$timeout
,
$sce
,
$location
,
$route
,
$compile
,
$log
,
RESTURL
,
$rootScope
,
Moment
,
WSOps
,
FormConstraints
)
{
.
factory
(
'Generator'
,
function
(
$http
,
$q
,
$timeout
,
$sce
,
$location
,
$route
,
$compile
,
$log
,
RESTURL
,
$rootScope
,
Moment
,
WSOps
,
FormConstraints
,
$uibModal
)
{
var
generator
=
{};
var
generator
=
{};
/**
/**
* @memberof ulakbus.formService
* @memberof ulakbus.formService
...
@@ -609,10 +609,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -609,10 +609,12 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
};
};
}
}
},
},
confirm
:
{
//this field is a need for next features
confirmprev
:
{
default
:
function
(
scope
,
v
,
k
)
{
default
:
function
(
scope
,
v
,
k
)
{
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
{
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
{
type
:
"template"
,
type
:
"template"
,
isOpen
:
false
,
title
:
v
.
title
,
title
:
v
.
title
,
confirm_message
:
v
.
confirm_message
,
confirm_message
:
v
.
confirm_message
,
templateUrl
:
"shared/templates/confirm.html"
,
templateUrl
:
"shared/templates/confirm.html"
,
...
@@ -620,32 +622,73 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -620,32 +622,73 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
key
:
k
,
key
:
k
,
cmd
:
v
.
cmd
,
cmd
:
v
.
cmd
,
style
:
v
.
style
,
style
:
v
.
style
,
togglePopover
:
function
(
event
){
clickHandler
:
function
(
){
this
.
isOpen
=
!
this
.
isOpen
;
},
},
confirm
:
function
()
{
confirm
:
function
()
{
console
.
log
(
v
.
cmd
)
;
this
.
isOpen
=
false
;
// send cmd with submit
// send cmd with submit
delete
scope
.
form_params
.
cmd
;
scope
.
form_params
[
'cmd'
]
=
v
.
cmd
;
generator
.
submit
(
scope
,
false
);
generator
.
submit
(
scope
,
false
);
// .success(function(data){
}
// // response data contains object_id and unicode
// // scope.model can be reached via prototype chain
};
// scope.model[formName] = data.forms.model.object_key;
}
// // scope.form prototype chain returns this form item
},
// scope.form.titleMap.push({
confirm
:
{
// value: data.forms.model.object_key,
default
:
function
(
scope
,
v
,
k
)
{
// name: data.forms.model.unicode
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
{
// });
type
:
"template"
,
// scope.form.selected_item = {
title
:
v
.
title
,
// value: data.forms.model.object_key,
confirm_message
:
v
.
confirm_message
,
// name: data.forms.model.unicode
templateUrl
:
"shared/templates/confirm.html"
,
// };
name
:
k
,
// scope.$watch(document.querySelector('input[name=' + scope.form.model_name + ']'),
key
:
k
,
// function () {
style
:
v
.
style
,
// angular.element(document.querySelector('input[name=' + scope.form.model_name + ']')).val(scope.form.selected_item.name);
buttons
:
v
.
buttons
,
// }
modalInstance
:
""
,
// );
// buttons is an object array
// });
//Example:
//buttons: [{
// text: "Button text",
// cmd: "button command",
// style: "btn-warning",
// dismiss: false --> this one is for deciding if the button can dismiss modal
//}]
modalFunction
:
function
(
field
){
this
.
modalInstance
=
$uibModal
.
open
({
animation
:
true
,
templateUrl
:
'confirmModalTemplate.html'
,
controller
:
function
(
$scope
){
$scope
.
form
=
field
;
}
});
},
openModal
:
function
(
field
){
if
(
!
v
.
form_validate
&&
angular
.
isDefined
(
v
.
form_validate
)){
this
.
modalFunction
(
field
);
}
else
{
scope
.
$broadcast
(
'schemaFormValidate'
);
if
(
scope
.
$valid
===
true
)
{
this
.
modalFunction
(
field
);
scope
.
$broadcast
(
'disposeModal'
);
}
else
{
// focus to first input with validation error
$timeout
(
function
()
{
var
firsterror
=
angular
.
element
(
document
.
querySelectorAll
(
'input.ng-invalid'
))[
0
];
firsterror
.
focus
();
});
}
}
},
send
:
function
(
cmd
,
dismiss
)
{
// send cmd with submit
delete
scope
.
form_params
.
cmd
;
scope
.
form_params
[
'cmd'
]
=
v
.
cmd
;
if
(
dismiss
)
this
.
modalInstance
.
dismiss
(
'cancel'
);
if
(
cmd
)
generator
.
submit
(
scope
,
false
);
}
}
};
};
...
...
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