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
07a0d43d
Commit
07a0d43d
authored
Jun 17, 2014
by
Romain Courteaud
Committed by
Jérome Perrin
Aug 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to loop on results.
parent
27c9ec71
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
6 deletions
+54
-6
dream/platform/src2/dream/index.html
dream/platform/src2/dream/index.html
+14
-5
dream/platform/src2/dream/index.js
dream/platform/src2/dream/index.js
+40
-1
No files found.
dream/platform/src2/dream/index.html
View file @
07a0d43d
...
@@ -47,12 +47,21 @@
...
@@ -47,12 +47,21 @@
</div>
</div>
<header
data-role=
"header"
>
<header
data-role=
"header"
>
<a
href=
"#leftpanel"
data-icon=
"bars"
<div
data-role=
"controlgroup"
data-type=
"horizontal"
class=
"ui-btn-left"
>
class=
"menu_link ui-btn ui-icon-bars ui-btn-icon-left"
>
Menu
</a>
<a
href=
"#leftpanel"
<a
data-icon=
"back"
data-icon=
"bars"
class=
"back_link ui-btn ui-icon-back ui-btn-icon-left"
>
Back
</a>
class=
"menu_link ui-btn ui-icon-bars ui-btn-icon-left"
>
Menu
</a>
<a
data-icon=
"back"
class=
"back_link ui-btn ui-icon-back ui-btn-icon-right"
>
Back
</a>
</div>
<h1>
Dream Simulation
</h1>
<h1>
Dream Simulation
</h1>
<div
data-role=
"controlgroup"
data-type=
"horizontal"
class=
"ui-btn-right"
>
<a
data-icon=
"forward"
class=
"next_link ui-btn ui-icon-forward ui-btn-icon-right"
>
Next
</a>
</div>
</header>
</header>
<div
class=
"nav_container"
></div>
<div
class=
"nav_container"
></div>
...
...
dream/platform/src2/dream/index.js
View file @
07a0d43d
...
@@ -118,6 +118,40 @@
...
@@ -118,6 +118,40 @@
});
});
}
}
function
getNextLink
(
gadget
,
portal_type
,
options
)
{
var
forward_kw
=
{
action
:
options
.
action
||
"
view
"
},
queue
=
new
RSVP
.
Queue
();
if
(
portal_type
===
"
Input
"
)
{
forward_kw
.
id
=
options
.
id
;
}
else
if
(
portal_type
===
"
Output
"
)
{
forward_kw
.
id
=
options
.
id
;
queue
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
"
jio
"
);
})
.
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
getAttachment
({
_id
:
options
.
id
,
"
_attachment
"
:
"
simulation.json
"
});
})
.
push
(
function
(
sim_json
)
{
var
document_list
=
JSON
.
parse
(
sim_json
),
current
=
parseInt
(
options
.
result
,
10
);
if
(
current
===
(
document_list
.
length
-
1
))
{
forward_kw
.
result
=
0
;
}
else
{
forward_kw
.
result
=
current
+
1
;
}
});
}
else
if
(
portal_type
!==
"
Input Module
"
)
{
throw
new
Error
(
"
Unknown portal type:
"
+
portal_type
);
}
return
queue
.
push
(
function
()
{
return
gadget
.
aq_pleasePublishMyState
(
forward_kw
);
});
}
function
getTitle
(
gadget
,
portal_type
,
options
)
{
function
getTitle
(
gadget
,
portal_type
,
options
)
{
var
title
;
var
title
;
if
(
portal_type
===
"
Input Module
"
)
{
if
(
portal_type
===
"
Input Module
"
)
{
...
@@ -377,7 +411,8 @@
...
@@ -377,7 +411,8 @@
page_gadget
.
getElement
(),
page_gadget
.
getElement
(),
calculateNavigationHTML
(
gadget
,
portal_type
,
options
),
calculateNavigationHTML
(
gadget
,
portal_type
,
options
),
gadget
.
aq_pleasePublishMyState
(
back_kw
),
gadget
.
aq_pleasePublishMyState
(
back_kw
),
getTitle
(
gadget
,
portal_type
,
options
)
getTitle
(
gadget
,
portal_type
,
options
),
getNextLink
(
gadget
,
portal_type
,
options
)
]);
]);
}).
push
(
function
(
result_list
)
{
}).
push
(
function
(
result_list
)
{
var
nav_html
=
result_list
[
1
],
var
nav_html
=
result_list
[
1
],
...
@@ -391,6 +426,10 @@
...
@@ -391,6 +426,10 @@
// Update back link
// Update back link
gadget
.
props
.
element
gadget
.
props
.
element
.
getElementsByClassName
(
"
back_link
"
)[
0
].
href
=
result_list
[
2
];
.
getElementsByClassName
(
"
back_link
"
)[
0
].
href
=
result_list
[
2
];
// XXX Hide the forward button in case of non result?
// Update forward link
gadget
.
props
.
element
.
getElementsByClassName
(
"
next_link
"
)[
0
].
href
=
result_list
[
4
];
// Update the navigation panel
// Update the navigation panel
// Clear the previous rendering
// Clear the previous rendering
...
...
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