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
08d077a5
Commit
08d077a5
authored
Dec 02, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolves #53
parent
c0984834
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
9 deletions
+28
-9
foreignKey.html
app/shared/templates/foreignKey.html
+1
-1
form_service.js
app/zetalib/form_service.js
+22
-3
app.js
dist/app.js
+3
-3
components.js
dist/bower_components/components.js
+1
-1
templates.js
dist/templates.js
+1
-1
No files found.
app/shared/templates/foreignKey.html
View file @
08d077a5
...
...
@@ -44,7 +44,7 @@
<div
class=
"help-block"
sf-message=
"form.description"
></div>
</div>
<div
class=
"col-md-4"
>
<a
href=
"javascript:void(0);"
add-modal-for-linked-model
>
<a
href=
"javascript:void(0);"
add-modal-for-linked-model
=
"{{form.formName}}"
>
<i
class=
"fa fa-plus-circle fa-fw"
></i>
</a>
</div>
...
...
app/zetalib/form_service.js
View file @
08d077a5
...
...
@@ -291,6 +291,8 @@ angular.module('formService', ['ui.bootstrap'])
formitem
=
{
type
:
"template"
,
templateUrl
:
"shared/templates/foreignKey.html"
,
// formName will be used in modal return to save item on form
formName
:
k
,
title
:
v
.
title
,
wf
:
v
.
wf
,
add_cmd
:
v
.
add_cmd
,
...
...
@@ -843,7 +845,7 @@ angular.module('formService', ['ui.bootstrap'])
.
directive
(
'addModalForLinkedModel'
,
function
(
$uibModal
,
$rootScope
,
$route
,
Generator
)
{
return
{
link
:
function
(
scope
,
element
)
{
link
:
function
(
scope
,
element
,
attributes
)
{
element
.
on
(
'click'
,
function
()
{
var
modalInstance
=
$uibModal
.
open
({
animation
:
true
,
...
...
@@ -853,10 +855,12 @@ angular.module('formService', ['ui.bootstrap'])
size
:
'lg'
,
resolve
:
{
items
:
function
()
{
var
formName
=
attributes
.
addModalForLinkedModel
;
return
Generator
.
get_form
({
url
:
scope
.
form
.
wf
,
form_params
:
{
model
:
scope
.
form
.
model_name
,
cmd
:
scope
.
form
.
add_cmd
},
modalElements
:
{
// define button position properties
buttonPositions
:
{
bottom
:
'move-to-bottom-modal'
,
top
:
'move-to-top-modal'
,
...
...
@@ -870,14 +874,29 @@ angular.module('formService', ['ui.bootstrap'])
},
validateModalDate
:
function
(
field
)
{
$rootScope
.
$broadcast
(
'validateModalDate'
,
field
);
}
},
formName
:
formName
});
}
}
});
modalInstance
.
result
.
then
(
function
(
childscope
,
key
)
{
Generator
.
submit
(
childscope
,
false
);
var
formName
=
childscope
.
formName
;
Generator
.
submit
(
childscope
,
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
({
value
:
data
.
forms
.
model
.
object_key
,
name
:
data
.
forms
.
model
.
unicode
});
scope
.
form
.
selected_item
=
{
value
:
data
.
forms
.
model
.
object_key
,
name
:
data
.
forms
.
model
.
unicode
};
scope
.
$watch
(
document
.
querySelector
(
'input[name='
+
scope
.
form
.
model_name
+
']'
),
function
()
{
angular
.
element
(
document
.
querySelector
(
'input[name='
+
scope
.
form
.
model_name
+
']'
)).
val
(
scope
.
form
.
selected_item
.
name
);
}
);
});
//$route.reload();
});
});
...
...
dist/app.js
View file @
08d077a5
This diff is collapsed.
Click to expand it.
dist/bower_components/components.js
View file @
08d077a5
This diff is collapsed.
Click to expand it.
dist/templates.js
View file @
08d077a5
...
...
@@ -1506,7 +1506,7 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu
" <div class=
\"
help-block
\"
sf-message=
\"
form.description
\"
></div>
\n
"
+
" </div>
\n
"
+
" <div class=
\"
col-md-4
\"
>
\n
"
+
" <a href=
\"
javascript:void(0);
\"
add-modal-for-linked-model>
\n
"
+
" <a href=
\"
javascript:void(0);
\"
add-modal-for-linked-model
=
\"
{{form.formName}}
\"
>
\n
"
+
" <i class=
\"
fa fa-plus-circle fa-fw
\"
></i>
\n
"
+
" </a>
\n
"
+
" </div>
\n
"
+
...
...
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