Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
renderjs
Commits
8f806624
Commit
8f806624
authored
Feb 01, 2014
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fwi: use index_list gadget for blog post
parent
4bdd7671
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
55 deletions
+30
-55
examples/fwi/blog.html
examples/fwi/blog.html
+1
-6
examples/fwi/blog.js
examples/fwi/blog.js
+2
-33
examples/fwi/officejs.js
examples/fwi/officejs.js
+27
-16
No files found.
examples/fwi/blog.html
View file @
8f806624
...
...
@@ -9,13 +9,8 @@
<script
src=
"../../dist/renderjs-latest.js"
type=
"text/javascript"
></script>
<script
src=
"blog.js"
type=
"text/javascript"
></script>
</head>
<header><h1
style=
"text-align:center;"
>
Free Web Initiative
</h1></header>
<body
style=
"background-color: white; color: black;"
>
<div
class=
"sidebar"
id=
"index"
></div>
<div
class=
"main-container"
>
<div
class=
"main wrapper clearfix"
>
<div
id=
"content"
></div>
</div>
<div
id=
"post-content"
></div>
</div>
</body>
</html>
...
...
examples/fwi/blog.js
View file @
8f806624
...
...
@@ -6,41 +6,10 @@
*/
var
gk
=
rJS
(
window
);
var
loadAndDisplayIndexView
=
function
()
{
var
i
,
length
,
rows
,
row
,
page_list_html
=
"
<ul>
"
;
rows
=
this
.
page_list
.
data
.
rows
;
length
=
rows
.
length
;
for
(
i
=
0
;
i
<
length
;
i
+=
1
)
{
page_list_html
+=
"
<li><a href=
\"
#
"
+
rows
[
i
].
doc
.
title
.
replace
(
/"/g
,
"
\\\"
"
)
+
"
\"
>
"
+
rows
[
i
].
doc
.
title
+
"
</a></li>
"
;
}
page_list_html
+=
"
</ul>
"
;
place
.
index
.
dom
.
innerHTML
=
page_list_html
;
};
var
loadAndDisplayContentPage
=
function
(
value
)
{
var
i
;
//,
//rows = this.page_list.data.rows,
//length = rows.length;
//for (i = 0; i < length; i += 1) {
//if (rows[i].doc.title === page_title) {
// // show page
$
(
"
#content
"
).
empty
().
append
(
value
);
//place.content.dom.innerHTML = rows[i].doc.text_content;
// return;
// }
//}
//place.content.dom.innerHTML = "<p>404</p>";
};
/* Initialize Page List */
gk
.
declareMethod
(
'
setPageList
'
,
function
(
page_list
)
{
this
.
page_list
=
page_list
;
});
gk
.
declareMethod
(
'
displayHTML
'
,
function
(
value
)
{
gk
.
declareMethod
(
'
setContent
'
,
function
(
value
)
{
this
.
value
=
value
;
loadAndDisplayContentPage
(
value
);
$
(
"
#post-content
"
).
empty
().
append
(
value
.
text_content
);
});
/**
...
...
examples/fwi/officejs.js
View file @
8f806624
...
...
@@ -40,7 +40,7 @@
function
attachIOToBlog
(
all_param
)
{
var
blog
=
all_param
[
0
],
io
=
all_param
[
1
],
i
d
=
all_param
[
2
],
i
ndex
=
all_param
[
2
],
jio_config
=
{
"
type
"
:
"
dropbox
"
,
"
access_token
"
:
"
v43SQLCEoi8AAAAAAAAAAVixCoMfDelgGj3NRPfEnqscAuNGp2LhoS8-GiAaDD4C
"
...
...
@@ -48,15 +48,21 @@
$
(
blog
.
element
).
trigger
(
'
create
'
);
return
io
.
configureIO
(
jio_config
)
.
then
(
function
()
{
return
io
.
getIO
(
'
48c3ca06-78b9-2f4c-80db-d5cb2417de45
'
).
fail
(
function
(
error
)
{
return
io
.
getIO
List
(
).
fail
(
function
(
error
)
{
if
(
error
.
status
===
404
)
{
return
""
;
}
throw
error
;
});
})
.
then
(
function
(
document
)
{
return
blog
.
displayHTML
(
document
.
text_content
);
.
then
(
function
(
document_list
)
{
return
RSVP
.
all
([
blog
.
setContent
(
document_list
[
0
].
doc
),
index
.
setDocumentList
(
document_list
,
blog
,
blog
.
setContent
,
io
,
io
.
getIO
)
]);
});
}
...
...
@@ -96,17 +102,19 @@
};
}
function
createLoadNewBlogCallback
(
g
,
blog_path
,
e_c
,
io_path
,
i_c
)
{
function
createLoadNewBlogCallback
(
g
,
blog_path
,
e_c
,
io_path
,
i_c
,
index_path
,
index_c
)
{
return
function
()
{
e_c
.
empty
();
i_c
.
empty
();
$
(
'
.sidebar
'
).
empty
();
return
RSVP
.
all
([
g
.
declareGadget
(
blog_path
,
{
element
:
e_c
[
0
],
sandbox
:
'
iframe
'
}
),
g
.
declareGadget
(
blog_path
),
g
.
declareGadget
(
io_path
),
"
officejs
"
g
.
declareGadget
(
index_path
)
])
.
then
(
function
(
all_param
)
{
e_c
[
0
].
appendChild
(
all_param
[
0
].
element
);
index_c
[
0
].
appendChild
(
all_param
[
2
].
element
);
return
attachIOToBlog
(
all_param
);
})
.
fail
(
handleError
);
...
...
@@ -156,14 +164,13 @@
i
;
// Load 1 editor and 1 IO and plug them
return
RSVP
.
all
([
g
.
declareGadget
(
blog_list
[
0
].
path
,
{
element
:
blog_a_context
[
0
],
sandbox
:
'
iframe
'
}
),
g
.
declareGadget
(
io_list
[
0
].
path
),
// io_a_context),
"
officejs
"
g
.
declareGadget
(
blog_list
[
0
].
path
),
g
.
declareGadget
(
io_list
[
0
].
path
),
g
.
declareGadget
(
index_definition
)
])
.
then
(
function
(
all_param
)
{
blog_a_context
[
0
].
appendChild
(
all_param
[
0
].
element
);
index_a_context
[
0
].
appendChild
(
all_param
[
2
].
element
);
io_blog_a_context
.
empty
();
return
attachIOToBlog
(
all_param
);
})
...
...
@@ -176,8 +183,12 @@
'
data-iconpos="left">
'
+
blog_definition
.
title
+
'
</a>
'
);
panel_context
.
find
(
'
a
'
).
last
().
click
(
createLoadNewBlogCallback
(
g
,
blog_definition
.
path
,
blog_a_context
,
io_list
[
0
].
path
,
io_blog_a_context
)
createLoadNewBlogCallback
(
g
,
blog_definition
.
path
,
blog_a_context
,
io_list
[
0
].
path
,
io_blog_a_context
,
index_definition
,
index_a_context
)
);
}
for
(
i
=
0
;
i
<
editor_list
.
length
;
i
+=
1
)
{
...
...
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