app/controllers/works_controller.rb
def drafts
    unless params[:user_id]
      flash[:error] = ts("Whose drafts did you want to look at?")
      redirect_to :controller => :users, :action => :index
      return
    end

    @user = User.find_by_login(params[:user_id])

    unless current_user == @user
      flash[:error] = ts("You can only see your own drafts, sorry!")
      redirect_to current_user
      return
    end

    if params[:pseud_id]
      @pseud = @user.pseuds.find_by_name(params[:pseud_id])
      @works = @pseud.unposted_works.paginate(:page => params[:page])
    else
      @works = @user.unposted_works.paginate(:page => params[:page])
    end
  end
# only registered users and NOT admin should be able to create new works
only registered users and NOT admin should be able to create new works
only registered users and NOT admin should be able to create new works
def drafts
    unless params[:user_id]
      flash[:error] = ts("Whose drafts did you want to look at?")
      redirect_to :controller => :users, :action => :index
      return
    end
    @user = User.find_by_login(params[:user_id])
    unless current_user == @user
      flash[:error] = ts("You can only see your own drafts, sorry!")
      redirect_to current_user
      return
    end
    if params[:pseud_id]
      @pseud = @user.pseuds.find_by_name(params[:pseud_id])
      @works = @pseud.unposted_works.paginate(:page => params[:page])
    else
      @works = @user.unposted_works.paginate(:page => params[:page])
    end
  end
def drafts unless params [ :user_id ] flash [ :error ] = ts ( "Whose drafts did you want to look at?" ) redirect_to :controller => :users , :action => :index return end @user = User . find_by_login ( params [ :user_id ] ) unless current_user == @user flash [ :error ] = ts ( "You can only see your own drafts, sorry!" ) redirect_to current_user return end if params [ :pseud_id ] @pseud = @user . pseuds . find_by_name ( params [ :pseud_id ] ) @works = @pseud . unposted_works . paginate ( :page => params [ :page ] ) else @works = @user . unposted_works . paginate ( :page => params [ :page ] ) end end
only registered users and NOT admin should be able to create new works
only registered users and NOT admin should be able to create new works