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
edad2093
Commit
edad2093
authored
Aug 18, 2016
by
Vladimir Baranov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rref #5433. Fix key instead of unicode displaying in foreign key popoup, fix fields order
parent
45019b81
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
51 deletions
+91
-51
crud_controller.js
app/components/crud/crud_controller.js
+1
-0
nodeTable.html
app/components/crud/templates/nodeTable.html
+3
-3
form_service.js
app/zetalib/form_service.js
+60
-47
socket.js
app/zetalib/socket.js
+1
-1
utils_service.js
app/zetalib/utils_service.js
+26
-0
No files found.
app/components/crud/crud_controller.js
View file @
edad2093
...
...
@@ -515,6 +515,7 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi
$scope
.
prepareTimetable
=
function
prepareTimetable
(
timetable
){
var
grouped
=
groupBy
(
timetable
,
"saat"
);
for
(
var
day
in
grouped
){
if
(
!
grouped
.
hasOwnProperty
(
day
))
continue
;
var
dayItems
=
grouped
[
day
];
grouped
[
day
]
=
dayItems
.
sort
(
function
(
a
,
b
){
return
a
.
gun
<
b
.
gun
?
-
1
:
1
;
...
...
app/components/crud/templates/nodeTable.html
View file @
edad2093
...
...
@@ -19,7 +19,7 @@
</label>
</th>
<th
scope=
"row"
style=
"text-align:center"
>
#
</th>
<th
ng-repeat=
"prop
Name in node.form"
ng-init=
"prop = node.schema.properties[propName]
"
>
<th
ng-repeat=
"prop
in node.schema.properties_list
"
>
<span
ng-if=
"!value.verbose_name"
>
{{prop.title||prop.name}}
</span>
</th>
<th
ng-if=
"meta.allow_actions!==false"
>
İşlem
</th>
...
...
@@ -42,14 +42,14 @@
</td>
</tr>
<tr
ng-repeat=
"listnodemodel in node.items
track by $index
"
ng-init=
"outerIndex=$index"
ng-if=
"node.schema.formType=='ListNode'"
>
<tr
ng-repeat=
"listnodemodel in node.items"
ng-init=
"outerIndex=$index"
ng-if=
"node.schema.formType=='ListNode'"
>
<td
ng-if=
"meta.allow_selection===true"
width=
"60"
>
<label>
<input
type=
"checkbox"
style=
"zoom:1.5; margin:5px 0 0 8px;"
>
</label>
</td>
<th
scope=
"row"
style=
"text-align:center"
>
{{$index+1}}
</th>
<td
ng-repeat=
"prop
Name in node.form"
ng-init=
"k = propName; v = listnodemodel[propName
]; inline = node.schema.inline_edit && node.schema.inline_edit.indexOf(k) > -1"
>
<td
ng-repeat=
"prop
in node.schema.properties_list"
ng-init=
"k = prop.name; v = listnodemodel[k
]; inline = node.schema.inline_edit && node.schema.inline_edit.indexOf(k) > -1"
>
<span
ng-if=
"!inline"
>
{{ v.unicode || v }}
</span>
<!--<input type="{{node.schema.properties[k].type}}"-->
<!--ng-if="node.schema.inline_edit.indexOf(k) > -1"-->
...
...
app/zetalib/form_service.js
View file @
edad2093
...
...
@@ -29,7 +29,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @name Generator
* @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
,
$uibModal
,
$filter
)
{
.
factory
(
'Generator'
,
function
(
$http
,
$q
,
$timeout
,
$sce
,
$location
,
$route
,
$compile
,
$log
,
RESTURL
,
$rootScope
,
Moment
,
WSOps
,
FormConstraints
,
$uibModal
,
$filter
,
Utils
)
{
var
generator
=
{};
/**
* @memberof ulakbus.formService
...
...
@@ -287,7 +287,6 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
*
* @returns scope {Object}
*/
generator
.
prepareFormItems
=
function
(
scope
)
{
...
...
@@ -397,6 +396,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
form
:
[],
schema
:
{
properties
:
{},
properties_list
:
[],
required
:
[],
title
:
v
.
title
,
type
:
"object"
,
...
...
@@ -419,6 +419,11 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
angular
.
forEach
(
v
.
schema
,
function
(
item
)
{
scope
[
v
.
type
][
k
].
schema
.
properties
[
item
.
name
]
=
angular
.
copy
(
item
);
// save properties order in schema
if
(
item
.
name
!=
'idx'
){
scope
[
v
.
type
][
k
].
schema
.
properties_list
.
push
(
scope
[
v
.
type
][
k
].
schema
.
properties
[
item
.
name
]);
}
if
(
angular
.
isDefined
(
item
.
wf
))
{
scope
[
v
.
type
][
k
].
schema
.
properties
[
item
.
name
][
'wf'
]
=
angular
.
copy
(
item
.
wf
);
}
...
...
@@ -445,40 +450,39 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
});
$timeout
(
function
()
{
if
(
v
.
type
!=
'ListNode'
)
return
;
// todo: needs refactor
if
(
v
.
type
===
'ListNode'
)
{
scope
[
v
.
type
][
k
].
items
=
angular
.
copy
(
scope
.
model
[
k
]
||
[]);
angular
.
forEach
(
scope
[
v
.
type
][
k
].
items
,
function
(
value
,
key
)
{
if
(
value
.
constructor
===
Object
)
{
angular
.
forEach
(
value
,
function
(
x
,
y
)
{
try
{
if
(
scope
[
v
.
type
][
k
].
schema
.
properties
[
y
].
type
===
'date'
)
{
scope
[
v
.
type
][
k
].
items
[
key
][
y
]
=
generator
.
dateformatter
(
x
);
scope
[
v
.
type
][
k
].
model
[
key
][
y
]
=
generator
.
dateformatter
(
x
);
}
if
(
scope
[
v
.
type
][
k
].
schema
.
properties
[
y
].
type
===
'select'
)
{
scope
[
v
.
type
][
k
].
items
[
key
][
y
]
=
generator
.
item_from_array
(
x
.
toString
(),
scope
[
v
.
type
][
k
].
schema
.
properties
[
y
].
titleMap
)
}
}
catch
(
e
)
{
$log
.
debug
(
'Field is not date'
);
}
});
}
});
}
});
var
list
=
scope
[
v
.
type
][
k
];
list
.
items
=
angular
.
copy
(
scope
.
model
[
k
]
||
[]);
angular
.
forEach
(
list
.
items
,
function
(
node
,
fieldName
)
{
if
(
!
Object
.
keys
(
node
).
length
)
return
;
// todo: check this place to fix 'keys instead of names' bug
if
(
scope
.
model
[
k
])
{
angular
.
forEach
(
scope
.
model
[
k
],
function
(
value
,
key
)
{
angular
.
forEach
(
value
,
function
(
y
,
x
)
{
if
(
y
.
constructor
===
Object
)
{
scope
.
model
[
k
][
key
][
x
]
=
y
.
key
;
angular
.
forEach
(
node
,
function
(
prop
,
propName
)
{
var
propInSchema
=
list
.
schema
.
properties
[
propName
];
try
{
if
(
propInSchema
.
type
===
'date'
)
{
node
[
propName
]
=
generator
.
dateformatter
(
prop
);
list
.
model
[
fieldName
][
propName
]
=
generator
.
dateformatter
(
prop
);
}
if
(
propInSchema
.
type
===
'select'
)
{
node
[
propName
]
=
generator
.
item_from_array
(
prop
.
toString
(),
list
.
schema
.
properties
[
propName
].
titleMap
)
}
if
(
propInSchema
.
titleMap
){
node
[
propName
]
=
{
key
:
prop
,
unicode
:
generator
.
item_from_array
(
prop
,
propInSchema
.
titleMap
)
};
}
}
catch
(
e
)
{
$log
.
debug
(
'Field is not date'
);
}
});
});
}
}
);
scope
.
model
[
k
]
=
scope
.
model
[
k
]
||
[];
...
...
@@ -516,6 +520,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
var
modelItems
=
[];
var
modelKeys
=
[];
angular
.
forEach
(
scope
.
model
[
k
],
function
(
value
,
mkey
)
{
modelItems
.
push
({
"value"
:
value
[
v
.
schema
[
0
].
name
].
key
,
...
...
@@ -895,8 +900,6 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
formitem
.
titleMap
=
data
;
formitem
.
gettingTitleMap
=
false
;
});
}
};
...
...
@@ -905,15 +908,15 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
// get selected item from titleMap using model value
if
(
scope
.
model
[
k
])
{
generator
.
get_list
({
url
:
'crud'
,
form_params
:
{
wf
:
v
.
wf
,
model
:
v
.
model_name
,
object_id
:
scope
.
model
[
k
],
cmd
:
'object_name'
}
})
.
then
(
function
(
data
)
{
url
:
'crud'
,
form_params
:
{
wf
:
v
.
wf
,
model
:
v
.
model_name
,
object_id
:
scope
.
model
[
k
],
cmd
:
'object_name'
}
}).
then
(
function
(
data
)
{
try
{
$timeout
(
function
()
{
document
.
querySelector
(
'input[name='
+
k
+
']'
).
value
=
data
.
object_name
;
...
...
@@ -949,6 +952,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
// "val_msg": "Erkek kardes sayisi kiz kardes sayisindan az olamaz."
// }
// };
angular
.
forEach
(
scope
.
schema
.
properties
,
function
(
v
,
k
)
{
// generically change _id fields model value
if
(
'form_params'
in
scope
)
{
...
...
@@ -958,7 +962,6 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
return
;
}
}
try
{
generate_fields
[
v
.
type
][
v
.
widget
||
'default'
](
scope
,
v
,
k
);
}
...
...
@@ -1073,7 +1076,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @description Changes html disabled and enabled attributes of all buttons on current page.
* @param {boolean} position
*/
// todo: remove
// todo: remove
generator
.
button_switch
=
function
(
position
)
{
var
buttons
=
angular
.
element
(
document
.
querySelectorAll
(
'button'
));
var
positions
=
{
true
:
"enabled"
,
false
:
"disabled"
};
...
...
@@ -1340,7 +1343,6 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @todo diff for all submits to recognize form change. if no change returns to view with no submit
*/
generator
.
submit
=
function
(
$scope
,
redirectTo
,
dontProcessReply
)
{
/**
* In case of unformatted date object in any key recursively, it must be converted.
* @param model
...
...
@@ -1404,7 +1406,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @param {Object} $route
* @returns {Object} returns value for modal
*/
.
controller
(
'ModalController'
,
function
(
$scope
,
$uibModalInstance
,
Generator
,
items
)
{
.
controller
(
'ModalController'
,
function
(
$scope
,
$uibModalInstance
,
Generator
,
items
,
$timeout
,
Utils
)
{
angular
.
forEach
(
items
,
function
(
value
,
key
)
{
$scope
[
key
]
=
items
[
key
];
});
...
...
@@ -1414,6 +1416,17 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
});
$scope
.
$on
(
'modalFormLocator'
,
function
(
event
)
{
// fix default model with unicode assign
$timeout
(
function
()
{
Utils
.
iterate
(
$scope
.
model
,
function
(
modelValue
,
k
){
if
(
angular
.
isUndefined
(
$scope
.
edit
))
return
;
var
unicode
=
$scope
.
items
[
$scope
.
edit
][
k
].
unicode
;
if
(
unicode
){
document
.
querySelector
(
'input[name='
+
k
+
']'
).
value
=
unicode
;
}
})
});
$scope
.
linkedModelForm
=
event
.
targetScope
.
linkedModelForm
;
});
...
...
@@ -1439,7 +1452,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
$uibModalInstance
.
close
(
$scope
);
}
};
$scope
.
cancel
=
function
()
{
$uibModalInstance
.
dismiss
(
'cancel'
);
};
...
...
@@ -1455,7 +1468,7 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
* @returns {Object} openmodal directive
*/
.
directive
(
'modalForNodes'
,
function
(
$uibModal
,
Generator
)
{
.
directive
(
'modalForNodes'
,
function
(
$uibModal
,
Generator
,
Utils
)
{
return
{
link
:
function
(
scope
,
element
,
attributes
)
{
element
.
on
(
'click'
,
function
()
{
...
...
app/zetalib/socket.js
View file @
edad2093
...
...
@@ -184,7 +184,7 @@ angular.module('ulakbus')
}
do_action
(
msg_data
,
msg_data
.
cmd
);
if
(
msg_data
.
msg
!=
"pong"
){
$log
.
info
(
"MESSAGE:"
,
event
,
"Data:"
,
msg_data
);
$log
.
info
(
"MESSAGE:"
,
event
,
"Data:"
,
angular
.
copy
(
msg_data
)
);
}
};
wsOps
.
onError
=
function
(
evt
)
{
...
...
app/zetalib/utils_service.js
View file @
edad2093
...
...
@@ -49,4 +49,30 @@ angular.module("ulakbus")
}
}
}
/**
* @param collection {Array|Object} Array of objects to group
* @param callback {Function} Callback to apply to every element of the collection
* @returns None
*/
this
.
iterate
=
function
(
collection
,
callback
){
angular
.
forEach
(
collection
,
function
(
val
,
key
){
// don't iterate over angular binding indexes
if
(
key
.
indexOf
&&
key
.
indexOf
(
'$$'
)
==
0
){
return
;
}
callback
(
val
,
key
);
})
}
})
.
filter
(
"formatJson"
,
function
(){
return
function
(
val
){
try
{
return
JSON
.
stringify
(
val
,
null
,
4
);
}
catch
(
e
){
return
val
;
}
}
});
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