Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
irul
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6649ceb1
authored
Dec 12, 2022
by
aagusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
penambahan widget
1 parent
518b9f53
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
25 deletions
opensipkd/base/views/provinsi.py
opensipkd/base/views/templates/base3.1.pt
opensipkd/base/views/templates/form_list.pt
opensipkd/detable/detable.py
opensipkd/detable/templates/detable.pt
opensipkd/models/base.py
opensipkd/base/views/provinsi.py
View file @
6649ceb
...
...
@@ -18,7 +18,9 @@ def provinsi_widget(node, kw):
url
=
node
and
hasattr
(
node
,
'slave_url'
)
and
node
.
slave_url
or
""
slave
=
node
and
hasattr
(
node
,
'slave'
)
and
node
.
slave
or
""
values
.
insert
(
0
,
(
""
,
"Pilih Propinsi..."
))
readonly
=
kw
.
get
(
"readonly"
,
False
)
return
widget_os
.
Select2MsWidget
(
values
=
values
,
readonly
=
readonly
,
url
=
url
,
slave
=
slave
,
placeholder
=
"Pilih Provinsi"
)
...
...
opensipkd/base/views/templates/base3.1.pt
View file @
6649ceb
...
...
@@ -55,7 +55,9 @@
<!-- LOOP FORM CSS INCLUDED-->
<tal:loop
tal:repeat=
"css_resource css"
>
<link
rel=
"stylesheet"
href=
"${home}${request.static_path(css_resource)}"
type=
"text/css"
>
type=
"text/css"
tal:condition=
"css_resource[:4]!='http'"
>
<link
rel=
"stylesheet"
href=
"${css_resource}"
type=
"text/css"
tal:condition=
"css_resource[:4]=='http'"
>
</tal:loop>
<!--? <link href="${home}/static/v3/js/plugin/bootstrap-datepicker/css/bootstrap-datepicker.min.css"-->
<!--? rel="stylesheet">-->
...
...
@@ -273,7 +275,8 @@
<script
src=
"${home}/static/v3/js/osipkd.js"
></script>
<!-- LOOP ON JS RESOURCE -->
<tal:loop
tal:repeat=
"js_resource js"
>
<script
src=
"${home}${request.static_path(js_resource)}"
></script>
<script
src=
"${home}${request.static_path(js_resource)}"
tal:condition=
"js_resource[:4]!='http'"
></script>
<script
src=
"${js_resource}"
tal:condition=
"js_resource[:4]=='http'"
></script>
</tal:loop>
<metal:js
define-slot=
"js_files"
></metal:js>
...
...
opensipkd/base/views/templates/form_list.pt
View file @
6649ceb
<html
metal:use-macro=
"load: ./base3.1.pt"
>
<div
metal:fill-slot=
"content"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h3
class=
"panel-title"
><i
class=
"fa fa-fw fa-plus"
></i>
${request.title}
</h3>
</div>
<div
class=
"panel-body"
>
<div
tal:content=
"structure form"
></div>
<div
class=
"jarviswidget jarviswidget-color-blueLight"
>
<div
tal:content=
"structure table"
></div>
</div>
</div>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h3
class=
"panel-title"
><i
class=
"fa fa-fw fa-plus"
></i>
${request.title}
</h3>
</div>
<div
class=
"panel-body"
>
<div
tal:content=
"structure form"
></div>
<div
class=
"container"
>
<div
tal:content=
"structure table"
></div>
</div>
</div>
</div>
</div>
<div
metal:fill-slot=
"scripts"
>
<script>
</script>
<div
metal:define-slot=
"scripts"
></div>
<script>
</script>
<div
metal:define-slot=
"scripts"
></div>
</div>
</html>
...
...
opensipkd/detable/detable.py
View file @
6649ceb
...
...
@@ -112,8 +112,14 @@ class DeTable(field.Field):
data
=
[],
allow_edit
=
True
,
allow_delete
=
True
,
allow_view
=
True
,
**
kw
):
# field.Field.__init__(self, schema, **kw)
super
()
.
__init__
(
schema
,
**
kw
)
self
.
request
=
kw
.
get
(
"request"
)
self
.
rows
=
kw
.
get
(
"rows"
)
params
=
params
and
f
"?{params}"
or
""
btn_close_js
=
"{window.location = '/'; return false;}"
btn_add_js
=
"{window.location = o
%
sUri+'/add
%
s';}"
%
(
tableid
,
params
)
...
...
@@ -128,11 +134,10 @@ class DeTable(field.Field):
btn_csv_js
=
"{window.location = o
%
sUri+'/csv/act
%
s';}"
%
(
tableid
,
params
)
btn_pdf_js
=
"{window.open(o
%
sUri+'/pdf/act
%
s');}"
%
(
tableid
,
params
)
btn_upload_js
=
"{window.location = o
%
sUri+'/upload
%
s';}"
%
(
tableid
,
params
)
btn_upload_js
=
"{window.location = o
%
sUri+'/upload
%
s';}"
%
(
tableid
,
params
)
action_suffix
=
f
"{action_suffix}{params}"
field
.
Field
.
__init__
(
self
,
schema
,
**
kw
)
self
.
request
=
kw
.
get
(
"request"
)
_buttons
=
[]
for
button
in
buttons
:
if
isinstance
(
button
,
compat
.
string_types
):
...
...
@@ -152,12 +157,13 @@ class DeTable(field.Field):
"""
)
_scripts
.
append
(
f
'$("#{tableid + button.name}").click(function ()'
+
eval
(
'btn_'
+
button
.
name
+
'_js'
)
+
');'
)
self
.
buttons
=
"','"
.
join
(
_buttons
)
.
replace
(
'
\n
'
,
""
)
.
replace
(
';'
,
';
\n
'
)
self
.
buttons
=
"','"
.
join
(
_buttons
)
.
replace
(
'
\n
'
,
""
)
.
\
replace
(
';'
,
';
\n
'
)
self
.
tableid
=
tableid
self
.
scripts
=
''
.
join
(
_scripts
)
.
replace
(
';'
,
";
\n
"
)
self
.
allow_edit
=
json
.
dumps
(
allow_edit
)
self
.
allow_delete
=
json
.
dumps
(
allow_delete
)
self
.
allow_view
=
json
.
dumps
(
allow_view
)
table_widget
=
getattr
(
schema
,
"widget"
,
None
)
if
table_widget
is
None
:
table_widget
=
widget
.
TableWidget
()
...
...
@@ -187,7 +193,7 @@ class DeTable(field.Field):
d
[
"orderable"
]
=
f
.
orderable
data
.
append
(
f
"orderable: {f.orderable}"
)
if
hasattr
(
f
,
"url"
):
d
[
"url"
]
=
f
.
url
d
[
"url"
]
=
f
.
url
# request = kw.get("request")
# if request:
# d["url"] = request.static_url(f.url)
...
...
@@ -240,7 +246,6 @@ class DeTable(field.Field):
self
.
sorts
=
sorts
self
.
paginates
=
paginates
self
.
filters
=
filters
print
(
self
.
headers
)
class
Button
(
object
):
...
...
opensipkd/detable/templates/detable.pt
View file @
6649ceb
...
...
@@ -18,6 +18,7 @@
data data|field.data;
allow_edit allow_edit|field.allow_edit;
allow_delete allow_delete|field.allow_delete;
allow_view allow_delete|field.allow_view;
"
tal:attributes="style style; class css_class; attributes|field.widget.attributes|{};"
i18n:domain="detable"
...
...
@@ -80,14 +81,17 @@
let url = ${tableid}Columns[co].url;
${tableid}Columns[co].render = function (data) {
let result = "No Data"
if (data
!=
null) {
if (data
!=
null) {
result = '<a href="' + url + data + '" target="_blank">Link</a> ';
}
return result;
}
} else if (${tableid}Columns[co].data === "id" && ${tableid}Columns[co].action === true) {
${tableid}Columns[co].render = function (id) {
let result = '<a href="${url}/' + id + '/view"><i class="fas fa-eye" aria-hidden="true"></i></a> ';
let result = ""
if (${allow_view}) {
result = '<a href="${url}/' + id + '/view"><i class="fas fa-eye" aria-hidden="true"></i></a> ';
}
if (${allow_edit}) {
result += '<a href="${url}/' + id + '/edit"><i class="fas fa-edit" aria-hidden="true"></i></a> '
}
...
...
opensipkd/models/base.py
View file @
6649ceb
...
...
@@ -44,7 +44,7 @@ class CommonModel(object):
for
column
in
self
.
__table__
.
columns
:
value
=
getattr
(
self
,
column
.
name
)
if
value
or
null
:
if
type
(
column
.
type
)
==
DateTime
:
if
type
(
column
.
type
)
==
DateTime
and
date_format
:
if
value
:
values
[
column
.
name
]
=
value
.
strftime
(
date_format
)
else
:
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment