Compare commits

..

No commits in common. "480cb4afe531d56ca426114486b240975fec2b3f" and "89e0dfc0eb5d957700e62e81f5a785ca45c8f76f" have entirely different histories.

12 changed files with 10 additions and 57 deletions

View File

@ -193,8 +193,3 @@ label, button {
button {
background: #99999 !important;
}
p {
line-height: 1.3;
}

View File

@ -39,20 +39,6 @@ class ServerAdmin(admin.ModelAdmin):
pass
'''
class MaxLengthAdminMarkdownxWidget(AdminMarkdownxWidget):
def get_context(self, name, value, attrs=None):
if name == 'teaser':
if not attrs:
attrs = {}
attrs['maxlength'] = 250
print(dir(self))
return super(MaxLengthAdminMarkdownxWidget, self).get_context(name, value, attrs)
class Media:
js = (
'js/maxlength_count.js',
)
class GalleryAdminForm(forms.ModelForm):
"""Users never need to enter a description on a gallery."""
@ -72,7 +58,7 @@ class ContentAdmin(admin.ModelAdmin):
raw_id_fields = ['photo']
inlines = [ContentParentsInline, FileInline, LinkInline]
formfield_overrides = {
models.TextField: {'widget': MaxLengthAdminMarkdownxWidget},
models.TextField: {'widget': AdminMarkdownxWidget},
}

View File

@ -114,7 +114,7 @@ class Content(models.Model):
if self.teaser:
value = markdownify(self.teaser)
elif self.header:
value = ox.sanitize_html(ox.decode_html(markdownify(self.header)))
value = ox.strip_tags(ox.decode_html(markdownify(self.header)))[:100]
else:
value = ''
return mark_safe(value)

View File

@ -1,18 +0,0 @@
django.jQuery(function() {
django.jQuery('textarea[maxlength]').each(function(i, textarea) {
var t = django.jQuery(textarea),
count = t.parent().find('.maxlength-count')
if (count.length == 0) {
count = django.jQuery('<div>', {'class': 'maxlength-count'} ).insertAfter(t)
t.on({
keydown: update,
change: update,
drop: update,
})
}
function update() {
var max = Math.round(t.attr('maxlength')), left = max - t.val().length
count.html(left + ' characters left. (max: ' + max + ')')
}
});
});

View File

@ -24,7 +24,7 @@
<li><a href="/about">ABOUT</a></li>
{% available_content as sections %}
{% for url, title in sections %}
<li><a href="{{url}}index/">{{title}}</a></li>
<li><a href="{{url}}">{{title}}</a></li>
{% endfor %}
<li><a href="/contact">CONTACT</a></li>
</ul>

View File

@ -16,9 +16,7 @@
<h4 class="sidebar-h4"> Past Events </h4>
{% include "event_preview.html" with events=past_events %}
{% endif %}
<a href="/events/index/">All Events</a>
<br>
<br>
<a href="index/">more</a>
</div>
</div>
{% endblock %}

View File

@ -33,4 +33,6 @@
</div>
{% endif %}
{% endfor %}
<br>
<br>
</div>

View File

@ -26,9 +26,6 @@
<h4 class="sidebar-h4"> Past Events </h4>
{% include "event_preview.html" with events=past_events %}
{% endif %}
<a href="/events/index/">All Events</a>
<br>
<br>
</div>
{% endblock %}

View File

@ -8,9 +8,7 @@
{% endfor %}
{% with section|lower|add:'_list' as section_list %}
{% if has_more_content %}
<a href="/{{section|lower}}/index/">All {{ section }}</a>
<br>
<br>
<a href="{% url section_list %}">more</a>
{% endif %}
{% endwith %}
</div>

View File

@ -27,8 +27,6 @@
<div class="small-6 medium-4 medium-offset-2 large-2 large-offset-2 columns">
{% if row.image_url %}
<a href="{{ row.get_absolute_url }}"> <img src="{{ row.image_url }}"> </a>
{% else %}
&nbsp;
{% endif %}
</div>
<div class="small-6 medium-4 end columns">

View File

@ -21,9 +21,7 @@
</div>
{% endfor %}
{% if more_content %}
<a href="/{{section|lower}}/index/">All {{ section }}</a>
<br>
<br>
<a href="index/">more</a>
{% endif %}
</div>
{% endif %}

View File

@ -135,7 +135,6 @@ def render_content(request, shortname, section, template, types):
return event(request)
else:
return section_index(request, section)
shortname = shortname.replace(' ', '_')
content = get_object_or_404(Content, shortname=shortname, type__name__in=types)
if not content.published and not request.user.is_staff:
raise Http404
@ -243,9 +242,9 @@ def redirect_index(request):
return redirect(reverse('index'))
def redirect_event(request):
shortname = request.GET.get('this').replace(' ', '_').lower()
shortname = request.GET.get('this')
if shortname:
content = get_object_or_404(Content, shortname__iexact=shortname)
content = get_object_or_404(Content, shortname=shortname)
return redirect(content.get_absolute_url())
id = request.GET.get('id')
if id: