others peoples edit window
This commit is contained in:
parent
98aadae1c7
commit
0c28952f8a
|
@ -242,6 +242,7 @@ class Article(models.Model):
|
||||||
'new_val': rev.new_val,
|
'new_val': rev.new_val,
|
||||||
'box_type': rev.box_type,
|
'box_type': rev.box_type,
|
||||||
'box_id': rev.box_id,
|
'box_id': rev.box_id,
|
||||||
|
'username': rev.user.username,
|
||||||
'uuid': rev.uuid,
|
'uuid': rev.uuid,
|
||||||
'rev_no': rev.id
|
'rev_no': rev.id
|
||||||
})
|
})
|
||||||
|
|
|
@ -582,6 +582,7 @@ def poll_changes(request):
|
||||||
rev_no = request.GET['rev_no']
|
rev_no = request.GET['rev_no']
|
||||||
uuid = request.GET['uuid']
|
uuid = request.GET['uuid']
|
||||||
changes = article.changes(rev_no, uuid)
|
changes = article.changes(rev_no, uuid)
|
||||||
|
|
||||||
return HttpResponse(json.dumps(changes), mimetype="application/javascript")
|
return HttpResponse(json.dumps(changes), mimetype="application/javascript")
|
||||||
|
|
||||||
def page_pdf(request):
|
def page_pdf(request):
|
||||||
|
|
|
@ -362,3 +362,21 @@ margin-top:0px;
|
||||||
font-size:13px;
|
font-size:13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#historyWindow {
|
||||||
|
position: fixed;
|
||||||
|
top: 20px;
|
||||||
|
right: 0px;
|
||||||
|
width: 180px;
|
||||||
|
padding: 6px;
|
||||||
|
border: 1px solid #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.historyItem {
|
||||||
|
margin-bottom: 6px;
|
||||||
|
background-color: #D3D79A;
|
||||||
|
}
|
||||||
|
|
||||||
|
.historyUser {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
|
@ -46,10 +46,31 @@ function startPoller() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addHistoryObject(data) {
|
||||||
|
var e = $('<div />').addClass("historyItem").data("data", data).hide();
|
||||||
|
var userHtml = "edit by <span class='historyUsername'>" + data.username + "</span>";
|
||||||
|
var userLine = $('<div />').addClass("historyUser").html(userHtml).appendTo(e);
|
||||||
|
$('.historyItems').prepend(e);
|
||||||
|
e.fadeIn();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.historyUser').live("click", function() {
|
||||||
|
var parent = $(this).parent();
|
||||||
|
if (parent.children('.historyData').length > 0 && parent.children('.historyData').is(":visible")) {
|
||||||
|
parent.children(".historyData").slideUp();
|
||||||
|
} else {
|
||||||
|
var data = parent.data('data');
|
||||||
|
data['page_no'] = getCanvasById(data.page_id).index + 1;
|
||||||
|
var html = tmpl("tmpl_historyData", data);
|
||||||
|
$('<div />').addClass('historyData').html(html).hide().appendTo(parent).slideDown();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//Refer to editor/models.py -> Revisions
|
//Refer to editor/models.py -> Revisions
|
||||||
function handleRevision(json) {
|
function handleRevision(json) {
|
||||||
// console.log(json);
|
// console.log(json);
|
||||||
var canvas = json.prop == 'new_page' ? {} : getCanvasById(json.page_id);
|
var canvas = json.prop == 'new_page' ? {} : getCanvasById(json.page_id);
|
||||||
|
addHistoryObject(json);
|
||||||
switch (json.prop) {
|
switch (json.prop) {
|
||||||
|
|
||||||
case "new_page":
|
case "new_page":
|
||||||
|
|
|
@ -5,9 +5,18 @@
|
||||||
.templateArticle {
|
.templateArticle {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
|
|
||||||
|
color: #393939;
|
||||||
|
}
|
||||||
|
|
||||||
|
.linkContainer {
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
color: #393939;
|
}
|
||||||
|
|
||||||
|
.seeLink {
|
||||||
|
font-size: 0.8em;
|
||||||
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
.templateArticle:hover {
|
.templateArticle:hover {
|
||||||
|
@ -46,11 +55,17 @@ $(function() {
|
||||||
<div id="templateArticles">
|
<div id="templateArticles">
|
||||||
<h3>Templates:</h3>
|
<h3>Templates:</h3>
|
||||||
{% for t in templates %}
|
{% for t in templates %}
|
||||||
<div class="templateArticle" data-id="{{ t.id }}">{{ t.name }}</div>
|
<div class="linkContainer">
|
||||||
|
<span class="templateArticle" data-id="{{ t.id }}">{{ t.name }}</span>
|
||||||
|
<span class="seeLink">[<a href="article_web/{{ t.id }}/" title="See Article" target="_blank">see</a>]</span>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<h3>Other Articles:</h3>
|
<h3>Other Articles:</h3>
|
||||||
{% for o in others %}
|
{% for o in others %}
|
||||||
<div class="templateArticle" data-id="{{ o.id }}">{{ o.name }}</div>
|
<div class="linkContainer">
|
||||||
|
<span class="templateArticle" data-id="{{ o.id }}">{{ o.name }}</span>
|
||||||
|
<span class="seeLink">[<a href="article_web/{{ o.id }}/" title="See Article" target="_blank">see</a>]</span>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -192,6 +192,13 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
<script type="text/html" id="tmpl_historyData">
|
||||||
|
<div class="historyPage">Page: <%= page_no %></div>
|
||||||
|
<div class="historyBoxType">BoxType: <%= box_type %></div>
|
||||||
|
<div class="historyAction">Action: <%= prop %></div>
|
||||||
|
<div class="historyOldVal">Old Value: <%= old_val %></div>
|
||||||
|
<div class="historyNewVal">New Value: <%= new_val %></div>
|
||||||
|
</script>
|
||||||
|
|
||||||
<div id="ajaxBusy">
|
<div id="ajaxBusy">
|
||||||
|
|
||||||
|
@ -253,5 +260,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div id="historyWindow">
|
||||||
|
<div class="historyTitle">Others' Edits:</div>
|
||||||
|
<div class="historyItems">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user