summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2011-10-07 10:11:57 -0300
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2011-10-07 10:11:57 -0300
commit68829269827ec4558fb04d1edf24c309f4a07ba1 (patch)
tree0c05ff972d818ed247b9c1c45f39d3d55b36cc76
parent8acee71fc60fd3cbd47013a656b65f521ed00f74 (diff)
parent227ca9c33d53cf866353773e669121169eee305e (diff)
downloadaskbot-68829269827ec4558fb04d1edf24c309f4a07ba1.tar.gz
askbot-68829269827ec4558fb04d1edf24c309f4a07ba1.tar.bz2
askbot-68829269827ec4558fb04d1edf24c309f4a07ba1.zip
Merge branch 'master' into bug97
-rwxr-xr-x.gitignore1
-rw-r--r--askbot/__init__.py2
-rw-r--r--askbot/conf/__init__.py1
-rw-r--r--askbot/conf/settings_wrapper.py8
-rw-r--r--askbot/conf/site_modes.py85
-rw-r--r--askbot/doc/source/changelog.rst11
-rw-r--r--askbot/models/answer.py2
-rw-r--r--askbot/skins/default/media/js/jquery.animate-colors.js105
-rw-r--r--askbot/skins/default/media/js/utils.js1
-rw-r--r--askbot/skins/default/media/style/style.css1
-rw-r--r--askbot/skins/default/templates/macros.html2
-rw-r--r--askbot/skins/default/templates/main_page/javascript.html12
-rw-r--r--askbot/skins/default/templates/question.html33
-rw-r--r--askbot/skins/default/templates/users.html8
-rw-r--r--askbot/views/writers.py11
15 files changed, 271 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 15b8d802..0375e009 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*.pyc
*.swp
*.log
+db
cache/??
run
*.wsgi
diff --git a/askbot/__init__.py b/askbot/__init__.py
index b4889f92..ef784c3b 100644
--- a/askbot/__init__.py
+++ b/askbot/__init__.py
@@ -9,7 +9,7 @@ import smtplib
import sys
import logging
-VERSION = (0, 7, 24)
+VERSION = (0, 7, 25)
#necessary for interoperability of django and coffin
try:
diff --git a/askbot/conf/__init__.py b/askbot/conf/__init__.py
index 1d2d7240..64fe41fb 100644
--- a/askbot/conf/__init__.py
+++ b/askbot/conf/__init__.py
@@ -19,6 +19,7 @@ import askbot.conf.markup
import askbot.conf.social_sharing
import askbot.conf.badges
import askbot.conf.login_providers
+import askbot.conf.site_modes
#import main settings object
from askbot.conf.settings_wrapper import settings
diff --git a/askbot/conf/settings_wrapper.py b/askbot/conf/settings_wrapper.py
index aac8f071..2e0d8db2 100644
--- a/askbot/conf/settings_wrapper.py
+++ b/askbot/conf/settings_wrapper.py
@@ -49,6 +49,14 @@ class ConfigSettings(object):
"""
return getattr(self.__instance, key).value
+ def get_default(self, key):
+ """return the defalut value for the setting"""
+ return getattr(self.__instance, key).default
+
+ def reset(self, key):
+ """returns setting to the default value"""
+ self.update(key, self.get_default(key))
+
def update(self, key, value):
setting = config_get(self.__group_map[key], key)
setting.update(value)
diff --git a/askbot/conf/site_modes.py b/askbot/conf/site_modes.py
new file mode 100644
index 00000000..e79169e7
--- /dev/null
+++ b/askbot/conf/site_modes.py
@@ -0,0 +1,85 @@
+"""
+Site modes settings:
+ Support for site modes currently supports
+ Bootstrap - for sites that are starting and
+ Default - for sites that already have a momentum.
+"""
+from askbot.conf.settings_wrapper import settings
+from askbot.deps.livesettings import ConfigurationGroup, BooleanValue
+from django.utils.translation import ugettext as _
+
+BOOTSTRAP_MODE_SETTINGS = {
+ #minimum reputation settins.
+ 'MIN_REP_TO_VOTE_UP': 5,
+ 'MIN_REP_TO_VOTE_DOWN': 50,
+ 'MIN_REP_TO_ANSWER_OWN_QUESTION': 5,
+ 'MIN_REP_TO_ACCEPT_OWN_ANSWER': 20,
+ 'MIN_REP_TO_FLAG_OFFENSIVE': 5,
+ 'MIN_REP_TO_LEAVE_COMMENTS': 10,
+ 'MIN_REP_TO_DELETE_OTHERS_COMMENTS': 200,
+ 'MIN_REP_TO_DELETE_OTHERS_POSTS': 500,
+ 'MIN_REP_TO_UPLOAD_FILES': 10,
+ 'MIN_REP_TO_CLOSE_OWN_QUESTIONS': 25,
+ 'MIN_REP_TO_RETAG_OTHERS_QUESTIONS': 50,
+ 'MIN_REP_TO_REOPEN_OWN_QUESTIONS': 50,
+ 'MIN_REP_TO_EDIT_WIKI': 75,
+ 'MIN_REP_TO_EDIT_OTHERS_POSTS': 200,
+ 'MIN_REP_TO_VIEW_OFFENSIVE_FLAGS': 200,
+ 'MIN_REP_TO_CLOSE_OTHERS_QUESTIONS': 200,
+ 'MIN_REP_TO_LOCK_POSTS': 400,
+ 'MIN_REP_TO_HAVE_STRONG_URL': 25,
+ #badge settings
+ 'NOTABLE_QUESTION_BADGE_MIN_VIEWS': 25,
+ 'POPULAR_QUESTION_BADGE_MIN_VIEWS': 15,
+ 'FAMOUS_QUESTION_BADGE_MIN_VIEWS': 50,
+ 'ENTHUSIAST_BADGE_MIN_DAYS': 5,
+ 'TAXONOMIST_BADGE_MIN_USE_COUNT': 5,
+ #moderation rule settings
+ 'MIN_FLAGS_TO_HIDE_POST': 2,
+ 'MIN_FLAGS_TO_DELETE_POST': 3,
+}
+
+def bootstrap_callback(current_value, new_value):
+ '''Callback to update settings'''
+
+ if current_value == new_value:
+ #do not overwrite settings in case that tha value
+ #is the same
+ return new_value
+
+ if new_value == True:
+ for key, value in BOOTSTRAP_MODE_SETTINGS.items():
+ settings.update(key, value)
+
+ else:
+ for key in BOOTSTRAP_MODE_SETTINGS:
+ settings.reset(key)
+
+ return new_value
+
+
+SITE_MODES = ConfigurationGroup(
+ 'SITE_MODES',
+ _('Site modes'),
+ )
+
+settings.register(
+ BooleanValue(
+ SITE_MODES,
+ 'ACTIVATE_BOOTSTRAP_MODE',
+ default=False,
+ description=_(
+ 'Activate a "Bootstrap" mode'),
+ help_text=_(
+ "Bootstrap mode lowers reputation and certain badge "
+ "thresholds, to values, more suitable "
+ "for the smaller communities, "
+ "<strong>WARNING:</strong> your current value for "
+ "Minimum reputation, "
+ "Bagde Settings and "
+ "Vote Rules will "
+ "be changed after you modify this setting."
+ ),
+ update_callback = bootstrap_callback
+ )
+)
diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst
index 77ff4a45..d58b415f 100644
--- a/askbot/doc/source/changelog.rst
+++ b/askbot/doc/source/changelog.rst
@@ -1,12 +1,15 @@
Changes in Askbot
=================
-Development version (Not yet released)
---------------------------------------
+0.7.25 (Current Version)
+------------------------
* RSS feed for individual question (Sayan Chowdhury)
+* Allow pre-population of tags via ask a questions link (Adolfo)
+* Make answering own question one click harder (Adolfo)
+* Bootstrap mode (Adolfo, Evgeny)
-0.7.24 (Current Version)
-------------------------
+0.7.24
+------
* Made it possible to disable the anonymous user greeting alltogether (Raghu Udiyar)
* Added annotations for the meanings of user levels on the "moderation" page. (Jishnu)
* Auto-link patterns - e.g. to bug databases - are configurable from settings. (Arun SAG)
diff --git a/askbot/models/answer.py b/askbot/models/answer.py
index 6a2cceee..b9b28f89 100644
--- a/askbot/models/answer.py
+++ b/askbot/models/answer.py
@@ -289,7 +289,7 @@ class Answer(content.Content, DeletableContent):
return self.question.title
def get_absolute_url(self):
- return u'%(base)s%(slug)s?answer=%(id)d#%(id)d' % \
+ return u'%(base)s%(slug)s?answer=%(id)d#answer-container-%(id)d' % \
{
'base': reverse('question', args=[self.question.id]),
'slug': django_urlquote(slugify(self.question.title)),
diff --git a/askbot/skins/default/media/js/jquery.animate-colors.js b/askbot/skins/default/media/js/jquery.animate-colors.js
new file mode 100644
index 00000000..07d8ac9c
--- /dev/null
+++ b/askbot/skins/default/media/js/jquery.animate-colors.js
@@ -0,0 +1,105 @@
+/**!
+ * @preserve Color animation jQuery-plugin
+ * http://www.bitstorm.org/jquery/color-animation/
+ * Copyright 2011 Edwin Martin <edwin@bitstorm.org>
+ * Released under the MIT and GPL licenses.
+ */
+
+(function($) {
+ /**
+ * Check whether the browser supports RGBA color mode.
+ *
+ * Author Mehdi Kabab <http://pioupioum.fr>
+ * @return {boolean} True if the browser support RGBA. False otherwise.
+ */
+ function isRGBACapable() {
+ var $script = $('script:first'),
+ color = $script.css('color'),
+ result = false;
+ if (/^rgba/.test(color)) {
+ result = true;
+ } else {
+ try {
+ result = ( color != $script.css('color', 'rgba(0, 0, 0, 0.5)').css('color') );
+ $script.css('color', color);
+ } catch (e) {
+ }
+ }
+
+ return result;
+ }
+
+ $.extend(true, $, {
+ support: {
+ 'rgba': isRGBACapable()
+ }
+ });
+
+ var properties = ['color', 'backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'outlineColor'];
+ $.each(properties, function(i, property) {
+ $.fx.step[property] = function(fx) {
+ if (!fx.init) {
+ fx.begin = parseColor($(fx.elem).css(property));
+ fx.end = parseColor(fx.end);
+ fx.init = true;
+ }
+
+ fx.elem.style[property] = calculateColor(fx.begin, fx.end, fx.pos);
+ }
+ });
+
+ // borderColor doesn't fit in standard fx.step above.
+ $.fx.step.borderColor = function(fx) {
+ if (!fx.init) {
+ fx.end = parseColor(fx.end);
+ }
+ var borders = properties.slice(2, 6); // All four border properties
+ $.each(borders, function(i, property) {
+ if (!fx.init) {
+ fx[property] = {begin: parseColor($(fx.elem).css(property))};
+ }
+
+ fx.elem.style[property] = calculateColor(fx[property].begin, fx.end, fx.pos);
+ });
+ fx.init = true;
+ }
+
+ // Calculate an in-between color. Returns "#aabbcc"-like string.
+ function calculateColor(begin, end, pos) {
+ var color = 'rgb' + ($.support['rgba'] ? 'a' : '') + '('
+ + parseInt((begin[0] + pos * (end[0] - begin[0])), 10) + ','
+ + parseInt((begin[1] + pos * (end[1] - begin[1])), 10) + ','
+ + parseInt((begin[2] + pos * (end[2] - begin[2])), 10);
+ if ($.support['rgba']) {
+ color += ',' + (begin && end ? parseFloat(begin[3] + pos * (end[3] - begin[3])) : 1);
+ }
+ color += ')';
+ return color;
+ }
+
+ // Parse an CSS-syntax color. Outputs an array [r, g, b]
+ function parseColor(color) {
+ var match, triplet;
+
+ // Match #aabbcc
+ if (match = /#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(color)) {
+ triplet = [parseInt(match[1], 16), parseInt(match[2], 16), parseInt(match[3], 16), 1];
+
+ // Match #abc
+ } else if (match = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(color)) {
+ triplet = [parseInt(match[1], 16) * 17, parseInt(match[2], 16) * 17, parseInt(match[3], 16) * 17, 1];
+
+ // Match rgb(n, n, n)
+ } else if (match = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) {
+ triplet = [parseInt(match[1]), parseInt(match[2]), parseInt(match[3]), 1];
+
+ } else if (match = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9\.]*)\s*\)/.exec(color)) {
+ triplet = [parseInt(match[1], 10), parseInt(match[2], 10), parseInt(match[3], 10),parseFloat(match[4])];
+
+ // No browser returns rgb(n%, n%, n%), so little reason to support this format.
+ } else if (color == 'transparent'){
+ triplet = [0,0,0,0]
+ }
+ return triplet;
+ }
+})(jQuery);
diff --git a/askbot/skins/default/media/js/utils.js b/askbot/skins/default/media/js/utils.js
index ec55e535..f80f906b 100644
--- a/askbot/skins/default/media/js/utils.js
+++ b/askbot/skins/default/media/js/utils.js
@@ -389,3 +389,4 @@ if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typ
(function(){var a={getSelection:function(){var b=this.jquery?this[0]:this;return(("selectionStart" in b&&function(){var c=b.selectionEnd-b.selectionStart;return{start:b.selectionStart,end:b.selectionEnd,length:c,text:b.value.substr(b.selectionStart,c)}})||(document.selection&&function(){b.focus();var d=document.selection.createRange();if(d==null){return{start:0,end:b.value.length,length:0}}var c=b.createTextRange();var e=c.duplicate();c.moveToBookmark(d.getBookmark());e.setEndPoint("EndToStart",c);return{start:e.text.length,end:e.text.length+d.text.length,length:d.text.length,text:d.text}})||function(){return{start:0,end:b.value.length,length:0}})()},replaceSelection:function(){var b=this.jquery?this[0]:this;var c=arguments[0]||"";return(("selectionStart" in b&&function(){b.value=b.value.substr(0,b.selectionStart)+c+b.value.substr(b.selectionEnd,b.value.length);return this})||(document.selection&&function(){b.focus();document.selection.createRange().text=c;return this})||function(){b.value+=c;return this})()}};jQuery.each(a,function(b){jQuery.fn[b]=this})})();
//our custom autocompleter
var AutoCompleter=function(a){var b={autocompleteMultiple:true,multipleSeparator:" ",inputClass:"acInput",loadingClass:"acLoading",resultsClass:"acResults",selectClass:"acSelect",queryParamName:"q",limitParamName:"limit",extraParams:{},lineSeparator:"\n",cellSeparator:"|",minChars:2,maxItemsToShow:10,delay:400,useCache:true,maxCacheLength:10,matchSubset:true,matchCase:false,matchInside:true,mustMatch:false,preloadData:false,selectFirst:false,stopCharRegex:/\s+/,selectOnly:false,formatItem:null,onItemSelect:false,autoFill:false,filterResults:true,sortResults:true,sortFunction:false,onNoMatch:false};this.options=$.extend({},b,a);this.cacheData_={};this.cacheLength_=0;this.selectClass_="jquery-autocomplete-selected-item";this.keyTimeout_=null;this.lastKeyPressed_=null;this.lastProcessedValue_=null;this.lastSelectedValue_=null;this.active_=false;this.finishOnBlur_=true;this.options.minChars=parseInt(this.options.minChars,10);if(isNaN(this.options.minChars)||this.options.minChars<1){this.options.minChars=2}this.options.maxItemsToShow=parseInt(this.options.maxItemsToShow,10);if(isNaN(this.options.maxItemsToShow)||this.options.maxItemsToShow<1){this.options.maxItemsToShow=10}this.options.maxCacheLength=parseInt(this.options.maxCacheLength,10);if(isNaN(this.options.maxCacheLength)||this.options.maxCacheLength<1){this.options.maxCacheLength=10}if(this.options.preloadData===true){this.fetchRemoteData("",function(){})}};inherits(AutoCompleter,WrappedElement);AutoCompleter.prototype.decorate=function(a){this._element=a;this._element.attr("autocomplete","off");this._results=$("<div></div>").hide();if(this.options.resultsClass){this._results.addClass(this.options.resultsClass)}this._results.css({position:"absolute"});$("body").append(this._results);this.setEventHandlers()};AutoCompleter.prototype.setEventHandlers=function(){var a=this;a._element.keydown(function(b){a.lastKeyPressed_=b.keyCode;switch(a.lastKeyPressed_){case 38:b.preventDefault();if(a.active_){a.focusPrev()}else{a.activate()}return false;break;case 40:b.preventDefault();if(a.active_){a.focusNext()}else{a.activate()}return false;break;case 9:case 13:if(a.active_){b.preventDefault();a.selectCurrent();return false}break;case 27:if(a.active_){b.preventDefault();a.finish();return false}break;default:a.activate()}});a._element.blur(function(){if(a.finishOnBlur_){setTimeout(function(){a.finish()},200)}})};AutoCompleter.prototype.position=function(){var a=this._element.offset();this._results.css({top:a.top+this._element.outerHeight(),left:a.left})};AutoCompleter.prototype.cacheRead=function(d){var f,c,b,a,e;if(this.options.useCache){d=String(d);f=d.length;if(this.options.matchSubset){c=1}else{c=f}while(c<=f){if(this.options.matchInside){a=f-c}else{a=0}e=0;while(e<=a){b=d.substr(0,c);if(this.cacheData_[b]!==undefined){return this.cacheData_[b]}e++}c++}}return false};AutoCompleter.prototype.cacheWrite=function(a,b){if(this.options.useCache){if(this.cacheLength_>=this.options.maxCacheLength){this.cacheFlush()}a=String(a);if(this.cacheData_[a]!==undefined){this.cacheLength_++}return this.cacheData_[a]=b}return false};AutoCompleter.prototype.cacheFlush=function(){this.cacheData_={};this.cacheLength_=0};AutoCompleter.prototype.callHook=function(c,b){var a=this.options[c];if(a&&$.isFunction(a)){return a(b,this)}return false};AutoCompleter.prototype.activate=function(){var b=this;var a=function(){b.activateNow()};var c=parseInt(this.options.delay,10);if(isNaN(c)||c<=0){c=250}if(this.keyTimeout_){clearTimeout(this.keyTimeout_)}this.keyTimeout_=setTimeout(a,c)};AutoCompleter.prototype.activateNow=function(){var a=this.getValue();if(a!==this.lastProcessedValue_&&a!==this.lastSelectedValue_){if(a.length>=this.options.minChars){this.active_=true;this.lastProcessedValue_=a;this.fetchData(a)}}};AutoCompleter.prototype.fetchData=function(b){if(this.options.data){this.filterAndShowResults(this.options.data,b)}else{var a=this;this.fetchRemoteData(b,function(c){a.filterAndShowResults(c,b)})}};AutoCompleter.prototype.fetchRemoteData=function(c,e){var d=this.cacheRead(c);if(d){e(d)}else{var a=this;if(this._element){this._element.addClass(this.options.loadingClass)}var b=function(g){var f=false;if(g!==false){f=a.parseRemoteData(g);a.options.data=f;a.cacheWrite(c,f)}if(a._element){a._element.removeClass(a.options.loadingClass)}e(f)};$.ajax({url:this.makeUrl(c),success:b,error:function(){b(false)}})}};AutoCompleter.prototype.setOption=function(a,b){this.options[a]=b};AutoCompleter.prototype.setExtraParam=function(b,c){var a=$.trim(String(b));if(a){if(!this.options.extraParams){this.options.extraParams={}}if(this.options.extraParams[a]!==c){this.options.extraParams[a]=c;this.cacheFlush()}}};AutoCompleter.prototype.makeUrl=function(e){var a=this;var b=this.options.url;var d=$.extend({},this.options.extraParams);if(this.options.queryParamName===false){b+=encodeURIComponent(e)}else{d[this.options.queryParamName]=e}if(this.options.limitParamName&&this.options.maxItemsToShow){d[this.options.limitParamName]=this.options.maxItemsToShow}var c=[];$.each(d,function(f,g){c.push(a.makeUrlParam(f,g))});if(c.length){b+=b.indexOf("?")==-1?"?":"&";b+=c.join("&")}return b};AutoCompleter.prototype.makeUrlParam=function(a,b){return String(a)+"="+encodeURIComponent(b)};AutoCompleter.prototype.splitText=function(a){return String(a).replace(/(\r\n|\r|\n)/g,"\n").split(this.options.lineSeparator)};AutoCompleter.prototype.parseRemoteData=function(c){var h,b,f,d,g;var e=[];var b=this.splitText(c);for(f=0;f<b.length;f++){var a=b[f].split(this.options.cellSeparator);g=[];for(d=0;d<a.length;d++){g.push(unescape(a[d]))}h=g.shift();e.push({value:unescape(h),data:g})}return e};AutoCompleter.prototype.filterAndShowResults=function(a,b){this.showResults(this.filterResults(a,b),b)};AutoCompleter.prototype.filterResults=function(d,b){var f=[];var l,c,e,m,j,a;var k,h,g;for(e=0;e<d.length;e++){m=d[e];j=typeof m;if(j==="string"){l=m;c={}}else{if($.isArray(m)){l=m[0];c=m.slice(1)}else{if(j==="object"){l=m.value;c=m.data}}}l=String(l);if(l>""){if(typeof c!=="object"){c={}}if(this.options.filterResults){h=String(b);g=String(l);if(!this.options.matchCase){h=h.toLowerCase();g=g.toLowerCase()}a=g.indexOf(h);if(this.options.matchInside){a=a>-1}else{a=a===0}}else{a=true}if(a){f.push({value:l,data:c})}}}if(this.options.sortResults){f=this.sortResults(f,b)}if(this.options.maxItemsToShow>0&&this.options.maxItemsToShow<f.length){f.length=this.options.maxItemsToShow}return f};AutoCompleter.prototype.sortResults=function(c,d){var b=this;var a=this.options.sortFunction;if(!$.isFunction(a)){a=function(g,e,h){return b.sortValueAlpha(g,e,h)}}c.sort(function(f,e){return a(f,e,d)});return c};AutoCompleter.prototype.sortValueAlpha=function(d,c,e){d=String(d.value);c=String(c.value);if(!this.options.matchCase){d=d.toLowerCase();c=c.toLowerCase()}if(d>c){return 1}if(d<c){return -1}return 0};AutoCompleter.prototype.showResults=function(e,b){var k=this;var g=$("<ul></ul>");var f,l,j,a,h=false,d=false;var c=e.length;for(f=0;f<c;f++){l=e[f];j=$("<li>"+this.showResult(l.value,l.data)+"</li>");j.data("value",l.value);j.data("data",l.data);j.click(function(){var i=$(this);k.selectItem(i)}).mousedown(function(){k.finishOnBlur_=false}).mouseup(function(){k.finishOnBlur_=true});g.append(j);if(h===false){h=String(l.value);d=j;j.addClass(this.options.firstItemClass)}if(f==c-1){j.addClass(this.options.lastItemClass)}}this.position();this._results.html(g).show();a=this._results.outerWidth()-this._results.width();this._results.width(this._element.outerWidth()-a);$("li",this._results).hover(function(){k.focusItem(this)},function(){});if(this.autoFill(h,b)){this.focusItem(d)}};AutoCompleter.prototype.showResult=function(b,a){if($.isFunction(this.options.showResult)){return this.options.showResult(b,a)}else{return b}};AutoCompleter.prototype.autoFill=function(e,c){var b,a,d,f;if(this.options.autoFill&&this.lastKeyPressed_!=8){b=String(e).toLowerCase();a=String(c).toLowerCase();d=e.length;f=c.length;if(b.substr(0,f)===a){this._element.val(e);this.selectRange(f,d);return true}}return false};AutoCompleter.prototype.focusNext=function(){this.focusMove(+1)};AutoCompleter.prototype.focusPrev=function(){this.focusMove(-1)};AutoCompleter.prototype.focusMove=function(a){var b,c=$("li",this._results);a=parseInt(a,10);for(var b=0;b<c.length;b++){if($(c[b]).hasClass(this.selectClass_)){this.focusItem(b+a);return}}this.focusItem(0)};AutoCompleter.prototype.focusItem=function(b){var a,c=$("li",this._results);if(c.length){c.removeClass(this.selectClass_).removeClass(this.options.selectClass);if(typeof b==="number"){b=parseInt(b,10);if(b<0){b=0}else{if(b>=c.length){b=c.length-1}}a=$(c[b])}else{a=$(b)}if(a){a.addClass(this.selectClass_).addClass(this.options.selectClass)}}};AutoCompleter.prototype.selectCurrent=function(){var a=$("li."+this.selectClass_,this._results);if(a.length==1){this.selectItem(a)}else{this.finish()}};AutoCompleter.prototype.selectItem=function(d){var c=d.data("value");var b=d.data("data");var a=this.displayValue(c,b);this.lastProcessedValue_=a;this.lastSelectedValue_=a;this.setValue(a);this.setCaret(a.length);this.callHook("onItemSelect",{value:c,data:b});this.finish()};AutoCompleter.prototype.isContentChar=function(a){if(a.match(this.options.stopCharRegex)){return false}else{if(a===this.options.multipleSeparator){return false}else{return true}}};AutoCompleter.prototype.getValue=function(){var c=this._element.getSelection();var d=this._element.val();var f=c.start;var e=f;for(cpos=f;cpos>=0;cpos=cpos-1){if(cpos===d.length){continue}var b=d.charAt(cpos);if(!this.isContentChar(b)){break}e=cpos}var a=f;for(cpos=f;cpos<d.length;cpos=cpos+1){if(cpos===0){continue}var b=d.charAt(cpos);if(!this.isContentChar(b)){break}a=cpos}this._selection_start=e;this._selection_end=a;return d.substring(e,a)};AutoCompleter.prototype.setValue=function(b){var a=this._element.val().substring(0,this._selection_start);var c=this._element.val().substring(this._selection_end+1);this._element.val(a+b+c)};AutoCompleter.prototype.displayValue=function(b,a){if($.isFunction(this.options.displayValue)){return this.options.displayValue(b,a)}else{return b}};AutoCompleter.prototype.finish=function(){if(this.keyTimeout_){clearTimeout(this.keyTimeout_)}if(this._element.val()!==this.lastSelectedValue_){if(this.options.mustMatch){this._element.val("")}this.callHook("onNoMatch")}this._results.hide();this.lastKeyPressed_=null;this.lastProcessedValue_=null;if(this.active_){this.callHook("onFinish")}this.active_=false};AutoCompleter.prototype.selectRange=function(d,a){var c=this._element.get(0);if(c.setSelectionRange){c.focus();c.setSelectionRange(d,a)}else{if(this.createTextRange){var b=this.createTextRange();b.collapse(true);b.moveEnd("character",a);b.moveStart("character",d);b.select()}}};AutoCompleter.prototype.setCaret=function(a){this.selectRange(a,a)};
+(function($){function isRGBACapable(){var $script=$("script:first"),color=$script.css("color"),result=false;if(/^rgba/.test(color)){result=true}else{try{result=(color!=$script.css("color","rgba(0, 0, 0, 0.5)").css("color"));$script.css("color",color)}catch(e){}}return result}$.extend(true,$,{support:{rgba:isRGBACapable()}});var properties=["color","backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","outlineColor"];$.each(properties,function(i,property){$.fx.step[property]=function(fx){if(!fx.init){fx.begin=parseColor($(fx.elem).css(property));fx.end=parseColor(fx.end);fx.init=true}fx.elem.style[property]=calculateColor(fx.begin,fx.end,fx.pos)}});$.fx.step.borderColor=function(fx){if(!fx.init){fx.end=parseColor(fx.end)}var borders=properties.slice(2,6);$.each(borders,function(i,property){if(!fx.init){fx[property]={begin:parseColor($(fx.elem).css(property))}}fx.elem.style[property]=calculateColor(fx[property].begin,fx.end,fx.pos)});fx.init=true};function calculateColor(begin,end,pos){var color="rgb"+($.support.rgba?"a":"")+"("+parseInt((begin[0]+pos*(end[0]-begin[0])),10)+","+parseInt((begin[1]+pos*(end[1]-begin[1])),10)+","+parseInt((begin[2]+pos*(end[2]-begin[2])),10);if($.support.rgba){color+=","+(begin&&end?parseFloat(begin[3]+pos*(end[3]-begin[3])):1)}color+=")";return color}function parseColor(color){var match,triplet;if(match=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(color)){triplet=[parseInt(match[1],16),parseInt(match[2],16),parseInt(match[3],16),1]}else{if(match=/#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(color)){triplet=[parseInt(match[1],16)*17,parseInt(match[2],16)*17,parseInt(match[3],16)*17,1]}else{if(match=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)){triplet=[parseInt(match[1]),parseInt(match[2]),parseInt(match[3]),1]}else{if(match=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9\.]*)\s*\)/.exec(color)){triplet=[parseInt(match[1],10),parseInt(match[2],10),parseInt(match[3],10),parseFloat(match[4])]}else{if(color=="transparent"){triplet=[0,0,0,0]}}}}}return triplet}})(jQuery); \ No newline at end of file
diff --git a/askbot/skins/default/media/style/style.css b/askbot/skins/default/media/style/style.css
index 478f5116..6297721b 100644
--- a/askbot/skins/default/media/style/style.css
+++ b/askbot/skins/default/media/style/style.css
@@ -887,6 +887,7 @@ a:hover.medal {
margin: 5px 0 0 4px;
padding: 0 2px;
text-decoration: none;
+ font-size: 12.5px;
}
.tabsA .label, .tabsC .label {
diff --git a/askbot/skins/default/templates/macros.html b/askbot/skins/default/templates/macros.html
index c56d1cc4..282553e4 100644
--- a/askbot/skins/default/templates/macros.html
+++ b/askbot/skins/default/templates/macros.html
@@ -411,7 +411,7 @@ poor design of the data or methods on data objects #}
{%- endmacro -%}
{%- macro question_summary(question, extra_class=None) -%}
- <div class="short-summary{% if extra_class %} {{extra_class}}{% endif %}">
+ <div class="short-summary{% if extra_class %} {{extra_class}}{% endif %}" id="question-{{question.id}}">
<div class="counts">
<div class="views
{% if question.view_count == 0 -%}
diff --git a/askbot/skins/default/templates/main_page/javascript.html b/askbot/skins/default/templates/main_page/javascript.html
index 14dfe3cd..e7479e63 100644
--- a/askbot/skins/default/templates/main_page/javascript.html
+++ b/askbot/skins/default/templates/main_page/javascript.html
@@ -13,7 +13,19 @@
var today = new Date();{#add timestamp to prevent browser caching #}
$.getJSON('{% url user_update_has_custom_avatar %}?t=' + today.getTime());
{% endif %}
+ animate_hashes();
});
+ $(window).bind('hashchange', animate_hashes);
+ function animate_hashes(){
+ var id_value = window.location.hash;
+ if (id_value != ""){
+ var previous_color = $(id_value).css('background-color');
+ $(id_value).css('backgroundColor', '#FFF8C6');
+ $(id_value).animate({backgroundColor: '#ff7f2a'}, 1000).animate({backgroundColor: '#FFF8C6'}, 1000, function(){
+ $(id_value).css('backgroundColor', previous_color);
+ });
+ }
+ }
askbot['urls']['mark_interesting_tag'] = scriptUrl + '{% url mark_interesting_tag %}';
askbot['urls']['mark_ignored_tag'] = scriptUrl + '{% url mark_ignored_tag %}';
askbot['urls']['unmark_tag'] = scriptUrl + '{% url unmark_tag %}';
diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html
index 91287bdb..3b07bddb 100644
--- a/askbot/skins/default/templates/question.html
+++ b/askbot/skins/default/templates/question.html
@@ -305,7 +305,12 @@
<a href="mailto:?subject={{ settings.APP_SHORT_NAME|urlencode }}&amp;body={{ question_url }}">{% trans %}email{% endtrans %}</a>.
</h2>
{% endif %}
-<form id="fmanswer" action="{% url answer question.id %}" method="post">{% csrf_token %}
+<form
+ id="fmanswer"
+ {% if user == question.author %}style="display:none"{% endif %}
+ action="{% url answer question.id %}"
+ method="post"
+>{% csrf_token %}
{% if request.user.is_authenticated() %}
<p style="padding-left:3px">
{{ answer.email_notify }}
@@ -380,6 +385,9 @@
{% endif %}
{% endif %}
</form>
+ {% if request.user == question.author %}
+ <input type="button" class="submit after-editor" id="fmanswer_button" value="{% trans %}Answer Your Own Question{% endtrans %}"/>
+ {%endif%}
{% endblock %}
{% block sidebar %}
@@ -535,7 +543,30 @@
$('#fmanswer textarea').focus();
}
{% if settings.ENABLE_SHARING_GOOGLE %}$.getScript("http://apis.google.com/js/plusone.js"){% endif %}
+
+ animate_hashes();
+
+ {% if request.user == question.author %}
+ $("#fmanswer_button").click(function() {
+ $("#fmanswer").show();
+ $("#fmanswer_button").hide();
+ });
+ {%endif%}
});
+
+ $(window).bind('hashchange', animate_hashes);
+
+ function animate_hashes(){
+ var id_value = window.location.hash;
+ if (id_value != ""){
+ var previous_color = $(id_value).css('background-color');
+ $(id_value).css('backgroundColor', '#FFF8C6');
+ $(id_value).animate({backgroundColor: '#ff7f2a'}, 1000).animate({backgroundColor: '#FFF8C6'}, 1000, function(){
+ $(id_value).css('backgroundColor', previous_color);
+ });
+ }
+ }
+
function initEditor(){
$('#editor').TextAreaResizer();
diff --git a/askbot/skins/default/templates/users.html b/askbot/skins/default/templates/users.html
index 750b3abb..1d7d02dd 100644
--- a/askbot/skins/default/templates/users.html
+++ b/askbot/skins/default/templates/users.html
@@ -10,25 +10,25 @@
id="sort_reputation"
href="{% url users %}?sort=reputation"
{% if tab_id == 'reputation' %}class="on"{% endif %}
- title="{% trans %}reputation{% endtrans %}"
+ title="{% trans %}see people with the highest reputation{% endtrans %}"
><span>{% trans %}reputation{% endtrans %}</span></a>
<a
id="sort_newest"
href="{% url users %}?sort=newest"
{% if tab_id == 'newest' %}class="on"{% endif %}
- class="off" title="{% trans %}recent{% endtrans %}"
+ class="off" title="{% trans %}see people who joined most recently{% endtrans %}"
><span>{% trans %}recent{% endtrans %}</span></a>
<a
id="sort_last"
href="{% url users %}?sort=last"
{% if tab_id == 'last' %}class="on"{% endif %}
- class="off" title="{% trans %}oldest{% endtrans %}"
+ class="off" title="{% trans %}see people who joined the site first{% endtrans %}"
><span>{% trans %}oldest{% endtrans %}<span></a>
<a
id="sort_user"
href="{% url users %}?sort=user"
{% if tab_id == 'user' %}class="on"{% endif %}
- title="{% trans %}by username{% endtrans %}"
+ title="{% trans %}see people sorted by name{% endtrans %}"
><span>{% trans %}by username{% endtrans %}</span></a>
</div>
</div>
diff --git a/askbot/views/writers.py b/askbot/views/writers.py
index d64c9c02..8b07681a 100644
--- a/askbot/views/writers.py
+++ b/askbot/views/writers.py
@@ -267,6 +267,17 @@ def ask(request):#view used to ask a new question
query = search_state.query
form.initial['title'] = query
+ if 'tags' in request.GET:
+ #pre-populate tags.
+ clean_tags = request.GET['tags'].replace(',', ' ')
+ form.initial['tags'] = clean_tags
+ else:
+ #attemp to get tags from search state
+ search_state = request.session.get('search_state', None)
+ if search_state.tags:
+ tags = ' '.join(search_state.tags)
+ form.initial['tags'] = tags
+
data = {
'active_tab': 'ask',
'page_class': 'ask-page',