From a057999dcca0f9f1322eb9bd9bd88e8b82d96ef4 Mon Sep 17 00:00:00 2001 From: Sanj Date: Sat, 9 Jul 2011 22:37:56 +0530 Subject: [PATCH] differentiate template articles; add ArticleTheme to admin --- edgware/editor/admin.py | 2 +- edgware/editor/models.py | 9 ++++++-- edgware/main/views.py | 8 +++++-- edgware/static/css/files/browse.css | 1 + edgware/static/js/editor.js | 3 ++- edgware/templates/main/publish.html | 36 ++++++++++++++++++----------- 6 files changed, 40 insertions(+), 19 deletions(-) diff --git a/edgware/editor/admin.py b/edgware/editor/admin.py index 5208a1e..6a53bd2 100644 --- a/edgware/editor/admin.py +++ b/edgware/editor/admin.py @@ -24,4 +24,4 @@ admin.site.register(Video) admin.site.register(Audio) admin.site.register(Srt) admin.site.register(SliderImage) - +admin.site.register(ArticleTheme) diff --git a/edgware/editor/models.py b/edgware/editor/models.py index 452a1a5..d8f293a 100644 --- a/edgware/editor/models.py +++ b/edgware/editor/models.py @@ -260,11 +260,16 @@ class Article(models.Model): def get_published_list(kls, user, qset=False): if not qset: 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 def get_theme_list(kls, theme_id): - qset = Article.objects.filter(published=True) + qset = Article.objects.filter(published=True).exclude(name__istartswith="template") try: theme = ArticleTheme.objects.get(pk=theme_id) qset = qset.filter(theme=theme) diff --git a/edgware/main/views.py b/edgware/main/views.py index ff46803..efbde0b 100644 --- a/edgware/main/views.py +++ b/edgware/main/views.py @@ -25,16 +25,20 @@ def publish(request): user = request.user can_edit_list = Article.get_can_edit_list(user) published_list = Article.get_published_list(user) + template_list = Article.get_template_list() own_list = [] pub_list = [] + tmpl_list = [] for c in can_edit_list: own_list.append(c.get_list_dict(user)) for p in published_list: pub_list.append(p.get_list_dict(user)) - + for t in template_list: + tmpl_list.append(t.get_list_dict(user)) context = RequestContext(request, { 'own_list': own_list, - 'pub_list': pub_list + 'pub_list': pub_list, + 'tmpl_list': tmpl_list }) return render_to_response("main/publish.html", context) diff --git a/edgware/static/css/files/browse.css b/edgware/static/css/files/browse.css index 9b26bdc..eed24c6 100644 --- a/edgware/static/css/files/browse.css +++ b/edgware/static/css/files/browse.css @@ -27,5 +27,6 @@ h5 { #iframePreview { overflow-x: hidden; + overflow-y: scroll; border: 0; } diff --git a/edgware/static/js/editor.js b/edgware/static/js/editor.js index d3700ab..34b7eed 100644 --- a/edgware/static/js/editor.js +++ b/edgware/static/js/editor.js @@ -1654,13 +1654,14 @@ $(".box").live("click", function(e){ $(".delete_box").bind("click", function(e){ 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(); boxObj.deleteme(); } }); }); + $(".canvas").live("mousemove", function(e){ var left = parseInt($(this).position().left) + parseInt($(this).css('margin-left')); diff --git a/edgware/templates/main/publish.html b/edgware/templates/main/publish.html index f3432ec..ef56615 100644 --- a/edgware/templates/main/publish.html +++ b/edgware/templates/main/publish.html @@ -15,14 +15,16 @@ $(function() { var articleTitle = prompt("Give your new article a name:"); // alert(articleId); var url = "/edit/create_article/"; - $.post(url, { - 'article_id': articleId, - 'article_name': articleTitle - }, function(url) { - window.location = url; -// $this.attr("href", url); -// $this.unbind("click"); - }); + if (articleTitle) { + $.post(url, { + 'article_id': articleId, + 'article_name': articleTitle + }, function(url) { + window.location = url; + // $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@

-Tool link -


-

Search for an existing article you were working on


Or
Create a new one + +