From 35ca0dd682070e391d8d62c3cf21e6bc22281f87 Mon Sep 17 00:00:00 2001 From: sanj Date: Fri, 14 May 2010 09:19:28 +0530 Subject: [PATCH] added button to view as webpage --- edgware/editor/views.py | 4 ++++ edgware/static/css/editor.css | 13 ++++++++++++- edgware/static/js/editor.js | 8 ++++++++ edgware/templates/article_frontend.html | 6 +++++- edgware/templates/editor.html | 13 ++++++++++++- 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/edgware/editor/views.py b/edgware/editor/views.py index f8276b4..38bf0ba 100644 --- a/edgware/editor/views.py +++ b/edgware/editor/views.py @@ -79,9 +79,13 @@ def add_srt(request): def edit_article(request, id): c = Category.objects.all() a = Article.objects.get(pk=id) + p = a.product + frontend_url = "/edit/article_frontend/%d/%d/" % (p.id, a.order) + rDict = { 'categories': c, 'article_id': id, + 'frontend_url': frontend_url, 'article_width': a.view_size()[0], 'article_height': a.view_size()[1], 'rev_no': a.current_revision(), diff --git a/edgware/static/css/editor.css b/edgware/static/css/editor.css index 73e5d8a..6e5ea60 100644 --- a/edgware/static/css/editor.css +++ b/edgware/static/css/editor.css @@ -76,12 +76,23 @@ border-color: #666; border-bottom: 0px; cursor: pointer; + margin-left: 10px; + background: #D0CDFF; + background: -moz-linear-gradient(top, #D0CDFF, #fff); + background: -webkit-gradient(linear, top, #D0CDFF, #fff); +} + +.page_btn:hover { + background: #e5aeff; + background: -moz-linear-gradient(top, #e5aeff, #fff); + background: -webkit-gradient(linear, top, #e5aeff, #fff); } .printMe { - margin-left: 10px; + } + .audio_video { width: 100%; height: 30px; diff --git a/edgware/static/js/editor.js b/edgware/static/js/editor.js index bda8a3f..48073ea 100644 --- a/edgware/static/js/editor.js +++ b/edgware/static/js/editor.js @@ -1592,6 +1592,14 @@ $('.printMe').live("click", function(e) { window.open(url); }); +$(function() { + $('.viewFrontend').live("click", function(e) { + window.open(FRONTEND_URL); + e.preventDefault(); + e.stopPropagation(); + }); +}); + $('.upload_srts').live("click", function(e) { var r = $(this).getResource(); var media_id = r.media_id; diff --git a/edgware/templates/article_frontend.html b/edgware/templates/article_frontend.html index a1558f4..8494722 100644 --- a/edgware/templates/article_frontend.html +++ b/edgware/templates/article_frontend.html @@ -74,7 +74,11 @@ body, html { {% endfor %} - + + diff --git a/edgware/templates/editor.html b/edgware/templates/editor.html index 29f4983..063b60d 100644 --- a/edgware/templates/editor.html +++ b/edgware/templates/editor.html @@ -43,6 +43,7 @@ ARTICLE_WIDTH = {{article_width}}; ARTICLE_HEIGHT = {{article_height}}; REVISION_NO = {{rev_no}}; + FRONTEND_URL = "{{frontend_url}}"; {% endif %} var UUID = parseInt(new Date().getTime() / (10000 * (Math.random() * 10))); USER_ID = {{ user.id }}; @@ -65,7 +66,17 @@