mirror of
https://gitlab.com/brutaldon/brutaldon.git
synced 2024-12-04 14:46:24 -05:00
Add lightbox preference
This commit is contained in:
parent
9bf48fab96
commit
7b8c5dbb59
@ -25,7 +25,7 @@ class PreferencesForm(forms.ModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Preference
|
model = Preference
|
||||||
fields = ['theme', 'filter_replies', 'filter_boosts', 'timezone',
|
fields = ['theme', 'filter_replies', 'filter_boosts', 'timezone',
|
||||||
'no_javascript', 'notifications', 'click_to_load']
|
'no_javascript', 'notifications', 'click_to_load', 'lightbox']
|
||||||
|
|
||||||
class PostForm(forms.Form):
|
class PostForm(forms.Form):
|
||||||
"""def status_post(self, status, in_reply_to_id=None, media_ids=None,
|
"""def status_post(self, status, in_reply_to_id=None, media_ids=None,
|
||||||
|
33
brutaldon/migrations/0016_auto_20181009_1805.py
Normal file
33
brutaldon/migrations/0016_auto_20181009_1805.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Generated by Django 2.1.2 on 2018-10-09 22:05
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('brutaldon', '0015_auto_20181001_1812'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='preference',
|
||||||
|
name='lightbox',
|
||||||
|
field=models.BooleanField(default=False, help_text='Use a JavaScript lightbox to display media.'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='preference',
|
||||||
|
name='click_to_load',
|
||||||
|
field=models.BooleanField(default=False, help_text='Click to load more toots in the same page, rather than using pagination.'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='preference',
|
||||||
|
name='no_javascript',
|
||||||
|
field=models.BooleanField(default=False, help_text='Disable all JavaScript. Overrides all other JavaScript options.'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='preference',
|
||||||
|
name='notifications',
|
||||||
|
field=models.BooleanField(default=True, help_text='Display live notifications in header.'),
|
||||||
|
),
|
||||||
|
]
|
@ -36,6 +36,8 @@ class Preference(models.Model):
|
|||||||
help_text="""Display live notifications in header.""")
|
help_text="""Display live notifications in header.""")
|
||||||
click_to_load = models.BooleanField(default=False,
|
click_to_load = models.BooleanField(default=False,
|
||||||
help_text="""Click to load more toots in the same page, rather than using pagination.""")
|
help_text="""Click to load more toots in the same page, rather than using pagination.""")
|
||||||
|
lightbox = models.BooleanField(default=False,
|
||||||
|
help_text="""Use a JavaScript lightbox to display media.""")
|
||||||
|
|
||||||
class Account(models.Model):
|
class Account(models.Model):
|
||||||
username = models.EmailField(unique=True)
|
username = models.EmailField(unique=True)
|
||||||
|
@ -173,10 +173,13 @@
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
menuPrepare();
|
menuPrepare();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
{% if preferences.lightbox %}
|
||||||
Intercooler.ready(function ()
|
Intercooler.ready(function ()
|
||||||
{
|
{
|
||||||
$(".attachments").photobox('a', { history: false });
|
$(".attachments").photobox('a', { history: false });
|
||||||
});
|
});
|
||||||
|
{% endif %}
|
||||||
</script>
|
</script>
|
||||||
{% block page_scripts_inline %}
|
{% block page_scripts_inline %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -75,6 +75,16 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label class="label checkbox" for="click_to_load">
|
||||||
|
{% render_field form.lightbox class+="checkbox" %}
|
||||||
|
{{ form.lightbox.label }}
|
||||||
|
</label>
|
||||||
|
<p class="notification is-info preferences-help">
|
||||||
|
{{ form.lightbox.help_text }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<input type="submit" name="submit"
|
<input type="submit" name="submit"
|
||||||
value="Save" class="button is-primary" >
|
value="Save" class="button is-primary" >
|
||||||
|
@ -400,6 +400,7 @@ def settings(request):
|
|||||||
account.preferences.no_javascript = form.cleaned_data['no_javascript']
|
account.preferences.no_javascript = form.cleaned_data['no_javascript']
|
||||||
account.preferences.notifications = form.cleaned_data['notifications']
|
account.preferences.notifications = form.cleaned_data['notifications']
|
||||||
account.preferences.click_to_load = form.cleaned_data['click_to_load']
|
account.preferences.click_to_load = form.cleaned_data['click_to_load']
|
||||||
|
account.preferences.lightbox = form.cleaned_data['lightbox']
|
||||||
request.session['timezone'] = account.preferences.timezone
|
request.session['timezone'] = account.preferences.timezone
|
||||||
account.preferences.save()
|
account.preferences.save()
|
||||||
account.save()
|
account.save()
|
||||||
|
Loading…
Reference in New Issue
Block a user