Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

First commit with passing test. This project will demonstrate a drast…

…ic change in refinery engine development ... I hope.
  • Loading branch information...
commit 5d10589786353c6842a5b7356918cd4b6812fb02 1 parent 64037fc
@joemsak joemsak authored
Showing with 934 additions and 0 deletions.
  1. +2 −0  .rspec
  2. +1 −0  .rvmrc
  3. +67 −0 Gemfile
  4. +258 −0 Gemfile.lock
  5. +27 −0 Guardfile
  6. +20 −0 Rakefile
  7. +11 −0 app/controllers/refinery/calendar/admin/events_controller.rb
  8. +34 −0 app/controllers/refinery/calendar/events_controller.rb
  9. +5 −0 app/models/refinery/calendar.rb
  10. +6 −0 app/models/refinery/calendar/event.rb
  11. +25 −0 app/views/refinery/calendar/admin/events/_actions.html.erb
  12. +20 −0 app/views/refinery/calendar/admin/events/_event.html.erb
  13. +2 −0  app/views/refinery/calendar/admin/events/_events.html.erb
  14. +17 −0 app/views/refinery/calendar/admin/events/_form.html.erb
  15. +18 −0 app/views/refinery/calendar/admin/events/_records.html.erb
  16. +5 −0 app/views/refinery/calendar/admin/events/_sortable_list.html.erb
  17. +1 −0  app/views/refinery/calendar/admin/events/edit.html.erb
  18. +7 −0 app/views/refinery/calendar/admin/events/index.html.erb
  19. +1 −0  app/views/refinery/calendar/admin/events/new.html.erb
  20. +11 −0 app/views/refinery/calendar/events/index.html.erb
  21. +27 −0 app/views/refinery/calendar/events/show.html.erb
  22. +27 −0 config/locales/en.yml
  23. +28 −0 config/locales/es.yml
  24. +27 −0 config/locales/fr.yml
  25. +27 −0 config/locales/nb.yml
  26. +27 −0 config/locales/nl.yml
  27. +19 −0 config/routes.rb
  28. +26 −0 db/migrate/1_create_calendar_events.rb
  29. +23 −0 db/seeds.rb
  30. +18 −0 lib/generators/refinery/calendar_generator.rb
  31. +21 −0 lib/refinery/events.rb
  32. +26 −0 lib/refinery/events/engine.rb
  33. +1 −0  lib/refinerycms-calendar.rb
  34. +13 −0 lib/tasks/refinery/calendar.rake
  35. +10 −0 readme.md
  36. +18 −0 refinerycms-calendar.gemspec
  37. +35 −0 script/test
  38. +9 −0 spec/models/refinery/refinery/calendar_spec.rb
  39. +6 −0 tasks/rspec.rake
  40. +8 −0 tasks/testing.rake
View
2  .rspec
@@ -0,0 +1,2 @@
+--color
+-I app/models/refinery
View
1  .rvmrc
@@ -0,0 +1 @@
+rvm use --create 1.9.3@refinerycms-calendar
View
67 Gemfile
@@ -0,0 +1,67 @@
+source "http://rubygems.org"
+
+gemspec
+
+gem 'refinerycms', '~> 2.0.2'
+
+# Refinery/rails should pull in the proper versions of these
+group :assets do
+ gem 'sass-rails'
+ gem 'coffee-rails'
+ gem 'uglifier'
+end
+
+gem 'jquery-rails'
+
+group :development, :test do
+ gem 'generator_spec'
+
+ require 'rbconfig'
+
+ platforms :jruby do
+ gem 'activerecord-jdbcsqlite3-adapter'
+ gem 'activerecord-jdbcmysql-adapter'
+ gem 'activerecord-jdbcpostgresql-adapter'
+ gem 'jruby-openssl'
+ end
+
+ unless defined?(JRUBY_VERSION)
+ gem 'sqlite3'
+ gem 'mysql2'
+ gem 'pg'
+ end
+
+ platforms :mswin, :mingw do
+ gem 'win32console'
+ gem 'rb-fchange', '~> 0.0.5'
+ gem 'rb-notifu', '~> 0.0.4'
+ end
+
+ platforms :ruby do
+ gem 'spork', '0.9.0.rc9'
+ gem 'guard-spork'
+
+ unless ENV['TRAVIS']
+ if RbConfig::CONFIG['target_os'] =~ /darwin/i
+ gem 'rb-fsevent', '>= 0.3.9'
+ gem 'growl', '~> 1.0.3'
+ end
+ if RbConfig::CONFIG['target_os'] =~ /linux/i
+ gem 'rb-inotify', '>= 0.5.1'
+ gem 'libnotify', '~> 0.1.3'
+ end
+ end
+ end
+
+ platforms :jruby do
+ unless ENV['TRAVIS']
+ if RbConfig::CONFIG['target_os'] =~ /darwin/i
+ gem 'growl', '~> 1.0.3'
+ end
+ if RbConfig::CONFIG['target_os'] =~ /linux/i
+ gem 'rb-inotify', '>= 0.5.1'
+ gem 'libnotify', '~> 0.1.3'
+ end
+ end
+ end
+end
View
258 Gemfile.lock
@@ -0,0 +1,258 @@
+PATH
+ remote: .
+ specs:
+ refinerycms-calendar (1.0)
+ refinerycms-core (~> 2.0.2)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.2.2)
+ actionpack (= 3.2.2)
+ mail (~> 2.4.0)
+ actionpack (3.2.2)
+ activemodel (= 3.2.2)
+ activesupport (= 3.2.2)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.1)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.2)
+ activemodel (3.2.2)
+ activesupport (= 3.2.2)
+ builder (~> 3.0.0)
+ activerecord (3.2.2)
+ activemodel (= 3.2.2)
+ activesupport (= 3.2.2)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.2)
+ activemodel (= 3.2.2)
+ activesupport (= 3.2.2)
+ activesupport (3.2.2)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ acts_as_indexed (0.7.8)
+ arel (3.0.2)
+ awesome_nested_set (2.1.2)
+ activerecord (>= 3.0.0)
+ babosa (0.3.7)
+ bcrypt-ruby (3.0.1)
+ builder (3.0.0)
+ capybara (1.1.2)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (~> 2.0)
+ xpath (~> 0.1.4)
+ childprocess (0.3.1)
+ ffi (~> 1.0.6)
+ coffee-rails (3.2.2)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.2.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.2.0)
+ database_cleaner (0.7.2)
+ devise (2.0.4)
+ bcrypt-ruby (~> 3.0)
+ orm_adapter (~> 0.0.3)
+ railties (~> 3.1)
+ warden (~> 1.1.1)
+ diff-lcs (1.1.3)
+ dragonfly (0.9.11)
+ rack
+ erubis (2.7.0)
+ execjs (1.3.0)
+ multi_json (~> 1.0)
+ factory_girl (2.6.4)
+ activesupport (>= 2.3.9)
+ factory_girl_rails (1.7.0)
+ factory_girl (~> 2.6.0)
+ railties (>= 3.0.0)
+ ffi (1.0.11)
+ friendly_id (4.0.4)
+ generator_spec (0.8.5)
+ rails (>= 3.0, < 4.0)
+ rspec-rails
+ globalize3 (0.2.0)
+ activemodel (>= 3.0.0)
+ activerecord (>= 3.0.0)
+ paper_trail (~> 2)
+ growl (1.0.3)
+ guard (1.0.1)
+ ffi (>= 0.5.0)
+ thor (~> 0.14.6)
+ guard-spork (0.5.2)
+ guard (>= 0.10.0)
+ spork (>= 0.8.4)
+ hike (1.2.1)
+ i18n (0.6.0)
+ journey (1.0.3)
+ jquery-rails (2.0.1)
+ railties (>= 3.2.0, < 5.0)
+ thor (~> 0.14)
+ json (1.6.6)
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.18)
+ multi_json (1.2.0)
+ mysql2 (0.3.11)
+ nokogiri (1.5.2)
+ orm_adapter (0.0.7)
+ paper_trail (2.6.3)
+ activerecord (~> 3.0)
+ railties (~> 3.0)
+ pg (0.13.2)
+ polyglot (0.3.3)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.2.2)
+ actionmailer (= 3.2.2)
+ actionpack (= 3.2.2)
+ activerecord (= 3.2.2)
+ activeresource (= 3.2.2)
+ activesupport (= 3.2.2)
+ bundler (~> 1.0)
+ railties (= 3.2.2)
+ railties (3.2.2)
+ actionpack (= 3.2.2)
+ activesupport (= 3.2.2)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rb-fsevent (0.9.0)
+ rdoc (3.12)
+ json (~> 1.4)
+ refinerycms (2.0.2)
+ bundler (~> 1.0)
+ refinerycms-authentication (= 2.0.2)
+ refinerycms-core (= 2.0.2)
+ refinerycms-dashboard (= 2.0.2)
+ refinerycms-images (= 2.0.2)
+ refinerycms-pages (= 2.0.2)
+ refinerycms-resources (= 2.0.2)
+ refinerycms-authentication (2.0.2)
+ devise (~> 2.0.0)
+ refinerycms-core (= 2.0.2)
+ refinerycms-core (2.0.2)
+ acts_as_indexed (~> 0.7.7)
+ awesome_nested_set (~> 2.1.0)
+ coffee-rails (~> 3.2.1)
+ friendly_id (~> 4.0.1)
+ globalize3 (~> 0.2.0)
+ jquery-rails (~> 2.0.0)
+ rails (>= 3.1.3, < 3.3)
+ sass-rails (~> 3.2.3)
+ truncate_html (~> 0.5)
+ uglifier (>= 1.0.3)
+ will_paginate (~> 3.0.2)
+ refinerycms-dashboard (2.0.2)
+ refinerycms-core (= 2.0.2)
+ refinerycms-images (2.0.2)
+ dragonfly (~> 0.9.8)
+ rack-cache (>= 0.5.3)
+ refinerycms-core (= 2.0.2)
+ refinerycms-pages (2.0.2)
+ awesome_nested_set (~> 2.1.0)
+ babosa (!= 0.3.6)
+ refinerycms-core (= 2.0.2)
+ seo_meta (~> 1.2.0)
+ refinerycms-resources (2.0.2)
+ dragonfly (~> 0.9.8)
+ rack-cache (>= 0.5.3)
+ refinerycms-core (= 2.0.2)
+ refinerycms-testing (2.0.2)
+ capybara (~> 1.1.0)
+ database_cleaner (~> 0.7.1)
+ factory_girl_rails (~> 1.7.0)
+ rack-test (~> 0.6.0)
+ refinerycms-core (= 2.0.2)
+ rspec-rails (~> 2.8.1)
+ rspec (2.8.0)
+ rspec-core (~> 2.8.0)
+ rspec-expectations (~> 2.8.0)
+ rspec-mocks (~> 2.8.0)
+ rspec-core (2.8.0)
+ rspec-expectations (2.8.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.8.0)
+ rspec-rails (2.8.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.8.0)
+ rubyzip (0.9.6.1)
+ sass (3.1.15)
+ sass-rails (3.2.5)
+ railties (~> 3.2.0)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ selenium-webdriver (2.20.0)
+ childprocess (>= 0.2.5)
+ ffi (~> 1.0)
+ multi_json (~> 1.0)
+ rubyzip
+ seo_meta (1.2.0)
+ railties (>= 3.0.0)
+ spork (0.9.0.rc9)
+ sprockets (2.1.2)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.5)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ truncate_html (0.5.4)
+ tzinfo (0.3.32)
+ uglifier (1.2.3)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+ warden (1.1.1)
+ rack (>= 1.0)
+ will_paginate (3.0.3)
+ xpath (0.1.4)
+ nokogiri (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activerecord-jdbcmysql-adapter
+ activerecord-jdbcpostgresql-adapter
+ activerecord-jdbcsqlite3-adapter
+ coffee-rails
+ generator_spec
+ growl (~> 1.0.3)
+ guard-spork
+ jquery-rails
+ jruby-openssl
+ mysql2
+ pg
+ rb-fchange (~> 0.0.5)
+ rb-fsevent (>= 0.3.9)
+ rb-notifu (~> 0.0.4)
+ refinerycms (~> 2.0.2)
+ refinerycms-calendar!
+ refinerycms-testing (~> 2.0.2)
+ sass-rails
+ spork (= 0.9.0.rc9)
+ sqlite3
+ uglifier
+ win32console
View
27 Guardfile
@@ -0,0 +1,27 @@
+guard 'spork', :wait => 60, :cucumber => false, :rspec_env => { 'RAILS_ENV' => 'test' } do
+ watch('config/application.rb')
+ watch('config/environment.rb')
+ watch(%r{^config/environments/.+\.rb$})
+ watch(%r{^config/initializers/.+\.rb$})
+ watch('spec/spec_helper.rb')
+ watch(%r{^spec/support/.+\.rb$})
+ watch(%r{^vendor/extensions/(.+)/spec/support/.+\.rb$})
+end
+
+guard 'rspec', :version => 2, :cli => "--color --drb --format Fuubar", :all_on_start => false, :all_after_pass => false do
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
+ watch('spec/spec_helper.rb') { "spec" }
+
+ # Rails example
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
+ watch('spec/spec_helper.rb') { "spec" }
+ watch('config/routes.rb') { "spec/routing" }
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
+ # Capybara request specs
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
+end
View
20 Rakefile
@@ -0,0 +1,20 @@
+#!/usr/bin/env rake
+begin
+ require 'bundler/setup'
+rescue LoadError
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
+end
+
+ENGINE_PATH = File.dirname(__FILE__)
+APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
+
+if File.exists?(APP_RAKEFILE)
+ load 'rails/tasks/engine.rake'
+end
+
+require "refinerycms-testing"
+Refinery::Testing::Railtie.load_tasks
+Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH)
+
+load File.expand_path('../tasks/testing.rake', __FILE__)
+load File.expand_path('../tasks/rspec.rake', __FILE__)
View
11 app/controllers/refinery/calendar/admin/events_controller.rb
@@ -0,0 +1,11 @@
+module Refinery
+ module Calendar
+ module Admin
+ class EventsController < ::Refinery::AdminController
+
+ crudify :'refinery/calendar/event', :xhr_paging => true
+
+ end
+ end
+ end
+end
View
34 app/controllers/refinery/calendar/events_controller.rb
@@ -0,0 +1,34 @@
+module Refinery
+ module Calendar
+ class EventsController < ::ApplicationController
+
+ before_filter :find_all_events
+ before_filter :find_page
+
+ def index
+ # you can use meta fields from your model instead (e.g. browser_title)
+ # by swapping @page for @event in the line below:
+ present(@page)
+ end
+
+ def show
+ @event = Event.find(params[:id])
+
+ # you can use meta fields from your model instead (e.g. browser_title)
+ # by swapping @page for @event in the line below:
+ present(@page)
+ end
+
+ protected
+
+ def find_all_events
+ @events = Event.order('position ASC')
+ end
+
+ def find_page
+ @page = ::Refinery::Page.where(:link_url => "/events").first
+ end
+
+ end
+ end
+end
View
5 app/models/refinery/calendar.rb
@@ -0,0 +1,5 @@
+module Refinery
+ class Calendar
+ attr_accessor :title
+ end
+end
View
6 app/models/refinery/calendar/event.rb
@@ -0,0 +1,6 @@
+module Refinery
+ module Calendar
+ class Event
+ end
+ end
+end
View
25 app/views/refinery/calendar/admin/events/_actions.html.erb
@@ -0,0 +1,25 @@
+<ul>
+ <% if ::Refinery::Calendar::Admin::EventsController.searchable? %>
+ <li>
+ <%= render '/refinery/admin/search', :url => refinery.calendar_admin_events_path %>
+ </li>
+ <% end %>
+ <li>
+ <%= link_to t('.create_new'), refinery.new_calendar_admin_event_path,
+ :class => "add_icon" %>
+ </li>
+<% if !searching? && ::Refinery::Calendar::Admin::EventsController.sortable? && ::Refinery::Calendar::Event.any? %>
+ <li>
+ <%= link_to t('.reorder', :what => "Events"),
+ refinery.calendar_admin_events_path,
+ :id => "reorder_action",
+ :class => "reorder_icon" %>
+
+ <%= link_to t('.reorder_done', :what => "Events"),
+ refinery.calendar_admin_events_path,
+ :id => "reorder_action_done",
+ :style => "display: none;",
+ :class => "reorder_icon" %>
+ </li>
+<% end %>
+</ul>
View
20 app/views/refinery/calendar/admin/events/_event.html.erb
@@ -0,0 +1,20 @@
+<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(event) -%>">
+ <span class='title'>
+ <%= event.title %>
+
+ </span>
+ <span class='actions'>
+
+ <%= link_to refinery_icon_tag("application_go.png"), refinery.calendar_event_path(event),
+ :title => t('.view_live_html'),
+ :target => "_blank" %>
+
+ <%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_calendar_admin_event_path(event),
+ :title => t('.edit') %>
+ <%= link_to refinery_icon_tag("delete.png"), refinery.calendar_admin_event_path(event),
+ :class => "cancel confirm-delete",
+ :title => t('.delete'),
+ :confirm => t('message', :scope => 'refinery.admin.delete', :title => event.title),
+ :method => :delete %>
+ </span>
+</li>
View
2  app/views/refinery/calendar/admin/events/_events.html.erb
@@ -0,0 +1,2 @@
+<%= will_paginate @events if Refinery::Calendar::Admin::EventsController.pageable? %>
+<%= render 'sortable_list' %>
View
17 app/views/refinery/calendar/admin/events/_form.html.erb
@@ -0,0 +1,17 @@
+<%= form_for [refinery, :calendar_admin, @event] do |f| -%>
+ <%= render '/refinery/admin/error_messages',
+ :object => @event,
+ :include_object_name => true %>
+
+
+ <div class='field'>
+ <%= f.label :title -%>
+ <%= f.text_field :title, :class => 'larger widest' -%>
+
+ </div>
+
+ <%= render '/refinery/admin/form_actions', :f => f,
+ :continue_editing => false,
+ :delete_title => t('delete', :scope => 'refinery.events.admin.events.event'),
+ :delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @event.title) %>
+<% end -%>
View
18 app/views/refinery/calendar/admin/events/_records.html.erb
@@ -0,0 +1,18 @@
+<% if searching? %>
+ <h2><%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %></h2>
+<% end %>
+<div class='pagination_container'>
+ <% if @events.any? %>
+ <%= render 'events' %>
+ <% else %>
+ <p>
+ <% unless searching? %>
+ <strong>
+ <%= t('.no_items_yet') %>
+ </strong>
+ <% else %>
+ <%= t('no_results', :scope => 'refinery.admin.search') %>
+ <% end %>
+ </p>
+ <% end %>
+</div>
View
5 app/views/refinery/calendar/admin/events/_sortable_list.html.erb
@@ -0,0 +1,5 @@
+<ul id='sortable_list'>
+ <%= render :partial => 'event', :collection => @events %>
+</ul>
+<%= render '/refinery/admin/sortable_list',
+ :continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true %>
View
1  app/views/refinery/calendar/admin/events/edit.html.erb
@@ -0,0 +1 @@
+<%= render 'form' %>
View
7 app/views/refinery/calendar/admin/events/index.html.erb
@@ -0,0 +1,7 @@
+<section id='records'>
+ <%= render 'records' %>
+</section>
+<aside id='actions'>
+ <%= render 'actions' %>
+</aside>
+<%= render '/refinery/admin/make_sortable', :tree => false if !searching? and ::Refinery::Calendar::Admin::EventsController.sortable? and ::Refinery::Calendar::Event.count > 1 %>
View
1  app/views/refinery/calendar/admin/events/new.html.erb
@@ -0,0 +1 @@
+<%= render 'form' %>
View
11 app/views/refinery/calendar/events/index.html.erb
@@ -0,0 +1,11 @@
+<% content_for :body_content_left do %>
+ <ul id="events">
+ <% @events.each do |event| %>
+ <li>
+ <%= link_to event.title, refinery.calendar_event_path(event) %>
+ </li>
+ <% end %>
+ </ul>
+<% end %>
+
+<%= render '/refinery/content_page' %>
View
27 app/views/refinery/calendar/events/show.html.erb
@@ -0,0 +1,27 @@
+<% content_for :body_content_title do %>
+ <%= @event.title %>
+<% end %>
+
+<% content_for :body_content_left do %>
+ <section>
+ <h1>Title</h1>
+ <p>
+ <%=raw @event.title %>
+ </p>
+ </section>
+<% end %>
+
+<% content_for :body_content_right do %>
+ <aside>
+ <h2><%= t('.other') %></h2>
+ <ul id="events">
+ <% @events.each do |event| %>
+ <li>
+ <%= link_to event.title, refinery.calendar_event_path(event) %>
+ </li>
+ <% end %>
+ </ul>
+ </aside>
+<% end %>
+
+<%= render '/refinery/content_page' %>
View
27 config/locales/en.yml
@@ -0,0 +1,27 @@
+en:
+ refinery:
+ plugins:
+ events:
+ title: Events
+ calendar:
+ admin:
+ events:
+ actions:
+ create_new: Add New Event
+ reorder: Reorder Events
+ reorder_done: Done Reordering Events
+ records:
+ title: Events
+ sorry_no_results: Sorry! There are no results found.
+ no_items_yet: There are no Events yet. Click "Add New Event" to add your first event.
+ event:
+ view_live_html: View this event live <br/><em>(opens in a new window)</em>
+ edit: Edit this event
+ delete: Remove this event forever
+ events:
+ show:
+ other: Other Events
+ activerecord:
+ attributes:
+ 'refinery/calendar/event':
+ title: Title
View
28 config/locales/es.yml
@@ -0,0 +1,28 @@
+es:
+ refinery:
+ plugins:
+ events:
+ title: Events
+# article: masculino/femenino
+ calendar:
+ admin:
+ events:
+ actions:
+ create_new: Crear nuevo event
+ reorder: Reordenar events
+ reorder_done: Reordenación de events completada
+ records:
+ title: Events
+ sorry_no_results: Lo siento, no hay resultados
+ no_items_yet: No hay events todavía. Pulsa en "Crear nuevo Event" para crear tu primer event.
+ event:
+ view_live_html: Ver este event como abierto al público <br/><em>(abre en ventana nueva)</em>
+ edit: Editar este event
+ delete: Borrar este event para siempre
+ events:
+ show:
+ other: Otros events
+ activerecord:
+ attributes:
+ 'refinery/calendar/event':
+ title: Title
View
27 config/locales/fr.yml
@@ -0,0 +1,27 @@
+fr:
+ refinery:
+ plugins:
+ events:
+ title: Events
+ calendar:
+ admin:
+ events:
+ actions:
+ create_new: Créer un(e) nouve(au/l/lle) Event
+ reorder: Réordonner les Events
+ reorder_done: Fin de réordonnancement des Events
+ records:
+ title: Events
+ sorry_no_results: "Désolé ! Aucun résultat."
+ no_items_yet: 'Il n''y a actuellement aucun(e) Event. Cliquer sur "Créer un(e) nouve(au/l/lle) Event" pour créer votre premi(er/ère) event.'
+ event:
+ view_live_html: Voir ce(t/tte) event <br/><em>(Ouvre une nouvelle fenêtre)</em>
+ edit: Modifier ce(t/tte) event
+ delete: Supprimer définitivement ce(t/tte) event
+ events:
+ show:
+ other: Autres Events
+ activerecord:
+ attributes:
+ 'refinery/calendar/event':
+ title: Title
View
27 config/locales/nb.yml
@@ -0,0 +1,27 @@
+nb:
+ refinery:
+ plugins:
+ events:
+ title: Events
+ calendar:
+ admin:
+ events:
+ actions:
+ create_new: Lag en ny Event
+ reorder: Endre rekkefølgen på Events
+ reorder_done: Ferdig å endre rekkefølgen Events
+ records:
+ title: Events
+ sorry_no_results: Beklager! Vi fant ikke noen resultater.
+ no_items_yet: Det er ingen Events enda. Klikk på "Lag en ny Event" for å legge til din første event.
+ event:
+ view_live_html: Vis hvordan denne event ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
+ edit: Rediger denne event
+ delete: Fjern denne event permanent
+ events:
+ show:
+ other: Andre Events
+ activerecord:
+ attributes:
+ 'refinery/calendar/event':
+ title: Title
View
27 config/locales/nl.yml
@@ -0,0 +1,27 @@
+nl:
+ refinery:
+ plugins:
+ events:
+ title: Events
+ calendar:
+ admin:
+ events:
+ actions:
+ create_new: Maak een nieuwe Event
+ reorder: Wijzig de volgorde van de Events
+ reorder_done: Klaar met het wijzingen van de volgorde van de Events
+ records:
+ title: Events
+ sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
+ no_items_yet: Er zijn nog geen Events. Druk op 'Maak een nieuwe Event' om de eerste aan te maken.
+ event:
+ view_live_html: Bekijk deze event op de website <br/><em>(opent een nieuw venster)</em>
+ edit: Bewerk deze event
+ delete: Verwijder deze event voor eeuwig
+ events:
+ show:
+ other: Andere Events
+ activerecord:
+ attributes:
+ 'refinery/calendar/event':
+ title: Title
View
19 config/routes.rb
@@ -0,0 +1,19 @@
+Refinery::Core::Engine.routes.append do
+
+ # Frontend routes
+ namespace :calendar do
+ resources :events, :only => [:index, :show]
+ end
+
+ # Admin routes
+ namespace :calendar, :path => '' do
+ namespace :admin, :path => 'refinery/calendar' do
+ resources :events, :except => :show do
+ collection do
+ post :update_positions
+ end
+ end
+ end
+ end
+
+end
View
26 db/migrate/1_create_calendar_events.rb
@@ -0,0 +1,26 @@
+class CreateCalendarEvents < ActiveRecord::Migration
+
+ def up
+ create_table :refinery_calendar_events do |t|
+ t.string :title
+ t.integer :position
+
+ t.timestamps
+ end
+
+ end
+
+ def down
+ if defined?(::Refinery::UserPlugin)
+ ::Refinery::UserPlugin.destroy_all({:name => "refinerycms-calendar"})
+ end
+
+ if defined?(::Refinery::Page)
+ ::Refinery::Page.delete_all({:link_url => "/calendar/events"})
+ end
+
+ drop_table :refinery_calendar_events
+
+ end
+
+end
View
23 db/seeds.rb
@@ -0,0 +1,23 @@
+if defined?(::Refinery::User)
+ ::Refinery::User.all.each do |user|
+ if user.plugins.where(:name => 'refinerycms-calendar').blank?
+ user.plugins.create(:name => 'refinerycms-calendar',
+ :position => (user.plugins.maximum(:position) || -1) +1)
+ end
+ end
+end
+
+
+url = "/calendar/events"
+if defined?(::Refinery::Page) && ::Refinery::Page.where(:link_url => url).empty?
+ page = ::Refinery::Page.create(
+ :title => 'Events',
+ :link_url => url,
+ :deletable => false,
+ :menu_match => "^#{url}(\/|\/.+?|)$"
+ )
+ Refinery::Pages.default_parts.each_with_index do |default_page_part, index|
+ page.parts.create(:title => default_page_part, :body => nil, :position => index)
+ end
+end
+
View
18 lib/generators/refinery/calendar_generator.rb
@@ -0,0 +1,18 @@
+module Refinery
+ class CalendarGenerator < Rails::Generators::Base
+
+ def rake_db
+ rake("refinery_calendar:install:migrations")
+ end
+
+ def append_load_seed_data
+ create_file 'db/seeds.rb' unless File.exists?(File.join(destination_root, 'db', 'seeds.rb'))
+ append_file 'db/seeds.rb', :verbose => true do
+ <<-EOH
+
+Refinery::Calendar::Engine.load_seed
+ EOH
+ end
+ end
+ end
+end
View
21 lib/refinery/events.rb
@@ -0,0 +1,21 @@
+require 'refinerycms-core'
+
+module Refinery
+ autoload :CalendarGenerator, 'generators/refinery/calendar_generator'
+
+ module Events
+ require 'refinery/events/engine'
+
+ class << self
+ attr_writer :root
+
+ def root
+ @root ||= Pathname.new(File.expand_path('../../../', __FILE__))
+ end
+
+ def factory_paths
+ @factory_paths ||= [ root.join('spec', 'factories').to_s ]
+ end
+ end
+ end
+end
View
26 lib/refinery/events/engine.rb
@@ -0,0 +1,26 @@
+module Refinery
+ module Calendar
+ class Engine < Rails::Engine
+ include Refinery::Engine
+ isolate_namespace Refinery::Calendar
+
+ engine_name :refinery_calendar
+
+ initializer "register refinerycms_events plugin" do
+ Refinery::Plugin.register do |plugin|
+ plugin.name = "events"
+ plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.calendar_admin_events_path }
+ plugin.pathname = root
+ plugin.activity = {
+ :class_name => :'refinery/calendar/event'
+ }
+ plugin.menu_match = %r{refinery/calendar/events(/.*)?$}
+ end
+ end
+
+ config.after_initialize do
+ Refinery.register_extension(Refinery::Events)
+ end
+ end
+ end
+end
View
1  lib/refinerycms-calendar.rb
@@ -0,0 +1 @@
+require 'refinery/events'
View
13 lib/tasks/refinery/calendar.rake
@@ -0,0 +1,13 @@
+namespace :refinery do
+
+ namespace :calendar do
+
+ # call this task by running: rake refinery:calendar:my_task
+ # desc "Description of my task below"
+ # task :my_task => :environment do
+ # # add your logic here
+ # end
+
+ end
+
+end
View
10 readme.md
@@ -0,0 +1,10 @@
+# Calendar extension for Refinery CMS.
+
+## How to build this extension as a gem
+
+ cd vendor/extensions/calendar
+ gem build refinerycms-calendar.gemspec
+ gem install refinerycms-calendar.gem
+
+ # Sign up for a http://rubygems.org/ account and publish the gem
+ gem push refinerycms-calendar.gem
View
18 refinerycms-calendar.gemspec
@@ -0,0 +1,18 @@
+# Encoding: UTF-8
+
+Gem::Specification.new do |s|
+ s.platform = Gem::Platform::RUBY
+ s.name = 'refinerycms-calendar'
+ s.version = '1.0'
+ s.description = 'Ruby on Rails Calendar extension for Refinery CMS'
+ s.date = '2012-03-26'
+ s.summary = 'Calendar extension for Refinery CMS'
+ s.require_paths = %w(lib)
+ s.files = Dir["{app,config,db,lib}/**/*"] + ["readme.md"]
+
+ # Runtime dependencies
+ s.add_dependency 'refinerycms-core', '~> 2.0.2'
+
+ # Development dependencies (usually used for testing)
+ s.add_development_dependency 'refinerycms-testing', '~> 2.0.2'
+end
View
35 script/test
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# From Destroy All Software screencast #10, at:
+# http://destroyallsoftware.com/screencasts/catalog/fast-tests-with-and-without-rails
+#
+# Put this in the script/ directory of your Rails app, then run it with a spec
+# filename. If the spec uses spec_helper, it'll be run inside Bundler.
+# Otherwise, it'll be run directly with whatever `rspec` executable is on the
+# path.
+
+set -e
+
+need_rails=1
+
+if [ $# -gt 0 ]; then # we have args
+ filename=$1
+ # Remove trailing line numbers from filename, e.g. spec/my_spec.rb:33
+ grep_filename=`echo $1 | sed 's/:.*$//g'`
+
+ (set +e; grep -r '\bspec_helper\b' $grep_filename) > /dev/null
+ if [ $? -eq 1 ]; then # no match; we have a stand-alone spec
+ need_rails=''
+ fi
+else # we have no args
+ filename='spec'
+fi
+
+command='rspec'
+
+if [ $need_rails ]; then
+ command="ruby -S bundle exec $command"
+fi
+
+RAILS_ENV=test $command $filename
+
View
9 spec/models/refinery/refinery/calendar_spec.rb
@@ -0,0 +1,9 @@
+require 'calendar'
+
+module Refinery
+ describe Calendar do
+ it "has an empty title" do
+ subject.title.should be_nil
+ end
+ end
+end
View
6 tasks/rspec.rake
@@ -0,0 +1,6 @@
+require 'rspec/core/rake_task'
+
+desc "Run specs"
+RSpec::Core::RakeTask.new do |t|
+ t.pattern = "./spec"
+end
View
8 tasks/testing.rake
@@ -0,0 +1,8 @@
+namespace :refinery do
+ namespace :testing do
+ # Put any code in here that you want run when you test this extension against a dummy app.
+ # For example, the call to require your gem and start your generator.
+ task :setup_extension do
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.