From: Frédéric Péters Date: Thu, 28 May 2020 15:37:57 +0000 (+0200) Subject: remove gallery; upstreamed X-Git-Tag: v2021~33 X-Git-Url: https://git.0d.be/?p=django-panik-combo.git;a=commitdiff_plain;h=021062bb1ccf1efdabd964fd4bd4869f59dafc94 remove gallery; upstreamed --- diff --git a/gallery/__init__.py b/gallery/__init__.py deleted file mode 100644 index d98cf04..0000000 --- a/gallery/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# combo - content management system -# Copyright (C) 2015 Entr'ouvert -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -import django.apps - -class AppConfig(django.apps.AppConfig): - name = 'gallery' - - def get_after_manager_urls(self): - from . import urls - return urls.manager_urlpatterns - -default_app_config = 'gallery.AppConfig' diff --git a/gallery/forms.py b/gallery/forms.py deleted file mode 100644 index c4a1420..0000000 --- a/gallery/forms.py +++ /dev/null @@ -1,31 +0,0 @@ -# combo - content management system -# Copyright (C) 2015 Entr'ouvert -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -from django import forms -from django.utils.translation import ugettext_lazy as _ - -from .models import Image - -class ImageAddForm(forms.ModelForm): - class Meta: - model = Image - fields = ('image', 'title',) - - -class ImageEditForm(forms.ModelForm): - class Meta: - model = Image - fields = ('title',) diff --git a/gallery/migrations/0001_initial.py b/gallery/migrations/0001_initial.py deleted file mode 100644 index d7e05d0..0000000 --- a/gallery/migrations/0001_initial.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('auth', '0001_initial'), - ('data', '0005_auto_20150226_0903'), - ] - - operations = [ - migrations.CreateModel( - name='GalleryCell', - fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('placeholder', models.CharField(max_length=20)), - ('order', models.PositiveIntegerField()), - ('slug', models.SlugField(verbose_name='Slug', blank=True)), - ('public', models.BooleanField(default=True, verbose_name='Public')), - ('groups', models.ManyToManyField(to='auth.Group', verbose_name='Groups', blank=True)), - ('page', models.ForeignKey(to='data.Page')), - ], - options={ - 'verbose_name': 'Gallery', - }, - bases=(models.Model,), - ), - migrations.CreateModel( - name='Image', - fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('image', models.ImageField(upload_to=b'uploads/gallery/%Y/%m/', verbose_name='Image')), - ('order', models.PositiveIntegerField()), - ('gallery', models.ForeignKey(verbose_name='Gallery', to='gallery.GalleryCell')), - ], - options={ - 'ordering': ['order'], - }, - bases=(models.Model,), - ), - ] diff --git a/gallery/migrations/0002_image_title.py b/gallery/migrations/0002_image_title.py deleted file mode 100644 index 32bd732..0000000 --- a/gallery/migrations/0002_image_title.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('gallery', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='image', - name='title', - field=models.CharField(max_length=50, verbose_name='Title', blank=True), - preserve_default=True, - ), - ] diff --git a/gallery/migrations/0003_gallerycell_title.py b/gallery/migrations/0003_gallerycell_title.py deleted file mode 100644 index 57cb09c..0000000 --- a/gallery/migrations/0003_gallerycell_title.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('gallery', '0002_image_title'), - ] - - operations = [ - migrations.AddField( - model_name='gallerycell', - name='title', - field=models.CharField(max_length=50, null=True, verbose_name='Title', blank=True), - preserve_default=True, - ), - ] diff --git a/gallery/migrations/0004_gallerycell_restricted_to_unlogged.py b/gallery/migrations/0004_gallerycell_restricted_to_unlogged.py deleted file mode 100644 index 385b103..0000000 --- a/gallery/migrations/0004_gallerycell_restricted_to_unlogged.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('gallery', '0003_gallerycell_title'), - ] - - operations = [ - migrations.AddField( - model_name='gallerycell', - name='restricted_to_unlogged', - field=models.BooleanField(default=False, verbose_name='Restrict to unlogged users'), - preserve_default=True, - ), - ] diff --git a/gallery/migrations/0005_auto_20170418_1154.py b/gallery/migrations/0005_auto_20170418_1154.py deleted file mode 100644 index c392796..0000000 --- a/gallery/migrations/0005_auto_20170418_1154.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models -import datetime - - -class Migration(migrations.Migration): - - dependencies = [ - ('gallery', '0004_gallerycell_restricted_to_unlogged'), - ] - - operations = [ - migrations.AddField( - model_name='gallerycell', - name='extra_css_class', - field=models.CharField(max_length=100, verbose_name='Extra classes for CSS styling', blank=True), - ), - migrations.AddField( - model_name='gallerycell', - name='last_update_timestamp', - field=models.DateTimeField(default=datetime.datetime(2017, 4, 18, 11, 54, 53, 442573), auto_now=True), - preserve_default=False, - ), - ] diff --git a/gallery/migrations/__init__.py b/gallery/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/gallery/models.py b/gallery/models.py deleted file mode 100644 index 9d4a8d3..0000000 --- a/gallery/models.py +++ /dev/null @@ -1,51 +0,0 @@ -# combo - content management system -# Copyright (C) 2015 Entr'ouvert -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -from django import template -from django.db import models -from django.forms import models as model_forms -from django.utils.translation import ugettext_lazy as _ - -from combo.data.models import CellBase -from combo.data.library import register_cell_class - -@register_cell_class -class GalleryCell(CellBase): - title = models.CharField(_('Title'), max_length=50, blank=True, null=True) - manager_form_template = 'combo/gallery_manager.html' - - class Meta: - verbose_name = _('Gallery') - - def render(self, context): - gallery_template = template.loader.get_template('combo/gallery.html') - return gallery_template.render(context) - - def get_additional_label(self): - if self.title: - return self.title - return '' - - -class Image(models.Model): - gallery = models.ForeignKey(GalleryCell, verbose_name=_('Gallery')) - image = models.ImageField(_('Image'), - upload_to='uploads/gallery/%Y/%m/') - order = models.PositiveIntegerField() - title = models.CharField(_('Title'), max_length=50, blank=True) - - class Meta: - ordering = ['order'] diff --git a/gallery/static/js/combo.gallery.js b/gallery/static/js/combo.gallery.js deleted file mode 100644 index a91e714..0000000 --- a/gallery/static/js/combo.gallery.js +++ /dev/null @@ -1,29 +0,0 @@ -function gallery(element) { - var element_id = '#' + $(element).attr('id'); - $(element).sortable({ - items: '> li', - containment: 'parent', - placeholder: 'empty-image', - update: function(event, ui) { - var new_order = $(element).find('> li').map(function() { return $(this).data('object-id'); }).get().join(); - $.ajax({ - url: $(element).data('order-url'), - data: {'new-order': new_order}, - success: function(data, status) { - $(element).replaceWith($(data).find(element_id)); - gallery($(element_id)); - } - }); - } - }); - $('.image-delete').on('click', function() { - $.ajax({ - url: $(this).attr('href'), - success: function(data, status) { - $(element).replaceWith($(data).find(element_id)); - gallery($(element_id)); - } - }); - return false; - }); -}; diff --git a/gallery/templates/combo/gallery.html b/gallery/templates/combo/gallery.html deleted file mode 100644 index 6be3c9f..0000000 --- a/gallery/templates/combo/gallery.html +++ /dev/null @@ -1,32 +0,0 @@ -{% load thumbnail %} -