From 234982796e9540d4971c7ac243a5a86f56e924e5 Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 8 Feb 2014 13:28:52 -0500 Subject: [PATCH 1/5] improve unglue.it iadmin move accepted rh and claims to their own pages --- frontend/templates/rights_holders.html | 15 ++++++++++++--- frontend/urls.py | 2 ++ frontend/views.py | 3 ++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/frontend/templates/rights_holders.html b/frontend/templates/rights_holders.html index 97419755..04beea6c 100644 --- a/frontend/templates/rights_holders.html +++ b/frontend/templates/rights_holders.html @@ -13,7 +13,14 @@
  • Admin
  • Libraries Needing Approval
  • Press Coverage
  • +{% if facet = 'top' %} +
  • Accepted Rights Holders
  • +
  • Active Claims
  • +{% else %} +
  • Unglue.it Admin
  • +{% endif %} +{% if facet = 'top' %}

    Rights Holder Admin

    Create New Rights Holder

    @@ -22,7 +29,8 @@ {{ form.as_p }} - +{% endif %} +{% if facet = 'accepted' %}

    Accepted Rights Holders

    {% for rights_holder in rights_holders %} @@ -34,8 +42,9 @@

    No rights holders have been accepted yet

    {% endfor %}
    +{% endif %} -{% if pending %} +{% if pending and facet = 'top' %}

    Pending Claims

    {{ pending_formset.management_form }} @@ -56,7 +65,7 @@
    {% endif %} -{% if active_data.count %} +{% if active_data.count and facet = 'claims' %}

    Active Claims: {{ active_data.count }}

    {% for claim in active_data %} diff --git a/frontend/urls.py b/frontend/urls.py index da61707b..f0cb0f9c 100644 --- a/frontend/urls.py +++ b/frontend/urls.py @@ -62,6 +62,8 @@ urlpatterns = patterns( url(r"^rightsholders/edition/(?P\d*)/upload/$", "edition_uploads", name="edition_uploads"), url(r"^rightsholders/claim/$", "claim", name="claim"), url(r"^rh_admin/$", "rh_admin", name="rh_admin"), + url(r"^rh_admin/accepted/$", "rh_admin", {'facet': 'accepted'}, name="accepted"), + url(r"^rh_admin/claims/$", "rh_admin", {'facet': 'claims'}, name="claims"), url(r"^campaign_admin/$", "campaign_admin", name="campaign_admin"), url(r"^faq/$", FAQView.as_view(), {'location':'faq', 'sublocation':'all'}, name="faq"), url(r"^faq/(?P\w*)/$", FAQView.as_view(), {'sublocation':'all'}, name="faq_location"), diff --git a/frontend/views.py b/frontend/views.py index afcb3e38..925709c7 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -1658,7 +1658,7 @@ def rh_tools(request): campaign.clone_form= CloneCampaignForm(initial={'campaign_id':campaign.id}, prefix = 'c%s' % campaign.id) return render(request, "rh_tools.html", {'claims': claims ,'campaigns': campaigns}) -def rh_admin(request): +def rh_admin(request, facet='top'): if not request.user.is_authenticated() : return render(request, "admins_only.html") if not request.user.is_staff : @@ -1691,6 +1691,7 @@ def rh_admin(request): 'pending': zip(pending_data,pending_formset), 'pending_formset': pending_formset, 'active_data': active_data, + 'facet': facet, } return render(request, "rights_holders.html", context) From 0cd6798bb52322bc994ed1eced3584bc32fce0a0 Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 8 Feb 2014 13:39:31 -0500 Subject: [PATCH 2/5] Add work id to rights emails [#16897275] --- frontend/templates/notification/rights_holder_claim/full.txt | 4 ++-- .../templates/notification/rights_holder_claim/notice.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/templates/notification/rights_holder_claim/full.txt b/frontend/templates/notification/rights_holder_claim/full.txt index 8ce16310..6a4d9ca8 100644 --- a/frontend/templates/notification/rights_holder_claim/full.txt +++ b/frontend/templates/notification/rights_holder_claim/full.txt @@ -14,10 +14,10 @@ Finally, think about how you're going to publicize your campaign: social media, We're thrilled to be working with you. {% endifequal %} {% ifequal claim.status 'pending' %} -{{ claim.rights_holder }}'s claim to {{ claim.work }} on Unglue.it has been entered. Our team will examine the claim and get back to you soon. +{{ claim.rights_holder }}'s claim to {{ claim.work }} (https://{{ current_site.domain }}{% url work claim.work.id %}) on Unglue.it has been entered. Our team will examine the claim and get back to you soon. {% endifequal %} {% ifequal claim.status 'release' %} -{{ claim.rights_holder }}'s claim to {{ claim.work }} on Unglue.it has been released. email us (rights@gluejar.com) if you have any questions about this. +{{ claim.rights_holder }}'s claim to {{ claim.work }} (https://{{ current_site.domain }}{% url work claim.work.id %}) on Unglue.it has been released. email us (rights@gluejar.com) if you have any questions about this. {% endifequal %} The Unglue.it team \ No newline at end of file diff --git a/frontend/templates/notification/rights_holder_claim/notice.html b/frontend/templates/notification/rights_holder_claim/notice.html index e2ed9c73..d3019b21 100644 --- a/frontend/templates/notification/rights_holder_claim/notice.html +++ b/frontend/templates/notification/rights_holder_claim/notice.html @@ -27,9 +27,9 @@ Finally, think about how you're going to publicize your campaign: social media, We're thrilled to be working with you. {% endifequal %} {% ifequal claim.status 'pending' %} - The claim will be examined, and we'll email you. Contact us at support@gluejar.com if you need any help. + The claim for {{ claim.work }} will be examined, and we'll email you. Contact us at support@gluejar.com if you need any help. {% endifequal %} {% ifequal claim.status 'release' %} - The claim has been released. Contact us at rights@gluejar.com if you have questions. + The claim for {{ claim.work }} has been released. Contact us at rights@gluejar.com if you have questions. {% endifequal %} {% endblock %} From f0bf0a266d61cc027befaff5791f7d4500a8333f Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 8 Feb 2014 14:05:18 -0500 Subject: [PATCH 3/5] set the rh as the default campaign manager Users had difficulty figuring out how to add themselves --- frontend/templates/rh_tools.html | 2 +- frontend/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/templates/rh_tools.html b/frontend/templates/rh_tools.html index 2968c302..24cbf79d 100644 --- a/frontend/templates/rh_tools.html +++ b/frontend/templates/rh_tools.html @@ -119,7 +119,7 @@ Any questions not covered here? Please email us at {% endif %} -
    Choose your Campaign Manager(s): {{ claim.campaign_form.managers }}{{ claim.campaign_form.managers.errors }}
    +

    Add a Campaign Manager(s) by their Unglue.it username:

    {{ claim.campaign_form.managers }}{{ claim.campaign_form.managers.errors }}

    {{ claim.campaign_form.work }}{{ claim.campaign_form.work.errors }} {{ claim.campaign_form.userid }}{{ claim.campaign_form.userid.errors }} diff --git a/frontend/views.py b/frontend/views.py index 925709c7..20ff101f 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -1643,7 +1643,7 @@ def rh_tools(request): else: c_type = 2 if claim.rights_holder.can_sell else 1 claim.campaign_form = OpenCampaignForm( - initial={'work': claim.work, 'name': claim.work.title, 'userid': request.user.id, 'managers_1': request.user.id, 'type': c_type}, + initial={'work': claim.work, 'name': claim.work.title, 'userid': request.user.id, 'managers': [request.user.id], 'type': c_type}, prefix = 'cl_'+str(claim.id), ) campaigns = request.user.campaigns.all() From a4488c45ce69e628faf4727b06c5b7ec71ba4158 Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 8 Feb 2014 15:29:27 -0500 Subject: [PATCH 4/5] make campaign creation really work the way it should Problem was that rh_tools forms were not being updated correctly after creating a campaign. --- core/models.py | 9 +++++++++ frontend/templates/rh_tools.html | 10 +++++----- frontend/views.py | 23 ++++++++++------------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/core/models.py b/core/models.py index c367148b..f6122544 100755 --- a/core/models.py +++ b/core/models.py @@ -145,8 +145,17 @@ class Claim(models.Model): if campaign.status in ['ACTIVE','INITIALIZED', 'SUCCESSFUL']: return False return True + def __unicode__(self): return self.work.title + + @property + def campaign(self): + return self.work.last_campaign() + + @property + def campaigns(self): + return self.work.campaigns.all() def notify_claim(sender, created, instance, **kwargs): if 'example.org' in instance.user.email or hasattr(instance,'dont_notify'): diff --git a/frontend/templates/rh_tools.html b/frontend/templates/rh_tools.html index 24cbf79d..95b8c431 100644 --- a/frontend/templates/rh_tools.html +++ b/frontend/templates/rh_tools.html @@ -104,7 +104,7 @@ Any questions not covered here? Please email us at {% csrf_token %} @@ -127,10 +127,10 @@ Any questions not covered here? Please email us at - {% else %}{%if claim.campaigns %} -

    Campaigns for this work

    + {% else %}{%if claim.campaign %} +

    Campaign for this work

    - {% for campaign in claim.campaigns %} + {% with claim.campaign as campaign %}
    {% if campaign.status = 'ACTIVE' or campaign.status = 'INITIALIZED' %} {% else %}{%if claim.campaign %}

    Campaign for this work

    @@ -138,8 +142,11 @@ Any questions not covered here? Please email us at
    {{ user.username }} {% endfor %}
    {% csrf_token %} - Add/Remove Managers: {{ campaign.edit_managers_form.managers }}{{ campaign.edit_managers_form.managers.errors }} +
    + Add/Remove Managers: + {{ campaign.edit_managers_form.managers }}{{ campaign.edit_managers_form.managers.errors }} +
    {% if request.user in campaign.managers.all %}