refinerycms-pods 1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ module Admin
2
+ class PodsController < Admin::BaseController
3
+
4
+ crudify :pod,
5
+ :title_attribute => 'name', :xhr_paging => true
6
+
7
+ end
8
+ end
data/app/models/pod.rb ADDED
@@ -0,0 +1,19 @@
1
+ class Pod < ActiveRecord::Base
2
+
3
+ POD_TYPES = %w(content banner gallery video)
4
+
5
+ acts_as_indexed :fields => [:name, :body, :url]
6
+
7
+ validates_presence_of :name
8
+ validates_inclusion_of :pod_type, :in => POD_TYPES
9
+
10
+ belongs_to :image
11
+ belongs_to :portfolio_entry
12
+ belongs_to :video
13
+ has_and_belongs_to_many :pages
14
+
15
+ def system_name
16
+ pod_type
17
+ end
18
+
19
+ end
@@ -0,0 +1,28 @@
1
+ <ul>
2
+ <% if Admin::PodsController.searchable? %>
3
+ <li>
4
+ <%= render :partial => "/shared/admin/search",
5
+ :locals => {
6
+ :url => admin_pods_path
7
+ } %>
8
+ </li>
9
+ <% end %>
10
+ <li>
11
+ <%= link_to t('.create_new'), new_admin_pod_path,
12
+ :class => "add_icon" %>
13
+ </li>
14
+ <% if !searching? and Admin::PodsController.sortable? and Pod.count > 1 %>
15
+ <li>
16
+ <%= link_to t('.reorder', :what => "Pods"),
17
+ admin_pods_path,
18
+ :id => "reorder_action",
19
+ :class => "reorder_icon" %>
20
+
21
+ <%= link_to t('.reorder_done', :what => "Pods"),
22
+ admin_pods_path,
23
+ :id => "reorder_action_done",
24
+ :style => "display: none;",
25
+ :class => "reorder_icon" %>
26
+ </li>
27
+ <% end %>
28
+ </ul>
@@ -0,0 +1,90 @@
1
+ <%= form_for [:admin, @pod] do |f| -%>
2
+ <%= render :partial => "/shared/admin/error_messages", :locals => {
3
+ :object => @pod,
4
+ :include_object_name => true
5
+ } %>
6
+
7
+ <%= hidden_field_tag 'pod[page_ids][]' %>
8
+
9
+ <div class='field'>
10
+ <%= f.label :pod_type -%>
11
+ <%#= f.collection_select :pod_type_id, PodType.order(:name), :id , :name, {:prompt => "-- Please select --"}, {} -%>
12
+ <%= f.select :pod_type, Pod::POD_TYPES, {:include_blank => true} %>
13
+ </div>
14
+
15
+ <div class='field'>
16
+ <%= f.label :name -%>
17
+ <%= f.text_field :name, :class => 'larger widest' -%>
18
+ </div>
19
+
20
+ <div class='field'>
21
+ <div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
22
+ <ul id='page_parts'>
23
+ <% [:body].each_with_index do |part, part_index| %>
24
+ <li class='ui-state-default<%= ' ui-state-active' if part_index == 0 %>'>
25
+ <%= link_to part.to_s.titleize, "##{part}" %>
26
+ </li>
27
+ <% end %>
28
+ </ul>
29
+
30
+ <div id='page_part_editors'>
31
+ <% [:body].each do |part| %>
32
+ <div class='page_part' id='<%= part %>'>
33
+ <%= f.text_area part, :rows => 20, :class => 'wymeditor widest' -%>
34
+ </div>
35
+ <% end %>
36
+ </div>
37
+ </div>
38
+ </div>
39
+
40
+ <div class='field'>
41
+ <%= f.label :url -%>
42
+ <%= f.text_field :url -%>
43
+ </div>
44
+
45
+ <div class='field'>
46
+ <%= f.label :image -%>
47
+ <%= render :partial => "/shared/admin/image_picker", :locals => {
48
+ :f => f,
49
+ :field => :image_id,
50
+ :image => @pod.image,
51
+ :toggle_image_display => false
52
+ } %>
53
+ </div>
54
+
55
+
56
+ <div class='field'>
57
+ <%= f.label :portfolio_entry_id, 'Gallery' -%>
58
+ <%= f.collection_select :portfolio_entry_id, PortfolioEntry.order(:title), :id , :title, {:prompt => "-- Please select when relevant --"}, {} -%>
59
+ </div>
60
+
61
+ <div class='field'>
62
+ <%= f.label :video_id -%>
63
+ <%= f.collection_select :video_id, Video.order(:name), :id , :name, {:prompt => "-- Please select when relevant --"}, {} -%>
64
+ </div>
65
+
66
+ <div class="field">
67
+ <%= f.label :pages %>
68
+ <% for page in Page.find(:all) %>
69
+ <div>
70
+ <%= check_box_tag "pod[page_ids][]", page.id, @pod.pages.include?(page) %>
71
+ <%= page.title %>
72
+ </div>
73
+ <% end %>
74
+ </div>
75
+
76
+ <%= render :partial => "/shared/admin/form_actions",
77
+ :locals => {
78
+ :f => f,
79
+ :continue_editing => false,
80
+ :delete_title => t('delete', :scope => 'admin.pods.pod'),
81
+ :delete_confirmation => t('message', :scope => 'shared.admin.delete', :title => @pod.name)
82
+ } %>
83
+ <% end -%>
84
+ <% content_for :javascripts do %>
85
+ <script>
86
+ $(document).ready(function(){
87
+ page_options.init(false, '', '');
88
+ });
89
+ </script>
90
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(pod) -%>">
2
+ <span class='title'>
3
+ <%= pod.name %>
4
+ <span class="preview">&nbsp;</span>
5
+ </span>
6
+ <span class='actions'>
7
+ <%= link_to refinery_icon_tag("application_edit.png"), edit_admin_pod_path(pod),
8
+ :title => t('.edit') %>
9
+ <%= link_to refinery_icon_tag("delete.png"), admin_pod_path(pod),
10
+ :class => "cancel confirm-delete",
11
+ :title => t('.delete'),
12
+ :confirm => t('message', :scope => 'shared.admin.delete', :title => pod.name),
13
+ :method => :delete %>
14
+ </span>
15
+ </li>
@@ -0,0 +1,2 @@
1
+ <%= will_paginate @pods %>
2
+ <%= render :partial => "sortable_list" %>
@@ -0,0 +1,18 @@
1
+ <% if searching? %>
2
+ <h2><%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
3
+ <% end %>
4
+ <% if @pods.any? %>
5
+ <div class='pagination_container'>
6
+ <%= render :partial => 'pods' %>
7
+ </div>
8
+ <% else %>
9
+ <p>
10
+ <% unless searching? %>
11
+ <strong>
12
+ <%= t('.no_items_yet') %>
13
+ </strong>
14
+ <% else %>
15
+ <%= t('no_results', :scope => 'shared.admin.search') %>
16
+ <% end %>
17
+ </p>
18
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <ul id='sortable_list'>
2
+ <%= render :partial => 'pod', :collection => @pods %>
3
+ </ul>
4
+ <%= render :partial => "/shared/admin/sortable_list",
5
+ :locals => {
6
+ :continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true
7
+ } %>
@@ -0,0 +1 @@
1
+ <%= render :partial => "form" %>
@@ -0,0 +1,10 @@
1
+ <section id='records'>
2
+ <%= render :partial => 'records' %>
3
+ </section>
4
+ <aside id='actions'>
5
+ <%= render :partial => 'actions' %>
6
+ </aside>
7
+ <%= render :partial => '/shared/admin/make_sortable',
8
+ :locals => {
9
+ :tree => false
10
+ } if !searching? and Admin::PodsController.sortable? and Pod.count > 1 %>
@@ -0,0 +1 @@
1
+ <%= render :partial => "form" %>
@@ -0,0 +1,11 @@
1
+ <% if pod.image.present? %>
2
+ <div class="tile banner">
3
+ <% if pod.url.present? %>
4
+ <%= link_to(image_tag(pod.image.image.thumb('280x205').url), pod.url) %>
5
+ <% else %>
6
+ <%= image_tag(pod.image.image.thumb('280x205').url) %>
7
+ <% end %>
8
+ <div class="clear"></div>
9
+ </div>
10
+
11
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <div class="side_pod content">
2
+ <% if pod.url.present? and pod.name.present? %>
3
+ <h1><%= link_to(pod.name, pod.url, :class => 'title') %></h1>
4
+ <% else %>
5
+ <h1><div class="title"><%= pod.name %></div></h1>
6
+ <% end %>
7
+ <%= content_tag('div', raw(pod.body), :class => 'body') if pod.body.present? %>
8
+ </div>
@@ -0,0 +1,10 @@
1
+ <div class="gallery_pod">
2
+ <ul class="gallery_slider">
3
+ <% pod.portfolio_entry.images.each do |image| %>
4
+ <li>
5
+ <%= image_fu(image, '280x180#c') %>
6
+ </li>
7
+ <% end if pod.portfolio_entry.present? and pod.portfolio_entry.images.present? %>
8
+ </ul>
9
+ <p><%= pod.name %></p>
10
+ </div>
@@ -0,0 +1,5 @@
1
+ <div class="video" targeturl="<%= video.youtube_url %>">
2
+ <h1><%= video.name %></h1>
3
+ <%= link_to('', video.youtube_url, :class => "ytlink") %>
4
+ <%= raw(video.body) %>
5
+ </div>
@@ -0,0 +1,5 @@
1
+ <% if pod.video.present? %>
2
+ <div class="video_pod">
3
+ <%= render :partial => 'shared/video', :locals => {:video => pod.video} %>
4
+ </div>
5
+ <% end %>
@@ -0,0 +1,25 @@
1
+ en:
2
+ shared:
3
+ admin:
4
+ image_picker:
5
+ image: image
6
+ plugins:
7
+ pods:
8
+ title: Pods
9
+ admin:
10
+ pods:
11
+ actions:
12
+ create_new: Add New Pod
13
+ reorder: Reorder Pods
14
+ reorder_done: Done Reordering Pods
15
+ records:
16
+ title: Pods
17
+ sorry_no_results: Sorry! There are no results found.
18
+ no_items_yet: There are no Pods yet. Click "Add New Pod" to add your first pod.
19
+ pod:
20
+ view_live_html: View this pod live <br/><em>(opens in a new window)</em>
21
+ edit: Edit this pod
22
+ delete: Remove this pod forever
23
+ pods:
24
+ show:
25
+ other: Other Pods
@@ -0,0 +1,25 @@
1
+ fr:
2
+ shared:
3
+ admin:
4
+ image_picker:
5
+ image: image
6
+ plugins:
7
+ pods:
8
+ title: Pods
9
+ admin:
10
+ pods:
11
+ actions:
12
+ create_new: Créer un(e) nouve(au/l/lle) Pod
13
+ reorder: Réordonner les Pods
14
+ reorder_done: Fin de réordonnancement des Pods
15
+ records:
16
+ title: Pods
17
+ sorry_no_results: "Désolé ! Aucun résultat."
18
+ no_items_yet: 'Il n''y a actuellement aucun(e) Pod. Cliquer sur "Créer un(e) nouve(au/l/lle) Pod" pour créer votre premi(er/ère) pod.'
19
+ pod:
20
+ view_live_html: Voir ce(t/tte) pod <br/><em>(Ouvre une nouvelle fenêtre)</em>
21
+ edit: Modifier ce(t/tte) pod
22
+ delete: Supprimer définitivement ce(t/tte) pod
23
+ pods:
24
+ show:
25
+ other: Autres Pods
@@ -0,0 +1,25 @@
1
+ lolcat:
2
+ shared:
3
+ admin:
4
+ image_picker:
5
+ image: IMAGE
6
+ plugins:
7
+ pods:
8
+ title: Pods
9
+ admin:
10
+ pods:
11
+ actions:
12
+ create_new: CREATE NEW Pod
13
+ reorder: REORDR Pods
14
+ reorder_done: DUN REORDERIN Pods
15
+ records:
16
+ title: Pods
17
+ sorry_no_results: SRY! THAR R NO RESULTS FINDZ.
18
+ no_items_yet: THAR R NO Pods YET. CLICK "CREATE NEW Pod" 2 ADD UR FURST pod.
19
+ pod:
20
+ view_live_html: VIEW DIS pod LIV <BR/><EM>(OPENS IN NEW WINDOW)</EM>
21
+ edit: EDIT DIS pod
22
+ delete: REMOOV DIS pod FOREVR
23
+ pods:
24
+ show:
25
+ other: OTHR Pods
@@ -0,0 +1,21 @@
1
+ nb:
2
+ plugins:
3
+ pods:
4
+ title: Pods
5
+ admin:
6
+ pods:
7
+ actions:
8
+ create_new: Lag en ny Pod
9
+ reorder: Endre rekkefølgen på Pods
10
+ reorder_done: Ferdig å endre rekkefølgen Pods
11
+ records:
12
+ title: Pods
13
+ sorry_no_results: Beklager! Vi fant ikke noen resultater.
14
+ no_items_yet: Det er ingen Pods enda. Klikk på "Lag en ny Pod" for å legge til din første pod.
15
+ pod:
16
+ view_live_html: Vis hvordan denne pod ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
17
+ edit: Rediger denne pod
18
+ delete: Fjern denne pod permanent
19
+ pods:
20
+ show:
21
+ other: Andre Pods
@@ -0,0 +1,21 @@
1
+ nl:
2
+ plugins:
3
+ pods:
4
+ title: Pods
5
+ admin:
6
+ pods:
7
+ actions:
8
+ create_new: Maak een nieuwe Pod
9
+ reorder: Wijzig de volgorde van de Pods
10
+ reorder_done: Klaar met het wijzingen van de volgorde van de Pods
11
+ records:
12
+ title: Pods
13
+ sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
14
+ no_items_yet: Er zijn nog geen Pods. Druk op 'Maak een nieuwe Pod' om de eerste aan te maken.
15
+ pod:
16
+ view_live_html: Bekijk deze pod op de website <br/><em>(opent een nieuw venster)</em>
17
+ edit: Bewerk deze pod
18
+ delete: Verwijder deze pod voor eeuwig
19
+ pods:
20
+ show:
21
+ other: Andere Pods
data/config/routes.rb ADDED
@@ -0,0 +1,10 @@
1
+ ::Refinery::Application.routes.draw do
2
+
3
+ scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
4
+ resources :pods, :except => :show do
5
+ collection do
6
+ post :update_positions
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ class RefinerycmsPods < Refinery::Generators::EngineInstaller
2
+
3
+ source_root File.expand_path('../../../', __FILE__)
4
+ engine_name "pods"
5
+
6
+ end
@@ -0,0 +1,17 @@
1
+ module Refinery
2
+ module Pods
3
+ module Extensions
4
+ module Page
5
+ module ClassMethods
6
+ def add_pods_relationship
7
+ has_and_belongs_to_many :pods
8
+ end
9
+ end
10
+
11
+ def self.included(base)
12
+ base.extend(ClassMethods).add_pods_relationship
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,29 @@
1
+ require 'refinerycms-base'
2
+
3
+ module Refinery
4
+ module Pods
5
+ class Engine < Rails::Engine
6
+ initializer "static assets" do |app|
7
+ app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
8
+ end
9
+
10
+ config.before_initialize do
11
+ require 'page_extensions_for_pods'
12
+ end
13
+
14
+ config.to_prepare do
15
+ Page.send :include, Refinery::Pods::Extensions::Page
16
+ end
17
+
18
+ config.after_initialize do
19
+ Refinery::Plugin.register do |plugin|
20
+ plugin.name = "pods"
21
+ plugin.activity = {
22
+ :class => Pod,
23
+ :title => 'name'
24
+ }
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,13 @@
1
+ namespace :refinery do
2
+
3
+ namespace :pods do
4
+
5
+ # call this task my running: rake refinery:pods: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
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: refinerycms-pods
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - James Thompson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-06-20 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Ruby on Rails Pods engine for Refinery CMS
15
+ email: james.b.thompson@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/generators/refinerycms_pods_generator.rb
21
+ - lib/page_extensions_for_pods.rb
22
+ - lib/refinerycms-pods.rb
23
+ - lib/tasks/pods.rake
24
+ - config/locales/en.yml
25
+ - config/locales/fr.yml
26
+ - config/locales/lolcat.yml
27
+ - config/locales/nb.yml
28
+ - config/locales/nl.yml
29
+ - config/routes.rb
30
+ - app/controllers/admin/pods_controller.rb
31
+ - app/models/pod.rb
32
+ - app/views/admin/pods/edit.html.erb
33
+ - app/views/admin/pods/index.html.erb
34
+ - app/views/admin/pods/new.html.erb
35
+ - app/views/admin/pods/_actions.html.erb
36
+ - app/views/admin/pods/_form.html.erb
37
+ - app/views/admin/pods/_pod.html.erb
38
+ - app/views/admin/pods/_pods.html.erb
39
+ - app/views/admin/pods/_records.html.erb
40
+ - app/views/admin/pods/_sortable_list.html.erb
41
+ - app/views/shared/_banner_pod.html.erb
42
+ - app/views/shared/_content_pod.html.erb
43
+ - app/views/shared/_gallery_pod.html.erb
44
+ - app/views/shared/_video.html.erb
45
+ - app/views/shared/_video_pod.html.erb
46
+ homepage: https://github.com/julesce/refinerycms-pods
47
+ licenses: []
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 1.8.18
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: Pods engine for Refinery CMS
70
+ test_files: []