removing is_preview since it's no longer needed

pull/1/head
Andromeda Yelton 2012-06-13 09:41:23 -03:00
parent 2241134e92
commit d652db5c03
6 changed files with 18 additions and 45 deletions

View File

@ -83,15 +83,9 @@
</div> </div>
</div> </div>
{% if is_preview %}
<div class="preview_top">
Welcome to the almost-beta version of Unglue.it. Thanks to everyone who helped us with <a href="https://unglue.it/work/82028/">our test campaign.</a> Real campaigns coming Thursday at noon EDT. See you then.
</div>
{% else %}
<div class="launch_top"> <div class="launch_top">
Unglue.it has launched! Please consider supporting our <a href="/campaigns/ending#2">five active campaigns</a>. Unglue.it has launched! Please consider supporting our <a href="/campaigns/ending#2">five active campaigns</a>.
</div> </div>
{% endif %}
{% block topsection %}{% endblock %} {% block topsection %}{% endblock %}
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>

View File

@ -79,13 +79,6 @@ location.hash = "#2";
</div> </div>
</div> </div>
<div id="content-block-content"> <div id="content-block-content">
{% if is_preview == 1 %}
<div class="preview_content">
We're not running campaigns during our alpha phase.<br /><br />
After we've implemented a few more features and improved the site based on <a href="/feedback">your feedback</a>, you'll see a list of active campaigns here.<br /><br />
If you're a rights holder and you'd like us to run campaigns to unglue your works, please contact us at <a href="mailto:rights@gluejar.com">rights@gluejar.com</a>. Want more info? We have a <a href="/faq/rightsholders">rights holder FAQ</a>.
</div>
{% else %}
{% ifequal campaign_list.count 0 %} {% ifequal campaign_list.count 0 %}
There aren't any ungluing campaigns active yet. If you're a rights holder, you can <a href="/faq/rightsholders">start one</a>. There aren't any ungluing campaigns active yet. If you're a rights holder, you can <a href="/faq/rightsholders">start one</a>.
{% else %} {% else %}
@ -108,7 +101,6 @@ location.hash = "#2";
{% endfor %} {% endfor %}
</div> </div>
{% endifequal %} {% endifequal %}
{% endif %}
</div> </div>
</div> </div>
</div> </div>

View File

@ -13,13 +13,9 @@
{% else %} {% else %}
<li class="first"> <li class="first">
{% endif %} {% endif %}
{% if not is_preview %}
<a href="{% url campaign_list 'ending' %}"><span>Active Campaigns</span></a></li> <a href="{% url campaign_list 'ending' %}"><span>Active Campaigns</span></a></li>
<li><a href="{% url comment %}"><span>Latest Comments</span></a></li> <li><a href="{% url comment %}"><span>Latest Comments</span></a></li>
<li><a href="{% url work_list 'popular' %}"><span>Most Wished</span></a></li> <li><a href="{% url work_list 'popular' %}"><span>Most Wished</span></a></li>
{% else %}
<a href="{% url work_list 'popular' %}"><span>Most Wishes</span></a></li>
{% endif %}
<li><a href="{% url work_list 'new' %}"><span>Newly Wished</span></a></li> <li><a href="{% url work_list 'new' %}"><span>Newly Wished</span></a></li>
<li><a href="{% url work_list 'recommended' %}"><span>Staff Picks</span></a></li> <li><a href="{% url work_list 'recommended' %}"><span>Staff Picks</span></a></li>
<li class="last"><a href="{% url unglued_list 'recent' %}"><span>Recently Unglued</span></a></li> <li class="last"><a href="{% url unglued_list 'recent' %}"><span>Recently Unglued</span></a></li>

View File

@ -1,5 +1,5 @@
{% with request.user.wishlist.works.all as wishlist %} {% with request.user.wishlist.works.all as wishlist %}
<h3><span>{% if is_preview %}Most wishlisted{% else %}{% if faqmenu %}You might also like...{% else %}Top ungluing campaigns{% endif %}{% endif %}</span></h3> <h3><span>{% if faqmenu %}You might also like...{% else %}Top ungluing campaigns{% endif %}</span></h3>
<div class="jsmod-content"> <div class="jsmod-content">
<div id="js-slideshow"> <div id="js-slideshow">
<div class="slides_container"> <div class="slides_container">

View File

@ -61,7 +61,7 @@ $j(document).ready(function(){
<span> <span>
{% if work.first_ebook %} {% if work.first_ebook %}
AVAILABLE! AVAILABLE!
{% else %}{% if work.last_campaign and not is_preview %} {% else %}{% if work.last_campaign %}
{% if status == 'ACTIVE' %} {% if status == 'ACTIVE' %}
Unglue it! <br /> Unglue it! <br />
${{ work.last_campaign.current_total|floatformat:0|intcomma }}/${{ work.last_campaign.target|floatformat:0|intcomma }} <br /> ${{ work.last_campaign.current_total|floatformat:0|intcomma }}/${{ work.last_campaign.target|floatformat:0|intcomma }} <br />

View File

@ -63,29 +63,24 @@ logger = logging.getLogger(__name__)
def slideshow(max): def slideshow(max):
ending = models.Campaign.objects.filter(status='ACTIVE').order_by('deadline') ending = models.Campaign.objects.filter(status='ACTIVE').order_by('deadline')
count = ending.count() count = ending.count()
is_preview = settings.IS_PREVIEW
j = 0 j = 0
if is_preview: worklist = []
# on the preview site there are no active campaigns, so we should show most-wished books instead if max > count:
worklist = models.Work.objects.order_by('-num_wishes')[:max] # add all the works with active campaigns
for campaign in ending:
worklist.append(campaign.work)
# then fill out the rest of the list with popular but inactive works
remainder = max - count
remainder_works = models.Work.objects.exclude(campaigns__status='ACTIVE').order_by('-num_wishes')[:remainder]
worklist.extend(remainder_works)
else: else:
worklist = [] # if the active campaign list has more works than we can fit
if max > count: # in our slideshow, it's the only source we need to draw from
# add all the works with active campaigns while j < max:
for campaign in ending: worklist.append(ending[j].work)
worklist.append(campaign.work) j +=1
# then fill out the rest of the list with popular but inactive works
remainder = max - count
remainder_works = models.Work.objects.exclude(campaigns__status='ACTIVE').order_by('-num_wishes')[:remainder]
worklist.extend(remainder_works)
else:
# if the active campaign list has more works than we can fit
# in our slideshow, it's the only source we need to draw from
while j < max:
worklist.append(ending[j].work)
j +=1
return worklist return worklist
@ -354,9 +349,7 @@ def manage_campaign(request, id):
alerts.append(_('Campaign data has NOT been saved')) alerts.append(_('Campaign data has NOT been saved'))
if 'launch' in request.POST.keys(): if 'launch' in request.POST.keys():
activetab = '#3' activetab = '#3'
# only staff should be allowed to launch a campaign before site launch if (campaign.launchable and form.is_valid()):
# this line can be removed after site launch
if (campaign.launchable and form.is_valid()) and (not settings.IS_PREVIEW or request.user.is_staff):
campaign.activate() campaign.activate()
alerts.append(_('Campaign has been launched')) alerts.append(_('Campaign has been launched'))
else: else:
@ -1272,7 +1265,6 @@ def supporter(request, supporter_username, template_name):
works_unglued = [] works_unglued = []
works_active = [] works_active = []
works_wished = [] works_wished = []
is_preview = settings.IS_PREVIEW
if (wishlist.works.all()): if (wishlist.works.all()):
# querysets for tabs # querysets for tabs
@ -1361,7 +1353,6 @@ def supporter(request, supporter_username, template_name):
"works_wished": works_wished, "works_wished": works_wished,
"works": works, "works": works,
"works2": works2, "works2": works2,
"is_preview": is_preview,
"backed": backed, "backed": backed,
"backing": backing, "backing": backing,
"wished": wished, "wished": wished,