differentiate template articles; add ArticleTheme to admin
This commit is contained in:
parent
6ed60fc123
commit
a057999dcc
|
@ -24,4 +24,4 @@ admin.site.register(Video)
|
||||||
admin.site.register(Audio)
|
admin.site.register(Audio)
|
||||||
admin.site.register(Srt)
|
admin.site.register(Srt)
|
||||||
admin.site.register(SliderImage)
|
admin.site.register(SliderImage)
|
||||||
|
admin.site.register(ArticleTheme)
|
||||||
|
|
|
@ -260,11 +260,16 @@ class Article(models.Model):
|
||||||
def get_published_list(kls, user, qset=False):
|
def get_published_list(kls, user, qset=False):
|
||||||
if not qset:
|
if not qset:
|
||||||
qset = kls.objects.all()
|
qset = kls.objects.all()
|
||||||
return qset.filter(published=True).exclude(Q(owner=user) | Q(users=user))
|
return qset.filter(published=True).exclude(Q(owner=user) | Q(users=user)).exclude(name__istartswith="template")
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_template_list(kls):
|
||||||
|
qset = Article.objects.all()
|
||||||
|
return qset.filter(published=True).filter(name__istartswith="template")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_theme_list(kls, theme_id):
|
def get_theme_list(kls, theme_id):
|
||||||
qset = Article.objects.filter(published=True)
|
qset = Article.objects.filter(published=True).exclude(name__istartswith="template")
|
||||||
try:
|
try:
|
||||||
theme = ArticleTheme.objects.get(pk=theme_id)
|
theme = ArticleTheme.objects.get(pk=theme_id)
|
||||||
qset = qset.filter(theme=theme)
|
qset = qset.filter(theme=theme)
|
||||||
|
|
|
@ -25,16 +25,20 @@ def publish(request):
|
||||||
user = request.user
|
user = request.user
|
||||||
can_edit_list = Article.get_can_edit_list(user)
|
can_edit_list = Article.get_can_edit_list(user)
|
||||||
published_list = Article.get_published_list(user)
|
published_list = Article.get_published_list(user)
|
||||||
|
template_list = Article.get_template_list()
|
||||||
own_list = []
|
own_list = []
|
||||||
pub_list = []
|
pub_list = []
|
||||||
|
tmpl_list = []
|
||||||
for c in can_edit_list:
|
for c in can_edit_list:
|
||||||
own_list.append(c.get_list_dict(user))
|
own_list.append(c.get_list_dict(user))
|
||||||
for p in published_list:
|
for p in published_list:
|
||||||
pub_list.append(p.get_list_dict(user))
|
pub_list.append(p.get_list_dict(user))
|
||||||
|
for t in template_list:
|
||||||
|
tmpl_list.append(t.get_list_dict(user))
|
||||||
context = RequestContext(request, {
|
context = RequestContext(request, {
|
||||||
'own_list': own_list,
|
'own_list': own_list,
|
||||||
'pub_list': pub_list
|
'pub_list': pub_list,
|
||||||
|
'tmpl_list': tmpl_list
|
||||||
})
|
})
|
||||||
|
|
||||||
return render_to_response("main/publish.html", context)
|
return render_to_response("main/publish.html", context)
|
||||||
|
|
|
@ -27,5 +27,6 @@ h5 {
|
||||||
|
|
||||||
#iframePreview {
|
#iframePreview {
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
overflow-y: scroll;
|
||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1654,13 +1654,14 @@ $(".box").live("click", function(e){
|
||||||
|
|
||||||
$(".delete_box").bind("click", function(e){
|
$(".delete_box").bind("click", function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (confirm("are you sure you wish to permanently delete this box?")) {
|
if (confirm("are you sure you wish to permanently delete this box from this page?")) {
|
||||||
$(".properties").remove();
|
$(".properties").remove();
|
||||||
boxObj.deleteme();
|
boxObj.deleteme();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$(".canvas").live("mousemove", function(e){
|
$(".canvas").live("mousemove", function(e){
|
||||||
|
|
||||||
var left = parseInt($(this).position().left) + parseInt($(this).css('margin-left'));
|
var left = parseInt($(this).position().left) + parseInt($(this).css('margin-left'));
|
||||||
|
|
|
@ -15,14 +15,16 @@ $(function() {
|
||||||
var articleTitle = prompt("Give your new article a name:");
|
var articleTitle = prompt("Give your new article a name:");
|
||||||
// alert(articleId);
|
// alert(articleId);
|
||||||
var url = "/edit/create_article/";
|
var url = "/edit/create_article/";
|
||||||
$.post(url, {
|
if (articleTitle) {
|
||||||
'article_id': articleId,
|
$.post(url, {
|
||||||
'article_name': articleTitle
|
'article_id': articleId,
|
||||||
}, function(url) {
|
'article_name': articleTitle
|
||||||
window.location = url;
|
}, function(url) {
|
||||||
// $this.attr("href", url);
|
window.location = url;
|
||||||
// $this.unbind("click");
|
// $this.attr("href", url);
|
||||||
});
|
// $this.unbind("click");
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -51,9 +53,6 @@ If you are a participant looking to open a new account, please write to contact@
|
||||||
</div>
|
</div>
|
||||||
<div id="publishBlockright">
|
<div id="publishBlockright">
|
||||||
<p>
|
<p>
|
||||||
Tool link
|
|
||||||
</p> <br/>
|
|
||||||
<p>
|
|
||||||
Search for an existing article you were working on</p> <br/>
|
Search for an existing article you were working on</p> <br/>
|
||||||
<ul id="ownList">
|
<ul id="ownList">
|
||||||
{% for o in own_list %}
|
{% for o in own_list %}
|
||||||
|
@ -67,11 +66,22 @@ Search for an existing article you were working on</p> <br/>
|
||||||
</ul>
|
</ul>
|
||||||
Or <br/>
|
Or <br/>
|
||||||
Create a new one
|
Create a new one
|
||||||
|
<ul id="templateList">
|
||||||
|
{% for t in tmpl_list %}
|
||||||
|
<li data-id="{{ t.id }}">
|
||||||
|
<span class="articleTitle">{{ o.title }}</span>
|
||||||
|
{% if o.is_locked %} {% else %} <a href="{{ t.edit_url }}" title="Edit Article" target="_blank">edit</a> {% endif %}
|
||||||
|
<a href="{{ t.web_url }}" title="View as Webpage" target="_blank">web</a>
|
||||||
|
<a href="#" class="createCopy">copy</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
<ul id="publishedList">
|
<ul id="publishedList">
|
||||||
{% for p in pub_list %}
|
{% for p in pub_list %}
|
||||||
<li>
|
<li data-id="{{ p.id }}">
|
||||||
<span class="articleTitle">{{ p.title }}</span>
|
<span class="articleTitle">{{ p.title }}</span>
|
||||||
<a href="{{ o.web_url }}" title="View as Webpage" target="_blank">web</a>
|
<a href="{{ p.web_url }}" title="View as Webpage" target="_blank">web</a>
|
||||||
<a href="#" class="createCopy">copy</a>
|
<a href="#" class="createCopy">copy</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user