Skip to content

Commit

Permalink
Removed the subforums feature.
Browse files Browse the repository at this point in the history
Maybe I'll reimplement this sometime later.
I have removed it because it had many flaws (which I weren't aware) and I can live without this feature. :)
  • Loading branch information
sh4nks committed Feb 1, 2014
1 parent 7228d57 commit 43938a0
Show file tree
Hide file tree
Showing 14 changed files with 369 additions and 428 deletions.
2 changes: 1 addition & 1 deletion flaskbb/admin/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def validate_moderators(self, field):
raise ValidationError("User not found")
field.data = self._moderators

def save(self):
def save(self, category_id=None):
forum = Forum(title=self.title.data,
description=self.description.data,
position=self.position.data)
Expand Down
28 changes: 21 additions & 7 deletions flaskbb/admin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from flaskbb.utils.decorators import admin_required
from flaskbb.extensions import db
from flaskbb.user.models import User, Group
from flaskbb.forum.models import Post, Topic, Forum
from flaskbb.forum.models import Post, Topic, Forum, Category
from flaskbb.admin.forms import (AddUserForm, EditUserForm, AddGroupForm,
EditGroupForm, ForumForm)

Expand Down Expand Up @@ -66,10 +66,8 @@ def groups():
@admin.route("/forums")
@admin_required
def forums():
page = request.args.get("page", 1, type=int)
forums = Forum.query.\
paginate(page, current_app.config['USERS_PER_PAGE'], False)
return render_template("admin/forums.html", forums=forums)
categories = Category.query.order_by(Category.position.asc()).all()
return render_template("admin/forums.html", categories=categories)


@admin.route("/users/<int:user_id>/edit", methods=["GET", "POST"])
Expand Down Expand Up @@ -250,13 +248,29 @@ def delete_forum(forum_id):


@admin.route("/forums/add", methods=["GET", "POST"])
@admin.route("/forums/<int:category_id>/add")
@admin_required
def add_forum():
def add_forum(category_id=None):
form = ForumForm()

if form.validate_on_submit():
form.save()
form.save(category_id)
flash("Forum successfully added.", "success")
return redirect(url_for("admin.forums"))

return render_template("admin/edit_forum.html", form=form)


@admin.route("/category/add", methods=["GET", "POST"])
def add_category():
pass


@admin.route("/category/<int:category_id>/edit", methods=["GET", "POST"])
def edit_category(category_id):
pass


@admin.route("/category/<int:category_id>/delete", methods=["GET", "POST"])
def delete_category(category_id):
pass
88 changes: 0 additions & 88 deletions flaskbb/forum/helpers.py

This file was deleted.

1 comment on commit 43938a0

@sarahspock
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aww.

Please sign in to comment.