a TON of bugfixes and new features

This commit is contained in:
jomo
2014-04-28 03:01:33 +02:00
parent a6ba503e73
commit 65f5adf65d
59 changed files with 1023 additions and 970 deletions

View File

@@ -5,7 +5,7 @@ class ForumgroupsController < ApplicationController
end
def show
redirect_to forums_path + "#forum-#{params[:id]}"
redirect_to forums_path + "#group-#{params[:id]}"
end
def edit

View File

@@ -3,11 +3,15 @@ class ForumsController < ApplicationController
def index
@groups = Forumgroup.select {|g| g.can_read?(current_user) }
@groups.sort_by!{|g| g[:position]}
@groups.sort_by!{ |g| g.position || 0 }
end
def show
@threads = @forum.forumthreads.order("sticky desc, updated_at desc")
@threads = @forum.forumthreads.to_a
@threads.sort_by! do |t|
# sticky goes first, then sort by last activity (new replies)
[t.sticky ? 0 : 1, -(t.replies.last.try(:created_at) || t.created_at).to_i]
end
end
def edit

View File

@@ -12,7 +12,7 @@ class ForumthreadsController < ApplicationController
def update
if mod? || @thread.author.is?(current_user)
@thread.user_editor = current_user
@thread.attributes = thread_params([:user_editor])
@thread.attributes = (mod? ? thread_params([:sticky, :locked, :forum_id]) : thread_params)
if @thread.save
redirect_to @thread, notice: 'Post has been updated.'
else

View File

@@ -1,6 +0,0 @@
[yt](729o_Xwg1WU)
\[yt\]\(([a-zA-Z0-9\-_]+)\)
https://www.youtube.com/embed/{id}?theme=light&iv_load_policy=3&showinfo=1&showsearch=0&rel=0&modestbranding&hd=1&autohide=1&html5=1