cirandas.net

ref: dockerize

plugins/context_content/controllers/profile/context_content_plugin_profile_controller.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class ContextContentPluginProfileController < ProfileController
  append_view_path File.join(File.dirname(__FILE__) + '/../../views')

  def view_content
    block = Block.find(params[:id])
    p = params[:page].to_i
    contents = block.contents(profile.articles.find(params[:article_id]), p)

    if contents
      @page = Article.find(params[:article_id])

      render :update do |page|
        page.replace_html "context_content_#{block.id}", :file => "blocks/context_content", :locals => {:block => block}
        page.replace_html "context_content_more_#{block.id}", :file => 'blocks/footers/context_content', :locals => {:block => block}
      end
    else
      render :text => "invalid page", :status => 500
    end
   end

end