Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
renderjs
Commits
20834ef4
Commit
20834ef4
authored
Jan 31, 2014
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
index_list: add Basic Gadget
parent
f97a810f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
82 additions
and
9 deletions
+82
-9
examples/fwi/catalog.js
examples/fwi/catalog.js
+9
-0
examples/fwi/index_list.html
examples/fwi/index_list.html
+19
-0
examples/fwi/index_list.js
examples/fwi/index_list.js
+27
-0
examples/fwi/io.js
examples/fwi/io.js
+1
-1
examples/fwi/officejs.html
examples/fwi/officejs.html
+1
-0
examples/fwi/officejs.js
examples/fwi/officejs.js
+25
-8
No files found.
examples/fwi/catalog.js
View file @
20834ef4
...
@@ -27,6 +27,11 @@
...
@@ -27,6 +27,11 @@
"
title
"
:
"
Blog
"
,
"
title
"
:
"
Blog
"
,
"
interface
"
:
"
http://www.renderjs.org/interface/blog
"
"
interface
"
:
"
http://www.renderjs.org/interface/blog
"
},
},
index_1_dict
=
{
"
path
"
:
"
./index_list.html
"
,
"
title
"
:
"
Index
"
,
"
interface
"
:
"
http://www.renderjs.org/interface/index
"
},
property_1_dict
=
{
property_1_dict
=
{
"
path
"
:
"
./property.html
"
,
"
path
"
:
"
./property.html
"
,
"
title
"
:
"
Property
"
,
"
title
"
:
"
Property
"
,
...
@@ -46,6 +51,7 @@
...
@@ -46,6 +51,7 @@
catalog_list
.
push
(
editor_4_dict
);
catalog_list
.
push
(
editor_4_dict
);
catalog_list
.
push
(
property_1_dict
);
catalog_list
.
push
(
property_1_dict
);
catalog_list
.
push
(
blog_1_dict
);
catalog_list
.
push
(
blog_1_dict
);
catalog_list
.
push
(
index_1_dict
);
gk
.
declareMethod
(
'
allDocs
'
,
function
(
filter
)
{
gk
.
declareMethod
(
'
allDocs
'
,
function
(
filter
)
{
var
deferred
=
$
.
Deferred
();
var
deferred
=
$
.
Deferred
();
...
@@ -57,6 +63,9 @@
...
@@ -57,6 +63,9 @@
}
else
if
(
filter
.
query
===
}
else
if
(
filter
.
query
===
'
interface: "http://www.renderjs.org/interface/blog"
'
)
{
'
interface: "http://www.renderjs.org/interface/blog"
'
)
{
deferred
.
resolve
([
blog_1_dict
]);
deferred
.
resolve
([
blog_1_dict
]);
}
else
if
(
filter
.
query
===
'
interface: "http://www.renderjs.org/interface/index"
'
)
{
deferred
.
resolve
([
index_1_dict
]);
}
else
if
(
filter
.
query
===
}
else
if
(
filter
.
query
===
'
interface: "http://www.renderjs.org/interface/property"
'
)
{
'
interface: "http://www.renderjs.org/interface/property"
'
)
{
deferred
.
resolve
([
property_1_dict
]);
deferred
.
resolve
([
property_1_dict
]);
...
...
examples/fwi/index_list.html
0 → 100644
View file @
20834ef4
<!DOCTYPE html>
<html>
<head>
<title>
Free Web Initiative
</title>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
>
<link
rel=
"stylesheet"
href=
"blog.css"
>
<script
src=
"../../lib/jquery/jquery.js"
type=
"text/javascript"
></script>
<script
src=
"../../node_modules/rsvp/dist/rsvp-2.0.4.js"
type=
"text/javascript"
></script>
<script
src=
"../../dist/renderjs-latest.js"
type=
"text/javascript"
></script>
<script
src=
"index_list.js"
type=
"text/javascript"
></script>
</head>
<body
style=
"background-color: white; color: black;"
>
<div
class=
"sidebar"
>
<ul
id=
"index_list"
>
</ul>
</div>
</body>
</html>
examples/fwi/index_list.js
0 → 100644
View file @
20834ef4
/*jslint indent: 2 */
/*global EventEmitter, RSVP, jIO */
(
function
(
window
,
rJS
,
$
)
{
/**
* Web site configurations
*/
var
gk
=
rJS
(
window
);
/* Initialize Page List */
gk
.
declareMethod
(
'
setDocumentList
'
,
function
(
document_list
)
{
var
i
,
document
,
index_list_panel
=
$
(
'
#index_list
'
);
for
(
i
=
0
;
i
<
document_list
.
length
;
i
+=
1
)
{
document
=
document_list
[
i
].
doc
;
index_list_panel
.
append
(
"
<li><a href=#>
"
+
document
.
title
+
"
</a></li>
"
);
//panel_context.find('a').last().click(
// createLoadNewBlogCallback(
// g, blog_definition.path,
// blog_a_context, io_list[0].path, io_blog_a_context)
// );
}
});
}(
window
,
rJS
,
jQuery
));
\ No newline at end of file
examples/fwi/io.js
View file @
20834ef4
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
.
declareMethod
(
'
getIOList
'
,
function
()
{
.
declareMethod
(
'
getIOList
'
,
function
()
{
var
gadget
=
this
;
var
gadget
=
this
;
// Should use index storage
// Should use index storage
return
gadget
.
jio
.
A
llDocs
({
return
gadget
.
jio
.
a
llDocs
({
"
include_docs
"
:
true
"
include_docs
"
:
true
}).
then
(
function
(
response
)
{
}).
then
(
function
(
response
)
{
return
response
.
data
.
rows
;
return
response
.
data
.
rows
;
...
...
examples/fwi/officejs.html
View file @
20834ef4
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
<div
class=
"editor_a"
>
<div
class=
"editor_a"
>
<div
data-role=
"fieldcontain"
class=
"editor_a_safe"
>
<div
data-role=
"fieldcontain"
class=
"editor_a_safe"
>
</div>
</div>
<div
data-role=
"fieldcontain"
class=
"sidebar"
></div>
<div
data-role=
"fieldcontain"
class=
"property_a_safe"
>
<div
data-role=
"fieldcontain"
class=
"property_a_safe"
>
</div>
</div>
<div
data-role=
"fieldcontain"
class=
"editor_a"
>
<div
data-role=
"fieldcontain"
class=
"editor_a"
>
...
...
examples/fwi/officejs.js
View file @
20834ef4
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
io
=
all_param
[
1
],
io
=
all_param
[
1
],
id
=
all_param
[
2
],
id
=
all_param
[
2
],
property
=
all_param
[
3
],
property
=
all_param
[
3
],
index
=
all_param
[
4
],
jio_config
=
{
jio_config
=
{
"
type
"
:
"
dropbox
"
,
"
type
"
:
"
dropbox
"
,
"
access_token
"
:
"
v43SQLCEoi8AAAAAAAAAAVixCoMfDelgGj3NRPfEnqscAuNGp2LhoS8-GiAaDD4C
"
"
access_token
"
:
"
v43SQLCEoi8AAAAAAAAAAVixCoMfDelgGj3NRPfEnqscAuNGp2LhoS8-GiAaDD4C
"
...
@@ -19,15 +20,20 @@
...
@@ -19,15 +20,20 @@
return
io
.
configureDataSourceCallback
(
editor
,
editor
.
getContent
,
property
,
property
.
getContent
,
'
48c3ca06-78b9-2f4c-80db-d5cb2417de45
'
);
return
io
.
configureDataSourceCallback
(
editor
,
editor
.
getContent
,
property
,
property
.
getContent
,
'
48c3ca06-78b9-2f4c-80db-d5cb2417de45
'
);
})
})
.
then
(
function
()
{
.
then
(
function
()
{
return
io
.
getIO
(
'
48c3ca06-78b9-2f4c-80db-d5cb2417de45
'
).
fail
(
function
(
error
)
{
return
io
.
getIO
List
(
).
fail
(
function
(
error
)
{
if
(
error
.
status
===
404
)
{
if
(
error
.
status
===
404
)
{
return
""
;
return
""
;
}
}
throw
error
;
throw
error
;
});
});
})
})
.
then
(
function
(
document
)
{
.
then
(
function
(
document_list
)
{
return
RSVP
.
all
([
editor
.
setContent
(
document
.
text_content
),
property
.
setContent
(
document
)]);
console
.
log
(
document_list
);
return
RSVP
.
all
([
editor
.
setContent
(
document_list
[
0
].
doc
.
text_content
),
property
.
setContent
(
document_list
[
0
].
doc
),
index
.
setDocumentList
(
document_list
)
]);
});
});
}
}
...
@@ -71,22 +77,24 @@
...
@@ -71,22 +77,24 @@
throw
rejectedReason
;
throw
rejectedReason
;
}
}
function
createLoadNewEditorCallback
(
g
,
editor_path
,
e_c
,
io_path
,
i_c
,
property_path
,
p_c
)
{
function
createLoadNewEditorCallback
(
g
,
editor_path
,
e_c
,
io_path
,
i_c
,
property_path
,
p_c
,
index_path
,
index_c
)
{
return
function
()
{
return
function
()
{
e_c
.
empty
();
e_c
.
empty
();
p_c
.
empty
();
p_c
.
empty
().
attr
(
"
style
"
,
""
);
index_c
.
empty
().
attr
(
"
style
"
,
""
);
$
(
'
.editor_a_safe
'
).
attr
(
"
style
"
,
""
);
$
(
'
.editor_a_safe
'
).
attr
(
"
style
"
,
""
);
$
(
'
.property_a_safe
'
).
attr
(
"
style
"
,
""
);
return
RSVP
.
all
([
return
RSVP
.
all
([
g
.
declareGadget
(
editor_path
,
{
element
:
e_c
[
0
],
sandbox
:
'
iframe
'
}),
g
.
declareGadget
(
editor_path
,
{
element
:
e_c
[
0
],
sandbox
:
'
iframe
'
}),
g
.
declareGadget
(
io_path
),
g
.
declareGadget
(
io_path
),
"
officejs
"
,
"
officejs
"
,
g
.
declareGadget
(
property_path
)
g
.
declareGadget
(
property_path
),
g
.
declareGadget
(
index_path
)
])
])
.
then
(
function
(
all_param
)
{
.
then
(
function
(
all_param
)
{
i_c
.
empty
();
i_c
.
empty
();
i_c
[
0
].
appendChild
(
all_param
[
1
].
element
);
i_c
[
0
].
appendChild
(
all_param
[
1
].
element
);
p_c
[
0
].
appendChild
(
all_param
[
3
].
element
);
p_c
[
0
].
appendChild
(
all_param
[
3
].
element
);
index_c
[
0
].
appendChild
(
all_param
[
4
].
element
);
return
attachIOToEditor
(
all_param
);
return
attachIOToEditor
(
all_param
);
})
})
.
fail
(
handleError
);
.
fail
(
handleError
);
...
@@ -96,6 +104,7 @@
...
@@ -96,6 +104,7 @@
function
createLoadNewBlogCallback
(
g
,
blog_path
,
e_c
,
io_path
,
i_c
)
{
function
createLoadNewBlogCallback
(
g
,
blog_path
,
e_c
,
io_path
,
i_c
)
{
return
function
()
{
return
function
()
{
e_c
.
empty
();
e_c
.
empty
();
$
(
'
.sidebar
'
).
empty
();
$
(
'
.editor_a_safe
'
).
attr
(
"
style
"
,
"
display:none
"
);
$
(
'
.editor_a_safe
'
).
attr
(
"
style
"
,
"
display:none
"
);
$
(
'
.property_a_safe
'
).
attr
(
"
style
"
,
"
display:none
"
);
$
(
'
.property_a_safe
'
).
attr
(
"
style
"
,
"
display:none
"
);
return
RSVP
.
all
([
return
RSVP
.
all
([
...
@@ -117,6 +126,7 @@
...
@@ -117,6 +126,7 @@
io_a_context
=
$
(
g
.
element
).
find
(
"
.editor_a_safe
"
).
last
(),
io_a_context
=
$
(
g
.
element
).
find
(
"
.editor_a_safe
"
).
last
(),
io_blog_a_context
=
$
(
g
.
element
).
find
(
"
.editor_a_safe
"
).
last
(),
io_blog_a_context
=
$
(
g
.
element
).
find
(
"
.editor_a_safe
"
).
last
(),
blog_a_context
=
$
(
g
.
element
).
find
(
"
.editor_a
"
).
last
(),
blog_a_context
=
$
(
g
.
element
).
find
(
"
.editor_a
"
).
last
(),
index_a_context
=
$
(
g
.
element
).
find
(
"
.sidebar
"
).
last
(),
property_a_context
=
$
(
g
.
element
).
find
(
"
.property_a_safe
"
).
last
()
property_a_context
=
$
(
g
.
element
).
find
(
"
.property_a_safe
"
).
last
()
;
;
...
@@ -138,6 +148,9 @@
...
@@ -138,6 +148,9 @@
),
),
catalog
.
allDocs
(
catalog
.
allDocs
(
{
query
:
'
interface: "http://www.renderjs.org/interface/property"
'
}
{
query
:
'
interface: "http://www.renderjs.org/interface/property"
'
}
),
catalog
.
allDocs
(
{
query
:
'
interface: "http://www.renderjs.org/interface/index"
'
}
)
)
]);
]);
})
})
...
@@ -147,8 +160,10 @@
...
@@ -147,8 +160,10 @@
io_list
=
all_list
[
1
],
io_list
=
all_list
[
1
],
blog_list
=
all_list
[
2
],
blog_list
=
all_list
[
2
],
property_list
=
all_list
[
3
],
property_list
=
all_list
[
3
],
index_list
=
all_list
[
4
],
editor_definition
,
editor_definition
,
blog_definition
,
blog_definition
,
index_definition
=
index_list
[
0
].
path
,
property_definition
,
property_definition
,
i
;
i
;
// Load 1 editor and 1 IO and plug them
// Load 1 editor and 1 IO and plug them
...
@@ -192,7 +207,9 @@
...
@@ -192,7 +207,9 @@
createLoadNewEditorCallback
(
createLoadNewEditorCallback
(
g
,
editor_definition
.
path
,
g
,
editor_definition
.
path
,
editor_a_context
,
io_list
[
0
].
path
,
io_a_context
,
editor_a_context
,
io_list
[
0
].
path
,
io_a_context
,
property_definition
.
path
,
property_a_context
)
property_definition
.
path
,
property_a_context
,
index_definition
,
index_a_context
)
);
);
}
}
panel_context
.
trigger
(
'
create
'
);
panel_context
.
trigger
(
'
create
'
);
...
...
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