From e854ce21858964f5f85e4901c6fc56bd7aa4639b Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Mon, 27 May 2013 02:24:30 -0400 Subject: merged the "subscribe" checkbox with "follow" button functionally --- askbot/media/js/utils.js | 1 + askbot/media/style/style.css | 10 ++++++++++ askbot/media/style/style.less | 11 +++++++++++ askbot/models/__init__.py | 14 ++++++++++++++ askbot/templates/question/sidebar.html | 13 ------------- 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 %}
- {%if request.user.is_authenticated() %} - - - {%else%} - - - {%endif%} {% if settings.RSS_ENABLED %}