refinerycms-news 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/.gitignore +3 -0
  2. data/.travis.yml +17 -0
  3. data/Gemfile +69 -0
  4. data/Guardfile +20 -0
  5. data/Rakefile +19 -0
  6. data/app/controllers/refinery/news/admin/items_controller.rb +11 -0
  7. data/app/controllers/refinery/news/items_controller.rb +50 -0
  8. data/app/helpers/refinery/news/items_helper.rb +51 -0
  9. data/app/models/refinery/news/item.rb +91 -0
  10. data/app/views/{admin/news_items → refinery/news/admin/items}/_form.html.erb +13 -8
  11. data/app/views/{admin/news_items/_news_item.html.erb → refinery/news/admin/items/_item.html.erb} +8 -8
  12. data/app/views/{admin/news_items → refinery/news/admin/items}/_locale_picker.html.erb +1 -1
  13. data/app/views/{admin/news_items → refinery/news/admin/items}/edit.html.erb +0 -0
  14. data/app/views/refinery/news/admin/items/index.html.erb +30 -0
  15. data/app/views/{admin/news_items → refinery/news/admin/items}/new.html.erb +0 -0
  16. data/app/views/{news_items → refinery/news/items}/_recent_posts.html.erb +2 -2
  17. data/app/views/refinery/news/items/archive.html.erb +17 -0
  18. data/app/views/refinery/news/items/index.html.erb +28 -0
  19. data/app/views/{news_items → refinery/news/items}/index.rss.builder +5 -5
  20. data/app/views/refinery/news/items/show.html.erb +20 -0
  21. data/app/views/refinery/news/items/widgets/_news_archive.html.erb +10 -0
  22. data/app/views/refinery/news/shared/_body_content_right.html.erb +5 -0
  23. data/app/views/refinery/news/shared/_item.html.erb +22 -0
  24. data/config/locales/bg.yml +37 -0
  25. data/config/locales/cs.yml +29 -28
  26. data/config/locales/de.yml +27 -27
  27. data/config/locales/en.yml +39 -29
  28. data/config/locales/es-MX.yml +26 -26
  29. data/config/locales/es.yml +29 -27
  30. data/config/locales/fr.yml +28 -28
  31. data/config/locales/it.yml +27 -27
  32. data/config/locales/jp.yml +36 -0
  33. data/config/locales/lv.yml +28 -26
  34. data/config/locales/nb.yml +27 -27
  35. data/config/locales/nl.yml +27 -27
  36. data/config/locales/pl.yml +37 -0
  37. data/config/locales/pt-BR.yml +28 -28
  38. data/config/locales/ru.yml +26 -26
  39. data/config/locales/sk.yml +28 -28
  40. data/config/locales/sl.yml +31 -29
  41. data/config/locales/zh-CN.yml +37 -0
  42. data/config/locales/zh-TW.yml +37 -0
  43. data/config/routes.rb +13 -5
  44. data/db/migrate/20110817203701_create_news_items.rb +23 -0
  45. data/db/migrate/20110817203702_add_external_url_to_news_items.rb +15 -0
  46. data/db/migrate/20110817203703_translate_news_items.rb +21 -0
  47. data/db/migrate/20110817203704_add_image_id_to_news_items.rb +13 -0
  48. data/db/migrate/20110817203705_add_expiration_date_to_news_items.rb +15 -0
  49. data/db/migrate/20110817203706_remove_image_id_and_external_url_from_news.rb +19 -0
  50. data/db/migrate/20120129230838_add_source_to_news_items.rb +16 -0
  51. data/db/migrate/20120129230839_translate_source.rb +16 -0
  52. data/db/migrate/20120228150250_add_slug_to_news_items.rb +5 -0
  53. data/db/seeds.rb +22 -0
  54. data/lib/generators/refinery/news_generator.rb +19 -0
  55. data/lib/refinery/news.rb +22 -0
  56. data/lib/refinery/news/engine.rb +23 -0
  57. data/lib/refinerycms-news.rb +1 -23
  58. data/readme.md +10 -8
  59. data/refinerycms-news.gemspec +20 -0
  60. data/spec/factories/news.rb +7 -0
  61. data/spec/models/refinery/news/item_spec.rb +91 -0
  62. data/spec/requests/manage_news_items_spec.rb +90 -0
  63. data/spec/requests/news_archive.rb +12 -0
  64. data/spec/requests/visit_news_items_spec.rb +37 -0
  65. data/spec/spec_helper.rb +56 -0
  66. data/tasks/rspec.rake +4 -0
  67. metadata +113 -40
  68. data/app/controllers/admin/news_items_controller.rb +0 -5
  69. data/app/controllers/news_items_controller.rb +0 -33
  70. data/app/models/news_item.rb +0 -46
  71. data/app/views/admin/news_items/index.html.erb +0 -30
  72. data/app/views/news_items/index.html.erb +0 -23
  73. data/app/views/news_items/show.html.erb +0 -15
  74. data/db/migrate/1_create_news_items.rb +0 -23
  75. data/db/migrate/2_add_external_url_to_news_items.rb +0 -15
  76. data/db/migrate/3_translate_news_items.rb +0 -24
  77. data/db/migrate/4_add_image_id_to_news_items.rb +0 -13
  78. data/db/migrate/5_add_expiration_date_to_news_items.rb +0 -15
  79. data/db/migrate/6_remove_image_id_and_external_url_from_news.rb +0 -19
  80. data/db/seeds/refinerycms_news.rb +0 -24
  81. data/features/manage_news_items.feature +0 -56
  82. data/features/step_definitions/news_steps.rb +0 -25
  83. data/features/support/factories.rb +0 -7
  84. data/features/support/paths.rb +0 -26
  85. data/features/visit_news_items.feature +0 -27
  86. data/lib/gemspec.rb +0 -29
  87. data/lib/generators/refinerycms_news_generator.rb +0 -8
  88. data/lib/news.rb +0 -9
  89. data/spec/models/news_item_spec.rb +0 -89
@@ -1,9 +1,9 @@
1
1
  <nav id="recent_news_items">
2
2
  <h2><%= t('.recent_posts') %></h2>
3
3
  <ul>
4
- <% @news_items.each do |item| %>
4
+ <% @items.each do |item| %>
5
5
  <li>
6
- <%= link_to item.title, news_item_url(item) %>
6
+ <%= link_to item.title, refinery.news_item_path(item) %>
7
7
  </li>
8
8
  <% end %>
9
9
  </ul>
@@ -0,0 +1,17 @@
1
+ <% content_for :title, "#{t('.news_item_archive_for', :date => @archive_date.strftime('%B %Y'))}" %>
2
+
3
+ <% content_for :body_content_left do %>
4
+ <h1><%= t('.news_item_archive_for', :date => @archive_date.strftime('%B %Y')) %></h1>
5
+ <% if @items.any? %>
6
+ <section id="news_items">
7
+ <%= render :partial => "/refinery/news/shared/item", :collection => @items %>
8
+ </section>
9
+ <% else %>
10
+ <p><%= t('.no_news_item_articles_posted', :date => @archive_date.strftime('%B %Y')) %></p>
11
+ <% end %>
12
+ <% end %>
13
+
14
+ <%= render :partial => '/refinery/news/shared/body_content_right' %>
15
+
16
+ <%= render :partial => "/refinery/content_page" %>
17
+ <% content_for :stylesheets, stylesheet_link_tag('refinery/news/frontend') %>
@@ -0,0 +1,28 @@
1
+ <% content_for :body_content_left do %>
2
+ <%=raw @page.content_for(Refinery::Pages.default_parts.first.to_sym) unless params[:page] %>
3
+
4
+ <% if @items.any? %>
5
+ <% @items.each do |item| %>
6
+ <article class="news_item_truncated">
7
+ <h2><%= link_to item.title, refinery.news_item_path(item) %></h2>
8
+ <p>
9
+ <small><%= t('.published') %> <%= l(item.publish_date, :format => :long) %></small>
10
+ </p>
11
+ <%= truncate item.body, :length => 200,
12
+ :omission => " ... #{link_to t('.read_more'), refinery.news_item_path(item)}",
13
+ :preserve_html_tags => true %>
14
+ </article>
15
+ <% end %>
16
+
17
+ <%= will_paginate @items %>
18
+ <% else %>
19
+ <p><em><%= t('.no_items_yet') %></em></p>
20
+ <% end %>
21
+ <% end -%>
22
+
23
+ <% content_for :body_content_right_prepend do -%>
24
+ <%= raw @page.content_for(::Refinery::Pages.default_parts.second.to_sym) %>
25
+ <% end if ::Refinery::Pages.default_parts.many? -%>
26
+ <%= render :partial => '/refinery/news/shared/body_content_right' %>
27
+
28
+ <%= render :partial => "/refinery/content_page" %>
@@ -3,23 +3,23 @@ xml.rss :version => "2.0", "xmlns:atom" => "http://www.w3.org/2005/Atom" do
3
3
  xml.channel do
4
4
  # Required to pass W3C validation.
5
5
  xml.atom :link, nil, {
6
- :href => news_items_url(:format => 'rss'),
6
+ :href => refinery.news_items_url(:format => 'rss'),
7
7
  :rel => 'self', :type => 'application/rss+xml'
8
8
  }
9
9
 
10
10
  # Feed basics.
11
11
  xml.title page_title
12
12
  xml.description @page[:body].to_s.gsub(/<\/?[^>]*>/, "") # .to_s protects from nil errors
13
- xml.link news_items_url(:format => 'rss')
13
+ xml.link refinery.news_items_url(:format => 'rss')
14
14
 
15
15
  # News items.
16
- @news_items.each do |news_item|
16
+ @items.each do |news_item|
17
17
  xml.item do
18
18
  xml.title news_item.title
19
- xml.link news_item_url(news_item)
19
+ xml.link refinery.news_item_url(news_item)
20
20
  xml.description truncate(news_item.body, :length => 200, :preserve_html_tags => true)
21
21
  xml.pubDate news_item.publish_date.to_s(:rfc822)
22
- xml.guid news_item_url(news_item)
22
+ xml.guid refinery.news_item_url(news_item)
23
23
  end
24
24
  end
25
25
  end
@@ -0,0 +1,20 @@
1
+ <% content_for :body_content_title, @item.title %>
2
+ <% content_for :body_content_left do %>
3
+ <article class="news_item">
4
+ <p>
5
+ <small><%= t('.published') %> <%= l(@item.publish_date, :format => :long) %></small>
6
+ </p>
7
+ <% if @item.source.present? %>
8
+ <p>
9
+ <small><%= t('.source') %> <%= @item.source %></small>
10
+ </p>
11
+ <% end %>
12
+ <%= @item.body.html_safe %>
13
+ <p>
14
+ <%= link_to t('.back_to_index'), refinery.news_items_path %>
15
+ </p>
16
+ </article>
17
+ <% end %>
18
+ <% content_for :body_content_right, render(:partial => 'recent_posts') %>
19
+
20
+ <%= render :partial => "/refinery/content_page" %>
@@ -0,0 +1,10 @@
1
+ <section id="news_archive_widget">
2
+ <h2><%= t('archives', :scope => 'refinery.news.shared') %></h2>
3
+ <nav>
4
+ <ul>
5
+ <% items.each do |item| %>
6
+ <li><%= news_item_archive_link(item) %></li>
7
+ <% end %>
8
+ </ul>
9
+ </nav>
10
+ </section>
@@ -0,0 +1,5 @@
1
+ <% content_for :body_content_right do %>
2
+ <%= yield(:body_content_right_prepend) %>
3
+ <%= news_item_archive_widget %>
4
+ <%= yield(:body_content_right_append) %>
5
+ <% end %>
@@ -0,0 +1,22 @@
1
+ <article class="item_post" id="<%= dom_id(item) %>">
2
+ <header>
3
+ <h1><%= link_to item.title, refinery.news_item_path(item) %></h1>
4
+ <section class='details'>
5
+ <time datetime="<%=l item.publish_date.to_date, :format => :default %>" class='posted_at'>
6
+ <%= t('created_at', :scope => 'refinery.news.shared.items', :when => l(item.publish_date.to_date, :format => :short)) %>
7
+ </time>
8
+ </section>
9
+ </header>
10
+ <section class='clearfix'>
11
+ <% if news_item_teaser_enabled? %>
12
+ <%= news_item_teaser(item) %>
13
+ <% else %>
14
+ <%= item.body.html_safe %>
15
+ <% end %>
16
+ </section>
17
+ <footer>
18
+ <p>
19
+ <%= link_to t('read_more', :scope => 'refinery.news.shared.items'), refinery.news_item_path(item) if news_item_teaser_enabled? %>
20
+ </p>
21
+ </footer>
22
+ </article>
@@ -0,0 +1,37 @@
1
+ bg:
2
+ refinery:
3
+ plugins:
4
+ refinerycms_news:
5
+ title: Новини
6
+ description: Осигурява опростена секция за новини
7
+ news:
8
+ admin:
9
+ item:
10
+ view_live_html: "Преглед на тази новина <br/><em>(ще се отвори се в нов прозорец)</em>"
11
+ edit: "Редакция на тази новина"
12
+ delete: "Премахване на тази новина завинаги"
13
+ published: Публикувано на
14
+ index:
15
+ actions: Действия
16
+ create: "Добавяне на новина"
17
+ item: Новини
18
+ no_items: "За съжаление нищо не бе намерено."
19
+ no_items_yet: 'Все още няма новини. Натиснете "Добавяне на новина", за да въведете новина.'
20
+ show:
21
+ back_to_index: "Обратно към всички новини"
22
+ published: Публикувано на
23
+ recent_posts:
24
+ recent_posts: Последни публикации
25
+ index:
26
+ published: Публикувано на
27
+ read_more: Цялата новина
28
+ no_items_yet: Все още няма публикувани новини.
29
+ activerecord:
30
+ attributes:
31
+ 'refinery/news/item':
32
+ title: Заглавие
33
+ body: Съдържание
34
+ publish_date: Дата на публикуване
35
+ expiration_date: Крайна дата
36
+ models:
37
+ 'refinery/news/item': Новина
@@ -1,36 +1,37 @@
1
1
  cs:
2
- plugins:
3
- refinerycms_news:
4
- title: Novinky
5
- description: Poskytuje jednoduchou správu novinek
6
- admin:
7
- news_items:
8
- news_item:
9
- view_live_html: "Zobrazit novinku v novém okně"
10
- edit: "Editovať novinku"
11
- delete: "Smazat novinku"
12
- published: Zveřejněna
2
+ refinery:
3
+ plugins:
4
+ refinerycms_news:
5
+ title: Novinky
6
+ description: Poskytuje jednoduchou správu novinek
7
+ news:
8
+ admin:
9
+ item:
10
+ view_live_html: "Zobrazit novinku v novém okně"
11
+ edit: "Editovať novinku"
12
+ delete: "Smazat novinku"
13
+ published: Zveřejněna
14
+ index:
15
+ actions: Možnosti
16
+ create: "Přidat novinku"
17
+ item: Novinka
18
+ no_items: "Litujeme, žádné výsledky nenalezeny."
19
+ no_items_yet: 'Momentálně nejsou žádné novinky. Klikni na "Přidat novinku" pro vytvoření první.'
20
+ show:
21
+ back_to_index: "Návrat na seznam novinek"
22
+ published: Zveřejněné
23
+ recent_posts:
24
+ recent_posts: Poslední příspěvky
13
25
  index:
14
- actions: Možnosti
15
- create: "Přidat novinku"
16
- news_item: Novinka
17
- no_items: "Litujeme, žádné výsledky nenalezeny."
18
- no_items_yet: 'Momentálně nejsou žádné novinky. Klikni na "Přidat novinku" pro vytvoření první.'
19
- news_items:
20
- show:
21
- back_to_index: "Návrat na seznam novinek"
22
- published: Zveřejněné
23
- recent_posts:
24
- recent_posts: Poslední příspěvky
25
- index:
26
- published: Zveřejněné
27
- read_more: Číst dále
28
- no_items_yet: Neexistují žádné záznamy novinek.
26
+ published: Zveřejněné
27
+ read_more: Číst dále
28
+ no_items_yet: Neexistují žádné záznamy novinek.
29
29
  activerecord:
30
30
  attributes:
31
- news_item:
31
+ 'refinery/news/item':
32
32
  title: Název
33
33
  body: Obsah
34
34
  publish_date: Datum zveřejnění
35
+ expiration_date: Datum vypršení platnosti
35
36
  models:
36
- news_item: Novinka
37
+ 'refinery/news/item': Novinka
@@ -1,36 +1,36 @@
1
1
  de:
2
- plugins:
3
- refinerycms_news:
4
- title: News
5
- description: Bietet einen einfachen Newsbereich an
6
- admin:
7
- news_items:
8
- news_item:
9
- view_live_html: "Diesen News-Eintrag live anschauen <br/><em>(Öffnet sich in eine neuen Fenster)</em>"
10
- edit: "Diesen News-Eintrag editieren"
11
- delete: "Diesen News-Eintrag endgültig löschen"
2
+ refinery:
3
+ plugins:
4
+ refinerycms_news:
5
+ title: News
6
+ description: Bietet einen einfachen Newsbereich an
7
+ news:
8
+ admin:
9
+ item:
10
+ view_live_html: "Diesen News-Eintrag live anschauen <br/><em>(Öffnet sich in eine neuen Fenster)</em>"
11
+ edit: "Diesen News-Eintrag editieren"
12
+ delete: "Diesen News-Eintrag endgültig löschen"
13
+ published: Veröffentlicht
14
+ index:
15
+ actions: Actions
16
+ create: "News-Eintrag hinzufügen"
17
+ item: News
18
+ no_items: "Entschuldigung, es wurde nichts gefunden."
19
+ no_items_yet: 'Es sind keine News-Einträge vorhanden. Klick auf "News-Eintrag hinzufügen" um den ersten Eintrag zu machen.'
20
+ show:
21
+ back_to_index: "Zurück zur Übersicht"
12
22
  published: Veröffentlicht
23
+ recent_posts:
24
+ recent_posts: Aktuelle Einträge
13
25
  index:
14
- actions: Actions
15
- create: "News-Eintrag hinzufügen"
16
- news_item: News
17
- no_items: "Entschuldigung, es wurde nichts gefunden."
18
- no_items_yet: 'Es sind keine News-Einträge vorhanden. Klick auf "News-Eintrag hinzufügen" um den ersten Eintrag zu machen.'
19
- news_items:
20
- show:
21
- back_to_index: "Zurück zur Übersicht"
22
- published: Veröffentlicht
23
- recent_posts:
24
- recent_posts: Aktuelle Einträge
25
- index:
26
- published: Veröffentlicht
27
- read_more: Weiterlesen
28
- no_items_yet: Zur Zeit gibt es keine News.
26
+ published: Veröffentlicht
27
+ read_more: Weiterlesen
28
+ no_items_yet: Zur Zeit gibt es keine News.
29
29
  activerecord:
30
30
  attributes:
31
- news_item:
31
+ 'refinery/news/item':
32
32
  title: Titel
33
33
  body: Inhalt
34
34
  publish_date: Veröffentlichungsdatum
35
35
  models:
36
- news_item: News-Eintrag
36
+ 'refinery/news/item': News-Eintrag
@@ -1,37 +1,47 @@
1
1
  en:
2
- plugins:
3
- refinerycms_news:
4
- title: News
5
- description: Provides a simple news section
6
- admin:
7
- news_items:
8
- news_item:
9
- view_live_html: "View this news item live <br/><em>(opens in a new window)</em>"
10
- edit: "Edit this news item"
11
- delete: "Remove this news item forever"
12
- published: Published
13
- index:
14
- actions: Actions
15
- create: "Add News Item"
16
- news_item: News
17
- no_items: "Sorry, no results found."
18
- no_items_yet: 'There are no news items yet. Click "Add News Item" to add your first news item.'
19
- news_items:
20
- show:
21
- back_to_index: "Back to all news"
22
- published: Published
23
- recent_posts:
24
- recent_posts: Recent Posts
25
- index:
26
- published: Published
27
- read_more: Read more
28
- no_items_yet: There are no news item entries yet.
2
+ refinery:
3
+ plugins:
4
+ refinerycms_news:
5
+ title: News
6
+ description: Provides a simple news section
7
+ news:
8
+ admin:
9
+ items:
10
+ item:
11
+ view_live_html: "View this news item live <br/><em>(opens in a new window)</em>"
12
+ edit: "Edit this news item"
13
+ delete: "Remove this news item forever"
14
+ published: Published
15
+ index:
16
+ create: "Add News Item"
17
+ item: News
18
+ no_items_yet: 'There are no news items yet. Click "Add News Item" to add your first news item.'
19
+ shared:
20
+ items:
21
+ created_at: 'Created at %{when}'
22
+ archives: Archives
23
+ items:
24
+ show:
25
+ back_to_index: "Back to all news"
26
+ published: Published
27
+ source: Source
28
+ recent_posts:
29
+ recent_posts: Recent Posts
30
+ index:
31
+ published: Published
32
+ read_more: Read more
33
+ no_items_yet: There are no news item entries yet.
34
+ source: Source
35
+ archive:
36
+ news_item_archive_for: 'Archive for %{date}'
37
+ no_news_articles_posted: 'There are no news articles posted for %{date}. Stay tuned.'
29
38
  activerecord:
30
39
  attributes:
31
- news_item:
40
+ 'refinery/news/item':
32
41
  title: Title
33
42
  body: Body
34
43
  publish_date: Publish date
35
44
  expiration_date: Expiration date
45
+ source: Source
36
46
  models:
37
- news_item: News Item
47
+ 'refinery/news/item': News Item
@@ -1,34 +1,34 @@
1
1
  es-MX:
2
- plugins:
3
- refinerycms_news:
4
- title: Noticias
5
- admin:
6
- news_items:
7
- news_item:
8
- view_live: "View this news item live <br/><em>(opens in a new window)</em>"
9
- edit: "Modificar esta noticia"
10
- delete: "Eliminar esta noticia"
2
+ refinery:
3
+ plugins:
4
+ refinerycms_news:
5
+ title: Noticias
6
+ news:
7
+ admin:
8
+ item:
9
+ view_live: "View this news item live <br/><em>(opens in a new window)</em>"
10
+ edit: "Modificar esta noticia"
11
+ delete: "Eliminar esta noticia"
12
+ index:
13
+ actions: Acciones
14
+ create: "Crear una noticia"
15
+ item: Noticias
16
+ no_items: "Lo sentimos no hay resultados."
17
+ no_items_yet: 'Aun no hay noticias. Haga click en "Crear una noticia" para agregar la primera noticia.'
18
+ show:
19
+ back_to_index: "Regresar a noticias"
20
+ published: Publicada
21
+ no_items: "Lo sentimos, aun no ha publicado noticias."
22
+ recent_posts:
23
+ recent_posts: Publicaciones recientes
11
24
  index:
12
- actions: Acciones
13
- create: "Crear una noticia"
14
- news_item: Noticias
15
- no_items: "Lo sentimos no hay resultados."
16
- no_items_yet: 'Aun no hay noticias. Haga click en "Crear una noticia" para agregar la primera noticia.'
17
- news_items:
18
- show:
19
- back_to_index: "Regresar a noticias"
20
- published: Publicada
21
- no_items: "Lo sentimos, aun no ha publicado noticias."
22
- recent_posts:
23
- recent_posts: Publicaciones recientes
24
- index:
25
- published: Publicada
26
- read_more: Leer mas
25
+ published: Publicada
26
+ read_more: Leer mas
27
27
  activerecord:
28
28
  attributes:
29
- news_item:
29
+ 'refinery/news/item':
30
30
  title: Título
31
31
  body: Contenido
32
32
  publish_date: Fecha de publicación
33
33
  models:
34
- news_item: Noticia
34
+ 'refinery/news/item': Noticia