This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #serieses = Series.objects.filter(reduce(operator.and_, filter_list)).exclude(reduce(operator.or_, exclude_list)).annotate(latest_article_publish_date=Max('article__publish_date')).extra(select={'selected_language': "articles_series.title_%s <> ''" % (lang)}).order_by('-selected_language', order_by)[:limit] | |
| #serieses = Series.objects.filter(reduce(operator.and_, filter_list)).exclude(reduce(operator.or_, exclude_list)).annotate(latest_article_publish_date=Max('article__publish_date')).extra(select={'article_selected_language': "articles_article.title_%s <> ''" % (lang)}).distinct().order_by('-article_selected_language', order_by)[:limit] | |
| #serieses = Series.objects.filter(reduce(operator.and_, filter_list)).exclude(reduce(operator.or_, exclude_list))[:limit] | |
| #serieses = Series.objects.filter(published__exact=True).extra(select={'selected_language': "articles_series.title_%s <> ''" % (lang)}).extra(select={'latest_article_publish_date': 'SELECT articles_article.publish_date FR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% if LANG == 'en' or LANG == 'ja' %} {# pinterest only translates to english and japanese #} | |
| <script type="text/javascript" async defer data-pin-lang="{{ LANG }}" data-pin-color="red" data-pin-height="28" data-pin-hover="true" src="//assets.pinterest.com/js/pinit.js"></script> | |
| {% else %} {# pinterest without the need to translate #} | |
| <script type="text/javascript" async defer data-pin-shape="round" data-pin-height="32" data-pin-hover="true" src="//assets.pinterest.com/js/pinit.js"></script> | |
| {% endif %} | |
| <script type="text/javascript"> | |
| $(document).ready(function() { | |
| // disable pinterest hover on all images | |
| $("img").attr("data-pin-no-hover", true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def selected_image(self, lang='en', user_langs=None): | |
| """ | |
| For display at the top of an article, show the largest selected image, as long as it's not near the top of the article body | |
| """ | |
| # attachments | |
| if self.image_attachments(): | |
| # sort by size descending | |
| attachments = sorted(self.image_attachments(), key=lambda x: x.file.size, reverse=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% for article in author.articles|slice:":1" %} | |
| {% if not article.series.is_legacy and not article.is_legacy %} | |
| {% thumbnail article.signature_image2 490x100 upscale autocrop crop="0," as thumb %} | |
| {% if thumb.source_height > thumb.source_width %} | |
| <div class="cover" style="background-image: url('{% thumbnail article.signature_image2 490x100 upscale crop=",0" %}');"></div> | |
| {% else %} | |
| <div class="cover" style="background-image: url('{{ thumb }}');"></div> | |
| {% endif %} | |
| {% else %} | |
| <div class="cover"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def signature_image2(self): | |
| # image or attachment | |
| if self.image: | |
| if self.image.height == self.image.width or self.image.size <= 50000: # legacy pre-cropped, pre-sized square image, smaller than about 50KB | |
| if self.image_attachments(): | |
| attachments = sorted(self.image_attachments(), key=lambda x: x.file.size, reverse=True) | |
| for attachment in attachments: | |
| if attachment.selected: | |
| return attachment.file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def is_legacy(self): | |
| is_legacy = False | |
| temp = [] | |
| if not self.image_attachments(): | |
| if not self.image: | |
| temp.append(False) | |
| else: | |
| temp.append(True) | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% if article.series %} | |
| {% if article.is_current_series %} | |
| {% likes article %} | |
| {% if user.is_authenticated %} | |
| {% if likes_enabled %} | |
| {% if can_vote %} {# logged in and can vote #} | |
| <div class="rating_badge"> | |
| <img src="{{ MEDIA_URL }}nima_star_icon.png" alt="" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # automated push | |
| today = datetime.date.today() | |
| magic = datetime.date(2014, 11, 01) | |
| if today < magic: | |
| closed = False | |
| else: | |
| closed = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var JI = JI || {}; | |
| JI.getJSON = function(options){ | |
| if(options['callback'] == null){ | |
| options['callback'] = function(data){ | |
| return true; | |
| } | |
| } | |
| this.cb = 'jsonp_request_' + Math.floor(Math.random()*1000); | |
| window[this.cb] = function(data){ |