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
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 @@
...
@@ -9,13 +9,8 @@
<script
src=
"../../dist/renderjs-latest.js"
type=
"text/javascript"
></script>
<script
src=
"../../dist/renderjs-latest.js"
type=
"text/javascript"
></script>
<script
src=
"blog.js"
type=
"text/javascript"
></script>
<script
src=
"blog.js"
type=
"text/javascript"
></script>
</head>
</head>
<header><h1
style=
"text-align:center;"
>
Free Web Initiative
</h1></header>
<body
style=
"background-color: white; color: black;"
>
<body
style=
"background-color: white; color: black;"
>
<div
class=
"sidebar"
id=
"index"
></div>
<div
id=
"post-content"
></div>
<div
class=
"main-container"
>
<div
class=
"main wrapper clearfix"
>
<div
id=
"content"
></div>
</div>
</div>
</div>
</body>
</body>
</html>
</html>
...
...
examples/fwi/blog.js
View file @
8f806624
...
@@ -6,41 +6,10 @@
...
@@ -6,41 +6,10 @@
*/
*/
var
gk
=
rJS
(
window
);
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 */
/* Initialize Page List */
gk
.
declareMethod
(
'
setPageList
'
,
function
(
page_list
)
{
gk
.
declareMethod
(
'
setContent
'
,
function
(
value
)
{
this
.
page_list
=
page_list
;
});
gk
.
declareMethod
(
'
displayHTML
'
,
function
(
value
)
{
this
.
value
=
value
;
this
.
value
=
value
;
loadAndDisplayContentPage
(
value
);
$
(
"
#post-content
"
).
empty
().
append
(
value
.
text_content
);
});
});
/**
/**
...
...
examples/fwi/officejs.js
View file @
8f806624
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
function
attachIOToBlog
(
all_param
)
{
function
attachIOToBlog
(
all_param
)
{
var
blog
=
all_param
[
0
],
var
blog
=
all_param
[
0
],
io
=
all_param
[
1
],
io
=
all_param
[
1
],
i
d
=
all_param
[
2
],
i
ndex
=
all_param
[
2
],
jio_config
=
{
jio_config
=
{
"
type
"
:
"
dropbox
"
,
"
type
"
:
"
dropbox
"
,
"
access_token
"
:
"
v43SQLCEoi8AAAAAAAAAAVixCoMfDelgGj3NRPfEnqscAuNGp2LhoS8-GiAaDD4C
"
"
access_token
"
:
"
v43SQLCEoi8AAAAAAAAAAVixCoMfDelgGj3NRPfEnqscAuNGp2LhoS8-GiAaDD4C
"
...
@@ -48,15 +48,21 @@
...
@@ -48,15 +48,21 @@
$
(
blog
.
element
).
trigger
(
'
create
'
);
$
(
blog
.
element
).
trigger
(
'
create
'
);
return
io
.
configureIO
(
jio_config
)
return
io
.
configureIO
(
jio_config
)
.
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
blog
.
displayHTML
(
document
.
text_content
);
return
RSVP
.
all
([
blog
.
setContent
(
document_list
[
0
].
doc
),
index
.
setDocumentList
(
document_list
,
blog
,
blog
.
setContent
,
io
,
io
.
getIO
)
]);
});
});
}
}
...
@@ -96,17 +102,19 @@
...
@@ -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
()
{
return
function
()
{
e_c
.
empty
();
e_c
.
empty
();
i_c
.
empty
();
i_c
.
empty
();
$
(
'
.sidebar
'
).
empty
();
$
(
'
.sidebar
'
).
empty
();
return
RSVP
.
all
([
return
RSVP
.
all
([
g
.
declareGadget
(
blog_path
,
{
element
:
e_c
[
0
],
sandbox
:
'
iframe
'
}
),
g
.
declareGadget
(
blog_path
),
g
.
declareGadget
(
io_path
),
g
.
declareGadget
(
io_path
),
"
officejs
"
g
.
declareGadget
(
index_path
)
])
])
.
then
(
function
(
all_param
)
{
.
then
(
function
(
all_param
)
{
e_c
[
0
].
appendChild
(
all_param
[
0
].
element
);
index_c
[
0
].
appendChild
(
all_param
[
2
].
element
);
return
attachIOToBlog
(
all_param
);
return
attachIOToBlog
(
all_param
);
})
})
.
fail
(
handleError
);
.
fail
(
handleError
);
...
@@ -156,14 +164,13 @@
...
@@ -156,14 +164,13 @@
i
;
i
;
// Load 1 editor and 1 IO and plug them
// Load 1 editor and 1 IO and plug them
return
RSVP
.
all
([
return
RSVP
.
all
([
g
.
declareGadget
(
g
.
declareGadget
(
blog_list
[
0
].
path
),
blog_list
[
0
].
path
,
g
.
declareGadget
(
io_list
[
0
].
path
),
{
element
:
blog_a_context
[
0
],
sandbox
:
'
iframe
'
}
g
.
declareGadget
(
index_definition
)
),
g
.
declareGadget
(
io_list
[
0
].
path
),
// io_a_context),
"
officejs
"
])
])
.
then
(
function
(
all_param
)
{
.
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
();
io_blog_a_context
.
empty
();
return
attachIOToBlog
(
all_param
);
return
attachIOToBlog
(
all_param
);
})
})
...
@@ -176,8 +183,12 @@
...
@@ -176,8 +183,12 @@
'
data-iconpos="left">
'
+
blog_definition
.
title
+
'
</a>
'
'
data-iconpos="left">
'
+
blog_definition
.
title
+
'
</a>
'
);
);
panel_context
.
find
(
'
a
'
).
last
().
click
(
panel_context
.
find
(
'
a
'
).
last
().
click
(
createLoadNewBlogCallback
(
g
,
blog_definition
.
path
,
createLoadNewBlogCallback
(
blog_a_context
,
io_list
[
0
].
path
,
io_blog_a_context
)
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
)
{
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