Skip to content

Commit

Permalink
Can now edit current site within LifeFlow Editor.
Browse files Browse the repository at this point in the history
Cannot edit other sites, however.
  • Loading branch information
lethain committed Jul 7, 2008
1 parent f4d0096 commit 31a252c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions editor/urls.py
Expand Up @@ -8,6 +8,7 @@

(r'^admin/blogroll/$', 'blogroll'),
(r'^admin/sites_to_ping/$', 'sites_to_notify'),
(r'^admin/site_config/$', 'site_config'),


(r'^authors/$', 'authors'),
Expand Down
10 changes: 9 additions & 1 deletion editor/views.py
Expand Up @@ -27,6 +27,7 @@
from django.contrib.auth import login as auth_login
from django.contrib.auth import views, authenticate
from django.core.paginator import QuerySetPaginator
from django.contrib.sites.models import Site


CHARACTERS_TO_STRIP = """ .,!?'";:/\+=# """
Expand Down Expand Up @@ -108,6 +109,13 @@ def sites_to_notify(request):
{'sites_to_notify':sites},
RequestContext(request,{}))

@login_required
def site_config(request):
site = Site.objects.get_current()
return render_to_response('lifeflow/editor/site.html',
{'sites_to_notify':site},
RequestContext(request,{}))

@login_required
def files(request):
resources = Resource.objects.all()
Expand Down Expand Up @@ -196,7 +204,7 @@ def update(request):
return HttpResponse("success")


API_CLASSES = {"comment":Comment, "project":Project, "flow":Flow, "tag":Tag, "series":Series, "draft":Draft, "entry":Entry, "author":Author, "resource":Resource, "recommendedsite":RecommendedSite,'site_to_notify':SiteToNotify}
API_CLASSES = {"comment":Comment, "project":Project, "flow":Flow, "tag":Tag, "series":Series, "draft":Draft, "entry":Entry, "author":Author, "resource":Resource, "recommendedsite":RecommendedSite,'site_to_notify':SiteToNotify,'site':Site}

def get_class(str):
return API_CLASSES[str]
Expand Down
30 changes: 30 additions & 0 deletions templates/lifeflow/editor/site.html
@@ -0,0 +1,30 @@
{% extends "lifeflow/editor/admin_base.html" %}

{% block body2 %}
<script>
var update = function() {
var data = { name:$("#name").val(), domain:$("#domain").val()};
update_model("site", {{ site.pk }}, data);
}

$(document).ready(function() {
$("#name").hover(function(){},function(){ update(); });
$("#domain").hover(function(){},function(){ update(); });
});
</script>

<div class="editing">
<ul>
<li>
<p> The name of site used for this blog. (This can be anything.) </p>
<input id="name" name="name" value="{{ site.name }}">
<p> The URL of the site this blog is hosted at. (For example
'example.com', no http:// or trailing slash.)
<input id="domain" name="domain" value="{{ site.domain }}">
</p>
</li>
</div>



{% endblock %}

0 comments on commit 31a252c

Please sign in to comment.