Class: IrisRails::PostsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- IrisRails::PostsController
- Defined in:
- lib/generators/templates/app/controllers/iris_rails/posts_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/generators/templates/app/controllers/iris_rails/posts_controller.rb', line 2 def index response = IrisRails::Post.all @posts, @account = response @first_posts = @posts.first(3) @highlighted_posts = @posts[3, 3] @more_posts = @posts[6, @posts.size - (@posts.length.odd? ? 9 : 6)] if @posts.length.odd? && (@posts.length >= 9) @last_posts = @posts.last(3) elsif @posts.length == 7 @last_posts = [] @last_posts << @posts.last end end |
#show ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/generators/templates/app/controllers/iris_rails/posts_controller.rb', line 17 def show response = IrisRails::Post.find(params[:slug]) @post, @related_posts, @account = response @author = (@post.) strongkeyphrase = '<strong>' + @post.keyphrase + '</strong>' @post.first_introduction = @post.first_introduction.gsub(@post.keyphrase, strongkeyphrase) @post.second_introduction = @post.second_introduction.gsub(@post.keyphrase, strongkeyphrase) @post.ordered_topics.each do |topic| topic['content'] = topic['content'].gsub(@post.keyphrase, strongkeyphrase) end end |