diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d0d227 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.egg-info +__pycache__ +*.css +*.css.map diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..da1900e --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,8 @@ +include MANIFEST.in +include COPYING +include README +include VERSION + +recursive-include combo_plugin_imio_townstreet/locale *.po *.mo +recursive-include combo_plugin_imio_townstreet/templates *.html +recursive-include combo_plugin_imio_townstreet/static *.css *.scss *.js *.svg *.png *.jpg diff --git a/combo_plugin_imio_townstreet/__init__.py b/combo_plugin_imio_townstreet/__init__.py new file mode 100644 index 0000000..c786915 --- /dev/null +++ b/combo_plugin_imio_townstreet/__init__.py @@ -0,0 +1,26 @@ +# combo-plugin-imio-townstreet - Combo iMio town street plugin +# Copyright (C) 2021 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 +from django.utils.translation import ugettext_lazy as _ + + +class AppConfig(django.apps.AppConfig): + name = __name__ + verbose_name = _('iMio Townstreet') + + +default_app_config = __name__ + '.AppConfig' diff --git a/combo_plugin_imio_townstreet/migrations/0001_initial.py b/combo_plugin_imio_townstreet/migrations/0001_initial.py new file mode 100644 index 0000000..9b954ce --- /dev/null +++ b/combo_plugin_imio_townstreet/migrations/0001_initial.py @@ -0,0 +1,45 @@ +# Generated by Django 2.2.12 on 2021-02-19 13:28 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('data', '0045_link_list_limit'), + ] + + operations = [ + migrations.CreateModel( + name='TownstreetButton', + fields=[ + ( + 'id', + models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), + ), + ('placeholder', models.CharField(max_length=20)), + ('order', models.PositiveIntegerField()), + ('slug', models.SlugField(blank=True, verbose_name='Slug')), + ( + 'extra_css_class', + models.CharField( + blank=True, max_length=100, verbose_name='Extra classes for CSS styling' + ), + ), + ('public', models.BooleanField(default=True, verbose_name='Public')), + ( + 'restricted_to_unlogged', + models.BooleanField(default=False, verbose_name='Restrict to unlogged users'), + ), + ('last_update_timestamp', models.DateTimeField(auto_now=True)), + ('groups', models.ManyToManyField(blank=True, to='auth.Group', verbose_name='Groups')), + ('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='data.Page')), + ], + options={ + 'verbose_name': 'Townstreet Button', + }, + ), + ] diff --git a/combo_plugin_imio_townstreet/migrations/__init__.py b/combo_plugin_imio_townstreet/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/combo_plugin_imio_townstreet/models.py b/combo_plugin_imio_townstreet/models.py new file mode 100644 index 0000000..19ab9ff --- /dev/null +++ b/combo_plugin_imio_townstreet/models.py @@ -0,0 +1,39 @@ +# combo-plugin-imio-townstreet - Combo iMio town street plugin +# Copyright (C) 2021 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.conf import settings +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 TownstreetButton(CellBase): + template_name = 'imio_townstreet/button.html' + + class Meta: + verbose_name = _('Townstreet Button') + + class Media: + css = { + 'all': ('imio_townstreet/style.css',), + } + + def get_cell_extra_context(self, context): + extra_context = super().get_cell_extra_context(context) + extra_context['url'] = getattr(settings, 'TOWNSTREET_BUTTON_URL', '#') + return extra_context diff --git a/combo_plugin_imio_townstreet/static/imio_townstreet/icon.svg b/combo_plugin_imio_townstreet/static/imio_townstreet/icon.svg new file mode 100644 index 0000000..4f6197a --- /dev/null +++ b/combo_plugin_imio_townstreet/static/imio_townstreet/icon.svg @@ -0,0 +1,74 @@ + + +