Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
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
nexedi
dream
Commits
fd10e401
Commit
fd10e401
authored
Jan 26, 2015
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update static version
parent
ebc77d04
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
96 additions
and
99 deletions
+96
-99
dream/platform/static/dream/InputModule_viewAddDocumentDialog.js
...latform/static/dream/InputModule_viewAddDocumentDialog.js
+3
-1
dream/platform/static/dream/Input_viewDebugJson.html
dream/platform/static/dream/Input_viewDebugJson.html
+19
-0
dream/platform/static/dream/Input_viewDebugJson.js
dream/platform/static/dream/Input_viewDebugJson.js
+18
-0
dream/platform/static/dream/Input_viewResultList.js
dream/platform/static/dream/Input_viewResultList.js
+1
-1
dream/platform/static/dream/Output_viewStationUtilisationGraph.js
...atform/static/dream/Output_viewStationUtilisationGraph.js
+3
-3
dream/platform/static/dream/index.css
dream/platform/static/dream/index.css
+1
-1
dream/platform/static/dream/index.js
dream/platform/static/dream/index.js
+9
-4
dream/platform/static/fieldset/fieldset.js
dream/platform/static/fieldset/fieldset.js
+5
-16
dream/platform/static/jio_bridge/jiogadget.js
dream/platform/static/jio_bridge/jiogadget.js
+18
-5
dream/platform/static/jsplumb/index.html
dream/platform/static/jsplumb/index.html
+6
-8
dream/platform/static/jsplumb/jsplumb.js
dream/platform/static/jsplumb/jsplumb.js
+7
-57
dream/platform/static/number_field/numberfield.js
dream/platform/static/number_field/numberfield.js
+1
-1
dream/platform/static/string_field/stringfield.js
dream/platform/static/string_field/stringfield.js
+1
-1
dream/platform/static/toolbox/toolbox.js
dream/platform/static/toolbox/toolbox.js
+4
-1
No files found.
dream/platform/static/dream/InputModule_viewAddDocumentDialog.js
View file @
fd10e401
...
...
@@ -24,7 +24,9 @@
name
=
file
.
name
;
return
promiseReadAsText
(
file
);
}).
push
(
function
(
json
)
{
json_data
=
json
;
var
data
=
JSON
.
parse
(
json
);
data
.
general
.
name
=
name
;
json_data
=
JSON
.
stringify
(
data
);
return
createDocument
(
gadget
,
name
);
}).
push
(
function
(
jio_document
)
{
// Add JSON as attachment
...
...
dream/platform/static/dream/Input_viewDebugJson.html
0 → 100644
View file @
fd10e401
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Debug JSON
</title>
<script
src=
"../lib/rsvp.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/renderjs.min.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"Input_viewDebugJson.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
xdata-gadget-url=
"https://softinst52398.node.vifib.com/gadget_codemirror.html"
data-gadget-scope=
"editor"
data-gadget-sandbox=
"iframe"
></div>
<label
for=
"json"
>
JSON
</label>
<textarea
spellcheck=
"false"
rows=
"20"
name=
"json"
class=
"json"
></textarea>
</body>
</html>
dream/platform/static/dream/Input_viewDebugJson.js
0 → 100644
View file @
fd10e401
/*global rJS, initGadgetMixin */
(
function
(
window
,
rJS
,
initGadgetMixin
)
{
"
use strict
"
;
var
gadget_klass
=
rJS
(
window
);
initGadgetMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
this
.
props
.
jio_key
=
options
.
id
;
this
.
props
.
result
=
options
.
result
;
return
gadget
.
aq_getAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
body.json
"
}).
push
(
function
(
result_json
)
{
var
document
=
JSON
.
parse
(
result_json
);
gadget
.
props
.
element
.
querySelector
(
"
.json
"
).
textContent
=
JSON
.
stringify
(
document
,
undefined
,
"
"
);
});
});
})(
window
,
rJS
,
initGadgetMixin
);
\ No newline at end of file
dream/platform/static/dream/Input_viewResultList.js
View file @
fd10e401
...
...
@@ -15,7 +15,7 @@
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
simulation.json
"
}).
push
(
undefined
,
function
(
error
)
{
if
(
error
.
status
===
404
)
{
if
(
error
.
status
_code
===
404
)
{
// Simulation not yet generated
return
JSON
.
stringify
([]);
}
...
...
dream/platform/static/dream/Output_viewStationUtilisationGraph.js
View file @
fd10e401
...
...
@@ -2,10 +2,10 @@
/*jslint unparam: true */
(
function
(
window
,
rJS
,
$
,
initGadgetMixin
)
{
"
use strict
"
;
function
station_utilisation_graph_widget
(
output_data
)
{
function
station_utilisation_graph_widget
(
data
,
result_id
)
{
var
blockage_data
=
[],
waiting_data
=
[],
failure_data
=
[],
working_data
=
[],
ticks
=
[],
counter
=
1
,
series
,
options
;
// XXX output is still elementList ???
$
.
each
(
output_data
.
elementList
.
sort
(
function
(
a
,
b
)
{
$
.
each
(
data
.
result
.
result_list
[
result_id
]
.
elementList
.
sort
(
function
(
a
,
b
)
{
return
a
.
id
<
b
.
id
?
-
1
:
1
;
}),
function
(
idx
,
obj
)
{
// add each object that has a working ratio
...
...
@@ -106,7 +106,7 @@
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
simulation.json
"
}).
push
(
function
(
simulation_json
)
{
gadget
.
props
.
result_list
=
station_utilisation_graph_widget
(
JSON
.
parse
(
simulation_json
)
.
result
.
result_list
[
gadget
.
props
.
result
]
);
gadget
.
props
.
result_list
=
station_utilisation_graph_widget
(
JSON
.
parse
(
simulation_json
)
,
gadget
.
props
.
result
);
});
}).
declareMethod
(
"
startService
"
,
function
()
{
// XXX Manually calculate width and height when resizing
...
...
dream/platform/static/dream/index.css
View file @
fd10e401
@media
(
min-width
:
110em
){
.jqm-navmenu-panel.ui-panel-closed
{
visibility
:
visible
!important
;
width
:
17em
;
-webkit-transition
:
none
!important
;
-moz-transition
:
none
!important
;
transition
:
none
!important
;
-webkit-transform
:
none
!important
;
-moz-transform
:
none
!important
;
transform
:
none
!important
;
-webkit-box-shadow
:
none
;
-moz-box-shadow
:
none
;
box-shadow
:
none
;
height
:
100%
;
position
:
absolute
;
display
:
block
}
.ui-panel-page-content-open
{
width
:
auto
}
.ui-panel-page-content-open.ui-panel-page-content-position-left
{
margin-right
:
17em
}
.ui-panel-dismiss
,
.menu_link
{
display
:
none
!important
}
.gadget_container
,
header
,
nav
{
margin-left
:
17em
}
.close-entry
{
display
:
none
!important
}
.gadget_container
{
padding
:
1em
}}
[
data-gadget-scope
=
productionline_toolbox
]
{
position
:
relative
;
width
:
19.5%
;
float
:
left
}
[
data-gadget-scope
=
productionline_graph
]
{
position
:
relative
;
width
:
79.5%
;
float
:
right
}
form
.save_form
{
display
:
none
}
\ No newline at end of file
@media
(
min-width
:
100em
){
.jqm-navmenu-panel.ui-panel-closed
{
visibility
:
visible
!important
;
width
:
17em
;
-webkit-transition
:
none
!important
;
-moz-transition
:
none
!important
;
transition
:
none
!important
;
-webkit-transform
:
none
!important
;
-moz-transform
:
none
!important
;
transform
:
none
!important
;
-webkit-box-shadow
:
none
;
-moz-box-shadow
:
none
;
box-shadow
:
none
;
height
:
100%
;
position
:
absolute
;
display
:
block
}
.ui-panel-page-content-open
{
width
:
auto
}
.ui-panel-page-content-open.ui-panel-page-content-position-left
{
margin-right
:
17em
}
.ui-panel-dismiss
,
.menu_link
{
display
:
none
!important
}
.gadget_container
,
header
,
nav
{
margin-left
:
17em
}
.close-entry
{
display
:
none
!important
}
.gadget_container
{
padding
:
1em
}}
[
data-gadget-scope
=
productionline_toolbox
]
{
position
:
relative
;
width
:
19.5%
;
float
:
left
}
[
data-gadget-scope
=
productionline_graph
]
{
position
:
relative
;
width
:
79.5%
;
float
:
right
}
form
.save_form
{
display
:
none
}
\ No newline at end of file
dream/platform/static/dream/index.js
View file @
fd10e401
...
...
@@ -314,9 +314,14 @@
}).
ready
(
function
(
g
)
{
return
g
.
getDeclaredGadget
(
"
jio
"
).
push
(
function
(
gadget
)
{
return
gadget
.
createJio
({
type
:
"
local
"
,
username
:
"
dream
"
,
applicationname
:
"
dream
"
type
:
"
query
"
,
sub_storage
:
{
type
:
"
document
"
,
document_id
:
"
/
"
,
sub_storage
:
{
type
:
"
local
"
}
}
});
});
}).
declareMethod
(
"
render
"
,
function
(
options
)
{
...
...
@@ -398,7 +403,7 @@
if
(
error
instanceof
RSVP
.
CancellationError
)
{
throw
error
;
}
console
.
error
(
error
);
console
.
error
(
error
.
stack
);
document
.
querySelector
(
"
article[class='gadget_container']
"
).
innerHTML
=
error_template
({
error
:
error
});
...
...
dream/platform/static/fieldset/fieldset.js
View file @
fd10e401
...
...
@@ -7,7 +7,7 @@
// Handlebars
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
var
i
,
gadget_klass
=
rJS
(
window
),
source
=
gadget_klass
.
__template_element
.
getElementById
(
"
label-template
"
).
innerHTML
,
label_template
=
Handlebars
.
compile
(
source
);
var
gadget_klass
=
rJS
(
window
),
source
=
gadget_klass
.
__template_element
.
getElementById
(
"
label-template
"
).
innerHTML
,
label_template
=
Handlebars
.
compile
(
source
);
initGadgetMixin
(
gadget_klass
);
gadget_klass
.
declareMethod
(
"
render
"
,
function
(
options
,
node_id
)
{
// XXX node_id is added like a property so that one can change the node
...
...
@@ -18,7 +18,7 @@
gadget
.
props
.
field_gadget_list
=
[];
function
addField
(
property_id
,
property_definition
,
value
)
{
var
sub_gadget
;
console
.
log
(
"
addField
"
,
property_id
,
property_definition
,
value
);
//
console.log("addField", property_id, property_definition, value);
queue
.
push
(
function
()
{
// XXX this is incorrect for recursive fieldsets.
// we should use nested fieldset with legend
...
...
@@ -26,15 +26,6 @@
"
for
"
:
property_id
,
name
:
property_definition
.
name
||
property_definition
.
description
||
property_id
}));
//console.log("PD", property_definition);
if
(
property_definition
.
oneOf
)
{
// if we got a oneOf, then we use the first one that matches our
// data.
console
.
log
(
value
);
for
(
i
=
0
;
i
<
property_definition
.
oneOf
.
length
;
i
+=
1
)
{
console
.
log
(
property_definition
.
oneOf
[
i
]);
}
}
if
(
property_definition
.
type
===
"
object
"
)
{
// Create a recursive fieldset for this key.
return
gadget
.
declareGadget
(
"
../fieldset/index.html
"
);
...
...
@@ -66,20 +57,18 @@
type
:
"
string
"
},
node_id
);
}
console
.
log
(
options
.
property_definition
);
//
console.log(options.property_definition);
Object
.
keys
(
options
.
property_definition
.
properties
).
forEach
(
function
(
property_name
)
{
var
property_definition
=
options
.
property_definition
.
properties
[
property_name
],
value
=
(
options
.
value
||
{})[
property_name
]
===
undefined
?
property_definition
.
_
default
:
options
.
value
[
property_name
];
var
property_definition
=
options
.
property_definition
.
properties
[
property_name
],
value
=
(
options
.
value
||
{})[
property_name
]
===
undefined
?
property_definition
.
default
:
options
.
value
[
property_name
];
//console.log(property_name, property_definition);
// XXX some properties are not editable
// XXX should not be defined here
if
(
property_name
!==
"
coordinate
"
&&
property_name
!==
"
_class
"
)
{
if
(
property_name
!==
"
coordinate
"
&&
property_name
!==
"
_class
"
&&
property_name
!==
"
id
"
)
{
addField
(
property_name
,
property_definition
,
value
);
}
});
});
return
queue
;
}).
declareMethod
(
"
notifyDataChanged
"
,
function
()
{
console
.
log
(
"
content changed
"
);
}).
declareMethod
(
"
getContent
"
,
function
()
{
var
i
,
promise_list
=
[],
gadget
=
this
;
for
(
i
=
0
;
i
<
this
.
props
.
field_gadget_list
.
length
;
i
+=
1
)
{
...
...
dream/platform/static/jio_bridge/jiogadget.js
View file @
fd10e401
...
...
@@ -13,23 +13,36 @@
return
storage
.
allDocs
.
apply
(
storage
,
arguments
);
}).
declareMethod
(
"
get
"
,
function
()
{
var
storage
=
this
.
state_parameter_dict
.
jio_storage
;
return
storage
.
get
.
apply
(
storage
,
arguments
);
return
storage
.
get
.
apply
(
storage
,
arguments
).
push
(
function
(
result
)
{
return
{
data
:
result
};
});
}).
declareMethod
(
"
remove
"
,
function
()
{
var
storage
=
this
.
state_parameter_dict
.
jio_storage
;
return
storage
.
remove
.
apply
(
storage
,
arguments
);
}).
declareMethod
(
"
getAttachment
"
,
function
()
{
var
storage
=
this
.
state_parameter_dict
.
jio_storage
;
return
storage
.
getAttachment
.
apply
(
storage
,
arguments
).
then
(
function
(
response
)
{
return
jIO
.
util
.
readBlobAsText
(
response
.
data
);
return
jIO
.
util
.
readBlobAsText
(
response
);
}).
then
(
function
(
lala
)
{
return
lala
.
target
.
result
;
});
}).
declareMethod
(
"
putAttachment
"
,
function
()
{
var
storage
=
this
.
state_parameter_dict
.
jio_storage
;
return
storage
.
putAttachment
.
apply
(
storage
,
arguments
);
var
storage
=
this
.
state_parameter_dict
.
jio_storage
,
argument_list
=
arguments
;
return
storage
.
putAttachment
.
apply
(
storage
,
arguments
).
push
(
function
()
{
return
{
id
:
argument_list
[
0
].
_id
,
attachment
:
argument_list
[
0
].
_attachment
};
});
}).
declareMethod
(
"
post
"
,
function
()
{
// XXX set modified value
var
storage
=
this
.
state_parameter_dict
.
jio_storage
;
return
storage
.
post
.
apply
(
storage
,
arguments
);
return
storage
.
post
.
apply
(
storage
,
arguments
).
push
(
function
(
id
)
{
return
{
id
:
id
};
});
});
})(
rJS
,
jIO
);
\ No newline at end of file
dream/platform/static/jsplumb/index.html
View file @
fd10e401
...
...
@@ -14,6 +14,10 @@
<script
src=
"../lib/jquery.jsplumb.js"
></script>
<script
src=
"../lib/handlebars.min.js"
></script>
<script
src=
"../dream/mixin_gadget.js"
></script>
<script
src=
"../dream/mixin_promise.js"
></script>
<script
src=
"jsplumb.js"
></script>
<script
id=
"node-template"
type=
"text/x-handlebars-template"
>
<
div
class
=
"
window {{class}}
"
id
=
"
{{element_id}}
"
...
...
@@ -22,8 +26,7 @@
<
div
class
=
"
ep
"
><
/div
>
<
/div
>
</script>
<template
id=
"popup-edit-template"
>
<script
id=
"popup-edit-template"
type=
"text/x-handlebars-template"
>
<
div
id
=
"
edit-popup
"
data
-
position
-
to
=
"
origin
"
>
<
div
data
-
role
=
"
header
"
data
-
theme
=
"
a
"
>
<
h1
class
=
"
node_class
"
>
Edit
properties
<
/h1
>
...
...
@@ -36,12 +39,7 @@
<
input
type
=
"
submit
"
value
=
"
Validate
"
>
<
/form
>
<
/div
>
</template>
<script
src=
"../dream/mixin_gadget.js"
></script>
<script
src=
"../dream/mixin_promise.js"
></script>
<script
src=
"jsplumb.js"
></script>
</script>
</head>
<body>
<div
id=
"main"
></div>
...
...
dream/platform/static/jsplumb/jsplumb.js
View file @
fd10e401
...
...
@@ -35,7 +35,7 @@
* factorize node & edge popup edition
*/
/*jslint nomen: true */
var
gadget_klass
=
rJS
(
window
),
node_template_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
node-template
"
).
innerHTML
,
node_template
=
Handlebars
.
compile
(
node_template_source
),
popup_edit_template
=
gadget_klass
.
__template_element
.
getElementById
(
"
popup-edit-template
"
),
domParser
=
new
DOMParser
();
var
gadget_klass
=
rJS
(
window
),
node_template_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
node-template
"
).
innerHTML
,
node_template
=
Handlebars
.
compile
(
node_template_source
),
popup_edit_template
=
gadget_klass
.
__template_element
.
getElementById
(
"
popup-edit-template
"
)
.
innerHTML
,
domParser
=
new
DOMParser
();
function
loopJsplumbBind
(
gadget
,
type
,
callback
)
{
//////////////////////////
// Infinite event listener (promise is never resolved)
...
...
@@ -290,7 +290,7 @@
function
resolveReference
(
ref
,
schema
)
{
// 2 here is for #/
var
i
,
ref_path
=
ref
.
substr
(
2
,
ref
.
length
),
parts
=
ref_path
.
split
(
"
/
"
);
for
(
i
=
0
;
i
<
parts
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
parts
.
length
;
i
+=
1
)
{
schema
=
schema
[
parts
[
i
]];
}
return
schema
;
...
...
@@ -300,37 +300,17 @@
// references
// XXX this should probably be moved to fieldset ( and not handle
// class_definition here)
// XXX known limitation: we do not expand refs inside oneOf
var
property
,
referenced
,
i
,
expanded_class_definition
=
{
var
referenced
,
i
,
expanded_class_definition
=
{
properties
:
class_definition
.
properties
||
{}
};
console
.
log
(
"
expandSchema
"
,
class_definition
);
// expand direct ref
if
(
class_definition
.
$ref
)
{
console
.
log
(
"
DI
"
,
class_definition
.
$ref
);
referenced
=
expandSchema
(
resolveReference
(
class_definition
.
$ref
,
full_schema
.
class_definition
),
full_schema
);
if
(
referenced
.
properties
)
{
delete
referenced
.
properties
;
}
$
.
extend
(
expanded_class_definition
,
referenced
);
console
.
log
(
"
after direct expand
"
,
Object
.
create
(
referenced
));
}
/*
// expand refs inside properties
for (property in expanded_class_definition.properties) {
if (expanded_class_definition.properties.hasOwnProperty(property)) {
referenced = expanded_class_definition.properties[property];
if (referenced.$ref) {
if (!expanded_class_definition.properties[property]){
expanded_class_definition.properties[property] = {};
}
$.extend(expanded_class_definition.properties[property], expandSchema(
resolveReference(referenced.$ref, full_schema.class_definition),
full_schema));
}
}
}
*/
if
(
class_definition
.
oneOf
)
{
expanded_class_definition
.
oneOf
=
[];
for
(
i
=
0
;
i
<
class_definition
.
oneOf
.
length
;
i
+=
1
)
{
...
...
@@ -350,38 +330,7 @@
if
(
expanded_class_definition
.
$ref
)
{
delete
expanded_class_definition
.
$ref
;
}
console
.
log
(
"
R
"
,
expanded_class_definition
);
return
Object
.
create
(
expanded_class_definition
);
// expand refs directly in allOf
if
(
class_definition
.
xallOf
)
{
for
(
i
=
0
;
i
<
class_definition
.
allOf
.
length
;
i
+=
1
)
{
referenced
=
class_definition
.
allOf
[
i
];
if
(
referenced
.
$ref
)
{
referenced
=
Object
.
create
(
referenced
);
$
.
extend
(
referenced
,
expandSchema
(
resolveReference
(
referenced
.
$ref
,
full_schema
.
class_definition
),
full_schema
));
}
if
(
referenced
.
properties
)
{
for
(
property
in
referenced
.
properties
)
{
if
(
referenced
.
properties
.
hasOwnProperty
(
property
))
{
//console.log('property2', property, referenced.properties[property]);
// and in allOf references. XXX I guess this can be merged with
// "expand ref inside properties"
if
(
referenced
.
properties
[
property
].
$ref
)
{
expanded_class_definition
.
properties
[
property
]
=
referenced
.
properties
[
property
];
$
.
extend
(
expanded_class_definition
.
properties
[
property
],
expandSchema
(
resolveReference
(
referenced
.
properties
[
property
].
$ref
,
full_schema
.
class_definition
),
full_schema
));
}
if
(
referenced
.
properties
[
property
].
type
)
{
if
(
!
expanded_class_definition
.
properties
[
property
])
{
expanded_class_definition
.
properties
[
property
]
=
{};
}
$
.
extend
(
expanded_class_definition
.
properties
[
property
],
referenced
.
properties
[
property
]);
}
}
}
}
}
}
return
expanded_class_definition
;
}
function
openEdgeEditionDialog
(
gadget
,
connection
)
{
var
edge_id
=
connection
.
id
,
edge_data
=
gadget
.
props
.
data
.
graph
.
edge
[
edge_id
],
edit_popup
=
$
(
gadget
.
props
.
element
).
find
(
"
#popup-edit-template
"
),
schema
,
fieldset_element
,
delete_promise
;
...
...
@@ -389,7 +338,7 @@
// We do not edit source & destination on edge this way.
delete
schema
.
properties
.
source
;
delete
schema
.
properties
.
destination
;
gadget
.
props
.
element
.
appendChild
(
document
.
importNode
(
popup_edit_template
.
content
,
true
).
children
[
0
]
);
gadget
.
props
.
element
.
insertAdjacentHTML
(
"
beforeend
"
,
popup_edit_template
);
edit_popup
=
$
(
gadget
.
props
.
element
).
find
(
"
#edit-popup
"
);
edit_popup
.
find
(
"
.node_class
"
).
text
(
connection
.
_class
);
fieldset_element
=
edit_popup
.
find
(
"
fieldset
"
)[
0
];
...
...
@@ -449,15 +398,16 @@
function
openNodeEditionDialog
(
gadget
,
element
)
{
var
node_id
=
getNodeId
(
gadget
,
element
.
id
),
node_data
=
gadget
.
props
.
data
.
graph
.
node
[
node_id
],
node_edit_popup
=
$
(
gadget
.
props
.
element
).
find
(
"
#popup-edit-template
"
),
schema
,
fieldset_element
,
delete_promise
;
// If we have no definition for this, we do not allow edition.
// XXX incorrect, we need to display this dialog to be able
// to delete a node
if
(
gadget
.
props
.
data
.
class_definition
[
node_data
.
_class
]
===
undefined
)
{
return
;
}
schema
=
expandSchema
(
gadget
.
props
.
data
.
class_definition
[
node_data
.
_class
],
gadget
.
props
.
data
);
console
.
log
(
"
editing node with
"
,
schema
);
if
(
node_edit_popup
.
length
!==
0
)
{
node_edit_popup
.
remove
();
}
gadget
.
props
.
element
.
appendChild
(
document
.
importNode
(
popup_edit_template
.
content
,
true
).
children
[
0
]
);
gadget
.
props
.
element
.
insertAdjacentHTML
(
"
beforeend
"
,
popup_edit_template
);
node_edit_popup
=
$
(
gadget
.
props
.
element
).
find
(
"
#edit-popup
"
);
// Set the name of the popup to the node class
node_edit_popup
.
find
(
"
.node_class
"
).
text
(
node_data
.
_class
);
...
...
dream/platform/static/number_field/numberfield.js
View file @
fd10e401
...
...
@@ -9,7 +9,7 @@
var
input
=
this
.
element
.
querySelector
(
"
input
"
);
input
.
setAttribute
(
"
value
"
,
options
.
value
);
input
.
setAttribute
(
"
name
"
,
options
.
key
);
input
.
setAttribute
(
"
title
"
,
options
.
title
||
options
.
key
);
input
.
setAttribute
(
"
title
"
,
options
.
property_definition
.
description
);
}).
declareMethod
(
"
getContent
"
,
function
()
{
var
input
=
this
.
element
.
querySelector
(
"
input
"
),
result
=
{};
if
(
input
.
value
!==
""
)
{
...
...
dream/platform/static/string_field/stringfield.js
View file @
fd10e401
...
...
@@ -9,7 +9,7 @@
var
input
=
this
.
element
.
querySelector
(
"
input
"
);
input
.
setAttribute
(
"
value
"
,
options
.
value
||
""
);
input
.
setAttribute
(
"
name
"
,
options
.
key
);
input
.
setAttribute
(
"
title
"
,
options
.
title
||
options
.
key
);
input
.
setAttribute
(
"
title
"
,
options
.
property_definition
.
description
);
}).
declareMethod
(
"
getContent
"
,
function
()
{
var
input
=
this
.
element
.
querySelector
(
"
input
"
),
result
=
{};
result
[
input
.
getAttribute
(
"
name
"
)]
=
input
.
value
;
...
...
dream/platform/static/toolbox/toolbox.js
View file @
fd10e401
...
...
@@ -31,7 +31,7 @@
tools_container
.
className
=
"
tools-container
"
;
Object
.
keys
(
data
.
class_definition
).
forEach
(
function
(
key
)
{
var
_class
=
data
.
class_definition
[
key
],
tool
;
// XXX "expand" the json schema "allO
F
" etc
// XXX "expand" the json schema "allO
f
" etc
if
(
_class
.
_class
===
"
node
"
)
{
tool
=
document
.
createElement
(
"
div
"
);
// XXX maybe allow to configure the class name ?
...
...
@@ -39,6 +39,9 @@
tool
.
textContent
=
_class
.
name
||
key
;
tool
.
draggable
=
true
;
tool
.
dataset
.
class_name
=
JSON
.
stringify
(
key
);
if
(
_class
.
description
)
{
tool
.
title
=
_class
.
description
;
}
Object
.
keys
(
_class
.
css
||
{}).
forEach
(
function
(
k
)
{
tool
.
style
[
k
]
=
_class
.
css
[
k
];
});
...
...
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