Class: Integral::Widgets::RecentPosts
- Inherits:
-
Object
- Object
- Integral::Widgets::RecentPosts
- Defined in:
- lib/integral/widgets/recent_posts.rb
Overview
Outputs recent posts
Example Widget Markup <p class=‘integral-widget’ data-widget-type=‘recent_posts’ data-widget-value-tagged=‘awesome-tag’>
Class Method Summary collapse
-
.controller ⇒ Object
Frontend controller used to render views.
-
.default_options ⇒ Object
Default widget options.
-
.render(options = {}) ⇒ Object
Render the recent posts.
-
.skope(options) ⇒ Object
Scope of the widget.
Class Method Details
.controller ⇒ Object
Frontend controller used to render views
21 22 23 |
# File 'lib/integral/widgets/recent_posts.rb', line 21 def self.controller Integral.frontend_parent_controller.constantize end |
.default_options ⇒ Object
Default widget options
26 27 28 29 30 31 |
# File 'lib/integral/widgets/recent_posts.rb', line 26 def self. { amount: 2, tagged: '' } end |
.render(options = {}) ⇒ Object
Render the recent posts
10 11 12 13 14 15 16 17 18 |
# File 'lib/integral/widgets/recent_posts.rb', line 10 def self.render( = {}) = .reverse_merge() controller.render( partial: 'integral/posts/collection', locals: { collection: skope() }, layout: false ) end |