mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2024-11-21 21:17:23 +00:00
Property rejection handling
fixe some table to be wider make search and pagination float right
This commit is contained in:
parent
7f992a5dfa
commit
27c4f1a7f2
@ -68,7 +68,7 @@ def get(status):
|
|||||||
elif status == "resolved":
|
elif status == "resolved":
|
||||||
query = db.session.query().select_from(BugReport).filter(BugReport.resolved_time is not None)
|
query = db.session.query().select_from(BugReport).filter(BugReport.resolved_time is not None)
|
||||||
elif status == "unresolved":
|
elif status == "unresolved":
|
||||||
query = db.session.query().select_from(BugReport).filter(BugReport.resolved_time is None)
|
query = db.session.query().select_from(BugReport).filter(BugReport.resolved_time == "")
|
||||||
else:
|
else:
|
||||||
raise Exception("Not a valid filter")
|
raise Exception("Not a valid filter")
|
||||||
|
|
||||||
|
10
app/forms.py
10
app/forms.py
@ -187,3 +187,13 @@ class RescueForm(FlaskForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
submit = SubmitField('Submit')
|
submit = SubmitField('Submit')
|
||||||
|
|
||||||
|
|
||||||
|
class RejectPropertyForm(FlaskForm):
|
||||||
|
rejection_reason = StringField(
|
||||||
|
'Rejection Reason',
|
||||||
|
widget=TextArea(),
|
||||||
|
validators=[validators.DataRequired()]
|
||||||
|
)
|
||||||
|
|
||||||
|
submit = SubmitField('Submit')
|
||||||
|
@ -12,10 +12,11 @@ from flask import (
|
|||||||
from flask_user import login_required, current_user
|
from flask_user import login_required, current_user
|
||||||
from datatables import ColumnDT, DataTables
|
from datatables import ColumnDT, DataTables
|
||||||
import time
|
import time
|
||||||
from app.models import Property, db, UGC, CharacterInfo, PropertyContent, Account
|
from app.models import Property, db, UGC, CharacterInfo, PropertyContent, Account, Mail
|
||||||
from app.schemas import PropertySchema
|
from app.schemas import PropertySchema
|
||||||
from app import gm_level, log_audit
|
from app import gm_level, log_audit
|
||||||
from app.luclient import query_cdclient
|
from app.luclient import query_cdclient
|
||||||
|
from app.forms import RejectPropertyForm
|
||||||
|
|
||||||
import zlib
|
import zlib
|
||||||
import app.pylddlib as ldd
|
import app.pylddlib as ldd
|
||||||
@ -70,7 +71,7 @@ def approve(id):
|
|||||||
log_audit(message)
|
log_audit(message)
|
||||||
flash(
|
flash(
|
||||||
message,
|
message,
|
||||||
"danger"
|
"warning"
|
||||||
)
|
)
|
||||||
|
|
||||||
property_data.save()
|
property_data.save()
|
||||||
@ -88,6 +89,67 @@ def approve(id):
|
|||||||
return redirect(go_to)
|
return redirect(go_to)
|
||||||
|
|
||||||
|
|
||||||
|
@property_blueprint.route('/reject/<id>', methods=['GET', 'POST'])
|
||||||
|
@login_required
|
||||||
|
@gm_level(3)
|
||||||
|
def reject(id):
|
||||||
|
|
||||||
|
property_data = Property.query.filter(Property.id == id).first()
|
||||||
|
|
||||||
|
form = RejectPropertyForm()
|
||||||
|
|
||||||
|
if form.validate_on_submit():
|
||||||
|
char_name = CharacterInfo.query.filter(CharacterInfo.id==property_data.owner_id).first().name
|
||||||
|
zone_name = query_cdclient(
|
||||||
|
'select DisplayDescription from ZoneTable where zoneID = ?',
|
||||||
|
[property_data.zone_id],
|
||||||
|
one=True
|
||||||
|
)[0]
|
||||||
|
property_data.mod_approved = False
|
||||||
|
property_data.rejection_reason = form.rejection_reason.data
|
||||||
|
message = f"""Rejected Property
|
||||||
|
{property_data.name if property_data.name else zone_name}
|
||||||
|
from {char_name} with reason \"{form.rejection_reason.data}\""""
|
||||||
|
log_audit(message)
|
||||||
|
flash(
|
||||||
|
message,
|
||||||
|
"danger"
|
||||||
|
)
|
||||||
|
|
||||||
|
property_data.save()
|
||||||
|
|
||||||
|
# send rejection reason to their mailbox
|
||||||
|
# cause the game doesn't present it otherwise
|
||||||
|
Mail(
|
||||||
|
sender_id=0,
|
||||||
|
sender_name=f"[GM] {current_user.username}",
|
||||||
|
receiver_id=property_data.owner_id,
|
||||||
|
receiver_name=char_name,
|
||||||
|
time_sent=time.time(),
|
||||||
|
subject=f"Property {property_data.name} on {zone_name} Rejected",
|
||||||
|
body=message,
|
||||||
|
attachment_id=0,
|
||||||
|
attachment_lot=0,
|
||||||
|
attachment_count=0
|
||||||
|
).save()
|
||||||
|
|
||||||
|
go_to = ""
|
||||||
|
|
||||||
|
if request.referrer:
|
||||||
|
if "view_models" in request.referrer:
|
||||||
|
go_to = url_for('properties.view', id=id)
|
||||||
|
else:
|
||||||
|
go_to = url_for('properties.index')
|
||||||
|
else:
|
||||||
|
go_to = url_for('main.index')
|
||||||
|
|
||||||
|
return redirect(go_to)
|
||||||
|
|
||||||
|
form.rejection_reason.data = property_data.rejection_reason
|
||||||
|
|
||||||
|
return render_template('properties/reject.html.j2', property_data=property_data, form=form)
|
||||||
|
|
||||||
|
|
||||||
@property_blueprint.route('/view/<id>', methods=['GET'])
|
@property_blueprint.route('/view/<id>', methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
def view(id):
|
def view(id):
|
||||||
@ -172,6 +234,13 @@ def get(status="all"):
|
|||||||
Unapprove
|
Unapprove
|
||||||
</a>
|
</a>
|
||||||
"""
|
"""
|
||||||
|
if not property_data["10"]:
|
||||||
|
property_data["0"] += f"""
|
||||||
|
<a role="button" class="btn btn-danger btn btn-block"
|
||||||
|
href='{url_for('properties.reject', id=id)}'>
|
||||||
|
Reject
|
||||||
|
</a>
|
||||||
|
"""
|
||||||
|
|
||||||
property_data["1"] = f"""
|
property_data["1"] = f"""
|
||||||
<a role="button" class="btn btn-primary btn btn-block"
|
<a role="button" class="btn btn-primary btn btn-block"
|
||||||
|
@ -92,3 +92,13 @@ body { font-family:'Nunito', Helvetica, Arial, sans-serif; }
|
|||||||
color: rgba(255, 255, 255, 0.5);
|
color: rgba(255, 255, 255, 0.5);
|
||||||
border-color: rgba(255, 255, 255, 0.5);
|
border-color: rgba(255, 255, 255, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.dataTables_paginate {
|
||||||
|
float: right;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dataTables_filter{
|
||||||
|
float: right;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
@ -8,9 +8,10 @@
|
|||||||
{{ status|capitalize }} Bug Reports
|
{{ status|capitalize }} Bug Reports
|
||||||
{% endblock content_before %}
|
{% endblock content_before %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content_override %}
|
||||||
<table class="table table-dark table-striped table-bordered table-hover" id="accounts_table">
|
<div class="mx-5">
|
||||||
<thead>
|
<table class="table table-dark table-striped table-bordered table-hover" id="accounts_table">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
<th>Body</th>
|
<th>Body</th>
|
||||||
@ -20,9 +21,10 @@
|
|||||||
<th>Submitted</th>
|
<th>Submitted</th>
|
||||||
<th>Resolved</th>
|
<th>Resolved</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,60 +8,62 @@
|
|||||||
Moderation of {{ status|capitalize }} Items
|
Moderation of {{ status|capitalize }} Items
|
||||||
{% endblock content_before %}
|
{% endblock content_before %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content_override %}
|
||||||
<h4> Characters </h4>
|
<div class="mx-5">
|
||||||
<hr class="bg-primary"/>
|
<h4> Characters </h4>
|
||||||
<table class="table table-dark table-striped table-bordered table-hover" id="character_table">
|
<hr class="bg-primary"/>
|
||||||
<thead>
|
<table class="table table-dark table-striped table-bordered table-hover" id="character_table">
|
||||||
<tr>
|
<thead>
|
||||||
<th>Actions</th>
|
<tr>
|
||||||
<th>Account</th>
|
<th>Actions</th>
|
||||||
<th>Name</th>
|
<th>Account</th>
|
||||||
<th>Pending Name</th>
|
<th>Name</th>
|
||||||
<th>Needs Rename</th>
|
<th>Pending Name</th>
|
||||||
<th>Last Login</th>
|
<th>Needs Rename</th>
|
||||||
<th>Permission Map</th>
|
<th>Last Login</th>
|
||||||
</tr>
|
<th>Permission Map</th>
|
||||||
</thead>
|
</tr>
|
||||||
<tbody></tbody>
|
</thead>
|
||||||
</table>
|
<tbody></tbody>
|
||||||
<br/>
|
</table>
|
||||||
<h4> Pets </h4>
|
<br/>
|
||||||
<hr class="bg-primary"/>
|
<h4> Pets </h4>
|
||||||
<table class="table table-dark table-striped table-bordered table-hover" id="pet_table">
|
<hr class="bg-primary"/>
|
||||||
<thead>
|
<table class="table table-dark table-striped table-bordered table-hover" id="pet_table">
|
||||||
<tr>
|
<thead>
|
||||||
<th>Actions</th>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Actions</th>
|
||||||
<th>Status</th>
|
<th>Name</th>
|
||||||
<th>Owner</th>
|
<th>Status</th>
|
||||||
</tr>
|
<th>Owner</th>
|
||||||
</thead>
|
</tr>
|
||||||
<tbody></tbody>
|
</thead>
|
||||||
</table>
|
<tbody></tbody>
|
||||||
<br/>
|
</table>
|
||||||
<h4> Properties </h4>
|
<br/>
|
||||||
<hr class="bg-primary"/>
|
<h4> Properties </h4>
|
||||||
<table class="table table-dark table-striped table-bordered table-hover" id="property_table">
|
<hr class="bg-primary"/>
|
||||||
<thead>
|
<table class="table table-dark table-striped table-bordered table-hover" id="property_table">
|
||||||
<tr>
|
<thead>
|
||||||
<th>Actions</th>
|
<tr>
|
||||||
<th>Owner</th>
|
<th>Actions</th>
|
||||||
<th>Template ID</th>
|
<th>Owner</th>
|
||||||
<th>Clone ID</th>
|
<th>Template ID</th>
|
||||||
<th>Name</th>
|
<th>Clone ID</th>
|
||||||
<th>Description</th>
|
<th>Name</th>
|
||||||
<th>Privacy</th>
|
<th>Description</th>
|
||||||
<th>Approved</th>
|
<th>Privacy</th>
|
||||||
<th>Updated</th>
|
<th>Approved</th>
|
||||||
<th>Claimed</th>
|
<th>Updated</th>
|
||||||
<th>Rejection Reason</th>
|
<th>Claimed</th>
|
||||||
<th>Reputation</th>
|
<th>Rejection Reason</th>
|
||||||
<th>Location</th>
|
<th>Reputation</th>
|
||||||
</tr>
|
<th>Location</th>
|
||||||
</thead>
|
</tr>
|
||||||
<tbody></tbody>
|
</thead>
|
||||||
</table>
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
|
@ -8,36 +8,38 @@
|
|||||||
Property Management
|
Property Management
|
||||||
{% endblock content_before %}
|
{% endblock content_before %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content_override %}
|
||||||
{% if message %}
|
<div class="mx-5">
|
||||||
<div class="row">
|
{% if message %}
|
||||||
<div class="col text-center">
|
<div class="row">
|
||||||
<h3>{{ message }}</h3>
|
<div class="col text-center">
|
||||||
|
<h3>{{ message }}</h3>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<br/>
|
||||||
<br/>
|
{% endif %}
|
||||||
{% endif %}
|
<table class="table table-dark table-striped table-bordered table-hover" id="properties_table">
|
||||||
<table class="table table-dark table-striped table-bordered table-hover" id="properties_table">
|
<thead>
|
||||||
<thead>
|
<tr>
|
||||||
<tr>
|
<th>Actions</th>
|
||||||
<th>Actions</th>
|
<th>Owner</th>
|
||||||
<th>Owner</th>
|
<th>Template ID</th>
|
||||||
<th>Template ID</th>
|
<th>Clone ID</th>
|
||||||
<th>Clone ID</th>
|
<th>Name</th>
|
||||||
<th>Name</th>
|
<th>Description</th>
|
||||||
<th>Description</th>
|
<th>Privacy</th>
|
||||||
<th>Privacy</th>
|
<th>Approved</th>
|
||||||
<th>Approved</th>
|
<th>Updated</th>
|
||||||
<th>Updated</th>
|
<th>Claimed</th>
|
||||||
<th>Claimed</th>
|
<th>Rejection Reason</th>
|
||||||
<th>Rejection Reason</th>
|
<th>Reputation</th>
|
||||||
<th>Reputation</th>
|
<th>Performance Cost</th>
|
||||||
<th>Performance Cost</th>
|
<th>Location</th>
|
||||||
<th>Location</th>
|
</tr>
|
||||||
</tr>
|
</thead>
|
||||||
</thead>
|
<tbody></tbody>
|
||||||
<tbody></tbody>
|
</table>
|
||||||
</table>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
32
app/templates/properties/reject.html.j2
Normal file
32
app/templates/properties/reject.html.j2
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{% extends 'base.html.j2' %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
Viewing {{property_data.owner.name}}'s
|
||||||
|
{% if property_data.name %}
|
||||||
|
{{ property_data.name }}
|
||||||
|
{% else %}
|
||||||
|
{{ property_data.zone_id|get_zone_name }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content_before %}
|
||||||
|
Viewing {{property_data.owner.name}}'s
|
||||||
|
{% if property_data.name %}
|
||||||
|
{{ property_data.name }}
|
||||||
|
{% else %}
|
||||||
|
{{ property_data.zone_id|get_zone_name }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<form method=post>
|
||||||
|
{{ form.csrf_token }}
|
||||||
|
<div class="card shadow-sm mx-auto pb-3 bg-dark border-primary" style="width: 20rem;">
|
||||||
|
<div class="card-body">
|
||||||
|
{{ helper.render_field(form.rejection_reason) }}
|
||||||
|
{{ helper.render_submit_field(form.submit) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% endblock content %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user