refinerycms-news
所属分类:建站系统
开发工具:Ruby
文件大小:52KB
下载次数:0
上传日期:2021-04-29 22:03:44
上 传 者:
sh-1993
说明: 炼油厂CMS的新闻插件
(News Plugin for Refinery CMS)
文件列表:
.rspec (8, 2021-04-30)
.travis.yml (684, 2021-04-30)
Gemfile (1060, 2021-04-30)
Rakefile (494, 2021-04-30)
app (0, 2021-04-30)
app\controllers (0, 2021-04-30)
app\controllers\refinery (0, 2021-04-30)
app\controllers\refinery\news (0, 2021-04-30)
app\controllers\refinery\news\admin (0, 2021-04-30)
app\controllers\refinery\news\admin\items_controller.rb (370, 2021-04-30)
app\controllers\refinery\news\items_controller.rb (1252, 2021-04-30)
app\helpers (0, 2021-04-30)
app\helpers\refinery (0, 2021-04-30)
app\helpers\refinery\news (0, 2021-04-30)
app\helpers\refinery\news\items_helper.rb (1529, 2021-04-30)
app\models (0, 2021-04-30)
app\models\refinery (0, 2021-04-30)
app\models\refinery\news (0, 2021-04-30)
app\models\refinery\news\item.rb (2837, 2021-04-30)
app\views (0, 2021-04-30)
app\views\refinery (0, 2021-04-30)
app\views\refinery\news (0, 2021-04-30)
app\views\refinery\news\admin (0, 2021-04-30)
app\views\refinery\news\admin\items (0, 2021-04-30)
app\views\refinery\news\admin\items\_form.html.erb (1230, 2021-04-30)
app\views\refinery\news\admin\items\_item.html.erb (1369, 2021-04-30)
app\views\refinery\news\admin\items\edit.html.erb (21, 2021-04-30)
app\views\refinery\news\admin\items\index.html.erb (778, 2021-04-30)
app\views\refinery\news\admin\items\new.html.erb (21, 2021-04-30)
app\views\refinery\news\items (0, 2021-04-30)
app\views\refinery\news\items\_recent_posts.html.erb (221, 2021-04-30)
app\views\refinery\news\items\archive.html.erb (754, 2021-04-30)
app\views\refinery\news\items\index.html.erb (1056, 2021-04-30)
app\views\refinery\news\items\index.rss.builder (955, 2021-04-30)
app\views\refinery\news\items\show.html.erb (593, 2021-04-30)
app\views\refinery\news\items\widgets (0, 2021-04-30)
... ...
# Refinery CMS News
[![Build Status](https://travis-ci.org/refinery/refinerycms-news.svg?branch=master)](https://travis-ci.org/refinery/refinerycms-news)
## About
__Refinery's news engine allows you to post updates to the news section of your website.__
Key features:
* Default news page shows a summary of recent news posts
* Detail view shows the full post and also linked to recent news on the "side bar"
## Requirements
[Refinery CMS](http://refinerycms.com) "core" engine version 2.0.0 or later.
### Gem Installation using Bundler (The very best way)
Include the latest [gem](http://rubygems.org/gems/refinerycms-news) into your Refinery CMS application's Gemfile:
```ruby
gem "refinerycms-news", '~> 2.1.0'
```
Then type the following at command line inside your Refinery CMS application's root directory:
bundle install
rails generate refinery:news
rake db:migrate
rake db:seed
## How to display a news feed on the homepage:
Assuming you've already overridden the homepage view:
$ rake refinery:override view=refinery/pages/home
You can render the `recent_posts` partial. However, you will need to set the recent News items manually, since this is normally handled in the News::Items controller:
```erb
<% @items = Refinery::News::Item.latest(5) %>
<%= render :partial => '/refinery/news/items/recent_posts' %>
```
## Configuring the number of items per page
To modify the number of items per page for the news items index without
affecting the archive page you must override the method in the controller that
sets `@items` for the index: `find_published_news_items`.
Currently the method body is:
```ruby
@items = Item.published.translated.page(params[:page])
```
The `page` convenience method needs to be replaced with `paginate` and
`per_page` passed as an option. Add a decorator for the items controller with
the following contents:
```ruby
module Refinery::News
ItemsController.class_eval do
def find_published_news_items
@items = Item.published.translated.paginate :page => params[:page],
:per_page => 8
end
end
end
```
## Customising the views
Type this command at your project root to override the default front end views:
$ rake refinery:override view=refinery/news/items/*
Copied view template file to app/views/refinery/news/items/_recent_posts.html.erb
Copied view template file to app/views/refinery/news/items/index.html.erb
Copied view template file to app/views/refinery/news/items/show.html.erb
etc.
## RSS (Really Simple Syndication)
To get RSS for your entire site, insert this into the head section of your layout after installing:
```erb
<%= auto_discovery_link_tag(:rss, refinery.news_items_url(:format => 'rss')) %>
```
## More Information
* Check out our [Website](http://refinerycms.com/)
* Refinery Documentation is available in the [guides](http://refinerycms.com/guides)
* Questions can be asked on our [Google Group](http://group.refinerycms.org)
* Questions can also be asked in our IRC room, [#refinerycms on freenode](irc://irc.freenode.net/refinerycms)
近期下载者:
相关文件:
收藏者: