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
007d8fc1
Commit
007d8fc1
authored
Jul 16, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement getContent on fieldset gadget and use it
parent
86024186
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
64 deletions
+54
-64
dream/platform/src/dream/Input_viewSimulation.js
dream/platform/src/dream/Input_viewSimulation.js
+4
-30
dream/platform/src/fieldset/fieldset.js
dream/platform/src/fieldset/fieldset.js
+19
-2
dream/platform/src/jsplumb/jsplumb.js
dream/platform/src/jsplumb/jsplumb.js
+31
-32
No files found.
dream/platform/src/dream/Input_viewSimulation.js
View file @
007d8fc1
...
...
@@ -4,39 +4,13 @@
"
use strict
"
;
function
saveForm
(
gadget
)
{
var
general
=
{},
field_gadget_list
;
var
general
;
return
gadget
.
getDeclaredGadget
(
'
fieldset
'
)
.
push
(
function
(
fieldset_gadget
)
{
return
fieldset_gadget
.
get
FieldGadgetLis
t
();
return
fieldset_gadget
.
get
Conten
t
();
})
.
push
(
function
(
field_gadgets
)
{
field_gadget_list
=
field_gadgets
;
})
.
push
(
function
()
{
var
i
,
promise_list
=
[];
for
(
i
=
0
;
i
<
field_gadget_list
.
length
;
i
+=
1
)
{
promise_list
.
push
(
field_gadget_list
[
i
].
getContent
());
}
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
(
result_list
)
{
var
i
,
result
,
key
;
for
(
i
=
0
;
i
<
result_list
.
length
;
i
+=
1
)
{
result
=
result_list
[
i
];
for
(
key
in
result
)
{
if
(
result
.
hasOwnProperty
(
key
))
{
// Drop empty
if
(
result
[
key
])
{
general
[
key
]
=
result
[
key
];
}
}
}
}
.
push
(
function
(
content
)
{
general
=
content
;
// Always get a fresh version, to prevent deleting spreadsheet & co
return
gadget
.
aq_getAttachment
({
"
_id
"
:
gadget
.
props
.
jio_key
,
...
...
dream/platform/src/fieldset/fieldset.js
View file @
007d8fc1
...
...
@@ -79,8 +79,25 @@
return
queue
;
})
.
declareMethod
(
"
getFieldGadgetList
"
,
function
()
{
return
this
.
props
.
field_gadget_list
;
// getContent of all subfields
.
declareMethod
(
"
getContent
"
,
function
()
{
var
i
,
promise_list
=
[];
for
(
i
=
0
;
i
<
this
.
props
.
field_gadget_list
.
length
;
i
+=
1
)
{
promise_list
.
push
(
this
.
props
.
field_gadget_list
[
i
].
getContent
());
}
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
(
result_list
)
{
var
name
,
result
=
{};
for
(
i
=
0
;
i
<
result_list
.
length
;
i
+=
1
)
{
for
(
name
in
result_list
[
i
])
{
if
(
result_list
[
i
].
hasOwnProperty
(
name
))
{
result
[
name
]
=
result_list
[
i
][
name
];
}
}
}
return
result
;
});
});
...
...
dream/platform/src/jsplumb/jsplumb.js
View file @
007d8fc1
...
...
@@ -405,10 +405,10 @@
function
updateElementData
(
gadget
,
node_id
,
data
)
{
var
element_id
=
gadget
.
props
.
node_container
[
node_id
].
element_id
,
new_id
=
data
.
id
;
if
(
data
.
name
)
{
$
(
gadget
.
props
.
element
).
find
(
"
#
"
+
element_id
).
text
(
data
.
name
)
if
(
data
.
data
.
name
)
{
$
(
gadget
.
props
.
element
).
find
(
"
#
"
+
element_id
).
text
(
data
.
data
.
name
)
.
append
(
'
<div class="ep"></div></div>
'
);
gadget
.
props
.
node_container
[
node_id
].
name
=
data
.
name
;
gadget
.
props
.
node_container
[
node_id
].
name
=
data
.
data
.
name
;
}
delete
data
.
id
;
$
.
extend
(
gadget
.
props
.
node_container
[
node_id
],
data
.
data
);
...
...
@@ -485,19 +485,6 @@
// onDataChange();
// }
function
saveNode
(
evt
,
gadget
,
node_id
)
{
var
i
,
data
=
{
"
id
"
:
$
(
evt
.
target
[
1
]).
val
(),
"
name
"
:
$
(
evt
.
target
[
2
]).
val
()
};
data
.
data
=
{};
for
(
i
=
3
;
i
<
evt
.
target
.
length
-
1
;
i
+=
1
)
{
data
.
data
[
evt
.
target
[
i
].
name
]
=
$
(
evt
.
target
[
i
]).
val
();
}
updateElementData
(
gadget
,
node_id
,
data
);
}
function
openNodeDialog
(
gadget
,
element
,
config_dict
)
{
var
node_id
=
getNodeId
(
gadget
.
props
.
node_container
,
element
.
id
),
node_data
=
gadget
.
props
.
node_container
[
node_id
],
...
...
@@ -505,7 +492,6 @@
property_list
=
config_dict
[
element_type
].
property_list
||
[],
node_edit_popup
=
$
(
gadget
.
props
.
element
).
find
(
'
#popup-edit-template
'
),
fieldset_element
,
save_promise
,
delete_promise
;
if
(
node_edit_popup
.
length
!==
0
)
{
...
...
@@ -521,6 +507,7 @@
node_data
.
id
=
node_id
;
if
(
property_list
.
length
===
0
||
property_list
[
0
].
id
!==
"
id
"
)
{
// XXX name & id should not be handled differently in form.
property_list
.
unshift
({
"
_class
"
:
"
Dream.Property
"
,
"
id
"
:
"
name
"
,
...
...
@@ -536,17 +523,27 @@
});
}
save_promise
=
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
promiseEventListener
(
node_edit_popup
.
find
(
"
form
"
)[
0
],
'
submit
'
,
false
);
})
.
push
(
function
(
evt
)
{
return
saveNode
(
evt
,
gadget
,
node_id
);
});
function
save_promise
(
fieldset_gadget
,
node_id
)
{
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
promiseEventListener
(
node_edit_popup
.
find
(
"
form
"
)[
0
],
'
submit
'
,
false
);
})
.
push
(
function
(
evt
)
{
var
data
=
{
// XXX id should not be handled differently ...
"
id
"
:
$
(
evt
.
target
[
1
]).
val
(),
"
data
"
:
{}
};
return
fieldset_gadget
.
getContent
().
then
(
function
(
r
)
{
$
.
extend
(
data
.
data
,
r
);
updateElementData
(
gadget
,
node_id
,
data
);
});
});
}
delete_promise
=
new
RSVP
.
Queue
()
.
push
(
function
()
{
...
...
@@ -565,15 +562,17 @@
scope
:
'
fieldset
'
})
.
push
(
function
(
fieldset_gadget
)
{
return
fieldset_gadget
.
render
(
property_list
,
node_data
);
return
RSVP
.
all
([
fieldset_gadget
,
fieldset_gadget
.
render
(
property_list
,
node_data
)]);
})
.
push
(
function
()
{
.
push
(
function
(
fieldset_gadget
)
{
node_edit_popup
.
enhanceWithin
();
node_edit_popup
.
popup
(
'
open
'
);
return
fieldset_gadget
[
0
];
})
.
push
(
function
()
{
.
push
(
function
(
fieldset_gadget
)
{
return
RSVP
.
any
([
save_promise
,
save_promise
(
fieldset_gadget
,
node_id
)
,
delete_promise
]);
})
...
...
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