Skip to content

Commit

Permalink
reverse filtering for display of sequence types, changes from product…
Browse files Browse the repository at this point in the history
…ion, some more #-cases
  • Loading branch information
jochengcd committed Mar 1, 2015
1 parent c2e6367 commit 1dd17f9
Show file tree
Hide file tree
Showing 21 changed files with 60 additions and 27 deletions.
2 changes: 1 addition & 1 deletion apps/gcd/models/issue.py
Expand Up @@ -27,7 +27,7 @@
}

def issue_descriptor(issue):
if issue.series.is_singleton and issue.number == '[nn]':
if issue.number == '[nn]' and issue.series.is_singleton:
return u''
if issue.title and issue.series.has_issue_title:
title = u' - ' + issue.title
Expand Down
2 changes: 2 additions & 0 deletions apps/gcd/search_indexes.py
Expand Up @@ -63,6 +63,8 @@ def prepare_key_date(self, obj):
else:
return "9999-99-99"

def prepare_title(self, obj):
return obj.short_name()

class SeriesIndex(ObjectIndex, indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
Expand Down
2 changes: 1 addition & 1 deletion apps/gcd/templatetags/display.py
Expand Up @@ -129,7 +129,7 @@ def show_series_tracking(series, direction):
elif direction == 'from' and origin_tracking .count():
for origin_series in origin_tracking.all():
if origin_series.origin_issue:
tracking_line += "<li> numbering continued from %s" % \
tracking_line += "<li> numbering continues from %s" % \
origin_series.origin_issue.full_name_with_link()
else:
tracking_line += "<li> numbering continues from %s" % \
Expand Down
14 changes: 7 additions & 7 deletions apps/gcd/views/details.py
Expand Up @@ -263,7 +263,7 @@ def series(request, series_id):
if series.deleted:
return HttpResponseRedirect(urlresolvers.reverse('change_history',
kwargs={'model_name': 'series', 'id': series_id}))
if series.is_singleton:
if series.is_singleton and series.issue_count:
return HttpResponseRedirect(
urlresolvers.reverse(issue, kwargs={ 'issue_id': int(series.active_issues()[0].id) }))

Expand Down Expand Up @@ -1096,7 +1096,7 @@ def show_issue(request, issue, preview=False):
zoom_level = ZOOM_MEDIUM
if preview:
images_count = 0
shown_types = StoryType.objects.values_list('id', flat=True)
not_shown_types = []
# excludes are currently only relevant for variant_add, maybe later
# other cover moves will be possible
if issue.changeset.change_type in [CTYPES['variant_add'],
Expand Down Expand Up @@ -1145,12 +1145,12 @@ def show_issue(request, issue, preview=False):
else:
issue_detail = 1
if issue_detail == 0:
shown_types = CORE_TYPES
not_shown_types = StoryType.objects.exclude(id__in=CORE_TYPES)\
.values_list('id', flat=True)
elif issue_detail == 1:
shown_types = StoryType.objects.exclude(id__in=AD_TYPES)\
.values_list('id', flat=True)
not_shown_types = AD_TYPES
else:
shown_types = StoryType.objects.values_list('id', flat=True)
not_shown_types = []
image_tag = get_image_tags_per_issue(issue=issue,
zoom_level=zoom_level,
alt_text=alt_text)
Expand Down Expand Up @@ -1222,7 +1222,7 @@ def show_issue(request, issue, preview=False):
'language': language,
'error_subject': '%s' % issue,
'preview': preview,
'shown_types': shown_types,
'not_shown_types': not_shown_types,
'NO_ADS': True
},
context_instance=RequestContext(request))
Expand Down
22 changes: 20 additions & 2 deletions apps/oi/models.py
Expand Up @@ -713,7 +713,7 @@ def queue_name(self):
elif ir_count > 1:
first = self.issuerevisions.order_by('revision_sort_code')[0]
last = self.issuerevisions.order_by('-revision_sort_code')[0]
return u'%s #%s - %s' % (first.series, first.display_number,
return u'%s %s - %s' % (first.series, first.display_number,
last.display_number)
return u'Unknown State'
elif self.change_type == CTYPES['issue']:
Expand Down Expand Up @@ -2696,7 +2696,8 @@ class Meta:
help_text="Publications in this series are mostly comics publications.")
is_singleton = models.BooleanField(
help_text="Series consists of one and only one issue by design. "
"Note that an issue with no issue number will be created upon approval.")
"Note that for series adds an issue with no issue number will"
" be created upon approval.")

notes = models.TextField(blank=True)
keywords = models.TextField(blank=True, default='',
Expand Down Expand Up @@ -2785,6 +2786,23 @@ def _has_gallery(self):
return self.series.has_gallery
has_gallery = property(_has_gallery)

def has_tracking(self):
if self.series is None:
return self.tracking_notes
return self.tracking_notes or self.series.has_series_bonds()

def _to_series_bond(self):
if self.series is None:
return SeriesBond.objects.filter(pk__isnull=True)
return self.series.to_series_bond.all()
to_series_bond = property(_to_series_bond)

def _from_series_bond(self):
if self.series is None:
return SeriesBond.objects.filter(pk__isnull=True)
return self.series.from_series_bond.all()
from_series_bond = property(_from_series_bond)

def get_ongoing_revision(self):
if self.series is None:
return None
Expand Down
6 changes: 4 additions & 2 deletions apps/oi/templatetags/compare.py
Expand Up @@ -85,8 +85,10 @@ def field_value(revision, field):
(res_holder.first_name, res_holder.last_name)
return yesno(value, 'Yes,No') + res_holder_display
elif field in ['publisher', 'indicia_publisher', 'series',
'origin', 'origin_issue', 'target', 'target_issue']:
'origin_issue', 'target_issue']:
return absolute_url(value)
elif field in ['origin', 'target']:
return value.full_name_with_link()
elif field == 'brand':
if value and value.emblem:
return mark_safe('<img src="' + value.emblem.icon.url + '"> ' \
Expand Down Expand Up @@ -185,7 +187,7 @@ def field_value(revision, field):
if hasattr(revision, 'changed'):
if revision.changed[field] and value == True:
if revision.series:
value_count = revision.series.active_issues().count()
value_count = revision.series.active_base_issues().count()
if value_count:
return 'Yes (note: the series has %d issue%s)' % \
(value_count, pluralize(value_count))
Expand Down
2 changes: 1 addition & 1 deletion apps/oi/templatetags/editing.py
Expand Up @@ -66,7 +66,7 @@ def header_link(changeset):
pub_url = absolute_url(revision.issue.series.publisher)
issue_url = revision.issue.get_absolute_url()
issue_num = revision.issue.display_number
header_link += mark_safe(u' and %s (%s) <a href="%s">#%s</a>' %
header_link += mark_safe(u' and %s (%s) <a href="%s">%s</a>' %
(series_url, pub_url, issue_url, issue_num))
if changeset.change_type == CTYPES['cover']:
if revision.issue.variant_name:
Expand Down
6 changes: 6 additions & 0 deletions apps/voting/templatetags/voting.py
Expand Up @@ -4,8 +4,14 @@

register = template.Library()

def order_by(queryset, args):
args = [x.strip() for x in args.split(',')]
return queryset.order_by(*args)


def show_rank(option, user):
rank = option.votes.get(voter=user).rank
return rank

register.filter(order_by)
register.filter(show_rank)
3 changes: 3 additions & 0 deletions media/css/oi/default.css
Expand Up @@ -102,9 +102,12 @@ div.indexer_right_box {
div.indexer_right_box h2 {
background-color: #DDD;
margin-bottom: 0em;
padding-left: 0.4em;
}

div.indexer_notice {
padding-top: 1em;
background-color: #EEE;
padding-left: 0.4em;
padding-right: 0.4em;
}
2 changes: 2 additions & 0 deletions templates/gcd/accounts/register.html
Expand Up @@ -66,6 +66,8 @@
{{ form.country|show_form_as_row }}
{{ form.languages|show_form_as_row }}
{{ form.interests|show_form_as_row }}
{{ form.opt_in_email|show_form_as_row }}
{{ form.issue_detail|show_form_as_row }}
{{ form.from_where|show_form_as_row }}
{{ form.notify_on_approve|show_form_as_row }}
{{ form.collapse_compare_view|show_form_as_row }}
Expand Down
2 changes: 1 addition & 1 deletion templates/gcd/bits/ad_med_rectangle.html
Expand Up @@ -4,6 +4,6 @@
</script>
<script type="text/javascript" src="//app.super-links.net/js/superdisplayads/superdisplayads-104780-95169d640259d099247084300ba25fed1decf094.js"></script>
<!-- superDisplayAds 104780-comics.org-102548 102548-1 end -->
{{% comment %}
{% comment %}
<script id="mNCC" language="javascript"> medianet_width='600'; medianet_height= '250'; medianet_crid='917532880'; </script> <script id="mNSC" src="http://contextual.media.net/nmedianet.js?cid=8CU73W537" language="javascript"></script>
{% endcomment %}
2 changes: 1 addition & 1 deletion templates/gcd/bits/issue_data.html
Expand Up @@ -8,7 +8,7 @@
<dd> {{ issue|show_volume }}
{% endif %}
<dt> {% trans "Price" %}:
<dd id="issue_price"> {{ issue.price|default:"" }}
<dd id="issue_price"> {{ issue.price|default:"?" }}
<dt> {% trans "Pages" %}:
<dd id="issue_pages"> {{ issue|show_page_count|default:"?" }}
{% if not issue.no_indicia_frequency and issue.series.has_indicia_frequency %}
Expand Down
2 changes: 1 addition & 1 deletion templates/gcd/details/cover.html
Expand Up @@ -3,7 +3,7 @@
{% load i18n %}

{% block title %}
GCD :: Cover :: {{ issue.series.name }} #{{ issue.display_number }}
GCD :: Cover :: {{ issue.series.name }} {{ issue.display_number }}
{% endblock %}

{% block css %}
Expand Down
6 changes: 3 additions & 3 deletions templates/gcd/details/single_story.html
Expand Up @@ -8,7 +8,7 @@
<h2 class="sequence header title">
<span class="title left">{{ story|show_title }}</span>
<span class="right single_story_navigation"><a class="toc" href="#toc">(Table of Contents)</a></span>
{% if story.type.id not in shown_types %}
{% if story.type.id in not_shown_types %}
<span class="right single_story_navigation"><a class="toc" href="?issue_detail=2">(Expand)</a> / </span>
{% endif %}
</h2>
Expand Down Expand Up @@ -41,7 +41,7 @@ <h3 class="sequence_header feature">
<span class="right single_story_navigation"><a href="http://errors.comics.org/enter_bug.cgi?product=GCD&amp;bug_file_loc={{ request.build_absolute_uri }}%23{{ story.id }}&amp;short_desc={{ error_subject|urlencode }}%20-%20{{story|show_title|urlencode}}" target="_blank">(report information)</a></span>
{% endif %}
</h3>
{% if story.type.id in shown_types %}
{% if not not_shown_types or story.type.id not in not_shown_types %}
{% if story.has_credits %}
<dl class="credits">
{{ story|show_credit:"script" }}
Expand Down Expand Up @@ -86,7 +86,7 @@ <h3 class="notes_header"> Indexer Notes </h3>
{% endif %}
{% endif %} <!-- shown_types -->

{% if not story.has_credits and not story.has_content and not story.notes or story.type.id not in shown_types %}
{% if not story.has_credits and not story.has_content and not story.notes or story.type.id in not_shown_types %}
<dl class="contents"></dl>
{% endif %}
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/gcd/search/cover_list.html
Expand Up @@ -9,7 +9,7 @@
<a href="{{ issue.get_absolute_url }}cover/4/">{{ tag }}</a>
<br>
<div class="cover_caption">
<a href="{{ issue.get_absolute_url }}">{{ issue.series.name }} #{{ issue.display_number }}</a><br>
<a href="{{ issue.get_absolute_url }}">{{ issue.series.name }} {{ issue.display_number }}</a><br>
({{ issue.series.publisher }}, {{ issue.series.year_began }})
<br><span class="cover_date">{{ issue.publication_date }}</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/oi/edit/edit_covers.html
Expand Up @@ -20,7 +20,7 @@
<h2>Covers for
{{ issue.series|absolute_url }}
({{ issue.series.publisher|absolute_url }})
<a href="{{ issue.get_absolute_url }}">#{{ issue.display_number }}</a>
<a href="{{ issue.get_absolute_url }}">{{ issue.display_number }}</a>
{% if issue.variant_name %} [{{ issue.variant_name }}] {% endif %}
</h2>
{% if issue.can_upload_variants %}
Expand Down
2 changes: 1 addition & 1 deletion templates/oi/edit/remove_story_revision.html
Expand Up @@ -4,7 +4,7 @@
{% load credits %}

{% block title %}
GCD :: Issue :: {{ issue.series.name }} #{{ issue.display_number }}
GCD :: Issue :: {{ issue.series.name }} {{ issue.display_number }}
{% endblock %}

{% block css %}
Expand Down
2 changes: 1 addition & 1 deletion templates/oi/edit/upload_cover.html
Expand Up @@ -5,7 +5,7 @@
{% load display %}

{% block title %}
GCD :: Cover upload for {{ issue.series.name }} #{{ issue.display_number }}
GCD :: Cover upload for {{ issue.series.name }} {{ issue.display_number }}
{% endblock %}

{% block css %}
Expand Down
2 changes: 1 addition & 1 deletion templates/oi/edit/upload_cover_complete.html
Expand Up @@ -2,7 +2,7 @@
{% load display %}

{% block title %}
GCD :: Cover for {{ issue.series.name }} #{{ issue.display_number }}
GCD :: Cover for {{ issue.series.name }} {{ issue.display_number }}
{% endblock %}

{% block css %}
Expand Down
2 changes: 1 addition & 1 deletion templates/oi/queues/covers.html
Expand Up @@ -32,7 +32,7 @@
<br/>
<div class="cover_caption">
<span class="{{ cover.changeset.changeset_action }}">{{ cover|show_revision_type }}</span><br>
{{ issue.series.name }} #{{ issue.display_number }}<br>
{{ issue.series.name }} {{ issue.display_number }}<br>
({{ issue.series.publisher }}, {{ issue.series.year_began }}) <br>
{% if issue.publication_date %}
<span class="cover_date">{{ issue.publication_date }}</span><br>
Expand Down
2 changes: 1 addition & 1 deletion templates/oi/queues/editing.html
Expand Up @@ -15,7 +15,7 @@

{% block view_body %}
<div class="queues">
<div class="left" width="70%">
<div class="left">
<h1> Records You Are Editing </h1>

{% with 'oi/bits/editing_actions.html' as actions %}
Expand Down

0 comments on commit 1dd17f9

Please sign in to comment.