Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

Commit

Permalink
Merge pull request #229 from aldryn/feature/cleanup
Browse files Browse the repository at this point in the history
Frontend Cleanup
  • Loading branch information
FinalAngel committed Jun 18, 2015
2 parents 701ab6b + 35aad4a commit f4eac04
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 43 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Manual Installation
# 'easy_thumbnails.processors.scale_and_crop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
'easy_thumbnails.processors.background',
)

For more information on this optional processor, see the
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*!
* @author: Divio AG
* @copyright: http://www.divio.ch
*/

//######################################################################################################################
// #NAMESPACES#
var Cl = window.Cl || {};

//######################################################################################################################
// #UTILS#
(function ($) {
'use strict';

Cl.newsBlog = {

init: function () {
var that = this;

// there might be more addons available within one page
$('.js-aldryn-newsblog-article-search').each(function () {
that._search($(this));
});
},

_search: function (container) {
var form = container.find('form');

form.on('submit', function (e) {
e.preventDefault();

$.ajax({
type: 'GET',
url: form.prop('action'),
data: form.serialize()
}).always(function (data) {
form.siblings('.js-search-results').html(data);
}).fail(function () {
alert('REQUEST TIMEOUT');
});
});
}

};

// autoload
$(function () {
if ($('.js-aldryn-newsblog-article-search').length) {
Cl.newsBlog.init();
}
});

})(jQuery);
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{% load i18n apphooks_config_tags cms_tags sekizai_tags staticfiles thumbnail %}
{% load url from future %}

{% addtoblock "css" %}
<link rel="stylesheet" href="{% static "css/aldryn-newsblog/article.css" %}">
{% endaddtoblock %}

<article class="aldryn-newsblog-article{% if article.is_featured %} aldryn-newsblog-featured{% endif %}{% if not article.published %} unpublished{% endif %}{% if article.future %} future{% endif %}">
{% block newsblog_visual %}
{% if article.featured_image_id %}
Expand Down Expand Up @@ -72,3 +68,5 @@ <h2>
{% endif %}
{% endblock newsblog_content %}
</article>

{% addtoblock "css" %}<link rel="stylesheet" href="{% static 'css/aldryn-newsblog/article.css' %}">{% endaddtoblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

<div class="aldryn-newsblog-meta">
{% if author and author.slug %}
<div class="image pull-left">
<a href="{% namespace_url "article-list-by-author" author.slug namespace=namespace default='' %}">
{% if author.visual %}
{% thumbnail author.visual "50x50" crop upscale subject_location=author.visual.subject_location as author_image %}
<img src="{{ author_image.url }}" width="50" height="50" alt="{{ author }}">
<div class="image pull-left">
<a href="{% namespace_url "article-list-by-author" author.slug namespace=namespace default='' %}">
{% if author.visual %}
{% thumbnail author.visual "50x50" crop upscale subject_location=author.visual.subject_location as author_image %}
<img src="{{ author_image.url }}" width="50" height="50" alt="{{ author }}">
{% else %}
<img src="{% static "img/aldryn_newsblog/no-photo.png" %}" height="50" width="50" alt="{{ author }}">
{% endif %}
</a>
</div>
<div class="meta">
<p class="author"><a href="{% namespace_url "article-list-by-author" author.slug namespace=namespace default='' %}">{{ author.name }}</a></p>
{% if author_view and author.slug %}
<p class="job">{{ author.function }}</p>
<p class="badge">{{ author.article_count }}</p>
{% else %}
<img src="{% static "img/aldryn_newsblog/no-photo.png" %}" height="50" width="50" alt="{{ author }}">
<p class="date">{{ article.publishing_date|date }}</p>
{% endif %}
</a>
</div>
<div class="meta">
<p class="author"><a href="{% namespace_url "article-list-by-author" author.slug namespace=namespace default='' %}">{{ author.name }}</a></p>
{% if author_view and author.slug %}
<p class="job">{{ author.function }}</p>
<p class="badge">{{ author.article_count }}</p>
{% else %}
<p class="date">{{ article.publishing_date|date }}</p>
{% endif %}
</div>
</div>
{% endif %}
</div>
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{% load i18n sekizai_tags staticfiles %}

{% addtoblock "css" %}<link rel="stylesheet" href="{% static "css/aldryn-newsblog/article.css" %}">{% endaddtoblock %}

<div class="aldryn aldryn-newsblog aldryn-newsblog-article-search">
<div class="aldryn aldryn-newsblog aldryn-newsblog-article-search js-aldryn-newsblog-article-search">
<form action="{{ query_url }}" class="form-inline" method="get">
{% csrf_token %}
<input type="hidden" name="max_articles" value="{{ instance.max_articles }}">
Expand All @@ -18,21 +16,5 @@
<div class="search-results js-search-results"></div>
</div>

{% addtoblock "js" %}
<script>
jQuery(document).ready(function () {
$('.aldryn-newsblog-article-search form').on('submit', function (e) {
e.preventDefault();
var form = $(this);

$.ajax({
'type': 'get',
'url': form.prop('action'),
'data': form.serialize()
}).always(function (data) {
form.siblings('.js-search-results').html(data);
});
});
});
</script>
{% endaddtoblock %}
{% addtoblock "css" %}<link rel="stylesheet" href="{% static 'css/aldryn-newsblog/article.css' %}">{% endaddtoblock %}
{% addtoblock "js" %}<script src="{% static 'js/addons/cl.newsblog.js' %}"></script>{% endaddtoblock %}
2 changes: 1 addition & 1 deletion aldryn_newsblog/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_render_template(self, context, instance, placeholder):


class NewsBlogPlugin(TemplatePrefixMixin, CMSPluginBase):
module = 'NewsBlog'
module = 'News & Blog'


@plugin_pool.register_plugin
Expand Down

0 comments on commit f4eac04

Please sign in to comment.