mirror of
https://github.com/TakeusV1/flask_ipam.git
synced 2026-10-13 17:15:33 +02:00
V1.5
- Rewrite theme system - Fixes
This commit is contained in:
1 parent
98ffa929ef
commit
1f32755ade
10 files changed
+40
-22
No files matched your search
@@ -31,7 +31,7 @@ def login():
|
||||
|
||||
flash("Bad username or password !", 'danger')
|
||||
return render_template("auth/login.html", title="Login", form=form, bad_password=True)
|
||||
return render_template('auth/login.html', title="Login", form=form, app_theme=app_theme)
|
||||
return render_template('auth/login.html', title="Login", form=form)
|
||||
|
||||
@auth.route("/change",methods=['GET','POST'])
|
||||
@login_required
|
||||
|
||||
+11
-4
@@ -28,7 +28,6 @@ def dashboard():
|
||||
for available_ip in Network.query.all():
|
||||
available_alloc += int(available_ip.hosts)
|
||||
|
||||
print(app_theme)
|
||||
return render_template(
|
||||
'panel/dashboard.html',
|
||||
title="Dashboard",
|
||||
@@ -41,6 +40,14 @@ def dashboard():
|
||||
available_alloc=available_alloc,
|
||||
db_users=db_users,
|
||||
Inventory=Inventory,
|
||||
navcolor='dark',
|
||||
app_theme=app_theme
|
||||
)
|
||||
navcolor='dark'
|
||||
)
|
||||
|
||||
@base.route("/theme/<string:name>",methods=['GET','POST'])
|
||||
@login_required
|
||||
def change_theme(name):
|
||||
if name in app_theme:
|
||||
current_user.ui_theme = name
|
||||
db.session.commit()
|
||||
return redirect(url_for('base.dashboard'))
|
||||
return 'Invalid theme name', 400
|
||||
@@ -4,7 +4,6 @@ from flask_login import login_required, current_user
|
||||
from app.extensions import *
|
||||
from app.models import *
|
||||
from app.forms import NewInventoryItem, ChangeInventoryItem
|
||||
from app._config import app_theme
|
||||
|
||||
inventory = Blueprint('inventory', __name__)
|
||||
|
||||
@@ -21,7 +20,7 @@ def add_item():
|
||||
db.session.commit()
|
||||
flash("Item ADDED", 'success')
|
||||
|
||||
return render_template('panel/inventory_add.html', title='ADD ITEM', form=form, navcolor='success', app_theme=app_theme)
|
||||
return render_template('panel/inventory_add.html', title='ADD ITEM', form=form, navcolor='success')
|
||||
|
||||
@inventory.route('/list/<int:item_type>', methods=['GET','POST'])
|
||||
@login_required
|
||||
@@ -44,7 +43,7 @@ def list_items(item_type):
|
||||
else:
|
||||
title = 'All'
|
||||
|
||||
return render_template('panel/inventory_view.html', title=title, item_list=db_items, current_page=item_type, navcolor='success', app_theme=app_theme)
|
||||
return render_template('panel/inventory_view.html', title=title, item_list=db_items, current_page=item_type, navcolor='success')
|
||||
|
||||
@inventory.route('/action/<int:item_id>/<int:action>', methods=['GET','POST'])
|
||||
@login_required
|
||||
|
||||
@@ -2,7 +2,7 @@ from flask import Blueprint, request, render_template, flash, redirect, url_for,
|
||||
from flask_login import login_required, current_user
|
||||
from ipaddress import IPv4Network, IPv4Address
|
||||
|
||||
from app._config import app_version, app_theme
|
||||
from app._config import app_version
|
||||
|
||||
from app.extensions import *
|
||||
from app.models import *
|
||||
@@ -36,7 +36,7 @@ def networks():
|
||||
elif form.errors:
|
||||
flash(form.errors, 'danger')
|
||||
|
||||
return render_template('panel/networks.html', title="Prefixes", is_networks=True, app_version=app_version, app_theme=app_theme, prefixes=networks, form=form, Allocation=Allocation, navcolor='dark')
|
||||
return render_template('panel/networks.html', title="Prefixes", is_networks=True, app_version=app_version, prefixes=networks, form=form, Allocation=Allocation, navcolor='dark')
|
||||
|
||||
@network.route('/<int:net_id>/allocations',methods=['GET','POST'])
|
||||
@login_required
|
||||
@@ -60,7 +60,7 @@ def allocations(net_id):
|
||||
db_network = Network.query.filter_by(id=net_id).first()
|
||||
db_allocations = db.paginate(db.select(Allocation).filter_by(net_id=net_id), per_page=session['items'] )
|
||||
|
||||
return render_template('panel/allocations.html', title="Allocations", is_networks=True, app_version=app_version, app_theme=app_theme, allocations=db_allocations, network=db_network, Inventory=Inventory, active_page=active_page, next_page=next_page, prev_page=prev_page, navcolor='dark')
|
||||
return render_template('panel/allocations.html', title="Allocations", is_networks=True, app_version=app_version, allocations=db_allocations, network=db_network, Inventory=Inventory, active_page=active_page, next_page=next_page, prev_page=prev_page, navcolor='dark')
|
||||
|
||||
## MODAL ROUTES
|
||||
|
||||
|
||||
Reference in new issue
Block a user