idk, lots

This commit is contained in:
jomo
2014-02-01 00:56:50 +01:00
parent 86452ea00b
commit 02f9664624
30 changed files with 1467 additions and 54 deletions

View File

@@ -29,7 +29,7 @@ class BlogpostsController < ApplicationController
def create
if mod?
@post = Blogpost.new(params[:blogpost] ? params[:blogpost].slice(:title, :content) : {})
@post = Blogpost.new(params[:blogpost].slice(:title, :content))
@post.user_author = current_user
if @post.save
redirect_to @post, notice: 'Post has been created.'

View File

@@ -4,18 +4,40 @@ class ForumthreadsController < ApplicationController
redirect_to forum_path(f.forumgroup, f)
end
def show
@thread = Forumthread.find(params[:id])
render text: @thread.content
end
def new
@forum = Forum.find(params[:id])
if @forum && current_user && (@forum.group.role_read.nil? || @forum.group.role_read <= current_user.role) && (@forum.role_read.nil? || @forum.role_read <= current_user.role)
@thread = Forumthread.new(forum: @forum)
else
flash[:alert] = "You are not allowed to create a new thread here!"
redirect_to @forum
end
end
def create
flash[:alert] = "Not yet ;("
redirect_to forum_path(params[:id])
@forum = Forum.find(params[:id])
if (confirmed? && (@forum.group.role_read || Role.get(:default))<= current_user.role && (@forum.group.role_write || Role.get(:default))<= current_user.role && (@forum.role_read || Role.get(:default))<= current_user.role && (@forum.group.role_write || Role.get(:default))<= current_user.role)
@thread = Forumthread.new(mod? ? params[:forumthread] : params[:forumthread].slice(:title, :content))
@thread.user_author = current_user
@thread.forum = @forum
if @thread.save
flash[:notice] = "Thread created!"
redirect_to @thread
return
else
flash[:alert] = "Seomthing went wrong while creating your thread."
render "new"
return
end
else
flash[:alert] = "You are not allowed to create a thread here!"
redirect_to @forum
end
end

View File

@@ -0,0 +1,9 @@
class StaticsController < ApplicationController
def index
end
def donate
end
end

View File

@@ -37,11 +37,18 @@ require 'open-uri'
if current_user
@user = User.find(params[:id])
code = params[:code]
if @user && @user == current_user && code && @user.confirm_code == code
if @user && @user.is?(current_user) && code && @user.confirm_code == code
if @user.role == Role.get(:unconfirmed)
@user.role = Role.get :default
@user.save
flash[:notice] = "Registration confirmed."
if @user.save
flash[:notice] = "Registration mail confirmed."
redirect_to edit_user_path(@user)
return
else
flash[:alert] = "Something went wrong, please contact us ingame."
redirect_to @user
return
end
elsif @user.role < Role.get(:unconfirmed)
flash[:alert] = "Your account has been banned or removed"
else