more fixes, changes, support for new mojang API

This commit is contained in:
jomo
2014-04-18 14:35:18 +02:00
parent 7135d2690c
commit 0264f239ba
62 changed files with 4927 additions and 15 deletions

View File

@@ -59,7 +59,7 @@ class ForumgroupsController < ApplicationController
private
def group_params(add = [])
a = [:name, :position, :role_read, :role_write] + add
a = [:name, :position, :role_read_id, :role_write_id] + add
params.require(:forumgroup).permit(a)
end

View File

@@ -39,8 +39,7 @@ class ForumsController < ApplicationController
def create
if admin?
@forum = Forum.new(forum_params)
@forum.forumgroup = Forumgroup.find(params[:forum][:forumgroup_id])
@forum = Forum.new(forum_params([:forumgroup_id]))
if @forum.save
flash[:notice] = "Forum created."
redirect_to @forum
@@ -66,7 +65,7 @@ class ForumsController < ApplicationController
end
def forum_params(add = [])
a = [:name, :position, :role_read, :role_write] + add
a = [:name, :position, :role_read_id, :role_write_id] + add
params.require(:forum).permit(a)
end
end

View File

@@ -36,10 +36,9 @@ class ForumthreadsController < ApplicationController
end
def create
@thread = Forumthread.new(mod? ? thread_params([:sticky, :locked]) : thread_params)
@thread = Forumthread.new(mod? ? thread_params([:sticky, :locked, :forum_id]) : thread_params([:forum_id]))
if @thread.can_write?(current_user)
@thread.user_author = current_user
@thread.forum = @thread.forum
if @thread.save
flash[:notice] = "Thread created!"
redirect_to forumthread_path( @thread)
@@ -71,6 +70,6 @@ class ForumthreadsController < ApplicationController
def thread_params(add = [])
a = [:title, :content]
a += add
params.require(:Forumthread).permit(a)
params.require(:forumthread).permit(a)
end
end