Merge pull request #293 from Gluejar/useability_tweaks

Useability tweaks to campaign creation
pull/1/head
Raymond Yee 2014-02-24 10:11:17 -08:00
commit a11e5a61fc
7 changed files with 58 additions and 33 deletions

View File

@ -145,9 +145,18 @@ 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'):
return

View File

@ -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

View File

@ -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 <a href="{% url work claim.work.id %}">{{ claim.work }}</a> 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 <a href="{% url work claim.work.id %}">{{ claim.work }}</a> has been released. Contact us at rights@gluejar.com if you have questions.
{% endifequal %}
{% endblock %}

View File

@ -104,11 +104,12 @@ Any questions not covered here? Please email us at <a href="mailto:rights@gluej
<br />PSA #: {{ claim.rights_holder.id }}
<br />Date of Claim : {{ claim.created }}
<br />Status of Claim: {{ claim.get_status_display }}
{% if claim.can_open_new %}
{% if claim.campaign_form %}
<h3>Open a blank campaign for this work</h3>
<div class="work_campaigns clearfix" style="padding: 5px;">
<form method="POST" action="#">
{% csrf_token %}
<p>Name the Campaign: {{ claim.campaign_form.name }}{{ claim.campaign_form.name.errors }}</p>
<p>{% csrf_token %}
Name the Campaign: {{ claim.campaign_form.name }}{{ claim.campaign_form.name.errors }}</p>
{% if claim.rights_holder.can_sell %}
<p>Choose the Campaign Type: {{ claim.campaign_form.type }}{{ claim.campaign_form.type.errors }}</p>
<ol>
@ -119,18 +120,21 @@ Any questions not covered here? Please email us at <a href="mailto:rights@gluej
{% else %}
<input type="hidden" id="type" name="type" value="1" />
{% endif %}
<div style="width:200px" >Choose your Campaign Manager(s): {{ claim.campaign_form.managers }}{{ claim.campaign_form.managers.errors }}</div>
<p>Add a Campaign Manager(s) by their Unglue.it username: </p>
<div style="width:220px; padding-left:20px" >{{ claim.campaign_form.managers }}{{ claim.campaign_form.managers.errors }}
<br />
<input type="submit" name="submit" value="Open Campaign">
</div>
<p>
{{ claim.campaign_form.work }}{{ claim.campaign_form.work.errors }}
{{ claim.campaign_form.userid }}{{ claim.campaign_form.userid.errors }}
</p>
<input type="submit" name="submit" value="Open Campaign">
</form>
{% else %}{%if claim.campaigns %}
<h3>Campaigns for this work</h3>
</div>
{% else %}{%if claim.campaign %}
<h3>Campaign for this work</h3>
{% for campaign in claim.campaigns %}
{% with claim.campaign as campaign %}
<div class="work_campaigns clearfix">
{% if campaign.status = 'ACTIVE' or campaign.status = 'INITIALIZED' %}
<div class="campaign_info">
@ -138,8 +142,11 @@ Any questions not covered here? Please email us at <a href="mailto:rights@gluej
Created: {{ campaign.created }}<br />
Manager(s): {% for user in campaign.managers.all %} <a href="{% url supporter user.username %}">{{ user.username }} </a> {% endfor %}
<form method="POST" action="#">{% csrf_token %}
Add/Remove Managers: {{ campaign.edit_managers_form.managers }}{{ campaign.edit_managers_form.managers.errors }}
<div style="width:220px; padding-left:20px" >
Add/Remove Managers:
{{ campaign.edit_managers_form.managers }}{{ campaign.edit_managers_form.managers.errors }}
<input type="submit" name="edit_managers_{{campaign.id}}" value="Save Managers">
</div>
</form>
</div>
{% if request.user in campaign.managers.all %}
@ -162,7 +169,7 @@ Any questions not covered here? Please email us at <a href="mailto:rights@gluej
</div>
{% endif %}
</div>
{% endfor %}
{% endwith %}
{% endif %}
{% endif %}
{% if claim.work.first_ebook %}

View File

@ -13,7 +13,14 @@
<li><a href="/admin/">Admin</a></li>
<li><a href="{% url new_libraries %}">Libraries Needing Approval</a></li>
<li><a href="{% url press_submitterator %}">Press Coverage</a></li>
{% if facet = 'top' %}
<li><a href="{% url accepted %}">Accepted Rights Holders</a></li>
<li><a href="{% url claims %}">Active Claims</a></li>
{% else %}
<li><a href="{% url rh_admin %}">Unglue.it Admin</a></li>
{% endif %}
</ul>
{% if facet = 'top' %}
<h2>Rights Holder Admin</h2>
<h3> Create New Rights Holder </h3>
@ -22,7 +29,8 @@
{{ form.as_p }}
<input type="submit" name="create_rights_holder" value="Create" id="submit">
</form>
{% endif %}
{% if facet = 'accepted' %}
<h3> Accepted Rights Holders </h3>
<dl>
{% for rights_holder in rights_holders %}
@ -34,8 +42,9 @@
<p>No rights holders have been accepted yet</p>
{% endfor %}
</dl>
{% endif %}
{% if pending %}
{% if pending and facet = 'top' %}
<h3> Pending Claims </h3>
<form method="POST" action="#">
{{ pending_formset.management_form }}
@ -56,7 +65,7 @@
</form>
{% endif %}
{% if active_data.count %}
{% if active_data.count and facet = 'claims' %}
<h3> Active Claims: {{ active_data.count }} </h3>
<dl>
{% for claim in active_data %}

View File

@ -62,6 +62,8 @@ urlpatterns = patterns(
url(r"^rightsholders/edition/(?P<edition_id>\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<location>\w*)/$", FAQView.as_view(), {'sublocation':'all'}, name="faq_location"),

View File

@ -1612,19 +1612,6 @@ def rh_tools(request):
if not claims:
return render(request, "rh_tools.html")
for claim in claims:
if claim.status == 'active':
claim.campaigns = claim.work.campaigns.all()
else:
claim.campaigns = []
for campaign in claim.campaigns:
if campaign.status in ['ACTIVE','INITIALIZED']:
if request.method == 'POST' and request.POST.has_key('edit_managers_%s'% campaign.id) :
campaign.edit_managers_form=EditManagersForm( instance=campaign, data=request.POST, prefix=campaign.id)
if campaign.edit_managers_form.is_valid():
campaign.edit_managers_form.save()
campaign.edit_managers_form = EditManagersForm(instance=campaign, prefix=campaign.id)
else:
campaign.edit_managers_form=EditManagersForm(instance=campaign, prefix=campaign.id)
if claim.can_open_new:
if request.method == 'POST' and request.POST.has_key('cl_%s-work' % claim.id) and int(request.POST['cl_%s-work' % claim.id]) == claim.work.id :
claim.campaign_form = OpenCampaignForm(data = request.POST, prefix = 'cl_'+str(claim.id),)
@ -1640,12 +1627,22 @@ def rh_tools(request):
new_campaign.target = D(settings.UNGLUEIT_MINIMUM_TARGET)
new_campaign.save()
claim.campaign_form.save_m2m()
claim.campaign_form = None
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),
)
if claim.campaign:
if claim.campaign.status in ['ACTIVE','INITIALIZED']:
if request.method == 'POST' and request.POST.has_key('edit_managers_%s'% claim.campaign.id) :
claim.campaign.edit_managers_form=EditManagersForm( instance=claim.campaign, data=request.POST, prefix=claim.campaign.id)
if claim.campaign.edit_managers_form.is_valid():
claim.campaign.edit_managers_form.save()
claim.campaign.edit_managers_form = EditManagersForm(instance=claim.campaign, prefix=claim.campaign.id)
else:
claim.campaign.edit_managers_form=EditManagersForm(instance=claim.campaign, prefix=claim.campaign.id)
campaigns = request.user.campaigns.all()
new_campaign = None
for campaign in campaigns:
@ -1658,7 +1655,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 +1688,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)