From 335df86439ca129c5e5a7a2e84afa39fadcb62d2 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Wed, 15 Aug 2012 00:17:03 -0600 Subject: Added the /widgets/ view and that link into the navigation bar --- askbot/skins/default/templates/list_ask_widget.html | 17 ++++++++++++++--- askbot/skins/default/templates/widgets.html | 13 +++++++++++++ .../default/templates/widgets/user_navigation.html | 1 + askbot/urls.py | 6 ++++++ askbot/views/widgets.py | 5 +++++ 5 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 askbot/skins/default/templates/widgets.html diff --git a/askbot/skins/default/templates/list_ask_widget.html b/askbot/skins/default/templates/list_ask_widget.html index 58510c63..0b6d20df 100644 --- a/askbot/skins/default/templates/list_ask_widget.html +++ b/askbot/skins/default/templates/list_ask_widget.html @@ -1,11 +1,13 @@ -{% extends "one_column_body.html" %} +{% extends "two_column_body.html" %} {% block title %}Create a Widget{% endblock %} {% block content %} -

Your current widgets

+

Ask Question widget list

{%for widget in widgets%} -

Widget: {{widget.title}}(http://{{settings.APP_URL}}{% url render_ask_widget widget.id%})

+

Widget: {{widget.title}}

+

Code: <script type="text/javascript" src=http://{{request.get_host()}}{% url render_ask_widget widget.id%} ><script> +

{%endfor%} @@ -13,3 +15,12 @@ {% block endjs %} {% endblock %} +{% block sidebar %} +

+

{% trans %}How to use?{% endtrans %}

+

{% trans %} + Just copy the <script> tag provided and paste it in the site where you wan to put it. + {%endtrans%} +

+
+{% endblock %} diff --git a/askbot/skins/default/templates/widgets.html b/askbot/skins/default/templates/widgets.html new file mode 100644 index 00000000..e259d662 --- /dev/null +++ b/askbot/skins/default/templates/widgets.html @@ -0,0 +1,13 @@ +{% extends "one_column_body.html" %} + +{% block title %}{% spaceless %}{% trans %}Widgets{% endtrans %}{% endspaceless %}{% endblock %} +{% block content %} +

{% trans %}Widgets{% endtrans %}

+

+{% trans %}You can create widgets to embed into your site, here a list of widgets that you can create.{% endtrans %}
+

+
+

Ask Question Widget (view lists)

+
+{% endblock %} + diff --git a/askbot/skins/default/templates/widgets/user_navigation.html b/askbot/skins/default/templates/widgets/user_navigation.html index 717cd7ee..295ba98f 100644 --- a/askbot/skins/default/templates/widgets/user_navigation.html +++ b/askbot/skins/default/templates/widgets/user_navigation.html @@ -21,5 +21,6 @@ {% endif %} {% if request.user.is_authenticated() and request.user.is_administrator() %} {% trans %}settings{% endtrans %} + {% trans %}create widgets{% endtrans %} {% endif %} {% trans %}help{% endtrans %} diff --git a/askbot/urls.py b/askbot/urls.py index b91c2ed8..f4576465 100644 --- a/askbot/urls.py +++ b/askbot/urls.py @@ -381,6 +381,12 @@ urlpatterns = patterns('', name = 'join_or_leave_group' ), #widgets url! + url( + r'^widgets/$', + views.widgets.widgets, + name = 'widgets' + ), + url( r'^widgets/ask/(?P\d+)/$', views.widgets.ask_widget, diff --git a/askbot/views/widgets.py b/askbot/views/widgets.py index 46a78037..e0d4b061 100644 --- a/askbot/views/widgets.py +++ b/askbot/views/widgets.py @@ -16,6 +16,11 @@ from askbot.utils import decorators from askbot import models from askbot import forms + +@decorators.admins_only +def widgets(request): + return render_into_skin('widgets.html', {}, request) + @csrf.csrf_protect def ask_widget(request, widget_id): -- cgit v1.2.3-1-g7c22