Skip to content

Commit

Permalink
Update readme, templates and fix manifest.in for building the pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Zowie committed Jul 13, 2017
1 parent 7c57311 commit af71957
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 94 deletions.
6 changes: 1 addition & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
include LICENSE.txt
include README.md
recursive-include djangocms_slider/locale *
recursive-include djangocms_slider/templates *
recursive-exclude * *.py[co]
recursive-include djangocms_slider_uploadcare *.html *.png *.gif *js *jpg *jpeg *svg *py *css *po *mo
35 changes: 17 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
djangocms-slider
djangocms-slider-easy-uploadcare
================

#WARNING: NOT SUITABLE FOR REUSE
Haven't had time to add a couple things that make it reusable.. :)

A simple django cms slideshow plugin. For of https://github.com/urga/djangocms-slider, but using easy-thumbnails by default.
A simple django cms slideshow plugin. Fork of https://github.com/urga/djangocms-slider, but using uploadcare.

Features:

* There are 2 plugins: SlideShow and Slide. A SlideShow can only contains Slides. Those can be arranged in the order you want just like any other plugin.
* Each image can have a url specified (creating an anchor around the image)
* By default, creates a [flexslider](http://www.woothemes.com/flexslider/) slideshow.
* By default, uses [easy-thumbnails](https://github.com/SmileyChris/easy-thumbnails) as a thumbnail plugin.
* Allows use of a custom thumbnail configuration in Django settings, using an `slider_thumb_id` field that should correspond to your id in THUMBNAIL_ALIASES.

So a settings of `'home_slider': {'size': (400, 200), 'crop': False},` in your `THUMBNAIL_ALIASES`, and a `slider_thumb_id` of `home_slider` in your Slider plugin/model (with `use_simple_settings` set to False) will result in the images being 400x200 instead of the settings in the `slide.html` template.

Of course, you can still override templates.
* Uses the uploadcare 3.0.1 widget to enable free cropping (currently no setting to enable self-defined cropping dimensions)

Installation
------------
Expand All @@ -25,12 +17,19 @@ This plugin requires `django CMS 3.0` or higher to be properly installed and con

To install:

* run `pip install djangocms-slider-easy` on your virtualenv
* add `easy_thumbnails` to your `INSTALLED_APPS` setting if you want to use default template.
* add `djangocms_slider` to your `INSTALLED_APPS` setting (mind the underscore)
* Run `./manage.py migrate djangocms_slider`
* run `pip install djangocms-slider-easy-uploadcare` on your virtualenv
* Make sure `pyuploadcare` is configured with the `UPLOADCARE` setting
* add `djangocms_slider_uploadcare` to your `INSTALLED_APPS` setting (mind the underscore)
* Run `./manage.py migrate djangocms_slider_uploadcare`


### Why use this plugin?

- Uploadcare is pretty great with an awesome widget, and very good at serving images *fast*
- If you've stumbled upon the well-known performance issues regarding cloud storage in combination with `easy-thumbnails` and `sorl-thumbnail`

Usage
-----
### Own Flexslider config?
This can be done by overriding the `slider.html` template.

To override the template, just add `slider.html` and or 'slide.html' in a django template directory under `templates/djangocms_slider`.
- Place a `djangocms_slider_uploadcare` directory with a `slider.html` in your `templates` directory
- In this `slider.html`, copy the original contents of `slider.html` and edit the Flexslider config included in it
2 changes: 1 addition & 1 deletion djangocms_slider_uploadcare/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.3.0'
__version__ = '0.3.5'
4 changes: 2 additions & 2 deletions djangocms_slider_uploadcare/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class UploadcareSlidePlugin(CMSPluginBase):
model = UploadcareSlide
module = _("Slider")
name = _("Slide")
render_template = 'djangocms_slider/slide.html'
render_template = 'djangocms_slider_uploadcare/slide.html'

plugin_pool.register_plugin(UploadcareSlidePlugin)

Expand All @@ -19,7 +19,7 @@ class UploadcareSliderPlugin(CMSPluginBase):
model = UploadcareSlider
name = _('Slider')
module = _("Slideshow")
render_template = 'djangocms_slider/slider.html'
render_template = 'djangocms_slider_uploadcare/slider.html'
allow_children = True
child_classes = ["UploadcareSlidePlugin"]

Expand Down
13 changes: 3 additions & 10 deletions djangocms_slider_uploadcare/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
from cms.models import CMSPlugin, Page
from cms.utils.compat.dj import python_2_unicode_compatible
from django.core.exceptions import ValidationError
Expand All @@ -23,7 +22,7 @@ class UploadcareSlide(CMSPlugin):
A Slide plugin that contains an image and some text.
"""

image = ImageField(manual_crop="")
image = ImageField(manual_crop="", )
url = models.CharField(
_("link"), max_length=255, blank=True, null=True,
help_text=_("If present, clicking on image will take user to link."))
Expand All @@ -41,14 +40,8 @@ class UploadcareSlide(CMSPlugin):
def __str__(self):
if self.caption:
return self.caption[:40]
elif self.image:
# added if, because it raised attribute error when file wasn't
# defined.
try:
return u"%s" % os.path.basename(self.image.name)
except AttributeError:
pass
return u"<empty>"
else:
return "Uploadcare Image"

def clean(self):
if self.url and self.page_link:
Expand Down

This file was deleted.

46 changes: 0 additions & 46 deletions djangocms_slider_uploadcare/templates/djangocms_slider/slider.html

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<li class="slideshow-slide">
{% if instance.url or instance.page_link %}
<a href="{% if instance.url %}{{ instance.url }}{% else %} {{instance.page_link.get_absolute_url}}{% endif %}">
<img src="{{ instance.image }}" alt="{{ instance.alt }}"
{% if instance.longdesc %}
title="{{ instance.longdesc }}"
{% endif %}/>
</a>
{% else %}
<img src="{{ instance.image }}" alt="{{ instance.alt }}"
{% if instance.longdesc %}
title="{{ instance.longdesc }}"
{% endif %}/>
{% endif %}
</li>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% load sekizai_tags cms_tags %}
<div class="slider">
<ul class="slides">
{% autoescape off %}
{% for plugin in instance.child_plugin_instances %}
{% render_plugin plugin %}
{% endfor %}
{% endautoescape %}
</ul>
</div>

{% addtoblock "css" %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flexslider/2.6.0/flexslider.min.css"/>
{% endaddtoblock %}

{% addtoblock "js" %}
<script type="text/javascript"
src="http://cdnjs.cloudflare.com/ajax/libs/flexslider/2.2.2/jquery.flexslider-min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('.slider').flexslider({
animation: "slide"
, pauseOnAction: false
, pauseOnHover: true
, controlNav: false
});
});
</script>
{% endaddtoblock %}
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def read(fname):
INSTALL_REQUIRES = [
"django>=1.8.0, <1.11",
"django-cms>=3.0",
"easy-thumbnails==2.3",
"pyuploadcare==2.2.1",
]

CLASSIFIERS = [
Expand All @@ -45,9 +45,9 @@ def read(fname):
author_email="[email protected]",
description="A slider plugin for djangocms that lets you arrange slides like any other djangocms plugin. Fork of urga/djangocms-slider, but using uploadcare.",
license="BSD",
keywords=["slideshow", "django", "cms", "plugin"],
url="https://github.com/Akoten/djangocms-slider-easy-uploadcare",
packages=['djangocms_slider_uploadcare', 'djangocms_slider_uploadcare.migrations'],
keywords=["slideshow", "django", "cms", "plugin", "uploadcare", "flexslider", "jquery"],
url="https://github.com/Zowie/djangocms-slider-easy-uploadcare",
packages=['djangocms_slider_uploadcare'],
install_requires=INSTALL_REQUIRES,
classifiers=CLASSIFIERS,
long_description=read('README.md'),
Expand Down

0 comments on commit af71957

Please sign in to comment.