refinerycms-news 0.9.6.1 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,29 @@
|
|
1
|
+
class NewsGenerator < Rails::Generator::NamedBase
|
2
|
+
|
3
|
+
def initialize(*runtime_args)
|
4
|
+
# set first argument to the table's name so that the user doesn't have to pass it in.
|
5
|
+
runtime_args[0] = ["news_items"]
|
6
|
+
super(*runtime_args)
|
7
|
+
end
|
8
|
+
|
9
|
+
def banner
|
10
|
+
"Usage: script/generate news"
|
11
|
+
end
|
12
|
+
|
13
|
+
def manifest
|
14
|
+
record do |m|
|
15
|
+
m.migration_template 'migration.rb', 'db/migrate',
|
16
|
+
:migration_file_name => "create_structure_for_news",
|
17
|
+
:assigns => {
|
18
|
+
:migration_name => "CreateStructureForNews",
|
19
|
+
:table_name => "news_items",
|
20
|
+
:attributes => [
|
21
|
+
Rails::Generator::GeneratedAttribute.new("title", "string"),
|
22
|
+
Rails::Generator::GeneratedAttribute.new("body", "text"),
|
23
|
+
Rails::Generator::GeneratedAttribute.new("publish_date", "datetime")
|
24
|
+
]
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end if defined?(Rails::Generator::NamedBase)
|
@@ -3,9 +3,10 @@ class <%= migration_name %> < ActiveRecord::Migration
|
|
3
3
|
def self.up
|
4
4
|
create_table :<%= table_name %> do |t|
|
5
5
|
<% attributes.each do |attribute| -%>
|
6
|
-
|
6
|
+
t.<%= attribute.type %> :<%= attribute.name %>
|
7
7
|
<% end -%>
|
8
|
-
|
8
|
+
t.timestamps
|
9
|
+
end
|
9
10
|
|
10
11
|
add_index :<%= table_name %>, :id
|
11
12
|
|
data/news.md
CHANGED
@@ -17,4 +17,7 @@ Your news section loads because you have a page in your site that is told to not
|
|
17
17
|
|
18
18
|
By default this page is called "News". Go to your "Pages" tab in the Refinery admin area and click the edit icon on "News". Now click on "Hide/Show Advanced Options" and you'll see that a "Custom URL" is set to ``/news``. Simply change this to nothing, or delete the "News" page.
|
19
19
|
|
20
|
-
You might also want to remove the News plugin from your backend view. To do that, you go to the "Users" tab in the Refinery admin area, edit your user, uncheck "News" from the list of plugins you can access.
|
20
|
+
You might also want to remove the News plugin from your backend view. To do that, you go to the "Users" tab in the Refinery admin area, edit your user, uncheck "News" from the list of plugins you can access.
|
21
|
+
|
22
|
+
To get RSS for your entire site, insert this into the head section of your layout after installing:
|
23
|
+
<%= auto_discovery_link_tag(:rss, news_items_url(:format => 'rss')) %>
|
data/rails/init.rb
CHANGED
metadata
CHANGED
@@ -5,9 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 9
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 0.9.6.1
|
8
|
+
- 7
|
9
|
+
version: 0.9.7
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Resolve Digital
|
@@ -17,7 +16,7 @@ autorequire:
|
|
17
16
|
bindir: bin
|
18
17
|
cert_chain: []
|
19
18
|
|
20
|
-
date: 2010-03-
|
19
|
+
date: 2010-03-12 00:00:00 +13:00
|
21
20
|
default_executable:
|
22
21
|
dependencies: []
|
23
22
|
|
@@ -44,8 +43,8 @@ files:
|
|
44
43
|
- app/views/news_items/show.html.erb
|
45
44
|
- config/locale/en.yml
|
46
45
|
- config/routes.rb
|
47
|
-
-
|
48
|
-
-
|
46
|
+
- generators/news/news_generator.rb
|
47
|
+
- generators/news/templates/migration.rb
|
49
48
|
- lib/news.rb
|
50
49
|
- news.md
|
51
50
|
- rails/init.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
class NewsGenerator < Rails::Generator::NamedBase
|
2
|
-
|
3
|
-
def manifest
|
4
|
-
record do |m|
|
5
|
-
m.migration_template 'migration.rb', 'db/migrate', :assigns => setup_news_migration_assigns, :migration_file_name => "create_structure_for_news"
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
def setup_news_migration_assigns
|
11
|
-
returning(assigns = {}) do
|
12
|
-
assigns[:migration_name] = "CreateStructureForNews"
|
13
|
-
assigns[:table_name] = "news_items"
|
14
|
-
|
15
|
-
# add fields for migration
|
16
|
-
assigns[:attributes] = []
|
17
|
-
[%w(title string), %w(body text), %w(publish_date datetime)].each do |attribute|
|
18
|
-
assigns[:attributes] << Rails::Generator::GeneratedAttribute.new(attribute[0], attribute[1])
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|