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 @@
...
@@ -4,39 +4,13 @@
"
use strict
"
;
"
use strict
"
;
function
saveForm
(
gadget
)
{
function
saveForm
(
gadget
)
{
var
general
=
{},
var
general
;
field_gadget_list
;
return
gadget
.
getDeclaredGadget
(
'
fieldset
'
)
return
gadget
.
getDeclaredGadget
(
'
fieldset
'
)
.
push
(
function
(
fieldset_gadget
)
{
.
push
(
function
(
fieldset_gadget
)
{
return
fieldset_gadget
.
get
FieldGadgetLis
t
();
return
fieldset_gadget
.
get
Conten
t
();
})
})
.
push
(
function
(
field_gadgets
)
{
.
push
(
function
(
content
)
{
field_gadget_list
=
field_gadgets
;
general
=
content
;
})
.
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
];
}
}
}
}
// Always get a fresh version, to prevent deleting spreadsheet & co
// Always get a fresh version, to prevent deleting spreadsheet & co
return
gadget
.
aq_getAttachment
({
return
gadget
.
aq_getAttachment
({
"
_id
"
:
gadget
.
props
.
jio_key
,
"
_id
"
:
gadget
.
props
.
jio_key
,
...
...
dream/platform/src/fieldset/fieldset.js
View file @
007d8fc1
...
@@ -79,8 +79,25 @@
...
@@ -79,8 +79,25 @@
return
queue
;
return
queue
;
})
})
.
declareMethod
(
"
getFieldGadgetList
"
,
function
()
{
// getContent of all subfields
return
this
.
props
.
field_gadget_list
;
.
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 @@
...
@@ -405,10 +405,10 @@
function
updateElementData
(
gadget
,
node_id
,
data
)
{
function
updateElementData
(
gadget
,
node_id
,
data
)
{
var
element_id
=
gadget
.
props
.
node_container
[
node_id
].
element_id
,
var
element_id
=
gadget
.
props
.
node_container
[
node_id
].
element_id
,
new_id
=
data
.
id
;
new_id
=
data
.
id
;
if
(
data
.
name
)
{
if
(
data
.
data
.
name
)
{
$
(
gadget
.
props
.
element
).
find
(
"
#
"
+
element_id
).
text
(
data
.
name
)
$
(
gadget
.
props
.
element
).
find
(
"
#
"
+
element_id
).
text
(
data
.
data
.
name
)
.
append
(
'
<div class="ep"></div></div>
'
);
.
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
;
delete
data
.
id
;
$
.
extend
(
gadget
.
props
.
node_container
[
node_id
],
data
.
data
);
$
.
extend
(
gadget
.
props
.
node_container
[
node_id
],
data
.
data
);
...
@@ -485,19 +485,6 @@
...
@@ -485,19 +485,6 @@
// onDataChange();
// 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
)
{
function
openNodeDialog
(
gadget
,
element
,
config_dict
)
{
var
node_id
=
getNodeId
(
gadget
.
props
.
node_container
,
element
.
id
),
var
node_id
=
getNodeId
(
gadget
.
props
.
node_container
,
element
.
id
),
node_data
=
gadget
.
props
.
node_container
[
node_id
],
node_data
=
gadget
.
props
.
node_container
[
node_id
],
...
@@ -505,7 +492,6 @@
...
@@ -505,7 +492,6 @@
property_list
=
config_dict
[
element_type
].
property_list
||
[],
property_list
=
config_dict
[
element_type
].
property_list
||
[],
node_edit_popup
=
$
(
gadget
.
props
.
element
).
find
(
'
#popup-edit-template
'
),
node_edit_popup
=
$
(
gadget
.
props
.
element
).
find
(
'
#popup-edit-template
'
),
fieldset_element
,
fieldset_element
,
save_promise
,
delete_promise
;
delete_promise
;
if
(
node_edit_popup
.
length
!==
0
)
{
if
(
node_edit_popup
.
length
!==
0
)
{
...
@@ -521,6 +507,7 @@
...
@@ -521,6 +507,7 @@
node_data
.
id
=
node_id
;
node_data
.
id
=
node_id
;
if
(
property_list
.
length
===
0
||
property_list
[
0
].
id
!==
"
id
"
)
{
if
(
property_list
.
length
===
0
||
property_list
[
0
].
id
!==
"
id
"
)
{
// XXX name & id should not be handled differently in form.
property_list
.
unshift
({
property_list
.
unshift
({
"
_class
"
:
"
Dream.Property
"
,
"
_class
"
:
"
Dream.Property
"
,
"
id
"
:
"
name
"
,
"
id
"
:
"
name
"
,
...
@@ -536,17 +523,27 @@
...
@@ -536,17 +523,27 @@
});
});
}
}
save_promise
=
new
RSVP
.
Queue
()
function
save_promise
(
fieldset_gadget
,
node_id
)
{
.
push
(
function
()
{
return
RSVP
.
Queue
()
return
promiseEventListener
(
.
push
(
function
()
{
node_edit_popup
.
find
(
"
form
"
)[
0
],
return
promiseEventListener
(
'
submit
'
,
node_edit_popup
.
find
(
"
form
"
)[
0
],
false
'
submit
'
,
);
false
})
);
.
push
(
function
(
evt
)
{
})
return
saveNode
(
evt
,
gadget
,
node_id
);
.
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
()
delete_promise
=
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
...
@@ -565,15 +562,17 @@
...
@@ -565,15 +562,17 @@
scope
:
'
fieldset
'
scope
:
'
fieldset
'
})
})
.
push
(
function
(
fieldset_gadget
)
{
.
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
.
enhanceWithin
();
node_edit_popup
.
popup
(
'
open
'
);
node_edit_popup
.
popup
(
'
open
'
);
return
fieldset_gadget
[
0
];
})
})
.
push
(
function
()
{
.
push
(
function
(
fieldset_gadget
)
{
return
RSVP
.
any
([
return
RSVP
.
any
([
save_promise
,
save_promise
(
fieldset_gadget
,
node_id
)
,
delete_promise
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