]> git.openstreetmap.org Git - osqa.git/commitdiff
Resolves OSQA-661, adding functionality to allow deleting static pages in the adminis...
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 24 Jun 2011 13:41:57 +0000 (13:41 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 24 Jun 2011 13:41:57 +0000 (13:41 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1074 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/skins/default/templates/osqaadmin/static_pages.html
forum/urls.py
forum/views/admin.py
forum_modules/mysqlfulltext/startup.py

index 7d0e567f3c4a9c85a6894b108df4c95aef9dbb87..ea49a26050ee4211ec2af58417bb959c252dee36 100644 (file)
                 {% for page in pages %}
                     <tr>
                         <th scope="row"><a href="{% url admin_edit_page id=page.id %}">{{ page.headline }}</a></th>
-                        <td><a class="changelink" href="{% url admin_edit_page id=page.id %}">{% trans "Edit" %}</a></td>
+                        <td style="width: 125px;"><a class="changelink" href="{% url admin_edit_page id=page.id %}">{% trans "Edit" %}</a></td>
+                        <td style="width: 125px;">
+                            <a onclick="return confirm('{% trans "Are you sure you want to delete this page?" %}');" class="deletelink" href="{% url admin_delete_page id=page.id %}">
+                                {% trans "Delete" %}
+                            </a>
+                        </td>
                     </tr>
                 {% endfor %}
             </tbody>
index d1e87bf76014974a140e843e46e88a8a4187c6f4..5485379f1cb0d8008066421fa81a97e354a3ec30 100644 (file)
@@ -142,7 +142,8 @@ core_urls = (
     
     url(r'^%s%s%s$' % (_('admin/'), _('static_pages/'), _('new/')), app.admin.edit_page, name='admin_new_page'),
     url(r'^%s%s%s(?P<id>\d+)/$' % (_('admin/'), _('static_pages/'), _('edit/')), app.admin.edit_page, name='admin_edit_page'),
-    
+    url(r'^%s%s%s(?P<id>\d+)/$' % (_('admin/'), _('static_pages/'), _('delete/')), app.admin.delete_page, name='admin_delete_page'),
+
     url(r'^%s%s(?P<name>\w+)/$' % (_('admin/'), _('tools/')), app.admin.tools_page, name='admin_tools'),
     
     url(r'^%s%s(?P<set_name>\w+)/$' % (_('admin/'), _('settings/')), app.admin.settings_set, name='admin_set'),
index 724315f3410e38fff2fec870b1c163ac51303cb5..6dffa5120a9add77f5f1dc97d651da2512a14c08 100644 (file)
@@ -401,6 +401,12 @@ def edit_page(request, id=None):
     'published': published
     })
 
+@admin_page
+def delete_page(request, id=None):
+    page = get_object_or_404(Page, id=id)
+    page.delete()
+    return HttpResponseRedirect(reverse('admin_static_pages'))
+
 @admin_tools_page(_('createuser'), _("Create new user"))
 def create_user(request):
     if request.POST:
index 08926cbfacdab00ae4625ced75fa7486ac2a63fc..8c2af5fadb488a6e10e70cecce6142fa42e4d532 100644 (file)
@@ -51,7 +51,7 @@ def question_search(self, keywords):
                 match(forum_mysqlftsindex.tagnames) against (%s) * 2 +
                 match(forum_mysqlftsindex.title) against (%s) * 4 +
                 match(forum_mysqlftsindex.body) against (%s) * 1
-                                """,
+                """,
             },
         select_params=[keywords, keywords, keywords]
     ).filter(Q(ftsindex__title__search=keywords) | Q(ftsindex__tagnames__search=keywords) | Q(ftsindex__body__search=keywords))