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
9a8712e0
Commit
9a8712e0
authored
Jun 18, 2014
by
Romain Courteaud
🐸
Committed by
Jérome Perrin
Aug 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to save wip spreadsheet.
parent
db2371b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
4 deletions
+63
-4
dream/platform/src2/dream/Input_viewWipPartSpreadsheet.html
dream/platform/src2/dream/Input_viewWipPartSpreadsheet.html
+7
-0
dream/platform/src2/dream/Input_viewWipPartSpreadsheet.js
dream/platform/src2/dream/Input_viewWipPartSpreadsheet.js
+56
-4
No files found.
dream/platform/src2/dream/Input_viewWipPartSpreadsheet.html
View file @
9a8712e0
...
...
@@ -6,12 +6,19 @@
<title>
Edit Wip Part Spreadsheet
</title>
<script
src=
"../<%= copy.rsvp.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= copy.renderjs.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= curl.jquery.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= curl.jquerymobilejs.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_promise.js"
type=
"text/javascript"
></script>
<script
src=
"Input_viewWipPartSpreadsheet.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
data-gadget-url=
"../handsontable/index.html"
data-gadget-scope=
"tableeditor"
></div>
<form
class=
"save_form"
>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right"
>
Save
</button>
</form>
</body>
</html>
dream/platform/src2/dream/Input_viewWipPartSpreadsheet.js
View file @
9a8712e0
/*global rJS, RSVP, initGadgetMixin */
(
function
(
window
,
rJS
,
RSVP
,
initGadgetMixin
)
{
/*global rJS, RSVP, initGadgetMixin
, loopEventListener
*/
(
function
(
window
,
rJS
,
RSVP
,
initGadgetMixin
,
loopEventListener
)
{
"
use strict
"
;
function
saveSpreadsheet
(
evt
)
{
var
gadget
=
this
,
editor_data
,
editor_gadget
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
// Prevent double click
evt
.
target
.
getElementsByClassName
(
"
ui-btn
"
)[
0
].
disabled
=
true
;
return
gadget
.
getDeclaredGadget
(
"
tableeditor
"
);
})
.
push
(
function
(
tablegadget
)
{
editor_gadget
=
tablegadget
;
return
editor_gadget
.
getData
();
})
.
push
(
function
(
data
)
{
editor_data
=
data
;
// Always get a fresh version, to prevent deleting spreadsheet & co
return
gadget
.
aq_getAttachment
({
"
_id
"
:
gadget
.
props
.
jio_key
,
"
_attachment
"
:
"
body.json
"
});
})
.
push
(
function
(
body
)
{
var
data
=
JSON
.
parse
(
body
);
data
.
wip_part_spreadsheet
=
JSON
.
parse
(
editor_data
);
return
gadget
.
aq_putAttachment
({
"
_id
"
:
gadget
.
props
.
jio_key
,
"
_attachment
"
:
"
body.json
"
,
"
_data
"
:
JSON
.
stringify
(
data
,
null
,
2
),
"
_mimetype
"
:
"
application/json
"
});
})
.
push
(
function
()
{
evt
.
target
.
getElementsByClassName
(
"
ui-btn
"
)[
0
].
disabled
=
false
;
});
}
function
waitForSave
(
gadget
)
{
return
loopEventListener
(
gadget
.
props
.
element
.
getElementsByClassName
(
"
save_form
"
)[
0
],
'
submit
'
,
false
,
saveSpreadsheet
.
bind
(
gadget
)
);
}
var
gadget_klass
=
rJS
(
window
);
initGadgetMixin
(
gadget_klass
);
gadget_klass
...
...
@@ -9,6 +56,7 @@
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
aq_putAttachment
"
,
"
jio_putAttachment
"
)
/////////////////////////////////////////////////////////////////
// declared methods
...
...
@@ -36,9 +84,13 @@
})
.
declareMethod
(
"
startService
"
,
function
()
{
var
gadget
=
this
;
return
this
.
getDeclaredGadget
(
"
tableeditor
"
)
.
push
(
function
(
tableeditor
)
{
return
tableeditor
.
startService
();
return
RSVP
.
all
([
tableeditor
.
startService
(),
waitForSave
(
gadget
)
]);
});
});
}(
window
,
rJS
,
RSVP
,
initGadgetMixin
));
}(
window
,
rJS
,
RSVP
,
initGadgetMixin
,
loopEventListener
));
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