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,
|
||||
'box_type': rev.box_type,
|
||||
'box_id': rev.box_id,
|
||||
'username': rev.user.username,
|
||||
'uuid': rev.uuid,
|
||||
'rev_no': rev.id
|
||||
})
|
||||
|
|
|
@ -582,6 +582,7 @@ def poll_changes(request):
|
|||
rev_no = request.GET['rev_no']
|
||||
uuid = request.GET['uuid']
|
||||
changes = article.changes(rev_no, uuid)
|
||||
|
||||
return HttpResponse(json.dumps(changes), mimetype="application/javascript")
|
||||
|
||||
def page_pdf(request):
|
||||
|
|
|
@ -362,3 +362,21 @@ margin-top:0px;
|
|||
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
|
||||
function handleRevision(json) {
|
||||
// console.log(json);
|
||||
var canvas = json.prop == 'new_page' ? {} : getCanvasById(json.page_id);
|
||||
addHistoryObject(json);
|
||||
switch (json.prop) {
|
||||
|
||||
case "new_page":
|
||||
|
|
|
@ -5,9 +5,18 @@
|
|||
.templateArticle {
|
||||
cursor: pointer;
|
||||
font-family: sans-serif;
|
||||
|
||||
color: #393939;
|
||||
}
|
||||
|
||||
.linkContainer {
|
||||
margin-bottom: 6px;
|
||||
margin-left: 12px;
|
||||
color: #393939;
|
||||
}
|
||||
|
||||
.seeLink {
|
||||
font-size: 0.8em;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.templateArticle:hover {
|
||||
|
@ -46,11 +55,17 @@ $(function() {
|
|||
<div id="templateArticles">
|
||||
<h3>Templates:</h3>
|
||||
{% 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 %}
|
||||
<h3>Other Articles:</h3>
|
||||
{% 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 %}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -192,6 +192,13 @@
|
|||
</ul>
|
||||
</div>
|
||||
</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">
|
||||
|
||||
|
@ -253,5 +260,11 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
<div id="historyWindow">
|
||||
<div class="historyTitle">Others' Edits:</div>
|
||||
<div class="historyItems">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue
Block a user