f.write(json.dumps(includes))
f.close()
+ lib._fileadd(resolve('parts'))
+
# update the parts cache
PartCache.update_cache(docid, current.owner,\
stored_includes, includes)
"parent_user_resivion": udoc.revision,
"parent_revision": doc.revision,
"revision": udoc.revision,
- })
\ No newline at end of file
+ })
' '.join(s.capitalize() for s in part.split('_'))\
for part in fileid.split('$'))
-
+@register.inclusion_tag('explorer/file_tree_part.html')
+def tree_part(document):
+ return {'document': document}
\ No newline at end of file
@with_repo
def file_list(request, repo):
import api.forms
+ from api.resources import library_resource
+
bookform = api.forms.DocumentUploadForm()
+
+ # short-circut the api document list
+ doctree = library_resource.handler.read(request)
+ print doctree['documents']
+
return direct_to_template(request, 'explorer/file_list.html', extra_context={
- 'files': repo.documents(), 'bookform': bookform,
+ 'filetree': doctree['documents'], 'bookform': bookform,
})
@permission_required('explorer.can_add_files')
from django.views.generic.simple import direct_to_template
def index(request):
- return direct_to_template(request, 'wysiwyg.html', extra_context={})
\ No newline at end of file
+ return direct_to_template(request,
+ 'wysiwyg.html', extra_context={
+ 'listA': [1,2,3,4],
+ 'listB': [5,6,7,8],
+ })
\ No newline at end of file
width: 35%;
}
+ul.file-tree-part {
+ margin: 0.5em 1em;
+ padding: 0em;
+}
+
+ul.file-tree-part li {
+ list-style: square;
+ padding: 0em;
+}
+
+ul.file-tree-part a {
+ padding: 0em;
+}
+
background-color: white;
}
+/*
ul {
margin: 20px;
padding: 0;
margin: 0;
padding: 0;
list-style: none;
-}
+} */
a {
text-decoration: none;
<input type="reset" value="Wyczyść" id="file-list-reset-button"/>
</p>
</form>
- <div id="file-list">
{% load explorer_tags %}
- {% for file in files %}
- <p title="{{file|bookname}}"><a href="{% url editor_view file %}">{{ file|bookname }}</a></p>
+ <ul class="file-tree-part file-tree-top">
+ {% for file in filetree %}
+ {% tree_part file %}
{% endfor %}
- </div>
+ </ul>
</div>
<div id="recent-file-list">
--- /dev/null
+{% load explorer_tags %}
+
+<li class="file-tree-entry" title="{{document.name|bookname}}">
+ <a href="{% url editor_view document.name %}">{{ document.name|bookname }}</a>
+ {% if document.parts %}
+ <ul class="file-tree-part">
+ {% for part in document.parts %}
+ {% tree_part part %}
+ {% endfor %}
+ </ul>
+ {% endif %}
+</li>
+
{% extends 'base.html' %}
-{% block extrahead %}
-<style type="text/css">
- #loremIpsum {
- position: relative;
- }
-
- /* #lorepmIpsum * {
- position: relative;
- } */
-
- .element-overlay {
- position: absolute;
- opacity: 1;
- background: green;
- z-index: 100;
- padding: 0px;
- }
-
- .element-overlay textarea {
- opacity: 1;
- background: white;
- color: black;
- border: 1px dashed red;
- margin: 0px;
-
-
- width: 100%;
- height: 100%;
- }
-</style>
-{% endblock %}
-
{% block maincontent %}
<h1>Wysiwyg editor</h1>
<div>This part is not editable!</div>
<div id="loremIpsum">
+ {% for a,b in listA,listB %}
+
+ {{ a }} / {{ b }}
+ {% endfor %}
+
<p>
<p>Lorem <b>ipsum</b> dolor sit amet, consectetur adipiscing elit.
Suspendisse a urna eu enim rutrum elementum nec sed nibh. Quisque sed tortor
<p>Donec semper tempus ante, eget gravida erat varius et. Suspendisse aliquam rutrum nunc ac pulvinar. Aliquam erat volutpat. Nulla consectetur ultricies imperdiet. Nulla tincidunt est vitae augue porttitor a faucibus odio facilisis. In nec nisl odio. Aliquam et libero tortor, eu tincidunt mi. Vivamus suscipit erat sed mi hendrerit fringilla. Integer iaculis tempus nulla, at egestas velit faucibus ut. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vestibulum vel massa enim. Aliquam erat volutpat. In ligula tortor, fermentum eu suscipit at, posuere vel nunc. Nullam nibh magna, sollicitudin at semper et, mattis ut quam. Curabitur accumsan semper elit ac posuere. Sed sit amet lorem tortor, vel porttitor justo. Fusce odio metus, bibendum ut bibendum sit amet, luctus a ipsum. </p>
</div>
-{% endblock %}
-
-{% block extrabody %}
-<script type="text/javascript">
-$(function() {
- var lorem = $('#loremIpsum');
-
- var x = $('#loremIpsum *');
-
- x.click( function(event)
- {
- var e = $(this);
- $.log("Overlaying element: ", this);
- var p = e.offsetParent();
- var pos = e.position();
- var marginTop = parseInt(e.css('margin-top'));
-
- $.log("Offset: ", pos, p);
- var overlay = $('<div class="element-overlay"><textarea></textarea></div>');
- var text = $('textarea', overlay);
- text.val(e.text());
-
- p.prepend(overlay);
-
- overlay.css({ top: pos.top+marginTop, left: pos.left, width: e.width(), height: e.height()});
-
- return false;
- })
-});
-</script>
{% endblock %}
\ No newline at end of file