refinerycms-global-content-blocks 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/app/controllers/refinery/global_content_blocks/admin/global_content_blocks_controller.rb +13 -0
  3. data/app/controllers/refinery/global_content_blocks/global_content_blocks_controller.rb +34 -0
  4. data/app/models/refinery/global_content_blocks/global_content_block.rb +12 -0
  5. data/app/views/refinery/global_content_blocks/admin/global_content_blocks/_actions.html.erb +25 -0
  6. data/app/views/refinery/global_content_blocks/admin/global_content_blocks/_form.html.erb +30 -0
  7. data/app/views/refinery/global_content_blocks/admin/global_content_blocks/_global_content_block.html.erb +16 -0
  8. data/app/views/refinery/global_content_blocks/admin/global_content_blocks/_global_content_blocks.html.erb +2 -0
  9. data/app/views/refinery/global_content_blocks/admin/global_content_blocks/_records.html.erb +16 -0
  10. data/app/views/refinery/global_content_blocks/admin/global_content_blocks/_sortable_list.html.erb +5 -0
  11. data/app/views/refinery/global_content_blocks/admin/global_content_blocks/edit.html.erb +1 -0
  12. data/app/views/refinery/global_content_blocks/admin/global_content_blocks/index.html.erb +7 -0
  13. data/app/views/refinery/global_content_blocks/admin/global_content_blocks/new.html.erb +1 -0
  14. data/app/views/refinery/global_content_blocks/global_content_blocks/index.html.erb +11 -0
  15. data/app/views/refinery/global_content_blocks/global_content_blocks/show.html.erb +33 -0
  16. data/config/locales/cs.yml +28 -0
  17. data/config/locales/en.yml +28 -0
  18. data/config/locales/es.yml +29 -0
  19. data/config/locales/fr.yml +28 -0
  20. data/config/locales/it.yml +28 -0
  21. data/config/locales/nb.yml +28 -0
  22. data/config/locales/nl.yml +28 -0
  23. data/config/locales/sk.yml +28 -0
  24. data/config/locales/tr.yml +28 -0
  25. data/config/locales/zh-CN.yml +30 -0
  26. data/config/routes.rb +14 -0
  27. data/db/migrate/1_create_global_content_blocks_global_content_blocks.rb +27 -0
  28. data/db/seeds.rb +25 -0
  29. data/lib/generators/refinery/global_content_blocks_generator.rb +19 -0
  30. data/lib/refinery/global_content_blocks.rb +21 -0
  31. data/lib/refinery/global_content_blocks/engine.rb +26 -0
  32. data/lib/refinerycms-global_content_blocks.rb +1 -0
  33. data/lib/tasks/refinery/global_content_blocks.rake +13 -0
  34. data/readme.md +29 -0
  35. metadata +89 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f67841aecf850ea3ceb1a095c5e5273fa0ea41c4
4
+ data.tar.gz: e021c4f03e186434f8913dab6ad4e603f0b3a28b
5
+ SHA512:
6
+ metadata.gz: bc555ee4bcc16120fad024e14daf9b5219236dabe1bd6e35395f09e6004e096d995d7a180c4c6b3ad046174bb30a336dd9fd2ddba3b7a0b8cf15ad8efe51c49a
7
+ data.tar.gz: c3f2ce2bcd31d25e564e0851aefa75a6264601566279aafb1235e6a698e55a6cc1051b7c3e0b457a454221365b30d3ada3123068ddb4e48bf058682fb1822d09
@@ -0,0 +1,13 @@
1
+ module Refinery
2
+ module GlobalContentBlocks
3
+ module Admin
4
+ class GlobalContentBlocksController < ::Refinery::AdminController
5
+
6
+ crudify :'refinery/global_content_blocks/global_content_block',
7
+ :title_attribute => 'name',
8
+ :xhr_paging => true
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,34 @@
1
+ module Refinery
2
+ module GlobalContentBlocks
3
+ class GlobalContentBlocksController < ::ApplicationController
4
+
5
+ before_filter :find_all_global_content_blocks
6
+ before_filter :find_page
7
+
8
+ def index
9
+ # you can use meta fields from your model instead (e.g. browser_title)
10
+ # by swapping @page for @global_content_block in the line below:
11
+ present(@page)
12
+ end
13
+
14
+ def show
15
+ @global_content_block = GlobalContentBlock.find(params[:id])
16
+
17
+ # you can use meta fields from your model instead (e.g. browser_title)
18
+ # by swapping @page for @global_content_block in the line below:
19
+ present(@page)
20
+ end
21
+
22
+ protected
23
+
24
+ def find_all_global_content_blocks
25
+ @global_content_blocks = GlobalContentBlock.order('position ASC')
26
+ end
27
+
28
+ def find_page
29
+ @page = ::Refinery::Page.where(:link_url => "/global_content_blocks").first
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,12 @@
1
+ module Refinery
2
+ module GlobalContentBlocks
3
+ class GlobalContentBlock < Refinery::Core::BaseModel
4
+ self.table_name = 'refinery_global_content_blocks'
5
+
6
+ attr_accessible :name, :content, :position
7
+
8
+ validates_presence_of :name, :content
9
+ validates_uniqueness_of :name
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,25 @@
1
+ <ul>
2
+ <% if ::Refinery::GlobalContentBlocks::Admin::GlobalContentBlocksController.searchable? %>
3
+ <li>
4
+ <%= render '/refinery/admin/search', :url => refinery.global_content_blocks_admin_global_content_blocks_path %>
5
+ </li>
6
+ <% end %>
7
+ <li>
8
+ <%= link_to t('.create_new'), refinery.new_global_content_blocks_admin_global_content_block_path,
9
+ :class => "add_icon" %>
10
+ </li>
11
+ <% if !searching? && ::Refinery::GlobalContentBlocks::Admin::GlobalContentBlocksController.sortable? && ::Refinery::GlobalContentBlocks::GlobalContentBlock.many? %>
12
+ <li>
13
+ <%= link_to t('.reorder', :what => "Global Content Blocks"),
14
+ refinery.global_content_blocks_admin_global_content_blocks_path,
15
+ :id => "reorder_action",
16
+ :class => "reorder_icon" %>
17
+
18
+ <%= link_to t('.reorder_done', :what => "Global Content Blocks"),
19
+ refinery.global_content_blocks_admin_global_content_blocks_path,
20
+ :id => "reorder_action_done",
21
+ :style => "display: none;",
22
+ :class => "reorder_icon" %>
23
+ </li>
24
+ <% end %>
25
+ </ul>
@@ -0,0 +1,30 @@
1
+ <%= form_for [refinery, :global_content_blocks_admin, @global_content_block] do |f| -%>
2
+ <%= render '/refinery/admin/error_messages',
3
+ :object => @global_content_block,
4
+ :include_object_name => true %>
5
+
6
+ <div class='field'>
7
+ <%= f.label :name -%>
8
+ <%= f.text_field :name, :class => 'larger widest' -%>
9
+ </div>
10
+
11
+ <div class='field'>
12
+ <%= render '/refinery/admin/wysiwyg',
13
+ :f => f,
14
+ :fields => [:content],
15
+ :object => "global_content_blocks/global_content_block" -%>
16
+ </div>
17
+
18
+ <%= render '/refinery/admin/form_actions', :f => f,
19
+ :continue_editing => false,
20
+ :delete_title => t('delete', :scope => 'refinery.global_content_blocks.admin.global_content_blocks.global_content_block'),
21
+ :delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @global_content_block.name) -%>
22
+ <% end -%>
23
+
24
+ <% content_for :javascripts do -%>
25
+ <script>
26
+ $(document).ready(function(){
27
+ page_options.init(false, '', '');
28
+ });
29
+ </script>
30
+ <% end -%>
@@ -0,0 +1,16 @@
1
+ <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(global_content_block) -%>">
2
+ <span class='title'>
3
+ <%= global_content_block.name %>
4
+
5
+ </span>
6
+ <span class='actions'>
7
+
8
+ <%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_global_content_blocks_admin_global_content_block_path(global_content_block),
9
+ :title => t('.edit') %>
10
+ <%= link_to refinery_icon_tag("delete.png"), refinery.global_content_blocks_admin_global_content_block_path(global_content_block),
11
+ :class => "cancel confirm-delete",
12
+ :title => t('.delete'),
13
+ :confirm => t('message', :scope => 'refinery.admin.delete', :title => global_content_block.name),
14
+ :method => :delete %>
15
+ </span>
16
+ </li>
@@ -0,0 +1,2 @@
1
+ <%= will_paginate @global_content_blocks if Refinery::GlobalContentBlocks::Admin::GlobalContentBlocksController.pageable? %>
2
+ <%= render 'sortable_list' %>
@@ -0,0 +1,16 @@
1
+ <%= render 'refinery/admin/search_header', :url => refinery.global_content_blocks_admin_global_content_blocks_path %>
2
+ <div class='pagination_container'>
3
+ <% if @global_content_blocks.any? %>
4
+ <%= render 'global_content_blocks' %>
5
+ <% else %>
6
+ <p>
7
+ <% unless searching? %>
8
+ <strong>
9
+ <%= t('.no_items_yet') %>
10
+ </strong>
11
+ <% else %>
12
+ <%= t('no_results', :scope => 'refinery.admin.search') %>
13
+ <% end %>
14
+ </p>
15
+ <% end %>
16
+ </div>
@@ -0,0 +1,5 @@
1
+ <ul id='sortable_list'>
2
+ <%= render :partial => 'global_content_block', :collection => @global_content_blocks %>
3
+ </ul>
4
+ <%= render '/refinery/admin/sortable_list',
5
+ :continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true %>
@@ -0,0 +1,7 @@
1
+ <section id='records'>
2
+ <%= render 'records' %>
3
+ </section>
4
+ <aside id='actions'>
5
+ <%= render 'actions' %>
6
+ </aside>
7
+ <%= render '/refinery/admin/make_sortable', :tree => false if !searching? and ::Refinery::GlobalContentBlocks::Admin::GlobalContentBlocksController.sortable? and ::Refinery::GlobalContentBlocks::GlobalContentBlock.many? %>
@@ -0,0 +1,11 @@
1
+ <% content_for :body do %>
2
+ <ul id="global_content_blocks">
3
+ <% @global_content_blocks.each do |global_content_block| %>
4
+ <li>
5
+ <%= link_to global_content_block.name, refinery.global_content_blocks_global_content_block_path(global_content_block) %>
6
+ </li>
7
+ <% end %>
8
+ </ul>
9
+ <% end %>
10
+
11
+ <%= render '/refinery/content_page' %>
@@ -0,0 +1,33 @@
1
+ <% content_for :body_content_title do %>
2
+ <%= @global_content_block.name %>
3
+ <% end %>
4
+
5
+ <% content_for :body do %>
6
+ <section>
7
+ <h1>Name</h1>
8
+ <p>
9
+ <%=raw @global_content_block.name %>
10
+ </p>
11
+ </section>
12
+ <section>
13
+ <h1>Content</h1>
14
+ <p>
15
+ <%=raw @global_content_block.content %>
16
+ </p>
17
+ </section>
18
+ <% end %>
19
+
20
+ <% content_for :side_body do %>
21
+ <aside>
22
+ <h2><%= t('.other') %></h2>
23
+ <ul id="global_content_blocks">
24
+ <% @global_content_blocks.each do |global_content_block| %>
25
+ <li>
26
+ <%= link_to global_content_block.name, refinery.global_content_blocks_global_content_block_path(global_content_block) %>
27
+ </li>
28
+ <% end %>
29
+ </ul>
30
+ </aside>
31
+ <% end %>
32
+
33
+ <%= render '/refinery/content_page' %>
@@ -0,0 +1,28 @@
1
+ cs:
2
+ refinery:
3
+ plugins:
4
+ global_content_blocks:
5
+ title: Global Content Blocks
6
+ global_content_blocks:
7
+ admin:
8
+ global_content_blocks:
9
+ actions:
10
+ create_new: Přidat Global Content Block
11
+ reorder: Řadit Global Content Blocks
12
+ reorder_done: Konec řazení Global Content Blocks
13
+ records:
14
+ title: Global Content Blocks
15
+ sorry_no_results: Litujeme, ale nebyly nalezny žádné výsledky.
16
+ no_items_yet: Zatím nebyly vytvořeny žádné Global Content Blocks. Zvolte "Přidat Global Content Block" pro přidání prvního global content block.
17
+ global_content_block:
18
+ view_live_html: Zobrazit náhled global content block<br/><em>(otevře se v novém okně)</em>
19
+ edit: Upravit global content block
20
+ delete: Smazat global content block
21
+ global_content_blocks:
22
+ show:
23
+ other: Další Global Content Blocks
24
+ activerecord:
25
+ attributes:
26
+ 'refinery/global_content_blocks/global_content_block':
27
+ name: Name
28
+ content: Content
@@ -0,0 +1,28 @@
1
+ en:
2
+ refinery:
3
+ plugins:
4
+ global_content_blocks:
5
+ title: Global Content Blocks
6
+ global_content_blocks:
7
+ admin:
8
+ global_content_blocks:
9
+ actions:
10
+ create_new: Add New Global Content Block
11
+ reorder: Reorder Global Content Blocks
12
+ reorder_done: Done Reordering Global Content Blocks
13
+ records:
14
+ title: Global Content Blocks
15
+ sorry_no_results: Sorry! There are no results found.
16
+ no_items_yet: There are no Global Content Blocks yet. Click "Add New Global Content Block" to add your first global content block.
17
+ global_content_block:
18
+ view_live_html: View this global content block live <br/><em>(opens in a new window)</em>
19
+ edit: Edit this global content block
20
+ delete: Remove this global content block forever
21
+ global_content_blocks:
22
+ show:
23
+ other: Other Global Content Blocks
24
+ activerecord:
25
+ attributes:
26
+ 'refinery/global_content_blocks/global_content_block':
27
+ name: Name
28
+ content: Content
@@ -0,0 +1,29 @@
1
+ es:
2
+ refinery:
3
+ plugins:
4
+ global_content_blocks:
5
+ title: Global Content Blocks
6
+ # article: masculino/femenino
7
+ global_content_blocks:
8
+ admin:
9
+ global_content_blocks:
10
+ actions:
11
+ create_new: Crear nuevo global content block
12
+ reorder: Reordenar global content blocks
13
+ reorder_done: Reordenación de global content blocks completada
14
+ records:
15
+ title: Global Content Blocks
16
+ sorry_no_results: Lo siento, no hay resultados
17
+ no_items_yet: No hay global content blocks todavía. Pulsa en "Crear nuevo Global Content Block" para crear tu primer global content block.
18
+ global_content_block:
19
+ view_live_html: Ver este global content block como abierto al público <br/><em>(abre en ventana nueva)</em>
20
+ edit: Editar este global content block
21
+ delete: Borrar este global content block para siempre
22
+ global_content_blocks:
23
+ show:
24
+ other: Otros global content blocks
25
+ activerecord:
26
+ attributes:
27
+ 'refinery/global_content_blocks/global_content_block':
28
+ name: Name
29
+ content: Content
@@ -0,0 +1,28 @@
1
+ fr:
2
+ refinery:
3
+ plugins:
4
+ global_content_blocks:
5
+ title: Global Content Blocks
6
+ global_content_blocks:
7
+ admin:
8
+ global_content_blocks:
9
+ actions:
10
+ create_new: Créer un(e) nouve(au/l/lle) Global Content Block
11
+ reorder: Réordonner les Global Content Blocks
12
+ reorder_done: Fin de réordonnancement des Global Content Blocks
13
+ records:
14
+ title: Global Content Blocks
15
+ sorry_no_results: "Désolé ! Aucun résultat."
16
+ no_items_yet: 'Il n''y a actuellement aucun(e) Global Content Block. Cliquer sur "Créer un(e) nouve(au/l/lle) Global Content Block" pour créer votre premi(er/ère) global content block.'
17
+ global_content_block:
18
+ view_live_html: Voir ce(t/tte) global content block <br/><em>(Ouvre une nouvelle fenêtre)</em>
19
+ edit: Modifier ce(t/tte) global content block
20
+ delete: Supprimer définitivement ce(t/tte) global content block
21
+ global_content_blocks:
22
+ show:
23
+ other: Autres Global Content Blocks
24
+ activerecord:
25
+ attributes:
26
+ 'refinery/global_content_blocks/global_content_block':
27
+ name: Name
28
+ content: Content
@@ -0,0 +1,28 @@
1
+ it:
2
+ refinery:
3
+ plugins:
4
+ global_content_blocks:
5
+ title: Global Content Blocks
6
+ global_content_blocks:
7
+ admin:
8
+ global_content_blocks:
9
+ actions:
10
+ create_new: Aggiungi Nuovo Global Content Block
11
+ reorder: Riordina Global Content Blocks
12
+ reorder_done: Termina il Riordino di Global Content Blocks
13
+ records:
14
+ title: Global Content Blocks
15
+ sorry_no_results: "Spiacenti! Nessun risultato trovato"
16
+ no_items_yet: Non ci sono ancora Global Content Blocks. Clicca "Aggiungi Nuovo Global Content Block" per aggiungere il tuo primo global content block.
17
+ global_content_block:
18
+ view_live_html: Guarda live questo global content block <br/><em>(apre una nuova finestra)</em>
19
+ edit: Modifica questo global content block
20
+ delete: Rimuovi per sempre questo global content block
21
+ global_content_blocks:
22
+ show:
23
+ other: Altri Global Content Blocks
24
+ activerecord:
25
+ attributes:
26
+ 'refinery/global_content_blocks/global_content_block':
27
+ name: Name
28
+ content: Content
@@ -0,0 +1,28 @@
1
+ nb:
2
+ refinery:
3
+ plugins:
4
+ global_content_blocks:
5
+ title: Global Content Blocks
6
+ global_content_blocks:
7
+ admin:
8
+ global_content_blocks:
9
+ actions:
10
+ create_new: Lag en ny Global Content Block
11
+ reorder: Endre rekkefølgen på Global Content Blocks
12
+ reorder_done: Ferdig å endre rekkefølgen Global Content Blocks
13
+ records:
14
+ title: Global Content Blocks
15
+ sorry_no_results: Beklager! Vi fant ikke noen resultater.
16
+ no_items_yet: Det er ingen Global Content Blocks enda. Klikk på "Lag en ny Global Content Block" for å legge til din første global content block.
17
+ global_content_block:
18
+ view_live_html: Vis hvordan denne global content block ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
19
+ edit: Rediger denne global content block
20
+ delete: Fjern denne global content block permanent
21
+ global_content_blocks:
22
+ show:
23
+ other: Andre Global Content Blocks
24
+ activerecord:
25
+ attributes:
26
+ 'refinery/global_content_blocks/global_content_block':
27
+ name: Name
28
+ content: Content
@@ -0,0 +1,28 @@
1
+ nl:
2
+ refinery:
3
+ plugins:
4
+ global_content_blocks:
5
+ title: Global Content Blocks
6
+ global_content_blocks:
7
+ admin:
8
+ global_content_blocks:
9
+ actions:
10
+ create_new: Nieuwe Global Content Block toevoegen
11
+ reorder: De volgorde van de Global Content Blocks wijzigen
12
+ reorder_done: Klaar met het wijzingen van de van de Global Content Block-volgorde
13
+ records:
14
+ title: Global Content Blocks
15
+ sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
16
+ no_items_yet: Er zijn nog geen Global Content Blocks. Druk op 'Nieuwe Global Content Block toevoegen' om de eerste toe te voegen.
17
+ global_content_block:
18
+ view_live_html: Deze global content block op de website bekijken <br/><em>(opent in een nieuw venster)</em>
19
+ edit: Bewerk deze global content block
20
+ delete: Deze global content block definitief verwijderen
21
+ global_content_blocks:
22
+ show:
23
+ other: Andere Global Content Blocks
24
+ activerecord:
25
+ attributes:
26
+ 'refinery/global_content_blocks/global_content_block':
27
+ name: Name
28
+ content: Content
@@ -0,0 +1,28 @@
1
+ sk:
2
+ refinery:
3
+ plugins:
4
+ global_content_blocks:
5
+ title: Global Content Blocks
6
+ global_content_blocks:
7
+ admin:
8
+ global_content_blocks:
9
+ actions:
10
+ create_new: Pridať Global Content Block
11
+ reorder: Preusporiadať Global Content Blocks
12
+ reorder_done: Koniec radenia Global Content Blocks
13
+ records:
14
+ title: Global Content Blocks
15
+ sorry_no_results: Ľutujeme, ale neboli nájdené žiadne výsledky.
16
+ no_items_yet: Nie sú vytvorené žiadne Global Content Blocks. Kliknite na "Pridať Global Content Block" pre pridanie prvého global content block.
17
+ global_content_block:
18
+ view_live_html: Zobraziť náhľad global content block<br/><em>(otvorí sa v novom okne)</em>
19
+ edit: Upraviť global content block
20
+ delete: Zmazať global content block
21
+ global_content_blocks:
22
+ show:
23
+ other: Daľšie Global Content Blocks
24
+ activerecord:
25
+ attributes:
26
+ 'refinery/global_content_blocks/global_content_block':
27
+ name: Name
28
+ content: Content
@@ -0,0 +1,28 @@
1
+ tr:
2
+ refinery:
3
+ plugins:
4
+ global_content_blocks:
5
+ title: Global Content Blocks
6
+ global_content_blocks:
7
+ admin:
8
+ global_content_blocks:
9
+ actions:
10
+ create_new: Yeni Ekle Global Content Block
11
+ reorder: Tekrar sirala Global Content Blocks
12
+ reorder_done: Tekrar siralama tamamlandiGlobal Content Blocks
13
+ records:
14
+ title: Global Content Blocks
15
+ sorry_no_results: Uzgunum! Herhangi bir sonuc bulunamadi.
16
+ no_items_yet: Herhangi bir Global Content Blocks yok henuz. Tikla "Yeni Ekle Global Content Block" eklemek senin ilk global content block.
17
+ global_content_block:
18
+ view_live_html: Bunu canlu global content block goruntule <br/><em>(yeni bir pencerede acar)</em>
19
+ edit: Bunu Duzenle global content block
20
+ delete: Bunu Sil global content block sonsuza dek
21
+ global_content_blocks:
22
+ show:
23
+ other: Diger Global Content Blocks
24
+ activerecord:
25
+ attributes:
26
+ 'refinery/global_content_blocks/global_content_block':
27
+ name: Name
28
+ content: Content
@@ -0,0 +1,30 @@
1
+ zh-CN:
2
+ refinery:
3
+ plugins:
4
+ global_content_blocks:
5
+ title: Global Content Blocks
6
+ global_content_blocks:
7
+ admin:
8
+ global_content_blocks:
9
+ actions:
10
+ create_new: 建立新的 Global Content Block
11
+ reorder: 对 Global Content Blocks 重新排序
12
+ reorder_done: 对 Global Content Blocks 的重新排序结束
13
+ records:
14
+ title: Global Content Blocks
15
+ sorry_no_results: 对不起,未找到结果。 #Sorry! There are no results found.
16
+
17
+ # There are no Global Content Blocks yet. Click "Add New Global Content Block" to add your first global content block.
18
+ no_items_yet: 目前没有 Global Content Blocks . 点击 "Add New Global Content Block" 创建一个global content block.
19
+ global_content_block:
20
+ view_live_html: 查看 global content block 的最新内容.<br/><em>(新窗口中打开)</em>
21
+ edit: 编辑 global content block
22
+ delete: 永久删除 global content block
23
+ global_content_blocks:
24
+ show:
25
+ other: 其他 Global Content Blocks
26
+ activerecord:
27
+ attributes:
28
+ 'refinery/global_content_blocks/global_content_block':
29
+ name: Name
30
+ content: Content
@@ -0,0 +1,14 @@
1
+ Refinery::Core::Engine.routes.draw do
2
+
3
+ # Admin routes
4
+ namespace :global_content_blocks, :path => '' do
5
+ namespace :admin, :path => Refinery::Core.backend_route do
6
+ resources :global_content_blocks, :except => :show do
7
+ collection do
8
+ post :update_positions
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ end
@@ -0,0 +1,27 @@
1
+ class CreateGlobalContentBlocksGlobalContentBlocks < ActiveRecord::Migration
2
+
3
+ def up
4
+ create_table :refinery_global_content_blocks do |t|
5
+ t.string :name
6
+ t.text :content
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+
12
+ end
13
+
14
+ def down
15
+ if defined?(::Refinery::UserPlugin)
16
+ ::Refinery::UserPlugin.destroy_all({:name => "refinerycms-global_content_blocks"})
17
+ end
18
+
19
+ if defined?(::Refinery::Page)
20
+ ::Refinery::Page.delete_all({:link_url => "/global_content_blocks/global_content_blocks"})
21
+ end
22
+
23
+ drop_table :refinery_global_content_blocks
24
+
25
+ end
26
+
27
+ end
@@ -0,0 +1,25 @@
1
+ Refinery::I18n.frontend_locales.each do |lang|
2
+ I18n.locale = lang
3
+
4
+ if defined?(Refinery::User)
5
+ Refinery::User.all.each do |user|
6
+ if user.plugins.where(:name => 'refinerycms-global_content_blocks').blank?
7
+ user.plugins.create(:name => 'refinerycms-global_content_blocks',
8
+ :position => (user.plugins.maximum(:position) || -1) +1)
9
+ end
10
+ end
11
+ end
12
+
13
+ url = "/global_content_blocks"
14
+ if defined?(Refinery::Page) && Refinery::Page.where(:link_url => url).empty?
15
+ page = Refinery::Page.create(
16
+ :title => 'Global Content Blocks',
17
+ :link_url => url,
18
+ :deletable => false,
19
+ :menu_match => "^#{url}(\/|\/.+?|)$"
20
+ )
21
+ Refinery::Pages.default_parts.each_with_index do |default_page_part, index|
22
+ page.parts.create(:title => default_page_part, :body => nil, :position => index)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,19 @@
1
+ module Refinery
2
+ class GlobalContentBlocksGenerator < Rails::Generators::Base
3
+
4
+ def rake_db
5
+ rake "refinery_global_content_blocks:install:migrations"
6
+ end
7
+
8
+ def append_load_seed_data
9
+ create_file 'db/seeds.rb' unless File.exists?(File.join(destination_root, 'db', 'seeds.rb'))
10
+ append_file 'db/seeds.rb', :verbose => true do
11
+ <<-EOH
12
+
13
+ # Added by Refinery CMS GlobalContentBlocks extension
14
+ Refinery::GlobalContentBlocks::Engine.load_seed
15
+ EOH
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ require 'refinerycms-core'
2
+
3
+ module Refinery
4
+ autoload :GlobalContentBlocksGenerator, 'generators/refinery/global_content_blocks_generator'
5
+
6
+ module GlobalContentBlocks
7
+ require 'refinery/global_content_blocks/engine'
8
+
9
+ class << self
10
+ attr_writer :root
11
+
12
+ def root
13
+ @root ||= Pathname.new(File.expand_path('../../../', __FILE__))
14
+ end
15
+
16
+ def factory_paths
17
+ @factory_paths ||= [ root.join('spec', 'factories').to_s ]
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,26 @@
1
+ module Refinery
2
+ module GlobalContentBlocks
3
+ class Engine < Rails::Engine
4
+ extend Refinery::Engine
5
+ isolate_namespace Refinery::GlobalContentBlocks
6
+
7
+ engine_name :refinery_global_content_blocks
8
+
9
+ initializer "register refinerycms_global_content_blocks plugin" do
10
+ Refinery::Plugin.register do |plugin|
11
+ plugin.name = "global_content_blocks"
12
+ plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.global_content_blocks_admin_global_content_blocks_path }
13
+ plugin.pathname = root
14
+ plugin.activity = {
15
+ :class_name => :'refinery/global_content_blocks/global_content_block',
16
+ :title => 'name'
17
+ }
18
+ end
19
+ end
20
+
21
+ config.after_initialize do
22
+ Refinery.register_extension(Refinery::GlobalContentBlocks)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1 @@
1
+ require 'refinery/global_content_blocks'
@@ -0,0 +1,13 @@
1
+ namespace :refinery do
2
+
3
+ namespace :global_content_blocks do
4
+
5
+ # call this task by running: rake refinery:global_content_blocks:my_task
6
+ # desc "Description of my task below"
7
+ # task :my_task => :environment do
8
+ # # add your logic here
9
+ # end
10
+
11
+ end
12
+
13
+ end
@@ -0,0 +1,29 @@
1
+ refinerycms_global_content_blocks
2
+ =================================
3
+
4
+ Small RefineryCMS engine for adding global content blocks. Something like this is quick to create yourself, but putting it out there to save anyone a few minutes.
5
+
6
+ My RefineryCMS template gem is current in development, when it is ready this gem will be of more use, allowing CMS users to place global content blocks in templates much like CMSMS does.
7
+
8
+
9
+ Installation
10
+ ==
11
+
12
+ Add the gem to your gemfile
13
+
14
+ $ gem 'refinerycms_global_content_blocks'
15
+
16
+ Then run bundle install and restart your server
17
+
18
+ Useage
19
+ ==
20
+
21
+ In the admin area you will be able to see a global content block engine.
22
+
23
+ The engine comes with a WYSIWYG editor so you can put HTML in the global content block.
24
+
25
+ Then render the global content block in your layout/view
26
+
27
+ $ <$= Refinery::GlobalContentBlocks::GlobalContentBlock.find_by_name("name").content.html_safe -%>
28
+
29
+
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: refinerycms-global-content-blocks
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Cristian Tountzis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: refinerycms-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 2.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 2.1.0
27
+ description: Ruby on Rails Global Content Blocks extension for Refinery CMS
28
+ email: cristian.tountzis@gmail.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - app/controllers/refinery/global_content_blocks/admin/global_content_blocks_controller.rb
34
+ - app/controllers/refinery/global_content_blocks/global_content_blocks_controller.rb
35
+ - app/models/refinery/global_content_blocks/global_content_block.rb
36
+ - app/views/refinery/global_content_blocks/admin/global_content_blocks/_actions.html.erb
37
+ - app/views/refinery/global_content_blocks/admin/global_content_blocks/_form.html.erb
38
+ - app/views/refinery/global_content_blocks/admin/global_content_blocks/_global_content_block.html.erb
39
+ - app/views/refinery/global_content_blocks/admin/global_content_blocks/_global_content_blocks.html.erb
40
+ - app/views/refinery/global_content_blocks/admin/global_content_blocks/_records.html.erb
41
+ - app/views/refinery/global_content_blocks/admin/global_content_blocks/_sortable_list.html.erb
42
+ - app/views/refinery/global_content_blocks/admin/global_content_blocks/edit.html.erb
43
+ - app/views/refinery/global_content_blocks/admin/global_content_blocks/index.html.erb
44
+ - app/views/refinery/global_content_blocks/admin/global_content_blocks/new.html.erb
45
+ - app/views/refinery/global_content_blocks/global_content_blocks/index.html.erb
46
+ - app/views/refinery/global_content_blocks/global_content_blocks/show.html.erb
47
+ - config/locales/cs.yml
48
+ - config/locales/en.yml
49
+ - config/locales/es.yml
50
+ - config/locales/fr.yml
51
+ - config/locales/it.yml
52
+ - config/locales/nb.yml
53
+ - config/locales/nl.yml
54
+ - config/locales/sk.yml
55
+ - config/locales/tr.yml
56
+ - config/locales/zh-CN.yml
57
+ - config/routes.rb
58
+ - db/migrate/1_create_global_content_blocks_global_content_blocks.rb
59
+ - db/seeds.rb
60
+ - lib/generators/refinery/global_content_blocks_generator.rb
61
+ - lib/refinery/global_content_blocks.rb
62
+ - lib/refinery/global_content_blocks/engine.rb
63
+ - lib/refinerycms-global_content_blocks.rb
64
+ - lib/tasks/refinery/global_content_blocks.rake
65
+ - readme.md
66
+ homepage:
67
+ licenses: []
68
+ metadata: {}
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 2.2.2
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: Global Content Blocks extension for Refinery CMS
89
+ test_files: []