From b9c6451f88caa35ab39b6468a99b147d7d7f4937 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 20 Mar 2011 15:51:02 -0500 Subject: Fix news preview with CSRF and AJAX in Django 1.2.5 Signed-off-by: Dan McGee --- media/archweb.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'media') diff --git a/media/archweb.js b/media/archweb.js index 52e817a4..03358fa9 100644 --- a/media/archweb.js +++ b/media/archweb.js @@ -71,16 +71,18 @@ if (typeof $.tablesorter !== 'undefined') { /* news/add.html */ function enablePreview() { - $('#previewbtn').click(function(event) { + $('#news-preview-button').click(function(event) { event.preventDefault(); - $.post('/news/preview/', - { data: $('#id_content').val() }, + $.post('/news/preview/', { + data: $('#id_content').val(), + csrfmiddlewaretoken: $('#newsform input[name=csrfmiddlewaretoken]').val() + }, function(data) { - $('#previewdata').html(data); - $('.news-article').show(); + $('#news-preview-data').html(data); + $('#news-preview').show(); } ); - $('#previewtitle').html($('#id_title').val()); + $('#news-preview-title').html($('#id_title').val()); }); } -- cgit v1.2.3-54-g00ecf From e8bbf9b35660c89718a35e173548d2abb4b654f8 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 22 Mar 2011 21:37:28 -0500 Subject: Simplify the dev dashboard Remove all the click to expand junk; just show the tables all the time. There is no form at the bottom of the page anymore, so if you don't want to read the tables on the bottom, just don't read them. Signed-off-by: Dan McGee --- media/archweb.css | 4 ---- templates/devel/clock.html | 2 +- templates/devel/index.html | 29 ++++++++++------------------- 3 files changed, 11 insertions(+), 24 deletions(-) (limited to 'media') diff --git a/media/archweb.css b/media/archweb.css index aec78f87..4b0b9e89 100644 --- a/media/archweb.css +++ b/media/archweb.css @@ -242,11 +242,7 @@ form#dash-pkg-notify input { vertical-align: middle; margin: 0 0.25em; } form#dash-pkg-notify input[type=submit] { margin-top: -0.25em; } form#dash-pkg-notify p { margin: 0; } -/* dev dashboard: collapse stat tables by default */ -table#stats-by-maintainer, table#stats-by-repo, table#stats-by-arch { display: none; } table.dash-stats .key { width: 50%; } -span.dash-click { font-weight: normal; font-size: 0.8em; color: #888; } -div.dash-stats h3 { color: #07b; } /* dev dashboard: admin actions (add news items, todo list, etc) */ ul.admin-actions { float: right; list-style: none; margin-top: -2.5em; } diff --git a/templates/devel/clock.html b/templates/devel/clock.html index ab1d9b9f..0f0e20c5 100644 --- a/templates/devel/clock.html +++ b/templates/devel/clock.html @@ -14,7 +14,7 @@

Developer World Clocks

UTC Time: {{ utc_now|date:"Y-m-d H:i T" }}

- +
diff --git a/templates/devel/index.html b/templates/devel/index.html index 0505ff14..af2e5d28 100644 --- a/templates/devel/index.html +++ b/templates/devel/index.html @@ -8,7 +8,7 @@

Developer Dashboard

My Flagged Packages

-
Developer
+
@@ -38,7 +38,7 @@

My Flagged Packages

My Incomplete Todo List Packages

-
Name
+
@@ -67,7 +67,7 @@

My Incomplete Todo List Packages

Package Todo Lists

-
Todo List
+
@@ -91,11 +91,9 @@

Package Todo Lists

-
+
-

- Stats by Architecture (click to toggle)

+

Stats by Architecture

Name
@@ -122,11 +120,9 @@

Package Todo Lists

-
+
-

- Stats by Repository (click to toggle)

+

Stats by Repository

@@ -153,11 +149,9 @@

Package Todo Lists

-
+
-

- Stats by Maintainer (click to toggle)

+

Stats by Maintainer

@@ -203,12 +197,9 @@

Package Todo Lists

{widgets: ['zebra'], sortList: [[0,0], [1,0]]}); $("#dash-todo:not(:has(tbody tr.empty))").tablesorter( {widgets: ['zebra'], sortList: [[1,1]]}); - $("#stats-by-arch").add("#stats-by-repo").add("#stats-by-maintainer").tablesorter( + $(".dash-stats").tablesorter( {widgets: ['zebra'], sortList: [[0,0]], headers: { 1: { sorter: 'pkgcount' }, 2: { sorter: 'pkgcount' } } }); - $("h3.dash-stats").click( - function(e) { $(this).next().toggle(); } - ); }); {% endblock %} -- cgit v1.2.3-54-g00ecf