summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-08-07 09:58:18 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-08-07 09:58:18 -0400
commit6266d4e5087c0203e013912a568c08bad8b866d8 (patch)
tree132d5468229dd3a51207d7a38dab7ea1b32b6a28
parent760db45c56611a7aca522799662cdbde7e1c660d (diff)
downloadaskbot-6266d4e5087c0203e013912a568c08bad8b866d8.tar.gz
askbot-6266d4e5087c0203e013912a568c08bad8b866d8.tar.bz2
askbot-6266d4e5087c0203e013912a568c08bad8b866d8.zip
styled the sharing tool a bit and added autocompleter dropdown
-rw-r--r--askbot/skins/common/media/js/post.js14
-rw-r--r--askbot/skins/common/media/js/user.js2
-rw-r--r--askbot/skins/default/media/style/style.less28
-rw-r--r--askbot/skins/default/templates/question/javascript.html1
-rw-r--r--askbot/skins/default/templates/question/sidebar.html17
-rw-r--r--askbot/skins/default/templates/user_profile/user.html2
6 files changed, 56 insertions, 8 deletions
diff --git a/askbot/skins/common/media/js/post.js b/askbot/skins/common/media/js/post.js
index b79fcef6..88f16e08 100644
--- a/askbot/skins/common/media/js/post.js
+++ b/askbot/skins/common/media/js/post.js
@@ -3840,6 +3840,20 @@ $(document).ready(function() {
var tip = new TippedInput();
tip.decorate(proxyUserEmailInput);
}
+ //if groups are enabled - activate share functions
+ var groupsInput = $('.share-with-group');
+ if (groupsInput.length === 1) {
+ var groupsAc = new AutoCompleter({
+ url: askbot['urls']['getGroupsList'],
+ preloadData: true,
+ minChars: 1,
+ useCache: true,
+ matchInside: true,
+ maxCacheLength: 100,
+ delay: 10
+ });
+ fakeUserAc.decorate(proxyUserNameInput);
+ }
});
diff --git a/askbot/skins/common/media/js/user.js b/askbot/skins/common/media/js/user.js
index 34bdeac5..e858257d 100644
--- a/askbot/skins/common/media/js/user.js
+++ b/askbot/skins/common/media/js/user.js
@@ -931,7 +931,7 @@ GroupAdderWidget.prototype.decorate = function(element){
this._input = input;
var groupsAc = new AutoCompleter({
- url: askbot['urls']['get_groups_list'],
+ url: askbot['urls']['getGroupsList'],
preloadData: true,
minChars: 1,
useCache: true,
diff --git a/askbot/skins/default/media/style/style.less b/askbot/skins/default/media/style/style.less
index 4b36a4a0..56461c1f 100644
--- a/askbot/skins/default/media/style/style.less
+++ b/askbot/skins/default/media/style/style.less
@@ -591,6 +591,7 @@ body.anon {
padding-left:5px;
border:#c9c9b5 1px solid;
height:25px;
+ font-size: 14px;
}
#ab-tag-search {
width: 138px;
@@ -1436,6 +1437,33 @@ ul#related-tags li {
}
}
+.groups-input {
+ width:152px;
+ padding-left:5px;
+ border:#c9c9b5 1px solid;
+ height:25px;
+ font-size: 14px;
+}
+
+.add-groups {
+ border:0;
+ font-weight:bold;
+ margin-top:-2px;
+ .button-style(27px, 14px);
+ .rounded-corners(4px);
+}
+
+.add-everyone-group {
+ text-align: center;
+ margin: auto;
+ display: block;
+ padding: 0 10px;
+}
+
+.add-groups:hover {
+ .button-style-hover;
+}
+
#id_user,
#id_user_author {
border:#cce6ec 3px solid;
diff --git a/askbot/skins/default/templates/question/javascript.html b/askbot/skins/default/templates/question/javascript.html
index 003d7f70..0be3e5a1 100644
--- a/askbot/skins/default/templates/question/javascript.html
+++ b/askbot/skins/default/templates/question/javascript.html
@@ -18,6 +18,7 @@
askbot['urls']['upvote_comment'] = '{% url upvote_comment %}';
askbot['urls']['delete_post'] = '{% url delete_post %}';
askbot['urls']['get_html_template'] = '{% url get_html_template %}';
+ askbot['urls']['getGroupsList'] = '{% url get_groups_list %}';
askbot['messages']['addComment'] = '{% trans %}post a comment{% endtrans %}';
{% if settings.SAVE_COMMENT_ON_ENTER %}
askbot['settings']['saveCommentOnEnter'] = true;
diff --git a/askbot/skins/default/templates/question/sidebar.html b/askbot/skins/default/templates/question/sidebar.html
index 63d25958..30d67c04 100644
--- a/askbot/skins/default/templates/question/sidebar.html
+++ b/askbot/skins/default/templates/question/sidebar.html
@@ -1,4 +1,4 @@
-{% from "macros.html" import timeago %}
+{% import "macros.html" as macros %}
{% if settings.SIDEBAR_QUESTION_HEADER %}
<div class="box">
{{ settings.SIDEBAR_QUESTION_HEADER }}
@@ -46,14 +46,18 @@
<div class="box sharing-widget">
{% if thread.is_private() %}
<h2>{% trans %}Share{% endtrans %}</h2>
- <p>{% trans %}Share with groups{% endtrans %}</p>
+ {% if thread.groups.count() %}
+ <label for="group_name">{% trans %}Shared with groups{% endtrans %}</label>
+ {% else %}
+ <label for="group_name">{% trans %}Share with group{% endtrans %}</label>
+ {% endif %}
{% for group in thread.groups.all() %}
- <p>{{ group.name }}</p>
+ <p>{{ macros.user_group(group) }}</p>
{% endfor %}
<form action="{% url share_question_with_group %}" method="post">{% csrf_token %}
- <input type="text" name="group_name" />
+ <input type="text" class="groups-input" name="group_name" />
<input type="hidden" name="thread_id" value="{{ thread.id }}"/>
- <input type="submit" value="{% trans %}add{% endtrans %}"/>
+ <input type="submit" class="add-groups" value="{% trans %}add{% endtrans %}"/>
</form>
<p style="text-align: center">{% trans %}or{% endtrans %}</p>
<form action="{% url share_question_with_group %}" method="post">{% csrf_token %}
@@ -65,6 +69,7 @@
<input type="hidden" name="thread_id" value="{{ thread.id }}"/>
<input
type="submit"
+ class="add-groups add-everyone-group"
value="{% trans %}share with everyone{% endtrans %}"
/>
</form>
@@ -80,7 +85,7 @@
<div class="clearfix"></div>
<h2>{% trans %}Stats{% endtrans %}</h2>
<p>
- {% trans %}Asked{% endtrans %}: <strong>{{ timeago(question.added_at) }}</strong>
+ {% trans %}Asked{% endtrans %}: <strong>{{ macros.timeago(question.added_at) }}</strong>
</p>
<p>
{% trans %}Seen{% endtrans %}: <strong>{{ thread.view_count|intcomma }} {% trans %}times{% endtrans %}</strong>
diff --git a/askbot/skins/default/templates/user_profile/user.html b/askbot/skins/default/templates/user_profile/user.html
index 2f06a3c9..3aee3cfa 100644
--- a/askbot/skins/default/templates/user_profile/user.html
+++ b/askbot/skins/default/templates/user_profile/user.html
@@ -24,7 +24,7 @@
askbot['data']['viewUserName'] = '{{ view_user.username|escape }}';
askbot['data']['viewUserId'] = {{view_user.id}};
askbot['urls']['edit_group_membership'] = '{% url edit_group_membership %}';
- askbot['urls']['get_groups_list'] = '{% url get_groups_list %}';
+ askbot['urls']['getGroupsList'] = '{% url get_groups_list %}';
</script>
{% if request.user|can_moderate_user(view_user) %}
<script type='text/javascript' src='{{"/js/jquery.form.js"|media}}'></script>