Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
erp5
Commits
1f0c33c1
Commit
1f0c33c1
authored
Jun 29, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: schema_editor fix panel rendering, add developer mode checkbox
parent
edc9ab42
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
73 deletions
+90
-73
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_ojs_schema_panel.html.html
...em/web_page_module/gadget_erp5_ojs_schema_panel.html.html
+4
-5
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_ojs_schema_panel.js.js
...teItem/web_page_module/gadget_erp5_ojs_schema_panel.js.js
+86
-68
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_ojs_schema_panel.html.html
View file @
1f0c33c1
...
...
@@ -36,16 +36,15 @@
<
/form
>
<
ul
data
-
role
=
"
listview
"
class
=
"
ui-listview
"
data
-
enhanced
=
"
true
"
><
/ul
>
<
div
data
-
gadget
-
url
=
"
gadget_erp5_field_checkbox.html
"
data
-
gadget
-
scope
=
"
editable_mode
"
data
-
gadget
-
sandbox
=
"
public
"
><
/div
>
<
dl
><
/dl
>
<
/div
>
</script>
<script
id=
"panel-template-body-list"
type=
"text/x-handlebars-template"
>
<
li
><
a
href
=
"
{{document_list_href}}
"
class
=
"
ui-btn ui-btn-icon-left ui-icon-search
"
data
-
i18n
=
"
Schemas
"
accesskey
=
"
s
"
>
Schemas
<
/a></
li
>
{{
list
}}
<
li
><
a
href
=
"
{{sync_href}}
"
class
=
"
ui-btn ui-btn-icon-left ui-icon-refresh
"
data
-
i18n
=
"
Synchronize
"
>
Synchronize
<
/a></
li
>
<
li
><
a
href
=
"
{{storage_href}}
"
class
=
"
ui-btn ui-btn-icon-left ui-icon-dropbox
"
data
-
i18n
=
"
Storages
"
>
Storages
<
/a></
li
>
<
li
><
a
href
=
"
{{multi_upload_href}}
"
class
=
"
ui-btn ui-btn-icon-left ui-icon-upload
"
data
-
i18n
=
"
Upload
"
>
Upload
<
/a></
li
>
{{
#
each
this
}}
<
li
><
a
href
=
"
{{href}}
"
class
=
"
ui-btn ui-btn-icon-left ui-icon-{{icon_class}}
"
{{
#
if
accesskey
}}
accesskey
=
"
{{accesskey}}
"
{{
/if}} data-i18n="{{title}}">{{title}}</
a
><
/li>{{/
each
}}
</script>
<script
id=
"panel-template-body-desktop"
type=
"text/x-handlebars-template"
>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_erp5_ojs_schema_panel.js.js
View file @
1f0c33c1
...
...
@@ -22,20 +22,6 @@
.
getElementById
(
"
panel-template-body-desktop
"
)
.
innerHTML
);
function
createElement
(
type
,
props
,
innerText
)
{
var
element
=
document
.
createElement
(
type
),
key
;
for
(
key
in
props
)
{
if
(
props
.
hasOwnProperty
(
key
))
{
element
.
setAttribute
(
key
,
props
[
key
]);
}
}
if
(
innerText
)
{
element
.
innerText
=
innerText
;
}
return
element
;
}
gadget_klass
.
setState
({
visible
:
false
,
...
...
@@ -84,11 +70,31 @@
workflow_list
=
JSON
.
stringify
(
workflow_list
);
view_list
=
JSON
.
stringify
(
view_list
);
}
return
context
.
getUrlParameter
(
'
editable
'
)
.
push
(
function
(
editable
)
{
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
context
.
jio_allDocs
({
"
query
"
:
'
portal_type:"JSON Schema"
'
,
"
limit
"
:
[
0
,
31
],
"
select_list
"
:
[
"
title
"
,
"
reference
"
],
"
sort_on
"
:
[[
"
title
"
,
"
descending
"
]]
})
.
push
(
function
(
result
)
{
return
JSON
.
stringify
(
result
.
data
.
rows
);
})
.
push
(
undefined
,
function
()
{
return
"
[]
"
;
}),
context
.
getUrlParameter
(
'
editable
'
)
]);
})
.
push
(
function
(
ret
)
{
var
schema_list
=
ret
[
0
],
editable
=
ret
[
1
];
return
context
.
changeState
({
workflow_list
:
workflow_list
,
view_list
:
view_list
,
schema_list
:
schema_list
,
global
:
true
,
editable
:
options
.
editable
||
editable
||
false
});
...
...
@@ -136,78 +142,90 @@
focus
:
false
});
})
.
push
(
function
()
{
return
context
.
declareGadget
(
'
gadget_erp5_field_multicheckbox.html
'
,
{
scope
:
"
editable_mode
"
,
element
:
tmp_element
.
querySelector
(
'
[data-gadget-scope="editable_mode"]
'
)
});
})
.
push
(
function
()
{
context
.
element
.
querySelector
(
"
div
"
).
appendChild
(
tmp_element
);
return
context
.
listenResize
();
});
}
if
(
modification_dict
.
hasOwnProperty
(
"
editable
"
))
{
if
(
modification_dict
.
hasOwnProperty
(
"
schema_list
"
)
||
modification_dict
.
hasOwnProperty
(
"
editable
"
))
{
queue
// Update the global links
.
push
(
function
()
{
return
context
.
jio_allDocs
({
"
query
"
:
'
portal_type:"JSON Schema"
'
,
"
limit
"
:
[
0
,
31
],
"
select_list
"
:
[
"
title
"
,
"
reference
"
],
"
sort_on
"
:
[[
"
title
"
,
"
descending
"
]]
function
gen_element
(
element
,
title
,
css
,
accesskey
)
{
return
context
.
getUrlFor
(
element
)
.
push
(
function
(
url
)
{
return
{
title
:
title
,
href
:
url
,
icon_class
:
css
,
accesskey
:
accesskey
};
});
})
.
push
(
function
(
result
)
{
return
result
.
data
.
rows
;
})
.
push
(
undefined
,
function
()
{
return
[];
})
.
push
(
function
(
result
)
{
function
gen_element
(
row
,
css
)
{
return
context
.
getUrlFor
({
command
:
'
display
'
,
options
:
{
}
var
i
,
row
,
tasks
=
[],
schema_list
=
JSON
.
parse
(
context
.
state
.
schema_list
);
if
(
context
.
state
.
editable
)
{
tasks
.
push
(
gen_element
({
command
:
'
display
'
,
options
:
{
page
:
"
ojs_schema_document_list
"
}},
"
Schemas
"
,
"
search
"
,
"
s
"
));
}
for
(
i
=
0
;
i
<
schema_list
.
length
;
i
+=
1
)
{
row
=
schema_list
[
i
];
tasks
.
push
(
gen_element
({
command
:
'
display
'
,
options
:
{
page
:
"
ojs_schema_document_list
"
,
portal_type
:
"
JSON Document
"
,
schema
:
row
.
id
,
schema_title
:
row
.
value
.
title
}})
.
push
(
function
(
url
)
{
var
element
=
createElement
(
"
li
"
);
element
.
appendChild
(
createElement
(
"
a
"
,
{
href
:
url
,
class
:
"
ui-btn ui-btn-icon-left
"
+
css
},
row
.
value
.
title
));
return
element
.
outerHTML
;
});
}},
row
.
value
.
title
,
"
search
"
));
}
var
i
,
tasks
=
[
context
.
getUrlFor
({
command
:
'
display
'
,
options
:
{
page
:
"
ojs_schema_document_list
"
}}),
context
.
getUrlFor
({
command
:
'
display
'
,
options
:
{
page
:
"
ojs_configurator
"
}}),
context
.
getUrlFor
({
command
:
'
display
'
,
options
:
{
page
:
"
ojs_sync
"
,
'
auto_repair
'
:
true
}}),
context
.
getUrlFor
({
command
:
'
index
'
,
options
:
{
page
:
"
ojs_multi_upload
"
}})
];
for
(
i
=
0
;
i
<
result
.
length
;
i
+=
1
)
{
tasks
.
push
(
gen_element
(
result
[
i
],
"
ui-icon-search
"
));
tasks
.
push
(
gen_element
({
command
:
'
display
'
,
options
:
{
page
:
"
ojs_sync
"
,
'
auto_repair
'
:
true
}},
"
Synchronize
"
,
"
refresh
"
));
tasks
.
push
(
gen_element
({
command
:
'
display
'
,
options
:
{
page
:
"
ojs_configurator
"
}},
"
Storages
"
,
"
dropbox
"
));
if
(
context
.
state
.
editable
)
{
tasks
.
push
(
gen_element
({
command
:
'
index
'
,
options
:
{
page
:
"
ojs_multi_upload
"
}},
"
Upload
"
,
"
upload
"
));
}
return
RSVP
.
all
(
tasks
);
})
.
push
(
function
(
result_list
)
{
var
i
,
html
=
""
;
for
(
i
=
4
;
i
<
result_list
.
length
;
i
+=
1
)
{
html
+=
result_list
[
i
];
}
return
context
.
translateHtml
(
panel_template_body_list
({
"
document_list_href
"
:
result_list
[
0
],
"
list
"
:
new
Handlebars
.
SafeString
(
html
),
"
storage_href
"
:
result_list
[
1
],
"
sync_href
"
:
result_list
[
2
],
"
multi_upload_href
"
:
result_list
[
3
]
})
panel_template_body_list
(
result_list
)
);
})
.
push
(
function
(
result
)
{
context
.
element
.
querySelector
(
"
ul
"
).
innerHTML
=
result
;
// Update the checkbox field value
return
RSVP
.
all
([
context
.
getDeclaredGadget
(
"
editable_mode
"
),
context
.
translate
(
"
Developer Mode
"
)
]);
})
.
push
(
function
(
result_list
)
{
var
value
=
[],
search_gadget
=
result_list
[
0
],
title
=
result_list
[
1
];
if
(
context
.
state
.
editable
)
{
value
=
[
'
editable
'
];
}
return
search_gadget
.
render
({
field_json
:
{
editable
:
true
,
name
:
'
editable
'
,
key
:
'
editable
'
,
hidden
:
false
,
items
:
[[
title
,
'
editable
'
]],
default
:
value
}});
});
}
...
...
@@ -318,9 +336,9 @@
})
.
allowPublicAcquisition
(
'
notifyChange
'
,
function
(
argument_list
,
scope
)
{
if
(
scope
===
'
e
rp5_checkbox
'
)
{
if
(
scope
===
'
e
ditable_mode
'
)
{
var
context
=
this
;
return
context
.
getDeclaredGadget
(
'
e
rp5_checkbox
'
)
return
context
.
getDeclaredGadget
(
'
e
ditable_mode
'
)
.
push
(
function
(
gadget
)
{
return
gadget
.
getContent
();
})
...
...
@@ -334,7 +352,7 @@
}
// Typing a search query should not modify the header status
return
;
})
}
,
{
mutex
:
'
changestate
'
}
)
.
allowPublicAcquisition
(
'
notifyValid
'
,
function
()
{
// Typing a search query should not modify the header status
return
;
...
...
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