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
6ac75ea9
Commit
6ac75ea9
authored
Jun 12, 2014
by
Romain Courteaud
Committed by
Jérome Perrin
Aug 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update static version.
parent
bd84d954
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
132 additions
and
19 deletions
+132
-19
dream/platform/static/dream/favicon.ico
dream/platform/static/dream/favicon.ico
+0
-0
dream/platform/static/dream/index.html
dream/platform/static/dream/index.html
+1
-0
dream/platform/static/dream/manage_document.html
dream/platform/static/dream/manage_document.html
+5
-0
dream/platform/static/dream/manage_document.js
dream/platform/static/dream/manage_document.js
+69
-19
dream/platform/static/list_field/index.html
dream/platform/static/list_field/index.html
+27
-0
dream/platform/static/list_field/listfield.js
dream/platform/static/list_field/listfield.js
+30
-0
No files found.
dream/platform/static/dream/favicon.ico
0 → 100644
View file @
6ac75ea9
1.12 KB
dream/platform/static/dream/index.html
View file @
6ac75ea9
...
...
@@ -4,6 +4,7 @@
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Dream Simulation
</title>
<link
rel=
"shortcut icon"
href=
"favicon.ico"
>
<link
rel=
"stylesheet"
href=
"../lib/jquerymobile.css"
>
<link
rel=
"stylesheet"
href=
"index.css"
/>
...
...
dream/platform/static/dream/manage_document.html
View file @
6ac75ea9
...
...
@@ -6,12 +6,17 @@
<title>
Manage document
</title>
<script
src=
"../lib/rsvp.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/renderjs.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/jquery.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/jquerymobile.js"
type=
"text/javascript"
></script>
<script
src=
"document_page_mixin.js"
type=
"text/javascript"
></script>
<script
src=
"manage_document.js"
type=
"text/javascript"
></script>
</head>
<body>
<a
class=
"export_link ui-btn ui-btn-inline ui-icon-action ui-btn-icon-right"
>
Export
</a>
<form
class=
"knowledge_form"
>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline ui-icon-refresh ui-btn-icon-right"
>
Run Knowledge Extraction
</button>
</form>
<form
class=
"delete_form"
>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline ui-icon-delete ui-btn-icon-right"
>
Delete
</button>
</form>
...
...
dream/platform/static/dream/manage_document.js
View file @
6ac75ea9
/*global console, rJS, RSVP, initDocumentPageMixin */
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
)
{
/*global console, rJS, RSVP, initDocumentPageMixin
, jQuery
*/
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
$
)
{
"
use strict
"
;
function
datatouri
(
data
,
mime_type
)
{
var
result
=
"
data:
"
;
...
...
@@ -29,6 +29,70 @@
}
return
new
RSVP
.
Promise
(
resolver
,
canceller
);
}
function
disableAllButtons
(
gadget
)
{
// Prevent double click
var
i
,
button_list
=
gadget
.
props
.
element
.
getElementsByClassName
(
"
ui-btn
"
);
for
(
i
=
0
;
i
<
button_list
.
length
;
i
+=
1
)
{
button_list
[
i
].
disabled
=
true
;
}
}
function
waitForKnowledgeExtraction
(
gadget
)
{
return
new
RSVP
.
Queue
().
push
(
function
()
{
return
promiseEventListener
(
gadget
.
props
.
element
.
getElementsByClassName
(
"
knowledge_form
"
)[
0
],
"
submit
"
,
false
);
}).
push
(
function
()
{
disableAllButtons
(
gadget
);
return
gadget
.
aq_getAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
body.json
"
});
}).
push
(
function
(
body_json
)
{
$
.
mobile
.
loading
(
"
show
"
);
// XXX Hardcoded relative URL
return
gadget
.
aq_ajax
({
url
:
"
../../runKnowledgeExtraction
"
,
type
:
"
POST
"
,
data
:
body_json
,
headers
:
{
"
Content-Type
"
:
"
application/json
"
}
});
}).
push
(
undefined
,
function
(
error
)
{
// Always drop the loader
$
.
mobile
.
loading
(
"
hide
"
);
throw
error
;
}).
push
(
function
(
evt
)
{
$
.
mobile
.
loading
(
"
hide
"
);
var
json_data
=
JSON
.
parse
(
evt
.
target
.
responseText
);
if
(
json_data
.
success
!==
true
)
{
throw
new
Error
(
json_data
.
error
);
}
return
gadget
.
aq_putAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
body.json
"
,
_data
:
JSON
.
stringify
(
json_data
.
data
,
null
,
2
),
_mimetype
:
"
application/json
"
});
}).
push
(
function
()
{
return
gadget
.
whoWantToDisplayThisDocument
(
gadget
.
props
.
jio_key
);
}).
push
(
function
(
url
)
{
return
gadget
.
pleaseRedirectMyHash
(
url
);
});
}
function
waitForDeletion
(
gadget
)
{
return
new
RSVP
.
Queue
().
push
(
function
()
{
return
promiseEventListener
(
gadget
.
props
.
element
.
getElementsByClassName
(
"
delete_form
"
)[
0
],
"
submit
"
,
false
);
}).
push
(
function
()
{
disableAllButtons
(
gadget
);
// Delete jIO document
return
gadget
.
aq_remove
({
_id
:
gadget
.
props
.
jio_key
});
}).
push
(
function
(
result
)
{
return
gadget
.
whoWantToDisplayHome
();
}).
push
(
function
(
url
)
{
return
gadget
.
pleaseRedirectMyHash
(
url
);
});
}
var
gadget_klass
=
rJS
(
window
);
initDocumentPageMixin
(
gadget_klass
);
gadget_klass
.
ready
(
function
(
g
)
{
...
...
@@ -37,7 +101,7 @@
return
g
.
getElement
().
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
});
}).
declareAcquiredMethod
(
"
aq_remove
"
,
"
jio_remove
"
).
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareAcquiredMethod
(
"
aq_
get
"
,
"
jio_get
"
).
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
declareAcquiredMethod
(
"
whoWantToDisplayHome
"
,
"
whoWantToDisplayHome
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
}).
declareAcquiredMethod
(
"
aq_remove
"
,
"
jio_remove
"
).
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareAcquiredMethod
(
"
aq_
putAttachment
"
,
"
jio_putAttachment
"
).
declareAcquiredMethod
(
"
aq_get
"
,
"
jio_get
"
).
declareAcquiredMethod
(
"
aq_ajax
"
,
"
jio_ajax
"
).
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
declareAcquiredMethod
(
"
whoWantToDisplayThisDocument
"
,
"
whoWantToDisplayThisDocument
"
).
declareAcquiredMethod
(
"
whoWantToDisplayHome
"
,
"
whoWantToDisplayHome
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
this
.
props
.
jio_key
=
options
.
id
;
var
gadget
=
this
;
return
new
RSVP
.
Queue
().
push
(
function
()
{
...
...
@@ -53,20 +117,6 @@
export_link
.
href
=
datatouri
(
result_list
[
1
],
"
application/json
"
);
});
}).
declareMethod
(
"
startService
"
,
function
()
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
().
push
(
function
()
{
return
promiseEventListener
(
gadget
.
props
.
element
.
getElementsByClassName
(
"
delete_form
"
)[
0
],
"
submit
"
,
false
);
}).
push
(
function
()
{
// Prevent double click
gadget
.
props
.
element
.
getElementsByClassName
(
"
ui-btn
"
)[
0
].
disabled
=
true
;
// Delete jIO document
return
gadget
.
aq_remove
({
_id
:
gadget
.
props
.
jio_key
});
}).
push
(
function
(
result
)
{
return
gadget
.
whoWantToDisplayHome
();
}).
push
(
function
(
url
)
{
return
gadget
.
pleaseRedirectMyHash
(
url
);
});
return
RSVP
.
all
([
waitForDeletion
(
this
),
waitForKnowledgeExtraction
(
this
)
]);
});
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
);
\ No newline at end of file
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
jQuery
);
\ No newline at end of file
dream/platform/static/list_field/index.html
0 → 100644
View file @
6ac75ea9
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no"
/>
<title>
Listfield
</title>
<!-- renderjs -->
<script
src=
"../lib/rsvp.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/renderjs.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/handlebars.min.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<script
src=
"listfield.js"
type=
"text/javascript"
></script>
<script
id=
"option-template"
type=
"text/x-handlebars-template"
>
<
option
value
=
"
{{value}}
"
>
{{
text
}}
<
/option
>
</script>
<script
id=
"selected-option-template"
type=
"text/x-handlebars-template"
>
<
option
selected
=
"
selected
"
value
=
"
{{value}}
"
>
{{
text
}}
<
/option
>
</script>
</head>
<body>
<select
/>
</body>
</html>
dream/platform/static/list_field/listfield.js
0 → 100644
View file @
6ac75ea9
/*global window, rJS, console, RSVP, Handlebars */
/*jslint nomen: true */
(
function
(
window
,
rJS
,
console
,
RSVP
,
Handlebars
)
{
"
use strict
"
;
/////////////////////////////////////////////////////////////////
// Handlebars
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
var
gadget_klass
=
rJS
(
window
),
option_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
option-template
"
).
innerHTML
,
option_template
=
Handlebars
.
compile
(
option_source
),
selected_option_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
option-template
"
).
innerHTML
,
selected_option_template
=
Handlebars
.
compile
(
selected_option_source
);
gadget_klass
.
ready
(
function
(
g
)
{
return
g
.
getElement
().
push
(
function
(
element
)
{
g
.
element
=
element
;
});
}).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
select
=
this
.
element
.
getElementsByTagName
(
"
select
"
)[
0
],
i
,
template
,
field_json
=
options
.
field_json
,
tmp
=
""
;
select
.
setAttribute
(
"
name
"
,
field_json
.
key
);
for
(
i
=
0
;
i
<
field_json
.
items
.
length
;
i
+=
1
)
{
if
(
field_json
.
items
[
i
][
1
]
===
field_json
.
default
[
0
])
{
template
=
selected_option_template
;
}
else
{
template
=
option_template
;
}
tmp
+=
template
({
value
:
field_json
.
items
[
i
][
1
],
text
:
field_json
.
items
[
i
][
0
]
});
}
select
.
innerHTML
+=
tmp
;
});
})(
window
,
rJS
,
console
,
RSVP
,
Handlebars
);
\ No newline at end of file
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