summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-05-27 02:24:30 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-05-27 02:24:30 -0400
commite854ce21858964f5f85e4901c6fc56bd7aa4639b (patch)
treef1d93e80bd0e53f32f2408fc3b8d20f550493391
parent45217999234bd2cbceda7c114c7526979883fa47 (diff)
downloadaskbot-e854ce21858964f5f85e4901c6fc56bd7aa4639b.tar.gz
askbot-e854ce21858964f5f85e4901c6fc56bd7aa4639b.tar.bz2
askbot-e854ce21858964f5f85e4901c6fc56bd7aa4639b.zip
merged the "subscribe" checkbox with "follow" button functionally
-rw-r--r--askbot/media/js/utils.js1
-rw-r--r--askbot/media/style/style.css10
-rw-r--r--askbot/media/style/style.less11
-rw-r--r--askbot/models/__init__.py14
-rw-r--r--askbot/templates/question/sidebar.html13
5 files changed, 36 insertions, 13 deletions
diff --git a/askbot/media/js/utils.js b/askbot/media/js/utils.js
index 51e3b7ba..ec3af964 100644
--- a/askbot/media/js/utils.js
+++ b/askbot/media/js/utils.js
@@ -2444,6 +2444,7 @@ PermsHoverCard.prototype.createDom = function() {
this.getKeepHandler(),
this.getCloseHandler()
);
+ this._element.hide();
};
var ShowPermsTrigger = function() {
diff --git a/askbot/media/style/style.css b/askbot/media/style/style.css
index 4d040adc..fbbd206a 100644
--- a/askbot/media/style/style.css
+++ b/askbot/media/style/style.css
@@ -1826,6 +1826,10 @@ ul#related-tags li {
margin-right: 7px;
}
.folded-editor {
+ box-shadow: inset 0 0 3px 1px #aaa;
+ -moz-box-shadow: inset 0 0 3px 1px #aaa;
+ -webkit-box-shadow: inset 0 0 3px 1px #aaa;
+ cursor: text;
height: 100px;
outline: none;
width: 100%;
@@ -1833,6 +1837,12 @@ ul#related-tags li {
.folded-editor .editor-proper {
display: none;
}
+.folded-editor.unfolded {
+ cursor: default;
+ box-shadow: 0 0 0 0;
+ -moz-box-shadow: 0 0 0 0;
+ -webkit-box-shadow: 0 0 0 0;
+}
.folded-editor p.prompt {
margin: 5px 8px;
display: block;
diff --git a/askbot/media/style/style.less b/askbot/media/style/style.less
index e345db96..4a957dd6 100644
--- a/askbot/media/style/style.less
+++ b/askbot/media/style/style.less
@@ -1923,6 +1923,10 @@ ul#related-tags li {
}
.folded-editor {
+ box-shadow: inset 0 0 3px 1px #aaa;
+ -moz-box-shadow: inset 0 0 3px 1px #aaa;
+ -webkit-box-shadow: inset 0 0 3px 1px #aaa;
+ cursor: text;
height: 100px;
outline: none;
width: 100%;
@@ -1930,6 +1934,13 @@ ul#related-tags li {
.editor-proper {
display: none;
}
+
+ &.unfolded {
+ cursor: default;
+ box-shadow: 0 0 0 0;
+ -moz-box-shadow: 0 0 0 0;
+ -webkit-box-shadow: 0 0 0 0;
+ }
p.prompt {
margin: 5px 8px;
display: block;
diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py
index 325f06d6..78a68487 100644
--- a/askbot/models/__init__.py
+++ b/askbot/models/__init__.py
@@ -2532,12 +2532,21 @@ def toggle_favorite_question(
about processing the "cancel" option
another strange thing is that this function unlike others below
returns a value
+
+ todo: the on-screen follow and email subscription is not
+ fully merged yet - see use of FavoriteQuestion and follow/unfollow question
+ btw, names of the objects/methods is quite misleading ATM
"""
try:
+ #this attempts to remove the on-screen follow
fave = FavoriteQuestion.objects.get(thread=question.thread, user=self)
fave.delete()
result = False
question.thread.update_favorite_count()
+ #this removes email subscription
+ if question.thread.is_followed_by(self):
+ self.unfollow_question(question)
+
except FavoriteQuestion.DoesNotExist:
if timestamp is None:
timestamp = datetime.datetime.now()
@@ -2547,6 +2556,11 @@ def toggle_favorite_question(
added_at = timestamp,
)
fave.save()
+
+ #this removes email subscription
+ if question.thread.is_followed_by(self) is False:
+ self.follow_question(question)
+
result = True
question.thread.update_favorite_count()
award_badges_signal.send(None,
diff --git a/askbot/templates/question/sidebar.html b/askbot/templates/question/sidebar.html
index 523f01ff..c4301b6c 100644
--- a/askbot/templates/question/sidebar.html
+++ b/askbot/templates/question/sidebar.html
@@ -26,19 +26,6 @@
{% endif %}
</div>
<div class="notify-sidebar">
- {%if request.user.is_authenticated() %}
- <input
- type="checkbox"
- id="question-subscribe-sidebar"
- {% if thread.is_followed_by(request.user) %}
- checked="checked"
- {% endif %}
- />
- <label for="question-subscribe-sidebar">{% trans %}email the updates{% endtrans %}</label>
- {%else%}
- <input type="checkbox" id="question-subscribe-sidebar"/>
- <label for="question-subscribe-sidebar">{% trans %}<strong>Here</strong> (once you log in) you will be able to sign up for the periodic email updates about this question.{% endtrans %}</label>
- {%endif%}
{% if settings.RSS_ENABLED %}
<p class="rss">
<a