publish page functionality all in; added bottom bar to tool page; needs some CSS love

This commit is contained in:
Sanj 2011-07-09 19:15:21 +05:30
parent 51a8c7cd58
commit 264a41ce03
5 changed files with 56 additions and 23 deletions

View File

@ -9,7 +9,7 @@ from os.path import join
from PIL import Image from PIL import Image
from django.template import Template, Context from django.template import Template, Context
from django.template.loader import get_template from django.template.loader import get_template
from settings import MEDIA_ROOT, PROJECT_PATH from settings import MEDIA_ROOT, PROJECT_PATH, SITE_BASE
from django.contrib.auth.models import User, Group from django.contrib.auth.models import User, Group
from tagging.fields import TagField from tagging.fields import TagField
from tagging.models import Tag from tagging.models import Tag
@ -368,7 +368,7 @@ class Article(models.Model):
'edit_url': "/edit/article/%d/" % (self.id,), 'edit_url': "/edit/article/%d/" % (self.id,),
'is_locked': self.locked, 'is_locked': self.locked,
'is_published': self.published, 'is_published': self.published,
'web_url': "/edit/web_frontend/%d/" % (self.id,) 'web_url': SITE_BASE + "/edit/article_web/%d/" % (self.id,)
} }

View File

@ -587,7 +587,7 @@ def create_article(request):
new_article.owner = request.user new_article.owner = request.user
new_article.save() new_article.save()
new_id = new_article.id new_id = new_article.id
return HttpResponseRedirect("/edit/article/%d/" % new_id) return HttpResponse("/edit/article/%d/" % new_id)
else: else:
templates = [] templates = []

View File

@ -1,6 +1,8 @@
<!DOCTYPE html>
<html> {% extends 'main_base.html' %}
<head>
{% block extra_head %}
<link rel="stylesheet" href="/static/css/ui-lightness/jquery-ui-1.7.2.custom.css" /> <link rel="stylesheet" href="/static/css/ui-lightness/jquery-ui-1.7.2.custom.css" />
<link rel="stylesheet" href="/static/css/farbtastic.css" /> <link rel="stylesheet" href="/static/css/farbtastic.css" />
<link rel="stylesheet" href="/static/css/editor.css" /> <link rel="stylesheet" href="/static/css/editor.css" />
@ -8,7 +10,7 @@
<link rel="stylesheet" href="/static/css/jquery.tooltip.css" /> <link rel="stylesheet" href="/static/css/jquery.tooltip.css" />
<link rel="stylesheet" href="/static/colorpicker/css/colorpicker.css" type="text/css" /> <link rel="stylesheet" href="/static/colorpicker/css/colorpicker.css" type="text/css" />
<link rel="stylesheet" media="screen" type="text/css" href="/static/colorpicker/css/layout.css" /> <link rel="stylesheet" media="screen" type="text/css" href="/static/colorpicker/css/layout.css" />
<script type="text/javascript" src="/static/js/jquery.js"></script> <!-- <script type="text/javascript" src="/static/js/jquery.js"></script> -->
<script type="text/javascript" src="/static/js/jquery-ui.js"></script> <script type="text/javascript" src="/static/js/jquery-ui.js"></script>
<script type="text/javascript" src="/static/js/farbtastic.js"></script> <script type="text/javascript" src="/static/js/farbtastic.js"></script>
<script type="text/javascript" src="/static/js/jquery.Jcrop.js"></script> <script type="text/javascript" src="/static/js/jquery.Jcrop.js"></script>
@ -66,11 +68,17 @@
}); });
}); });
</script> </script>
<title>
{% endblock %}
{% block title %}
Edgware Editor - Hi {{ user.username }} Edgware Editor - Hi {{ user.username }}
</title> {% endblock %}
</head>
<body> {% block header %}
{% endblock %}
{% block content %}
<script type="text/html" id="tmpl_canvas"> <script type="text/html" id="tmpl_canvas">
<div id="canvas<%= index %>" class="canvas" data-index="<%= index %>"> <div id="canvas<%= index %>" class="canvas" data-index="<%= index %>">
<div class="page_btns"> <div class="page_btns">
@ -275,5 +283,4 @@
</div> </div>
</div> </div>
</body> {% endblock %}
</html>

View File

@ -6,6 +6,27 @@
{% block extra_head %} {% block extra_head %}
<link rel="stylesheet" href="/static/css/files/publish.css" /> <link rel="stylesheet" href="/static/css/files/publish.css" />
<script type="text/javascript">
$(function() {
$('.createCopy').click(function(e) {
e.preventDefault();
var $this = $(this);
var articleId = $(this).parents('li').attr("data-id");
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");
});
});
});
</script>
{% endblock %} {% endblock %}
{% block pageTitle %} {% block pageTitle %}
@ -36,8 +57,11 @@ Tool link
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 %}
<li> <li data-id="{{ o.id }}">
<span class="articleTitle">{{ o.title }}</span> <span class="articleTitle">{{ o.title }}</span>
{% if o.is_locked %} locked {% else %} <a href="{{ o.edit_url }}" title="Edit Article" target="_blank">edit</a> {% endif %}
<a href="{{ o.web_url }}" title="View as Webpage" target="_blank">web</a>
<a href="#" class="createCopy">copy</a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -47,6 +71,8 @@ Create a new one
{% for p in pub_list %} {% for p in pub_list %}
<li> <li>
<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="#" class="createCopy">copy</a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -38,30 +38,30 @@
<div id="footer"> <div id="footer">
<ul id="nav"> <ul id="nav">
<li> <li>
<a href="archive" title="The Edgwareroad.org Archive">Archive</a> <a href="/archive" title="The Edgwareroad.org Archive">Archive</a>
</li> </li>
<li> <li>
<a href="upload" title="File Uploader">Upload</a> <a href="/upload" title="File Uploader">Upload</a>
</li> </li>
<li> <li>
<a href="publish" title="Publish!">Publish</a> <a href="/publish" title="Publish!">Publish</a>
</li> </li>
<li> <li>
<a href="browse" title="Browse Publications">Browse</a> <a href="/browse" title="Browse Publications">Browse</a>
</li> </li>
<li> <li>
<a href="contact" title="Contact Us">About/Contact</a> <a href="/contact" title="Contact Us">About/Contact</a>
</li> </li>
<li> <li>
<a href="faq" title="Frequently Asked Questions">FAQ</a> <a href="/faq" title="Frequently Asked Questions">FAQ</a>
</li> </li>
<li> &nbsp;</li> <li> &nbsp;</li>
<li> <li>
{% if user.is_authenticated %} {% if user.is_authenticated %}
<a href="logout" title="Logout">Logout</a> <a href="/logout" title="Logout">Logout</a>
{% else %} {% else %}
<a href="account" title="Login / Sign Up">Login/Sign Up</a> <a href="/account" title="Login / Sign Up">Login/Sign Up</a>
{% endif %} {% endif %}
</li> </li>