mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Improve views subfoldering
This commit is contained in:
parent
9866e43b4b
commit
9639cf04f1
@ -28,13 +28,16 @@ class QueryBuilder:
|
||||
self.order_by = args.get("sort") or "score"
|
||||
self.order_dir = args.get("order") or "desc"
|
||||
|
||||
if self.search is not None and self.search.strip() == "":
|
||||
self.search = None
|
||||
|
||||
def buildPackageQuery(self):
|
||||
query = Package.query.filter_by(soft_deleted=False, approved=True)
|
||||
|
||||
if len(self.types) > 0:
|
||||
query = query.filter(Package.type.in_(self.types))
|
||||
|
||||
if self.search is not None and self.search.strip() != "":
|
||||
if self.search:
|
||||
query = query.filter(Package.title.ilike('%' + self.search + '%'))
|
||||
|
||||
if self.random:
|
||||
@ -69,17 +72,14 @@ class QueryBuilder:
|
||||
def buildTopicQuery(self):
|
||||
topics = ForumTopic.query \
|
||||
.filter(~ db.exists().where(Package.forums==ForumTopic.topic_id)) \
|
||||
.order_by(db.asc(ForumTopic.wip), db.asc(ForumTopic.name), db.asc(ForumTopic.title)) \
|
||||
.filter(ForumTopic.title.ilike('%' + self.search + '%'))
|
||||
.order_by(db.asc(ForumTopic.wip), db.asc(ForumTopic.name), db.asc(ForumTopic.title))
|
||||
|
||||
if self.search:
|
||||
topics = topics.filter(ForumTopic.title.ilike('%' + self.search + '%'))
|
||||
|
||||
if len(self.types) > 0:
|
||||
topics = topics.filter(ForumTopic.type.in_(self.types))
|
||||
|
||||
if self.hide_nonfree:
|
||||
topics = topics \
|
||||
.filter(Package.license.has(License.is_foss == True)) \
|
||||
.filter(Package.media_license.has(License.is_foss == True))
|
||||
|
||||
if self.limit:
|
||||
topics = topics.limit(self.limit)
|
||||
|
||||
|
@ -56,9 +56,8 @@ def home_page():
|
||||
return render_template("index.html", count=count, \
|
||||
new=new, pop_mod=pop_mod, pop_txp=pop_txp, pop_gam=pop_gam)
|
||||
|
||||
from . import users, githublogin, packages, meta, threads, api
|
||||
from . import tasks, admin, notifications, tagseditor, licenseseditor
|
||||
from . import sass, thumbnails
|
||||
from . import users, packages, meta, threads, api
|
||||
from . import sass, thumbnails, tasks, admin
|
||||
|
||||
@menu.register_menu(app, ".help", "Help", order=19, endpoint_arguments_constructor=lambda: { 'path': 'help' })
|
||||
@app.route('/<path:path>/')
|
||||
|
18
app/views/admin/__init__.py
Normal file
18
app/views/admin/__init__.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Content DB
|
||||
# Copyright (C) 2018 rubenwardy
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from . import admin, licenseseditor, tagseditor, todo
|
@ -15,4 +15,4 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from . import packages, todo, screenshots, releases
|
||||
from . import packages, screenshots, releases
|
||||
|
18
app/views/users/__init__.py
Normal file
18
app/views/users/__init__.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Content DB
|
||||
# Copyright (C) 2018 rubenwardy
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from . import users, githublogin, notifications
|
Loading…
Reference in New Issue
Block a user