From 756f6f6498c6bae7527c8e6a79b1668fddc5a29e Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 22 Sep 2012 23:38:39 -0400 Subject: [PATCH 01/31] remove user's join date (need the space!) --- frontend/views.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/frontend/views.py b/frontend/views.py index 6a0c3a44..10fea660 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -1358,8 +1358,6 @@ def supporter(request, supporter_username, template_name): else: activetab = "#3" - date = supporter.date_joined.strftime("%B %d, %Y") - # following block to support profile admin form in supporter page if request.user.is_authenticated() and request.user.username == supporter_username: @@ -1415,7 +1413,6 @@ def supporter(request, supporter_username, template_name): "backed": backed, "backing": backing, "wished": wished, - "date": date, "profile_form": profile_form, "ungluers": userlists.other_users(supporter, 5 ), "goodreads_auth_url": reverse('goodreads_auth'), From 91ab80d112fb99414e7b0d90cf42e00fbede4691 Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 22 Sep 2012 23:43:59 -0400 Subject: [PATCH 02/31] Revert "remove user's join date (need the space!)" This reverts commit 756f6f6498c6bae7527c8e6a79b1668fddc5a29e. --- frontend/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/views.py b/frontend/views.py index 10fea660..6a0c3a44 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -1358,6 +1358,8 @@ def supporter(request, supporter_username, template_name): else: activetab = "#3" + date = supporter.date_joined.strftime("%B %d, %Y") + # following block to support profile admin form in supporter page if request.user.is_authenticated() and request.user.username == supporter_username: @@ -1413,6 +1415,7 @@ def supporter(request, supporter_username, template_name): "backed": backed, "backing": backing, "wished": wished, + "date": date, "profile_form": profile_form, "ungluers": userlists.other_users(supporter, 5 ), "goodreads_auth_url": reverse('goodreads_auth'), From fde22026610eeca71e6b6070ec1f1a1f804de123 Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 22 Sep 2012 23:46:00 -0400 Subject: [PATCH 03/31] try removing dates again --- frontend/views.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/frontend/views.py b/frontend/views.py index 6a0c3a44..10fea660 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -1358,8 +1358,6 @@ def supporter(request, supporter_username, template_name): else: activetab = "#3" - date = supporter.date_joined.strftime("%B %d, %Y") - # following block to support profile admin form in supporter page if request.user.is_authenticated() and request.user.username == supporter_username: @@ -1415,7 +1413,6 @@ def supporter(request, supporter_username, template_name): "backed": backed, "backing": backing, "wished": wished, - "date": date, "profile_form": profile_form, "ungluers": userlists.other_users(supporter, 5 ), "goodreads_auth_url": reverse('goodreads_auth'), From 72eb8f9e264b265d45ccb5418fa011aff4a828d5 Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 22 Sep 2012 23:48:53 -0400 Subject: [PATCH 04/31] made the tab badge mouseover text stop saying "I" when it's another supporter's page --- frontend/templates/supporter.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/templates/supporter.html b/frontend/templates/supporter.html index 158f8670..4d9da445 100644 --- a/frontend/templates/supporter.html +++ b/frontend/templates/supporter.html @@ -125,9 +125,15 @@ there's no tab for seeing ALL my books, only the filters! huh. {% endifequal %}
- I've unglued {{ backed }} - I'm ungluing {{ backing }} - I'm wishing for {{ wished }} + {% ifequal request.user supporter %} + I've unglued {{ backed }} + I'm ungluing {{ backing }} + I'm wishing for {{ wished }} + {% else %} + is unglued {{ backed }} + is ungluing {{ backing }} + is wishing for {{ wished }} + {% endifequal %}
From f940c3e239efd2c14a75c98c28e9772e07444039 Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 22 Sep 2012 23:49:43 -0400 Subject: [PATCH 05/31] more removing dates --- frontend/templates/supporter.html | 5 ----- 1 file changed, 5 deletions(-) diff --git a/frontend/templates/supporter.html b/frontend/templates/supporter.html index 4d9da445..b79de71b 100644 --- a/frontend/templates/supporter.html +++ b/frontend/templates/supporter.html @@ -66,8 +66,6 @@ function highlightTarget(targetdiv) { {% comment %} To do: create topsection file for inclusion in multiple contexts, if needed -figure out how to configure date display - decide if we're even including date joined in profile Goodreads be sure words display correctlydja do I need both add-wishlist and remove-wishlist classes? do they differ? @@ -94,7 +92,6 @@ there's no tab for seeing ALL my books, only the filters! huh. {% ifequal supporter request.user %}
- My Profile
@@ -104,7 +101,6 @@ there's no tab for seeing ALL my books, only the filters! huh. Generic Ungluer Avatar {% endif %} {{ supporter.username|truncatechars:20 }} - {{ date }} {{ supporter.profile.tagline }}
{% else %} @@ -116,7 +112,6 @@ there's no tab for seeing ALL my books, only the filters! huh. Generic Ungluer Avatar {% endif %} {{ supporter.username }} - {{ date }}
From 8611f733822683dda575217ee0c2dabdaac715eb Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 22 Sep 2012 23:54:06 -0400 Subject: [PATCH 06/31] give badges to users who've pledged! [#29340547] --- core/fixtures/initial_data.json | 10 +++++- .../commands/initialize_pledge_badges.py | 34 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 core/management/commands/initialize_pledge_badges.py diff --git a/core/fixtures/initial_data.json b/core/fixtures/initial_data.json index 70f557cc..67497d15 100644 --- a/core/fixtures/initial_data.json +++ b/core/fixtures/initial_data.json @@ -99,7 +99,15 @@ "model": "core.badge", "fields": { "name": "pledger", - "description": "has made a pledge in at least one ungluing campaign" + "description": "a pledger" + } + }, + { + "pk": 2, + "model": "core.badge", + "fields": { + "name": "pledger2", + "description": "a repeat pledger" } } ] diff --git a/core/management/commands/initialize_pledge_badges.py b/core/management/commands/initialize_pledge_badges.py new file mode 100644 index 00000000..3ef6cd5c --- /dev/null +++ b/core/management/commands/initialize_pledge_badges.py @@ -0,0 +1,34 @@ +""" +set the 'pledged' badge for people who've pledged +""" + +from django.core.management.base import BaseCommand +from django.contrib.auth.models import User +from regluit.core.models import Badge +from regluit.payment.models import Transaction + +class Command(BaseCommand): + help = "for people who've pledged, give them a badge!" + + + def handle(self, **options): + pledger= Badge.objects.get(name='pledger') + pledger2= Badge.objects.get(name='pledger2') + print 'start' + print 'pledger badges: %s' % pledger.holders.all().count() + print 'pledger2 badges: %s' % pledger2.holders.all().count() + pledges=Transaction.objects.exclude(status='NONE').exclude(status='Canceled',reason=None).exclude(anonymous=True) + for pledge in pledges: + if pledge.user.profile.badges.all().count(): + if pledge.user.profile.badges.all()[0].id == pledger.id: + pledge.user.profile.badges.remove(pledger) + pledge.user.profile.badges.add(pledger2) + else: + pledge.user.profile.badges.add(pledger) + print 'end' + print 'pledger badges: %s' % pledger.holders.all().count() + print 'pledger2 badges: %s' % pledger2.holders.all().count() + + + + From 4b49b1df4b3f91d7d186409d9bb0cb7a9089ea1b Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 22 Sep 2012 23:55:07 -0400 Subject: [PATCH 07/31] display badges on user profiles [#29340547] --- core/models.py | 4 ++++ frontend/templates/supporter.html | 11 +++++++++++ static/css/supporter_layout.css | 13 +++++++++---- static/images/pledger.png | Bin 0 -> 1038 bytes static/images/pledger2.png | Bin 0 -> 1948 bytes static/less/supporter_layout.less | 12 ++++++++---- 6 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 static/images/pledger.png create mode 100644 static/images/pledger2.png diff --git a/core/models.py b/core/models.py index 60e492ef..bc64aae6 100755 --- a/core/models.py +++ b/core/models.py @@ -895,6 +895,10 @@ class Badge(models.Model): name = models.CharField(max_length=72, blank=True) description = models.TextField(default='', null=True) + @property + def path(self): + return '/static/images/%s.png' % self.name + #class CampaignSurveyResponse(models.Model): # # generic # campaign = models.ForeignKey("Campaign", related_name="surveyresponse", null=False) diff --git a/frontend/templates/supporter.html b/frontend/templates/supporter.html index b79de71b..8c8d4675 100644 --- a/frontend/templates/supporter.html +++ b/frontend/templates/supporter.html @@ -92,6 +92,13 @@ there's no tab for seeing ALL my books, only the filters! huh. {% ifequal supporter request.user %}
+ My Profile + + {% for badge in supporter.profile.badges.all %} + {{ badge.description }} + {% endfor %} + +
@@ -112,6 +119,10 @@ there's no tab for seeing ALL my books, only the filters! huh. Generic Ungluer Avatar {% endif %} {{ supporter.username }} + + {% for badge in supporter.profile.badges.all %} + {{ badge.description }} + {% endfor %}
diff --git a/static/css/supporter_layout.css b/static/css/supporter_layout.css index 5c4c7df8..a06b5e19 100644 --- a/static/css/supporter_layout.css +++ b/static/css/supporter_layout.css @@ -195,6 +195,12 @@ img.user-avatar { -webkit-border-radius: 7px; border-radius: 7px; } +img.user-badge{ + vertical-align:middle; +} +.user-badges{ + font-size:32px; +} .social { width: 100%; } @@ -207,7 +213,6 @@ span.special-user-name { height: 50px; } span.user-name, -span.user-date, span.user-short-info { display: block; } @@ -313,10 +318,10 @@ span.my-setting { -moz-border-radius: 7px; -webkit-border-radius: 7px; border-radius: 7px; - height: 50px; - line-height: 50px; + height: 40px; + line-height: 40px; display: block; - padding: 0 0 0 10px; + padding: 0 0 10px 10px; font-size: 19px; font-weight: bold; cursor: pointer; diff --git a/static/images/pledger.png b/static/images/pledger.png new file mode 100644 index 0000000000000000000000000000000000000000..ea7a75741fdaf16e1d1ce29ae740719e51736ee8 GIT binary patch literal 1038 zcmV+p1o8WcP)fHfe3Ov~Ejmr->cg zyRHr9u(QT?{gGWu^hu+g*`0a6|9d<8c2|^2B_5~Q&z%pnv;H-}34CW+KpSuYd-afbhE$> zap%R_;9Q}Yeby%Ig!0AvYNUA5SFYMR6hj?;3eQvI&+ix ztDm51iMHXY_80TvQ=~K30WJYAN*1*O09JulfZ0s;4)Y5iqiS)>@SJ*&`S81BvNr){ zrSG*$V7)q!lJ{pOtKQ|;EALY%=1jv2#SFjwaguEAHo%PZnW}{~DnvP895|!pS6GaG zVG0g{#mHx9`2@fj;C1Qq5o=ZnRp11`T6)nG90Y6nh68v9&>BHnmEs)$Zr4^*aDl+% ze#Y>zvl*b3fV}`-PtX(`1d4mW@Uf?D0g7jvDLB|rJOfoe8d4Tx04R}-l+Q~PVHn51vyB)iL11Qkh@nGBs7w}RMCGo(*tBg~f0Po$?CiU{ zle4qa%26U(f|ru*d1uDm5$(qdGxK?$AK&MB z-{F0M8d)(-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vFPzRFZ*XilrV-AkcbLMlB<4HgruqPdx znwt8O)3IjU3D<@$U)RL83t(up-xM5#p^?9hg>>61buV8WpNTW;R;)8o4d8TmO~FBM zIZKR1EE7v+W6UZbupGea%H9dL2M5993>u3lsV!JQ&kDHjHU$R_ue%~IiJ4;7f5n2- zg2L;p$Ooho{B?dmLnD^}DD~Y(RdopLt|?Kk`(6N)6e!TrBHG%eff@kZl?GT%a_QV2 zE)R5PI^2jzbeR6DJuC>WU_s4`AU5#aZ+xj#O-qYt&CNy5Xc}(-=sIsE#}iFG7rW>SpJPFA1@|m{38%wNJP|Egv&>%w^qLYt zH=4)eDCOi&?-Ge-AK~h#rnJ`@b_^cRnf>(lyUW+;qQ4W1N1p7y@FV?$=kT}!#1m1( zXhd@YIxH8U@7l%e&~aVUUfr;L;MjEY8=kv*9H>9ECs?N`{k_p>cy;FCgA!H%`%MW< zb+7Q7DE0bNJFXp^X>M+01lN4m8rY;n-bS&~Xy)l-Mge8C^Y+HjwS9%W_Zh;{-qGgY ihT{2|=E Date: Mon, 24 Sep 2012 14:21:15 -0400 Subject: [PATCH 08/31] first pass --- settings/common.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/settings/common.py b/settings/common.py index 23053eb9..917ad16d 100644 --- a/settings/common.py +++ b/settings/common.py @@ -33,6 +33,12 @@ CKEDITOR_RESTRICT_BY_USER = True CKEDITOR_CONFIGS = { 'default': { 'width': 700, + 'toolbar': [ + ['Cut','Copy','Paste', 'PasteFromWord', '-', 'Undo', 'Redo', '-', 'Source'], + ['Bold', 'Italic', '-', 'NumberedList','BulletedList', '-','Blockquote'], + ['Find','Replace','-', 'Scayt'], + ['Link', 'Unlink', '-', 'Image', 'HorizontalRule'] + ], }, } From 0f91fddea534fce1266a2edd249dc4fc3125df17 Mon Sep 17 00:00:00 2001 From: Raymond Yee Date: Sat, 29 Sep 2012 11:30:02 -0700 Subject: [PATCH 09/31] Make requirements_relaunch.pip available on production branch to make it easy to do migration to Django 1.4 --- requirements_relaunch.pip | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 requirements_relaunch.pip diff --git a/requirements_relaunch.pip b/requirements_relaunch.pip new file mode 100644 index 00000000..c4e36f49 --- /dev/null +++ b/requirements_relaunch.pip @@ -0,0 +1,52 @@ +Django==1.4.1 +Fabric==1.4.3 +MySQL-python==1.2.3 +Pillow==1.7.7 +Pyzotero==0.9.51 +South==0.7.6 +amqplib==1.0.2 +anyjson==0.3.3 +billiard==2.7.3.12 +#boto==2.3.0 +git+ssh://git@github.com/Gluejar/boto.git@2.3.0 +celery==3.0.9 +distribute==0.6.28 +django-celery==3.0.9 +django-ckeditor==3.6.2.1 +django-endless-pagination==1.1 +django-extensions==0.9 +django-kombu==0.9.4 +django-maintenancemode==0.10 +django-nose-selenium==0.7.3 +#django-notification==0.2 +git+git://github.com/aladagemre/django-notification.git@2927346f4c513a217ac8ad076e494dd1adbf70e1 +django-registration==0.8 +django-selectable==0.5.2 +django-smtp-ssl==1.0 +django-social-auth==0.7.5 +django-tastypie==0.9.11 +feedparser==5.1.2 +freebase==1.0.8 +httplib2==0.7.5 +kombu==2.4.5 +lxml==2.3.5 +mechanize==0.2.5 +mimeparse==0.1.3 +nose==1.1.2 +oauth2==1.5.211 +paramiko==1.7.7.2 +pyasn1==0.1.4 +pycrypto==2.6 +python-dateutil==2.1 +python-openid==2.2.5 +pytz==2012d +rdflib==2.4.0 +redis==2.6.2 +requests==0.14.0 +selenium==2.25.0 +six==1.2.0 +ssh==1.7.14 +stripe==1.7.4 +virtualenv==1.4.9 +virtualenvwrapper==3.6 +wsgiref==0.1.2 From fd845d627b990b4f4d1eb472a39b74d95cd84396 Mon Sep 17 00:00:00 2001 From: Andromeda Yelton Date: Mon, 1 Oct 2012 09:47:32 -0400 Subject: [PATCH 10/31] is unglued is not grammatical here --- frontend/templates/supporter.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/templates/supporter.html b/frontend/templates/supporter.html index 8c8d4675..b7913dac 100644 --- a/frontend/templates/supporter.html +++ b/frontend/templates/supporter.html @@ -136,7 +136,7 @@ there's no tab for seeing ALL my books, only the filters! huh. I'm ungluing {{ backing }} I'm wishing for {{ wished }} {% else %} - is unglued {{ backed }} + has unglued {{ backed }} is ungluing {{ backing }} is wishing for {{ wished }} {% endifequal %} From bf212ed1653d15a938d805c6dd22dcb2ea369038 Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 1 Oct 2012 15:10:45 -0400 Subject: [PATCH 11/31] prettier stars matching site colors --- static/images/pledger.png | Bin 1038 -> 1375 bytes static/images/pledger2.png | Bin 1948 -> 1393 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/static/images/pledger.png b/static/images/pledger.png index ea7a75741fdaf16e1d1ce29ae740719e51736ee8..2ad3c001d5ec85fd5cce2644b73a6c3b7404d212 100644 GIT binary patch delta 1356 zcmV-S1+)5&2;T~jB!2;OQb$4nuFf3k0000XbVXQnQ*UN;cVTj607r6RaA;{`LvL<& zWpZ?7av&&4ZggdADR+nZ82|tT>`6pHRCt`kR!dJCR}{`7%l-fsEV}4|MHl`7S+MA$ zQlb#vVDN*NO4UYDTB)s+rj=5qS!7XFm71ujio(O-6x%!lfqyiFS4;zh1lvH>rWkwd z@fe#i_%XKUaeD3@pa}#pMuEkVEZ@2FednC-d}mGpz^Rjr69qpq0coB4QjYO;Cqh6G zV);SaC%_GSBg&Ha-mw#iJNpNiw)4Q43L(1uXVb9~P?B*C*L@L~j$-h&7eZk0s;Ed( zR#nI@`^7;U(|=Zg;N{@!C@!Kq&Z>)gdidoIo zBA5|)mjN@@tKrh^2H%W`OTYabxwGanLU^VgSc{&5ds_>E8EuM+Y3aDh z2^19fpi+Ig>&<}s1|jjx2wYdS3f_j`6V0qBDVqJKKvwejsoz-ALqZ~OA2Xge9*zVB zH-7+Uty0TQ!0m0UgzwI53}q!JGJSV(n?w(icwxwl1bJpw51d7-YN@3NeD)3mhh5D~{!pPFCInJQE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Dt{uBy@eJQ*gI2op<;5Kl%(rBeWZPFg4GL@7o4zLE-U(t21F z%lyTD9(phYMaB6Gn}O#ZT4pRc#Oc$Y5*`^q31@Z7MB~P1hp$ZaKzm!zZ+}tx5umo% zUCg7aUVx&K{|tWW)F+Ha!vMceidMfdG!TZHn(*5%y~Q@$yhA7+^SC^$UbPb(Wpjfk z203x+W5!~mAe^+@QjK+6MtbdK5j>ZyEI!}BCsq5z9sW_co9}FM5M4vx@s=5vzcNkAR2Cmoxbn);H{v1Z%}*M=@%*Tl99 zU}&`86dZ)1k-v?FblWR+FJBy=i8Jd~tTRy!;BP<6Msu)W6UZbupGea z%H9dL2M5993>u3lsV!JQ&kDHjHU$R_ue%~IiJ4;7f5n2-g2L;p$Ooho{B?dmLnD^} zDD~Y(RdopLt|?Kk`(6N)6e!TrBHG%eff@kZl?GT%a_QV2E)R5PI^2jzbeR6DJuC>W zU_s4`AU5#aZ+xj#O@B*^XwA(^Hzn|Rt$(4Kq{!)Tf#oi){IQqISI-iQXKrOt-)I_d z0O&ezCdU&^Jr}#^3!h^_a0T})eF>+-O*|1TTC>bw1@xK{KsTDl<0$3iPwx_mW*_0| zsHU{n8g>jG&zb%7_q)s2=%T+9i$|X9zVIXcgXi$L0>l$h#D8c+a{@Xn7ohLj#q7{= zUDICOuzldzbn_dYyLud`KeQ)Urz!ot(P(&e=HY`9Rsj1=2~2gb@S7<0`cpfu9h_-y zZe#@4eAgP-q(t6EvC?Sf>0?F#Wwi75#?ZBWg}nC}!qVQ+=HG_m`I+X)oqj$47cR%B VkH4?54gdfE00>D%PDHLkV1jE$t_=VH From 99c228323e8e66d141ad9c47ff78a59e66295d60 Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 1 Oct 2012 15:24:11 -0400 Subject: [PATCH 12/31] fix double toggle when clicking on star --- frontend/templates/supporter.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/templates/supporter.html b/frontend/templates/supporter.html index 8c8d4675..b57bbf4f 100644 --- a/frontend/templates/supporter.html +++ b/frontend/templates/supporter.html @@ -22,7 +22,7 @@ var $j = jQuery.noConflict(); $j(document).ready(function(){ $j('#user-block-hide').hide(); - $j('#user-block1 span').click(function() { + $j('#user-block1 > div > span').click(function() { $j(this).toggleClass("active"); $j("#user-block-hide").slideToggle(300); }); From 759e39f61d069dc1f691197e3d8d020929ff6d59 Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 1 Oct 2012 18:28:26 -0400 Subject: [PATCH 13/31] wired badge awarding into pledge modified and pledge complete signals --- core/models.py | 42 +++++++++++++++++++++++++++++++++++------- core/signals.py | 6 ++++++ payment/tests.py | 7 ++++++- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/core/models.py b/core/models.py index 3b8ac711..cf18449f 100755 --- a/core/models.py +++ b/core/models.py @@ -944,6 +944,18 @@ class Wishes(models.Model): class Meta: db_table = 'core_wishlist_works' +class Badge(models.Model): + name = models.CharField(max_length=72, blank=True) + description = models.TextField(default='', null=True) + + @property + def path(self): + return '/static/images/%s.png' % self.name + + +pledger= Badge.objects.get(name='pledger') +pledger2= Badge.objects.get(name='pledger2') + class UserProfile(models.Model): created = models.DateTimeField(auto_now_add=True) user = models.OneToOneField(User, related_name='profile') @@ -959,16 +971,32 @@ class UserProfile(models.Model): goodreads_user_name = models.CharField(max_length=200, null=True, blank=True) goodreads_auth_token = models.TextField(null=True, blank=True) goodreads_auth_secret = models.TextField(null=True, blank=True) - goodreads_user_link = models.CharField(max_length=200, null=True, blank=True) + goodreads_user_link = models.CharField(max_length=200, null=True, blank=True) + + def add_pledge_badge(self): + #give user a badge + if self.badges.all().count(): + if self.badges.all()[0].id == pledger.id: + self.badges.remove(pledger) + self.badges.add(pledger2) + else: + self.badges.add(pledger) -class Badge(models.Model): - name = models.CharField(max_length=72, blank=True) - description = models.TextField(default='', null=True) + def reset_pledge_badge(self): + #count user pledges + n_pledges = self.pledge_count + if self.badges.exists(): + self.badges.remove(pledger) + self.badges.remove(pledger2) + if n_pledges == 1: + self.badges.add(pledger) + elif n_pledges > 1: + self.badges.add(pledger2) @property - def path(self): - return '/static/images/%s.png' % self.name - + def pledge_count(self): + return self.user.transaction_set.exclude(status='NONE').exclude(status='Canceled',reason=None).exclude(anonymous=True).count() + #class CampaignSurveyResponse(models.Model): # # generic # campaign = models.ForeignKey("Campaign", related_name="surveyresponse", null=False) diff --git a/core/signals.py b/core/signals.py index 03e3f869..f55628d7 100644 --- a/core/signals.py +++ b/core/signals.py @@ -177,6 +177,8 @@ def handle_pledge_modified(sender, transaction=None, up_or_down=None, **kwargs): # up_or_down is 'increased', 'decreased', or 'canceled' if transaction==None or up_or_down==None: return + if up_or_down == 'canceled': + transaction.user.profile.reset_pledge_badge() notification.queue([transaction.user], "pledge_status_change", { 'site':Site.objects.get_current(), 'transaction': transaction, @@ -190,6 +192,10 @@ pledge_modified.connect(handle_pledge_modified) def handle_you_have_pledged(sender, transaction=None, **kwargs): if transaction==None: return + + #give user a badge + transaction.user.profile.add_pledge_badge() + notification.queue([transaction.user], "pledge_you_have_pledged", { 'site':Site.objects.get_current(), 'transaction': transaction diff --git a/payment/tests.py b/payment/tests.py index c0236d33..e3ed2f42 100644 --- a/payment/tests.py +++ b/payment/tests.py @@ -14,7 +14,6 @@ from regluit.payment.models import Transaction from regluit.core.models import Campaign, Wishlist, Work from regluit.core.signals import handle_transaction_charged from regluit.payment.parameters import * -from regluit.payment.paypal import * import traceback from django.core.validators import URLValidator from django.core.exceptions import ValidationError @@ -352,6 +351,12 @@ class TransactionTest(TestCase): t.user = user t.save() + #test pledge adders + user.profile.reset_pledge_badge() + self.assertEqual(user.profile.badges.all()[0].name,'pledger') + user.profile.add_pledge_badge() + self.assertEqual(user.profile.badges.all()[0].name,'pledger2') + p = PaymentManager() results = p.query_campaign(c,campaign_total=True, summary=False) self.assertEqual(results[0].amount, D('12.34')) From e4cccc277f2163c870712cc80b8898607b42ab43 Mon Sep 17 00:00:00 2001 From: Andromeda Yelton Date: Tue, 2 Oct 2012 14:17:26 -0400 Subject: [PATCH 14/31] try this placement of the star --- frontend/templates/supporter.html | 17 +++++++++-------- static/css/supporter_layout.css | 12 ++++++++---- static/less/supporter_layout.less | 10 +++++++--- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/frontend/templates/supporter.html b/frontend/templates/supporter.html index 7082c3bd..a8603b2b 100644 --- a/frontend/templates/supporter.html +++ b/frontend/templates/supporter.html @@ -93,15 +93,15 @@ there's no tab for seeing ALL my books, only the filters! huh.
My Profile + +
+
+
{% for badge in supporter.profile.badges.all %} {{ badge.description }} {% endfor %} - -
-
-
{% if supporter.profile.pic_url %} Picture of {{ supporter }} {% else %} @@ -113,16 +113,17 @@ there's no tab for seeing ALL my books, only the filters! huh. {% else %}
+ + {% for badge in supporter.profile.badges.all %} + {{ badge.description }} + {% endfor %} + {% if supporter.profile.pic_url %} Picture of {{ supporter }} {% else %} Generic Ungluer Avatar {% endif %} {{ supporter.username }} - - {% for badge in supporter.profile.badges.all %} - {{ badge.description }} - {% endfor %}
diff --git a/static/css/supporter_layout.css b/static/css/supporter_layout.css index a06b5e19..808e3f33 100644 --- a/static/css/supporter_layout.css +++ b/static/css/supporter_layout.css @@ -161,6 +161,7 @@ line-height: normal; float: left; width: 25%; + position: relative; } .user-block3, .user-block4 { @@ -195,11 +196,14 @@ img.user-avatar { -webkit-border-radius: 7px; border-radius: 7px; } -img.user-badge{ - vertical-align:middle; +img.user-badge { + position: absolute; + margin-left: 30px; + margin-top: -12px; + z-index: 100; } -.user-badges{ - font-size:32px; +.user-badges { + font-size: 32px; } .social { width: 100%; diff --git a/static/less/supporter_layout.less b/static/less/supporter_layout.less index 21ef4cc8..d450c4c9 100644 --- a/static/less/supporter_layout.less +++ b/static/less/supporter_layout.less @@ -85,6 +85,7 @@ line-height:normal; float:left; width:25%; + position: relative; } .user-block3, @@ -120,10 +121,13 @@ img.user-avatar { margin-right:10px; .one-border-radius(7px); } -img.user-badge{ - vertical-align:middle; +img.user-badge { + position: absolute; + margin-left: 30px; + margin-top: -12px; + z-index: 100; } -.user-badges{ +.user-badges { font-size:32px; } .social { From 1dad4342c9306e772c2ec438fdcf3fd7ff4b1b4e Mon Sep 17 00:00:00 2001 From: Andromeda Yelton Date: Tue, 2 Oct 2012 14:42:39 -0400 Subject: [PATCH 15/31] remove acknowledgements from premium display --- frontend/templates/manage_campaign.html | 7 +++---- frontend/views.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/frontend/templates/manage_campaign.html b/frontend/templates/manage_campaign.html index c14f6145..191c14f7 100644 --- a/frontend/templates/manage_campaign.html +++ b/frontend/templates/manage_campaign.html @@ -238,7 +238,6 @@ Please fix the following before launching your campaign: ${{ premium.amount|intcomma }} {{ premium.description }} - {% if premium.type %}
Type: {{ premium.get_type_display }}
{% endif %} {% ifnotequal premium.limit 0 %}
Limit: {{ premium.limit }}{% endifnotequal %} {% ifequal premium.type 'CU' %}
Deactivate? {% endifequal %} @@ -249,9 +248,7 @@ Please fix the following before launching your campaign: {% endif %}
-

Editing premiums

-

At this time, you can't edit a premium you've created. But you can deactivate a premium and add a new one to replace it. So be sure to double-check your spelling before adding it.

-

Add a custom premium for this campaign

+

Add a premium for this campaign

{% csrf_token %} Pledge Amount: {{ premium_form.amount.errors }}${{ premium_form.amount }}
@@ -262,6 +259,8 @@ Please fix the following before launching your campaign:
+

Editing premiums

+

At this time, you can't edit a premium you've created. But you can deactivate a premium and add a new one to replace it. So be sure to double-check your spelling before adding it.

{% ifequal campaign_status 'INITIALIZED' %} diff --git a/frontend/views.py b/frontend/views.py index 5cdb3580..354b9ca3 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -420,7 +420,7 @@ def manage_campaign(request, id): 'form':form, 'problems': campaign.problems, 'alerts': alerts, - 'premiums' : campaign.effective_premiums(), + 'premiums' : campaign.custom_premiums(), 'premium_form' : new_premium_form, 'pubdate': pubdate, 'work': work, From ceebcb690d67cb7fbcfadd292ae35a9e0c9b4f53 Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 2 Oct 2012 18:12:44 -0400 Subject: [PATCH 16/31] step one: fix media links [#37068821] --- frontend/templates/rh_tools.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/templates/rh_tools.html b/frontend/templates/rh_tools.html index aaa47ccc..37daada2 100644 --- a/frontend/templates/rh_tools.html +++ b/frontend/templates/rh_tools.html @@ -2,10 +2,10 @@ {% block title %}Tools for Rightsholders {% endblock %} {% block extra_extra_head %} - + - + {% endblock %} From 6a6c249c833ca9103d3e505f20a58c792e9d3274 Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 2 Oct 2012 18:47:52 -0400 Subject: [PATCH 17/31] f[inish #37068821] selectable 0.4.0 and later incompatible with earlier code see http://django-selectable.readthedocs.org/en/version-0.5.2/releases.html. In general, we can't blithely update our imported modules without reading the release notes. --- core/lookups.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/lookups.py b/core/lookups.py index a65e6134..0a4c5203 100644 --- a/core/lookups.py +++ b/core/lookups.py @@ -5,6 +5,6 @@ from django.contrib.auth.models import User class OwnerLookup(ModelLookup): model = User - search_field = 'username__icontains' + search_fields = ('username__icontains',) registry.register(OwnerLookup) \ No newline at end of file From 863055c3052a202c991752d1efcef099f04c40e7 Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 3 Oct 2012 08:56:29 -0400 Subject: [PATCH 18/31] Revert "wired badge awarding into pledge modified and pledge complete signals" This reverts commit 759e39f61d069dc1f691197e3d8d020929ff6d59. --- core/models.py | 42 +++++++----------------------------------- core/signals.py | 6 ------ payment/tests.py | 7 +------ 3 files changed, 8 insertions(+), 47 deletions(-) diff --git a/core/models.py b/core/models.py index 7e62c7f0..e3957964 100755 --- a/core/models.py +++ b/core/models.py @@ -956,18 +956,6 @@ class Wishes(models.Model): class Meta: db_table = 'core_wishlist_works' -class Badge(models.Model): - name = models.CharField(max_length=72, blank=True) - description = models.TextField(default='', null=True) - - @property - def path(self): - return '/static/images/%s.png' % self.name - - -pledger= Badge.objects.get(name='pledger') -pledger2= Badge.objects.get(name='pledger2') - class UserProfile(models.Model): created = models.DateTimeField(auto_now_add=True) user = models.OneToOneField(User, related_name='profile') @@ -983,32 +971,16 @@ class UserProfile(models.Model): goodreads_user_name = models.CharField(max_length=200, null=True, blank=True) goodreads_auth_token = models.TextField(null=True, blank=True) goodreads_auth_secret = models.TextField(null=True, blank=True) - goodreads_user_link = models.CharField(max_length=200, null=True, blank=True) - - def add_pledge_badge(self): - #give user a badge - if self.badges.all().count(): - if self.badges.all()[0].id == pledger.id: - self.badges.remove(pledger) - self.badges.add(pledger2) - else: - self.badges.add(pledger) + goodreads_user_link = models.CharField(max_length=200, null=True, blank=True) - def reset_pledge_badge(self): - #count user pledges - n_pledges = self.pledge_count - if self.badges.exists(): - self.badges.remove(pledger) - self.badges.remove(pledger2) - if n_pledges == 1: - self.badges.add(pledger) - elif n_pledges > 1: - self.badges.add(pledger2) +class Badge(models.Model): + name = models.CharField(max_length=72, blank=True) + description = models.TextField(default='', null=True) @property - def pledge_count(self): - return self.user.transaction_set.exclude(status='NONE').exclude(status='Canceled',reason=None).exclude(anonymous=True).count() - + def path(self): + return '/static/images/%s.png' % self.name + #class CampaignSurveyResponse(models.Model): # # generic # campaign = models.ForeignKey("Campaign", related_name="surveyresponse", null=False) diff --git a/core/signals.py b/core/signals.py index f55628d7..03e3f869 100644 --- a/core/signals.py +++ b/core/signals.py @@ -177,8 +177,6 @@ def handle_pledge_modified(sender, transaction=None, up_or_down=None, **kwargs): # up_or_down is 'increased', 'decreased', or 'canceled' if transaction==None or up_or_down==None: return - if up_or_down == 'canceled': - transaction.user.profile.reset_pledge_badge() notification.queue([transaction.user], "pledge_status_change", { 'site':Site.objects.get_current(), 'transaction': transaction, @@ -192,10 +190,6 @@ pledge_modified.connect(handle_pledge_modified) def handle_you_have_pledged(sender, transaction=None, **kwargs): if transaction==None: return - - #give user a badge - transaction.user.profile.add_pledge_badge() - notification.queue([transaction.user], "pledge_you_have_pledged", { 'site':Site.objects.get_current(), 'transaction': transaction diff --git a/payment/tests.py b/payment/tests.py index e3ed2f42..c0236d33 100644 --- a/payment/tests.py +++ b/payment/tests.py @@ -14,6 +14,7 @@ from regluit.payment.models import Transaction from regluit.core.models import Campaign, Wishlist, Work from regluit.core.signals import handle_transaction_charged from regluit.payment.parameters import * +from regluit.payment.paypal import * import traceback from django.core.validators import URLValidator from django.core.exceptions import ValidationError @@ -351,12 +352,6 @@ class TransactionTest(TestCase): t.user = user t.save() - #test pledge adders - user.profile.reset_pledge_badge() - self.assertEqual(user.profile.badges.all()[0].name,'pledger') - user.profile.add_pledge_badge() - self.assertEqual(user.profile.badges.all()[0].name,'pledger2') - p = PaymentManager() results = p.query_campaign(c,campaign_total=True, summary=False) self.assertEqual(results[0].amount, D('12.34')) From 57dc50064380e5cffb31ffd6e75519da7a678ac4 Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 3 Oct 2012 08:57:24 -0400 Subject: [PATCH 19/31] Revert "Revert "wired badge awarding into pledge modified and pledge complete signals"" This reverts commit 863055c3052a202c991752d1efcef099f04c40e7. --- core/models.py | 42 +++++++++++++++++++++++++++++++++++------- core/signals.py | 6 ++++++ payment/tests.py | 7 ++++++- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/core/models.py b/core/models.py index e3957964..7e62c7f0 100755 --- a/core/models.py +++ b/core/models.py @@ -956,6 +956,18 @@ class Wishes(models.Model): class Meta: db_table = 'core_wishlist_works' +class Badge(models.Model): + name = models.CharField(max_length=72, blank=True) + description = models.TextField(default='', null=True) + + @property + def path(self): + return '/static/images/%s.png' % self.name + + +pledger= Badge.objects.get(name='pledger') +pledger2= Badge.objects.get(name='pledger2') + class UserProfile(models.Model): created = models.DateTimeField(auto_now_add=True) user = models.OneToOneField(User, related_name='profile') @@ -971,16 +983,32 @@ class UserProfile(models.Model): goodreads_user_name = models.CharField(max_length=200, null=True, blank=True) goodreads_auth_token = models.TextField(null=True, blank=True) goodreads_auth_secret = models.TextField(null=True, blank=True) - goodreads_user_link = models.CharField(max_length=200, null=True, blank=True) + goodreads_user_link = models.CharField(max_length=200, null=True, blank=True) + + def add_pledge_badge(self): + #give user a badge + if self.badges.all().count(): + if self.badges.all()[0].id == pledger.id: + self.badges.remove(pledger) + self.badges.add(pledger2) + else: + self.badges.add(pledger) -class Badge(models.Model): - name = models.CharField(max_length=72, blank=True) - description = models.TextField(default='', null=True) + def reset_pledge_badge(self): + #count user pledges + n_pledges = self.pledge_count + if self.badges.exists(): + self.badges.remove(pledger) + self.badges.remove(pledger2) + if n_pledges == 1: + self.badges.add(pledger) + elif n_pledges > 1: + self.badges.add(pledger2) @property - def path(self): - return '/static/images/%s.png' % self.name - + def pledge_count(self): + return self.user.transaction_set.exclude(status='NONE').exclude(status='Canceled',reason=None).exclude(anonymous=True).count() + #class CampaignSurveyResponse(models.Model): # # generic # campaign = models.ForeignKey("Campaign", related_name="surveyresponse", null=False) diff --git a/core/signals.py b/core/signals.py index 03e3f869..f55628d7 100644 --- a/core/signals.py +++ b/core/signals.py @@ -177,6 +177,8 @@ def handle_pledge_modified(sender, transaction=None, up_or_down=None, **kwargs): # up_or_down is 'increased', 'decreased', or 'canceled' if transaction==None or up_or_down==None: return + if up_or_down == 'canceled': + transaction.user.profile.reset_pledge_badge() notification.queue([transaction.user], "pledge_status_change", { 'site':Site.objects.get_current(), 'transaction': transaction, @@ -190,6 +192,10 @@ pledge_modified.connect(handle_pledge_modified) def handle_you_have_pledged(sender, transaction=None, **kwargs): if transaction==None: return + + #give user a badge + transaction.user.profile.add_pledge_badge() + notification.queue([transaction.user], "pledge_you_have_pledged", { 'site':Site.objects.get_current(), 'transaction': transaction diff --git a/payment/tests.py b/payment/tests.py index c0236d33..e3ed2f42 100644 --- a/payment/tests.py +++ b/payment/tests.py @@ -14,7 +14,6 @@ from regluit.payment.models import Transaction from regluit.core.models import Campaign, Wishlist, Work from regluit.core.signals import handle_transaction_charged from regluit.payment.parameters import * -from regluit.payment.paypal import * import traceback from django.core.validators import URLValidator from django.core.exceptions import ValidationError @@ -352,6 +351,12 @@ class TransactionTest(TestCase): t.user = user t.save() + #test pledge adders + user.profile.reset_pledge_badge() + self.assertEqual(user.profile.badges.all()[0].name,'pledger') + user.profile.add_pledge_badge() + self.assertEqual(user.profile.badges.all()[0].name,'pledger2') + p = PaymentManager() results = p.query_campaign(c,campaign_total=True, summary=False) self.assertEqual(results[0].amount, D('12.34')) From deb67de0b8d5b501bfcf748e0c869676ab85d3fc Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 3 Oct 2012 08:57:35 -0400 Subject: [PATCH 20/31] Revert "try this placement of the star" This reverts commit e4cccc277f2163c870712cc80b8898607b42ab43. --- frontend/templates/supporter.html | 17 ++++++++--------- static/css/supporter_layout.css | 12 ++++-------- static/less/supporter_layout.less | 10 +++------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/frontend/templates/supporter.html b/frontend/templates/supporter.html index a8603b2b..7082c3bd 100644 --- a/frontend/templates/supporter.html +++ b/frontend/templates/supporter.html @@ -93,15 +93,15 @@ there's no tab for seeing ALL my books, only the filters! huh.
My Profile - -
-
-
{% for badge in supporter.profile.badges.all %} {{ badge.description }} {% endfor %} + +
+ +
{% if supporter.profile.pic_url %} Picture of {{ supporter }} {% else %} @@ -113,17 +113,16 @@ there's no tab for seeing ALL my books, only the filters! huh. {% else %}
- - {% for badge in supporter.profile.badges.all %} - {{ badge.description }} - {% endfor %} - {% if supporter.profile.pic_url %} Picture of {{ supporter }} {% else %} Generic Ungluer Avatar {% endif %} {{ supporter.username }} + + {% for badge in supporter.profile.badges.all %} + {{ badge.description }} + {% endfor %}
diff --git a/static/css/supporter_layout.css b/static/css/supporter_layout.css index 808e3f33..a06b5e19 100644 --- a/static/css/supporter_layout.css +++ b/static/css/supporter_layout.css @@ -161,7 +161,6 @@ line-height: normal; float: left; width: 25%; - position: relative; } .user-block3, .user-block4 { @@ -196,14 +195,11 @@ img.user-avatar { -webkit-border-radius: 7px; border-radius: 7px; } -img.user-badge { - position: absolute; - margin-left: 30px; - margin-top: -12px; - z-index: 100; +img.user-badge{ + vertical-align:middle; } -.user-badges { - font-size: 32px; +.user-badges{ + font-size:32px; } .social { width: 100%; diff --git a/static/less/supporter_layout.less b/static/less/supporter_layout.less index d450c4c9..21ef4cc8 100644 --- a/static/less/supporter_layout.less +++ b/static/less/supporter_layout.less @@ -85,7 +85,6 @@ line-height:normal; float:left; width:25%; - position: relative; } .user-block3, @@ -121,13 +120,10 @@ img.user-avatar { margin-right:10px; .one-border-radius(7px); } -img.user-badge { - position: absolute; - margin-left: 30px; - margin-top: -12px; - z-index: 100; +img.user-badge{ + vertical-align:middle; } -.user-badges { +.user-badges{ font-size:32px; } .social { From ae857b3c8fd0373cd6338dfb93a7618d973157cd Mon Sep 17 00:00:00 2001 From: Andromeda Yelton Date: Wed, 3 Oct 2012 10:59:57 -0400 Subject: [PATCH 21/31] restyle badges and edit profile function --- frontend/templates/supporter.html | 64 +++++++++++++----------------- static/css/supporter_layout.css | 24 +++++++++-- static/images/empty_badge.png | Bin 0 -> 3406 bytes static/images/pledger.png | Bin 1375 -> 4648 bytes static/images/pledger2.png | Bin 1393 -> 4293 bytes static/less/supporter_layout.less | 28 ++++++++++--- 6 files changed, 71 insertions(+), 45 deletions(-) create mode 100644 static/images/empty_badge.png diff --git a/frontend/templates/supporter.html b/frontend/templates/supporter.html index 7082c3bd..2ef98aa2 100644 --- a/frontend/templates/supporter.html +++ b/frontend/templates/supporter.html @@ -22,8 +22,7 @@ var $j = jQuery.noConflict(); $j(document).ready(function(){ $j('#user-block-hide').hide(); - $j('#user-block1 > div > span').click(function() { - $j(this).toggleClass("active"); + $j('#edit_profile').click(function() { $j("#user-block-hide").slideToggle(300); }); }); @@ -89,46 +88,34 @@ there's no tab for seeing ALL my books, only the filters! huh.
- {% ifequal supporter request.user %}
-
- My Profile +
+ {% if supporter.profile.pic_url %} + Picture of {{ supporter }} + {% else %} + Generic Ungluer Avatar + {% endif %} + + {{ supporter.username }} + +
- {% for badge in supporter.profile.badges.all %} - {{ badge.description }} - {% endfor %} + {% if supporter.profile.badges.all %} + {% for badge in supporter.profile.badges.all %} + {{ badge.description }} + {% endfor %} + {% else %} + empty badge + {% endif %} -
-
+
- {% if supporter.profile.pic_url %} - Picture of {{ supporter }} - {% else %} - Generic Ungluer Avatar - {% endif %} - {{ supporter.username|truncatechars:20 }} - {{ supporter.profile.tagline }} + + {% with supporter.profile.tagline as tagline %}{% if tagline %}{{ tagline }}{% else %} {% endif %}{% endwith %} +
- {% else %} -
-
- {% if supporter.profile.pic_url %} - Picture of {{ supporter }} - {% else %} - Generic Ungluer Avatar - {% endif %} - {{ supporter.username }} - - {% for badge in supporter.profile.badges.all %} - {{ badge.description }} - {% endfor %} -
-
-
- {% with supporter.profile.tagline as tagline %}{% if tagline %}{{ tagline }}{% else %} {% endif %}{% endwith %} -
- {% endifequal %} +
{% ifequal request.user supporter %} @@ -143,6 +130,11 @@ there's no tab for seeing ALL my books, only the filters! huh.
+ {% ifequal request.user supporter %} +
+ +
+ {% endifequal %} @@ -132,7 +130,7 @@ there's no tab for seeing ALL my books, only the filters! huh.
{% ifequal request.user supporter %}
- + Edit Your Profile
{% endifequal %}