Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ce2eb7133 | ||
|
|
c358c8b148 | ||
|
|
3d5a6dc32a | ||
|
|
506d5e518e | ||
|
|
ef0a32524e | ||
|
|
2abcd8ee47 | ||
|
|
2b7cc31b4b | ||
|
|
48ebc751e4 |
@@ -31,12 +31,13 @@ migrate = Migrate(app, db)
|
||||
|
||||
|
||||
class UserRank(enum.Enum):
|
||||
NOT_JOINED = 0
|
||||
NEW_MEMBER = 1
|
||||
MEMBER = 2
|
||||
EDITOR = 3
|
||||
MODERATOR = 4
|
||||
ADMIN = 5
|
||||
BANNED = 0
|
||||
NOT_JOINED = 1
|
||||
NEW_MEMBER = 2
|
||||
MEMBER = 3
|
||||
EDITOR = 4
|
||||
MODERATOR = 5
|
||||
ADMIN = 6
|
||||
|
||||
def atLeast(self, min):
|
||||
return self.value >= min.value
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 771 KiB |
@@ -54,6 +54,13 @@
|
||||
input.val("");
|
||||
return false;
|
||||
}
|
||||
}).focus(function() {
|
||||
// The following works only once.
|
||||
// $(this).trigger('keydown.autocomplete');
|
||||
// As suggested by digitalPBK, works multiple times
|
||||
// $(this).data("autocomplete").search($(this).val());
|
||||
// As noted by Jonny in his answer, with newer versions use uiAutocomplete
|
||||
$(this).data("ui-autocomplete").search($(this).val());
|
||||
});
|
||||
|
||||
input.data('ui-autocomplete')._renderItem = function(ul, item) {
|
||||
|
||||
@@ -99,14 +99,6 @@ a:hover {
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
header {
|
||||
.button, .buttonset li a, input[type=submit], input[type=text],
|
||||
input[type=password], textarea, select, .multichoice_selector {
|
||||
background: rgba(255,255,255,0.1);
|
||||
border: 1px solid rgba(255,255,255,0.2);
|
||||
}
|
||||
}
|
||||
|
||||
input[type=text], input[type=password], textarea, select, .multichoice_selector {
|
||||
text-align: left;
|
||||
}
|
||||
@@ -120,6 +112,9 @@ input[type=text], input[type=password], textarea, select, .multichoice_selector
|
||||
.ui-autocomplete {
|
||||
background: #333 !important;
|
||||
border: 1px solid #444 !important;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
max-height: 400px;
|
||||
|
||||
li {
|
||||
display: block !important;
|
||||
|
||||
@@ -37,6 +37,10 @@ nav li a {
|
||||
border-left: 1px solid #444;
|
||||
}
|
||||
|
||||
nav li a:not([href]) {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
nav ul li:last-child a {
|
||||
border-right: 1px solid #444;
|
||||
}
|
||||
|
||||
@@ -31,9 +31,7 @@ header h1, header p, header form {
|
||||
|
||||
header {
|
||||
padding: 30px;
|
||||
background: #258 url("jumbotron.png");
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
background: #258;
|
||||
}
|
||||
|
||||
header p {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<nav>
|
||||
<div class="container">
|
||||
<ul class="nav navbar-nav navbar-left">
|
||||
<li><a href="/"><img src="/static/logo_dark.svg" /></a></li>
|
||||
<li><a href="/">{{ config.USER_APP_NAME }}</a></li>
|
||||
{% for item in current_menu.children recursive %}
|
||||
{% if item.visible %}
|
||||
<li{% if item.children %} class="dropdown"{% endif %}>
|
||||
@@ -46,8 +46,7 @@
|
||||
</a></li>
|
||||
<li><a href="{{ url_for('create_edit_package_page') }}">+</a></li>
|
||||
<li class="dropdown">
|
||||
<a href="{{ url_for('user_profile_page', username=current_user.username) }}"
|
||||
class="dropdown-toggle"
|
||||
<a class="dropdown-toggle"
|
||||
data-toggle="dropdown"
|
||||
role="button"
|
||||
aria-expanded="false">{{ current_user.display_name }}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<aside class="box box_grey outsidecontainer">
|
||||
<!--<aside class="box box_grey outsidecontainer">
|
||||
<h3>Tags</h3>
|
||||
|
||||
<ul class="flatlist">
|
||||
@@ -27,7 +27,7 @@
|
||||
<li><i>No tags available</i></ul>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</aside>
|
||||
</aside> -->
|
||||
|
||||
{% from "macros/packagegridtile.html" import render_pkggrid %}
|
||||
{{ render_pkggrid(packages) }}
|
||||
|
||||
@@ -20,17 +20,21 @@
|
||||
{% else %}
|
||||
A release is required before this package can be approved.
|
||||
{% endif %}
|
||||
{% elif not package.getDownloadRelease() %}
|
||||
Please wait for the release to be approved.
|
||||
{% else %}
|
||||
{% if package.checkPerm(current_user, "APPROVE_NEW") %}
|
||||
{% if package.screenshots.count() == 0 %}
|
||||
<b>You should add at least one screenshot, but this isn't required.</b><br />
|
||||
{% endif %}
|
||||
|
||||
{% if not package.getDownloadRelease() %}
|
||||
Please wait for the release to be approved.
|
||||
{% elif package.checkPerm(current_user, "APPROVE_NEW") %}
|
||||
You can now approve this package if you're ready.
|
||||
<form method="post" action="{{ package.getApproveURL() }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<input type="submit" value="Approve" />
|
||||
</form>
|
||||
{% else %}
|
||||
This package needs to be approved before it can be found.
|
||||
Please wait for the package to be approved.
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<div style="clear: both;"></div>
|
||||
|
||||
@@ -62,6 +62,10 @@ def _do_login_user(user, remember_me=False):
|
||||
if not user:
|
||||
return False
|
||||
|
||||
if user.rank == UserRank.BANNED:
|
||||
flash("You have been banned.", "error")
|
||||
return False
|
||||
|
||||
user.active = True
|
||||
if not user.rank.atLeast(UserRank.NEW_MEMBER):
|
||||
user.rank = UserRank.NEW_MEMBER
|
||||
|
||||
@@ -51,3 +51,10 @@ def flatpage(path):
|
||||
page = pages.get_or_404(path)
|
||||
template = page.meta.get('template', 'flatpage.html')
|
||||
return render_template(template, page=page)
|
||||
|
||||
@app.before_request
|
||||
def do_something_whenever_a_request_comes_in():
|
||||
if current_user.is_authenticated and current_user.rank == UserRank.BANNED:
|
||||
flash("You have been banned.", "error")
|
||||
logout_user()
|
||||
return redirect(url_for('user.login'))
|
||||
|
||||
@@ -197,7 +197,7 @@ def approve_package_page(package):
|
||||
|
||||
screenshots = PackageScreenshot.query.filter_by(package=package, approved=False).all()
|
||||
for s in screenshots:
|
||||
screenshots.approved = True
|
||||
s.approved = True
|
||||
|
||||
triggerNotif(package.author, current_user,
|
||||
"{} approved".format(package.title), package.getDetailsURL())
|
||||
|
||||
29
migrations/versions/ea5a023711e0_.py
Normal file
29
migrations/versions/ea5a023711e0_.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: ea5a023711e0
|
||||
Revises: fa12fadbdb40
|
||||
Create Date: 2018-05-26 01:55:09.745881
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ea5a023711e0'
|
||||
down_revision = 'fa12fadbdb40'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
conn = op.get_bind()
|
||||
conn.execute("ALTER TYPE userrank ADD VALUE 'BANNED'")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user