Add key shortcut to add to favgroup
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class FavoriteGroupsController < ApplicationController
|
||||
before_filter :member_only, :except => [:index, :show]
|
||||
respond_to :html, :xml, :json
|
||||
respond_to :html, :xml, :json, :js
|
||||
|
||||
def index
|
||||
@favorite_groups = FavoriteGroup.search(params[:search]).order("updated_at desc").paginate(params[:page], :limit => params[:limit], :search_count => params[:search])
|
||||
@@ -59,6 +59,13 @@ class FavoriteGroupsController < ApplicationController
|
||||
redirect_to favorite_groups_path
|
||||
end
|
||||
|
||||
def add_post
|
||||
@favorite_group = FavoriteGroup.find(params[:id])
|
||||
check_privilege(@favorite_group)
|
||||
@post = Post.find(params[:post_id])
|
||||
@favorite_group.add!(@post)
|
||||
end
|
||||
|
||||
private
|
||||
def check_privilege(favgroup)
|
||||
raise User::PrivilegeError unless favgroup.editable_by?(CurrentUser.user)
|
||||
|
||||
Reference in New Issue
Block a user