summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2012-08-15 00:17:03 -0600
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2012-08-15 00:17:03 -0600
commit335df86439ca129c5e5a7a2e84afa39fadcb62d2 (patch)
tree9ee339a4090897d8b669a4b7fd9e3fa9d467fcc8
parent267587ef672703d90cfb8cc22a147c1e572de483 (diff)
downloadaskbot-335df86439ca129c5e5a7a2e84afa39fadcb62d2.tar.gz
askbot-335df86439ca129c5e5a7a2e84afa39fadcb62d2.tar.bz2
askbot-335df86439ca129c5e5a7a2e84afa39fadcb62d2.zip
Added the /widgets/ view and that link into the navigation bar
-rw-r--r--askbot/skins/default/templates/list_ask_widget.html17
-rw-r--r--askbot/skins/default/templates/widgets.html13
-rw-r--r--askbot/skins/default/templates/widgets/user_navigation.html1
-rw-r--r--askbot/urls.py6
-rw-r--r--askbot/views/widgets.py5
5 files changed, 39 insertions, 3 deletions
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" %}
<!-- create_ask_widget.html -->
{% block title %}Create a Widget{% endblock %}
{% block content %}
-<h1>Your current widgets</h1>
+<h1>Ask Question widget list</h1>
{%for widget in widgets%}
-<p>Widget: {{widget.title}}(http://{{settings.APP_URL}}{% url render_ask_widget widget.id%})<p>
+ <p>Widget: {{widget.title}}</p>
+ <p>Code: &lt;script type="text/javascript" src=http://{{request.get_host()}}{% url render_ask_widget widget.id%} &gt;&lt;script&gt;
+ <p>
{%endfor%}
@@ -13,3 +15,12 @@
{% block endjs %}
{% endblock %}
+{% block sidebar %}
+<div class="box">
+ <h2>{% trans %}How to use?{% endtrans %}</h2>
+ <p>{% trans %}
+ Just copy the &lt;script&gt; tag provided and paste it in the site where you wan to put it.
+ {%endtrans%}
+ </p>
+ </div>
+{% 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" %}
+<!-- template badges.html -->
+{% block title %}{% spaceless %}{% trans %}Widgets{% endtrans %}{% endspaceless %}{% endblock %}
+{% block content %}
+<h1 class="section-title">{% trans %}Widgets{% endtrans %}</h1>
+<p>
+{% trans %}You can create widgets to embed into your site, here a list of widgets that you can create.{% endtrans %}<br/>
+</p>
+<div id="widgetlist">
+ <p><a href="{%url create_ask_widget %}">Ask Question Widget </a><a href="{%url list_ask_widgets %}">(view lists)</a></p>
+</div>
+{% endblock %}
+<!-- end template badges.html -->
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() %}
<a href="{% url site_settings %}">{% trans %}settings{% endtrans %}</a>
+ <a href="{% url widgets %}">{% trans %}create widgets{% endtrans %}</a>
{% endif %}
<a href="{% url "help" %}" title="{% trans %}help{% endtrans %}">{% trans %}help{% endtrans %}</a>
diff --git a/askbot/urls.py b/askbot/urls.py
index b91c2ed8..f4576465 100644
--- a/askbot/urls.py
+++ b/askbot/urls.py
@@ -382,6 +382,12 @@ urlpatterns = patterns('',
),
#widgets url!
url(
+ r'^widgets/$',
+ views.widgets.widgets,
+ name = 'widgets'
+ ),
+
+ url(
r'^widgets/ask/(?P<widget_id>\d+)/$',
views.widgets.ask_widget,
name = 'ask_by_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):