mirror of
				https://gitlab.com/brutaldon/brutaldon
				synced 2025-06-05 21:49:32 +02:00 
			
		
		
		
	Add a settings page, controlling whether FULLBRUTALISM is used
This commit is contained in:
		@@ -7,3 +7,11 @@ class LoginForm(forms.Form):
 | 
			
		||||
                               max_length=256)
 | 
			
		||||
    password = forms.CharField(widget=forms.PasswordInput())
 | 
			
		||||
 | 
			
		||||
class SettingsForm(forms.Form):
 | 
			
		||||
    fullbrutalism = forms.BooleanField(label="Use FULLBRUTALISM mode?",
 | 
			
		||||
                                       required=False,
 | 
			
		||||
                                       help_text=
 | 
			
		||||
    """FULLBRUTALISM mode strips away most of the niceties of modern web design when
 | 
			
		||||
    brutaldon is viewed in a graphical browser. It has no effect in text-only browsers.""")
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
@@ -172,11 +172,21 @@ img {
 | 
			
		||||
.title {
 | 
			
		||||
    font-size: 3ex;
 | 
			
		||||
    font-weight: bold;
 | 
			
		||||
    margin-top: 1ex;
 | 
			
		||||
    margin-bottom: 1ex;
 | 
			
		||||
}
 | 
			
		||||
.subtitle {
 | 
			
		||||
    font-size: 1.5ex;
 | 
			
		||||
    font-weight: bold;
 | 
			
		||||
    margin-top: 0.25ex;
 | 
			
		||||
    margin-bottom: 0.25ex;
 | 
			
		||||
}
 | 
			
		||||
.toot {
 | 
			
		||||
    clear: both;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.box {
 | 
			
		||||
    padding: 4px;
 | 
			
		||||
    margin: 4px;
 | 
			
		||||
    border: 8px ridge #CCC;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,7 @@
 | 
			
		||||
                  <a class="navbar-item" href="{% url "fed" %}">Federated</a>
 | 
			
		||||
              </div>
 | 
			
		||||
              <div class="navbar-end" >
 | 
			
		||||
                  <a class="navbar-item" href="{% url "settings" %}">Settings</a>
 | 
			
		||||
                  <a class="navbar-item" href="{% url "logout" %}">Log out</a>
 | 
			
		||||
              </div>
 | 
			
		||||
          </div>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								brutaldon/templates/setup/settings.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								brutaldon/templates/setup/settings.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
{% extends "base.html" %}
 | 
			
		||||
{% load widget_tweaks %}
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
    <h1 class="title">Settings</h1>
 | 
			
		||||
    <form method="post" action="{% url "settings" %}" >
 | 
			
		||||
        {% csrf_token %}
 | 
			
		||||
        <div class="field">
 | 
			
		||||
            <label class="label checkbox">
 | 
			
		||||
                {% render_field form.fullbrutalism %}
 | 
			
		||||
                {{ form.fullbrutalism.label  }}
 | 
			
		||||
            </label>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="field">
 | 
			
		||||
            <input type="submit" name="submit"
 | 
			
		||||
                   value="Save" class="button is-primary" >
 | 
			
		||||
        </div>
 | 
			
		||||
    </form>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -26,5 +26,6 @@ urlpatterns = [
 | 
			
		||||
    path('note', views.note, name='note'),
 | 
			
		||||
    path('local', views.local, name='local'),
 | 
			
		||||
    path('fed', views.fed, name='fed'),
 | 
			
		||||
    path('settings', views.settings, name='settings'),
 | 
			
		||||
    path('', views.home),
 | 
			
		||||
]
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
from django.http import HttpResponse
 | 
			
		||||
from django.shortcuts import render, redirect
 | 
			
		||||
from brutaldon.forms import LoginForm
 | 
			
		||||
from brutaldon.forms import LoginForm, SettingsForm
 | 
			
		||||
from brutaldon.models import Client, Account
 | 
			
		||||
from mastodon import Mastodon
 | 
			
		||||
import datetime
 | 
			
		||||
@@ -105,3 +105,15 @@ def local(request):
 | 
			
		||||
def fed(request):
 | 
			
		||||
    return render(request, 'main/timeline.html', {'timeline': 'Federated'})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def settings(request):
 | 
			
		||||
    if request.method == 'POST':
 | 
			
		||||
        form = SettingsForm(request.POST)
 | 
			
		||||
        if form.is_valid():
 | 
			
		||||
            request.session['fullbrutalism'] = form.cleaned_data['fullbrutalism']
 | 
			
		||||
            return redirect(home)
 | 
			
		||||
        else:
 | 
			
		||||
            return render(request, 'setup/settings.html', {'form' : form })
 | 
			
		||||
    else:
 | 
			
		||||
        form = SettingsForm(request.session)
 | 
			
		||||
        return render(request, 'setup/settings.html', { 'form': form })
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user