Commits

Kai Diefenbach  committed b9c5145

Added management view for utilities.

  • Participants
  • Parent commits a91c60b

Comments (0)

Files changed (3)

File lfc/manage/urls.py

     url(r'^add-role$', "add_role", name="lfc_manage_add_role"),
     url(r'^save-role/(?P<id>\d+)$', "save_role", name="lfc_manage_save_role"),
     url(r'^delete-role/(?P<id>\d+)$', "delete_role", name="lfc_manage_delete_role"),
+    
+    # Utils
+    url(r'^utils$', "manage_utils", name="lfc_manage_utils"),
+    url(r'^reindex-objects$', "reindex_objects", name="lfc_reindex_objects"),
 
     # content
     url(r'^$', "portal", name="lfc_manage_portal"),

File lfc/manage/views.py

             "current_role_id" : int(id),
         }))
 
+# Utils
+def manage_utils(request, template_name="lfc/manage/utils.html"):
+    """Displays the overview over all utils.
+    """
+    return render_to_response(template_name, RequestContext(request, {
+    }))
+
+def reindex_objects(request):
+    """Reindexes the searchable text of all content objects.
+    """
+    for obj in lfc.utils.get_content_objects():
+        obj.reindex()
+
+    return MessageHttpResponseRedirect(reverse("lfc_manage_utils"), _(u"Objects have been reindexed."))
+
 # Privates ###################################################################
 ##############################################################################
 

File lfc/templates/lfc/manage/utils.html

+{% extends "lfc/manage/base.html" %}
+{% load i18n %}
+
+{% block left-slot-wrapper %}{% endblock %}
+
+{% block content %}
+    <div style="margin:20px 0 0 20px">
+        <div id="manage-tabs">
+            <ul>
+                <li class="ui-tabs-nav-item"><a href="#data">{% trans "Utilities" %}</a></li>
+            </ul>
+
+            <div id="data">
+                <h1>{% trans "Utilities" %}</h1>
+                <ul>
+                    <li>
+                        <a href="{% url lfc_reindex_objects %}">
+                            {% trans "Reindex Objects" %}
+                        </a>
+                    </li>
+                </ul>
+            </div>
+        </div>
+    </div>
+{% endblock %}