diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index ef1704ecc..156057da7 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -1,19 +1,51 @@ class MemosController < ApplicationController - layout 'base_memos' + layout 'base_memos' ,except: [:new ] def new + @forum = Forum.find(params[:forum_id]) @memo = Memo.new + @memo.forum_id = @forum.id respond_to do |format| - format.html # new.html.erb + format.html { + render action: :new ,layout: 'base' + }# new.html.erb format.json { render json: @memo } end end def show + # @offset, @limit = api_offset_and_limit({:limit => 10}) + # @forum = Forum.find(params[:id]) + # @memos_all = @forum.topics + # @topic_count = @memos_all.count + # @topic_pages = Paginator.new @topic_count, @limit, params['page'] + + # @offset ||= @topic_pages.offset + # @memos = @memos_all.offset(@offset).limit(@limit).all + # respond_to do |format| + # format.html { + # render :layout => 'base_forums' + # }# show.html.erb + # format.json { render json: @forum } + # end + + + @memo = Memo.find_by_id(params[:id]) + @offset, @limit = api_offset_and_limit({:limit => 10}) @forum = Forum.find(params[:forum_id]) - @replies = @memo.replies + @replies_all = @memo.replies + @repliy_count = @replies_all.count + @repliy_pages = Paginator.new @repliy_count, @limit, params['page'] + @offset ||= @repliy_pages.offset + @replies = @replies_all.offset(@offset).limit(@limit).all @mome_new = Memo.new + + + # @memo = Memo.find_by_id(params[:id]) + # @forum = Forum.find(params[:forum_id]) + # @replies = @memo.replies + # @mome_new = Memo.new respond_to do |format| format.html # show.html.erb