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
7cc01a8b
Commit
7cc01a8b
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
Publish built version.
parent
07a0d43d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
8 deletions
+94
-8
dream/platform/static/dream/Input_viewResultList.html
dream/platform/static/dream/Input_viewResultList.html
+4
-2
dream/platform/static/dream/Input_viewResultList.js
dream/platform/static/dream/Input_viewResultList.js
+6
-0
dream/platform/static/dream/index.html
dream/platform/static/dream/index.html
+14
-3
dream/platform/static/dream/index.js
dream/platform/static/dream/index.js
+70
-3
No files found.
dream/platform/static/dream/Input_viewResultList.html
View file @
7cc01a8b
...
...
@@ -10,9 +10,11 @@
<script
id=
"table-template"
type=
"text/x-handlebars-template"
>
<
ul
data
-
role
=
"
listview
"
data
-
inset
=
"
true
"
class
=
"
document-listview
"
>
{{
#
documentlist
}}
{{
#
each
documentlist
}}
<
li
><
a
href
=
"
{{link}}
"
>
{{
title
}}
<
/a></
li
>
{{
/
documentlist
}}
{{
else
}}
<
p
>
No
result
yet
.
<
/p
>
{{
/
each
}}
<
/ul
>
</script>
...
...
dream/platform/static/dream/Input_viewResultList.js
View file @
7cc01a8b
...
...
@@ -14,6 +14,12 @@
return
gadget
.
aq_getAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
simulation.json
"
}).
push
(
undefined
,
function
(
error
)
{
if
(
error
.
status
===
404
)
{
// Simulation not yet generated
return
JSON
.
stringify
([]);
}
throw
error
;
}).
push
(
function
(
sim_json
)
{
var
document_list
=
JSON
.
parse
(
sim_json
),
result_list
=
[],
i
;
for
(
i
=
0
;
i
<
document_list
.
length
;
i
+=
1
)
{
...
...
dream/platform/static/dream/index.html
View file @
7cc01a8b
...
...
@@ -47,10 +47,21 @@
</div>
<header
data-role=
"header"
>
<a
href=
"#leftpanel"
data-icon=
"bars"
class=
"menu_link ui-btn ui-icon-bars ui-btn-icon-left"
>
Menu
</a>
<div
data-role=
"controlgroup"
data-type=
"horizontal"
class=
"ui-btn-left"
>
<a
href=
"#leftpanel"
data-icon=
"bars"
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>
<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>
<div
class=
"nav_container"
></div>
...
...
dream/platform/static/dream/index.js
View file @
7cc01a8b
...
...
@@ -106,6 +106,63 @@
return
navigation_template
(
kw
);
});
}
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
)
{
var
title
;
if
(
portal_type
===
"
Input Module
"
)
{
title
=
"
Documents
"
;
}
else
if
(
portal_type
===
"
Input
"
)
{
title
=
gadget
.
getDeclaredGadget
(
"
jio
"
).
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
get
({
_id
:
options
.
id
});
}).
push
(
function
(
jio_doc
)
{
return
jio_doc
.
data
.
title
+
"
(
"
+
jio_doc
.
data
.
modified
+
"
)
"
;
});
}
else
if
(
portal_type
===
"
Output
"
)
{
title
=
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
);
return
document_list
[
options
.
result
].
score
+
"
"
+
document_list
[
options
.
result
].
key
;
});
}
else
{
throw
new
Error
(
"
Unknown portal type:
"
+
portal_type
);
}
return
title
;
}
function
calculateNavigationHTML
(
gadget
,
portal_type
,
options
)
{
var
nav_html
,
action
;
if
(
portal_types
[
portal_type
][
options
.
action
].
type
===
"
object_view
"
)
{
...
...
@@ -221,7 +278,9 @@
g
.
props
.
configuration_dict
=
JSON
.
parse
(
evt
.
target
.
responseText
);
});
}).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
page_gadget
,
portal_type
=
"
Input Module
"
,
nav_element
=
gadget
.
props
.
element
.
getElementsByClassName
(
"
nav_container
"
)[
0
],
element
=
gadget
.
props
.
element
.
getElementsByClassName
(
"
gadget_container
"
)[
0
];
var
gadget
=
this
,
back_kw
=
{
action
:
"
view
"
},
page_gadget
,
portal_type
=
"
Input Module
"
,
nav_element
=
gadget
.
props
.
element
.
getElementsByClassName
(
"
nav_container
"
)[
0
],
element
=
gadget
.
props
.
element
.
getElementsByClassName
(
"
gadget_container
"
)[
0
];
if
(
options
.
action
===
undefined
)
{
// Redirect to the view action
options
.
action
=
"
view
"
;
...
...
@@ -233,6 +292,8 @@
portal_type
=
"
Input
"
;
}
else
{
portal_type
=
"
Output
"
;
back_kw
.
action
=
"
view_result
"
;
back_kw
.
id
=
options
.
id
;
}
}
// Get the action informations
...
...
@@ -242,11 +303,17 @@
return
page_gadget
.
render
(
options
);
}
}).
push
(
function
()
{
return
RSVP
.
all
([
page_gadget
.
getElement
(),
calculateNavigationHTML
(
gadget
,
portal_type
,
options
)
]);
return
RSVP
.
all
([
page_gadget
.
getElement
(),
calculateNavigationHTML
(
gadget
,
portal_type
,
options
)
,
gadget
.
aq_pleasePublishMyState
(
back_kw
),
getTitle
(
gadget
,
portal_type
,
options
),
getNextLink
(
gadget
,
portal_type
,
options
)
]);
}).
push
(
function
(
result_list
)
{
var
nav_html
=
result_list
[
1
],
page_element
=
result_list
[
0
];
// Update title
gadget
.
props
.
element
.
querySelector
(
"
header h1
"
).
textContent
=
portal_type
;
gadget
.
props
.
element
.
querySelector
(
"
header h1
"
).
textContent
=
result_list
[
3
];
// XXX Hide the back button in case of module display?
// Update back link
gadget
.
props
.
element
.
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
// Clear the previous rendering
while
(
nav_element
.
firstChild
)
{
...
...
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