bcms_event 1.0.0 → 1.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.
data/Gemfile ADDED
@@ -0,0 +1,32 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Bundle edge Rails instead:
4
+ # gem 'rails', :git => 'git://github.com/rails/rails.git'
5
+
6
+ gem 'sqlite3'
7
+
8
+ # Use unicorn as the web server
9
+ # gem 'unicorn'
10
+
11
+ # Deploy with Capistrano
12
+ # gem 'capistrano'
13
+
14
+ # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
15
+ # gem 'ruby-debug'
16
+ # gem 'ruby-debug19', :require => 'ruby-debug'
17
+
18
+ # Bundle the extra gems:
19
+ # gem 'bj'
20
+ # gem 'nokogiri'
21
+ # gem 'sqlite3-ruby', :require => 'sqlite3'
22
+ # gem 'aws-s3', :require => 'aws/s3'
23
+
24
+ # Bundle gems for the local environment. Make sure to
25
+ # put test-only gems in this group so their generators
26
+ # and rake tasks are available in development mode:
27
+ # group :development, :test do
28
+ # gem 'webrat'
29
+ # end
30
+
31
+ gem "mysql"
32
+ gemspec
data/README.markdown ADDED
@@ -0,0 +1,44 @@
1
+ # Event Module for BrowserCMS
2
+
3
+ An Event Module for BrowserCMS. Allows contributors to create and post new upcoming events.
4
+
5
+ ## Features
6
+
7
+ * Events - Contributors can create Event content that represent Single or Multiday Events.
8
+ * Event Lists - Allows a complete listing of all published events in a reverse chronological order along with names and descriptions.
9
+ * Event Details - Allows visitors to see the complete details for each Event, including the ability link to external Event Registration pages.
10
+ * SEO Friendly URLs - Each event will have its own custom URL to display itself.
11
+ * Customizable Views - Event listings and detail pages can be styled using editable Portlet views.
12
+
13
+ ## Installation
14
+
15
+ The Event module installs like other BrowserCMS modules.
16
+
17
+ gem install bcms_event
18
+ rails g cms:install bcms_event
19
+
20
+ See http://guides.browsercms.org/installing_modules.html for further details.
21
+
22
+ ### What's installed
23
+
24
+ When installing this module, it will create the following new pages/blocks.
25
+
26
+ * Event Page - A new Page 'Event' will be created at the root of the site, with an 'Event' portlet added. (Allows this page to display any Event)
27
+ * Events Page - A new Page 'Events' that will list all published events in a list.
28
+ * Event Route - A dynamic route to allow specific events to be shown by the Event page using a route like /events/:year/:month/:day/:slug
29
+
30
+ ## Event Details
31
+
32
+ This module includes a new Event Content Type, with the following fields:
33
+
34
+ * Name
35
+ * Start and End Dates
36
+ * Location
37
+ * Contact Email
38
+ * Description - Used on the Event listing to summarize the Event.
39
+ * More Info URL
40
+ * Registration URL - Allows a link to external sites for registration.
41
+ * Category
42
+ * Tags
43
+ * Body - For the detailed view page.
44
+
data/app/models/event.rb CHANGED
@@ -5,7 +5,7 @@ class Event < ActiveRecord::Base
5
5
  before_validation :set_slug
6
6
  validates_presence_of :name, :slug, :starts_on
7
7
 
8
- named_scope :starts_on, lambda {|date|
8
+ scope :starts_on, lambda {|date|
9
9
  d = if date.kind_of?(Hash)
10
10
  Date.new(date[:year].to_i, date[:month].to_i, date[:day].to_i)
11
11
  else
@@ -15,7 +15,7 @@ class Event < ActiveRecord::Base
15
15
  {:conditions => ["events.starts_on = ?", d]}
16
16
  }
17
17
 
18
- named_scope :with_slug, lambda{|slug| {:conditions => ["events.slug = ?",slug]}}
18
+ scope :with_slug, lambda{|slug| {:conditions => ["events.slug = ?",slug]}}
19
19
 
20
20
  def self.default_order
21
21
  "starts_on desc"
@@ -1,5 +1,7 @@
1
1
  class EventPortlet < Portlet
2
2
 
3
+ enable_template_editor true
4
+
3
5
  def render
4
6
  # @event should already be set by the page route
5
7
  if !@event && params[:event_id]
@@ -1,5 +1,7 @@
1
1
  class EventsPortlet < Portlet
2
2
 
3
+ enable_template_editor true
4
+
3
5
  def render
4
6
  if self.category_id.blank?
5
7
  @events = Event.published.all
@@ -3,8 +3,8 @@
3
3
  <p><b>Ends On:</b> <%= @content_block.ends_on %></p>
4
4
  <p><b>Location:</b> <%= @content_block.location %></p>
5
5
  <p><b>Contact Email:</b> <%= @content_block.contact_email %></p>
6
- <p><b>Description:</b> <%= simple_format h(@content_block.description) %></p>
6
+ <p><b>Description:</b> <%= simple_format @content_block.description %></p>
7
7
  <p><b>More Info Url:</b> <%= @content_block.more_info_url %></p>
8
8
  <p><b>Registration Url:</b> <%= @content_block.registration_url %></p>
9
9
  <p><b>Category:</b> <%= @content_block.category_name %></p>
10
- <p><b>Body:</b> <%= @content_block.body %></p>
10
+ <p><b>Body:</b> <%= @content_block.body.html_safe %></p>
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
5
+ <title><%= page_title %></title>
6
+ <%= yield :html_head %>
7
+ </head>
8
+ <body style="margin: 0; padding: 0; text-align: center;">
9
+ <%= cms_toolbar %>
10
+ <div id="wrapper" style="width: 700px; margin: 0 auto; text-align: left; padding: 30px">
11
+ Breadcrumbs: <%= render_breadcrumbs %>
12
+ Main Menu: <%= render_menu %>
13
+ <h1><%= page_title %></h1>
14
+ <%= container :main %>
15
+ </div>
16
+ </body>
17
+ </html>
@@ -1,2 +1,2 @@
1
1
  <%= f.cms_text_field :name %>
2
- <%= f.cms_text_area :template, :default_value => @block.class.default_template %>
2
+ <%= f.cms_template_editor :template %>
@@ -1,4 +1,5 @@
1
- <p><b>Name:</b> <%= @event.name %></p>
1
+ <% if @event %>
2
+ <p><b>Name:</b> <%= @event.name.html_safe %></p>
2
3
  <p><b>Starts On:</b> <%= @event.starts_on %></p>
3
4
  <p><b>Ends On:</b> <%= @event.ends_on %></p>
4
5
  <p><b>Location:</b> <%= @event.location %></p>
@@ -7,4 +8,8 @@
7
8
  <p><b>More Info Url:</b> <%= @event.more_info_url %></p>
8
9
  <p><b>Registration Url:</b> <%= @event.registration_url %></p>
9
10
  <p><b>Category:</b> <%= @event.category_name %></p>
10
- <p><b>Body:</b> <%= @event.body %></p>
11
+ <p><b>Body:</b> <%= @event.body.html_safe %></p>
12
+ <% else -%>
13
+ <b>Missing required parameter</b><br/>
14
+ This portlet expects a request parameter 'event_id'. Be sure the calling page provides it.
15
+ <% end -%>
@@ -1,3 +1,3 @@
1
1
  <%= f.cms_text_field :name %>
2
2
  <%= f.cms_drop_down :category_id, categories_for('Event').map{|c| [c.path, c.id]}, :include_blank => true %>
3
- <%= f.cms_text_area :template, :default_value => @block.class.default_template %>
3
+ <%= f.cms_template_editor :template %>
@@ -7,9 +7,9 @@
7
7
  <div id="event_<%= event.id %>" class="event">
8
8
  <span class="event_starts_on"><b><%= event.starts_on.to_s(:long) %></b></span>
9
9
  <br/>
10
- <%= link_to "<b>#{h(event.name)}</b>", event_path(event.route_params) %><br/>
10
+ <%= link_to "<b>#{h(event.name)}</b>".html_safe, event_path(event.route_params) %><br/>
11
11
  <% unless event.description.blank? -%>
12
- <p><%= simple_format h(event.description) %></p>
12
+ <p><%= simple_format(event.description).html_safe %></p>
13
13
  <% end %>
14
14
  </div>
15
15
  <% end %>
@@ -0,0 +1,44 @@
1
+ # Load the seed data specifically for the Event Module
2
+ # Add the following line to your seeds.rb to make db:seed run this file:
3
+ # load File.expand_path('../bcms_event.seeds.rb', __FILE__)
4
+ unless CategoryType.named('Event').exists?
5
+ CategoryType.create!(:name => "Event")
6
+ end
7
+
8
+ ContentType.create!(:name => "Event", :group_name => "Event")
9
+
10
+ event_page = Page.create!(
11
+ :name => "Event",
12
+ :path => "/event",
13
+ :section => Section.root.first,
14
+ :template_file_name => "default.html.erb")
15
+
16
+ EventPortlet.create!(
17
+ :name => "Event Details",
18
+ :template => EventPortlet.default_template,
19
+ :connect_to_page_id => event_page.id,
20
+ :connect_to_container => "main",
21
+ :publish_on_save => true)
22
+
23
+ events_page = Page.create!(
24
+ :name => "Events",
25
+ :path => "/events",
26
+ :section => Section.root.first,
27
+ :template_file_name => "default.html.erb")
28
+
29
+ EventsPortlet.create!(
30
+ :name => "Event List",
31
+ :template => EventsPortlet.default_template,
32
+ :connect_to_page_id => events_page.id,
33
+ :connect_to_container => "main",
34
+ :publish_on_save => true)
35
+
36
+ route = event_page.page_routes.build(
37
+ :name => "Event",
38
+ :pattern => "/events/:year/:month/:day/:slug",
39
+ :code => "@event = Event.published.starts_on(params).with_slug(params[:slug]).first")
40
+ route.add_condition(:method, "get")
41
+ route.add_requirement(:year, '\d{4,}')
42
+ route.add_requirement(:month, '\d{2,}')
43
+ route.add_requirement(:day, '\d{2,}')
44
+ route.save!
@@ -13,42 +13,6 @@ class CreateEvents < ActiveRecord::Migration
13
13
  t.belongs_to :category
14
14
  t.text :body, :size => (64.kilobytes + 1)
15
15
  end
16
- unless CategoryType.named('Event').exists?
17
- CategoryType.create!(:name => "Event")
18
- end
19
-
20
- ContentType.create!(:name => "Event", :group_name => "Event")
21
-
22
- event_page = Page.create!(
23
- :name => "Event",
24
- :path => "/event",
25
- :section => Section.root.first,
26
- :template_file_name => "default.html.erb")
27
-
28
- EventPortlet.create!(
29
- :name => "Event Details",
30
- :template => EventPortlet.default_template,
31
- :connect_to_page_id => event_page.id,
32
- :connect_to_container => "main",
33
- :publish_on_save => true)
34
-
35
- EventsPortlet.create!(
36
- :name => "Event List",
37
- :template => EventsPortlet.default_template,
38
- :connect_to_page_id => event_page.id,
39
- :connect_to_container => "main",
40
- :publish_on_save => true)
41
-
42
- route = event_page.page_routes.build(
43
- :name => "Event",
44
- :pattern => "/events/:year/:month/:day/:slug",
45
- :code => "@event = Event.published.starts_on(params).with_slug(params[:slug]).first")
46
- route.add_condition(:method, "get")
47
- route.add_requirement(:year, '\d{4,}')
48
- route.add_requirement(:month, '\d{2,}')
49
- route.add_requirement(:day, '\d{2,}')
50
- route.save!
51
-
52
16
  end
53
17
 
54
18
  def self.down
@@ -0,0 +1,7 @@
1
+ require 'browsercms'
2
+
3
+ module BcmsEvent
4
+ class Engine < Rails::Engine
5
+ include Cms::Module
6
+ end
7
+ end
@@ -1,7 +1,7 @@
1
1
  module Cms::Routes
2
2
  def routes_for_bcms_event
3
- namespace(:cms) do |cms|
4
- cms.content_blocks :events
3
+ namespace(:cms) do
4
+ content_blocks :events
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,3 @@
1
+ module BcmsEvent
2
+ VERSION = "1.1.0"
3
+ end
data/lib/bcms_event.rb CHANGED
@@ -1 +1,2 @@
1
+ require 'bcms_event/engine'
1
2
  require 'bcms_event/routes'
@@ -0,0 +1,10 @@
1
+ Description:
2
+ Installs the bcms_event module.
3
+
4
+ Example:
5
+ rails generate bcms_event:install
6
+
7
+ This will:
8
+ 1. Copy any migrations from the gem into the project.
9
+ 2. Add the routes to the config/routes.rb
10
+
@@ -0,0 +1,13 @@
1
+ require 'cms/module_installation'
2
+
3
+ class BcmsEvent::InstallGenerator < Cms::ModuleInstallation
4
+ add_migrations_directory_to_source_root __FILE__
5
+
6
+ # Add migrations to be copied, by uncommenting the following file and editing as needed.
7
+ copy_migration_file '20090504174621_create_events.rb'
8
+
9
+ def add_seed_data_to_project
10
+ copy_file "../bcms_event.seeds.rb", "db/bcms_event.seeds.rb"
11
+ append_to_file "db/seeds.rb", "load File.expand_path('../bcms_event.seeds.rb', __FILE__)"
12
+ end
13
+ end
metadata CHANGED
@@ -1,72 +1,86 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bcms_event
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
+ authors:
7
8
  - BrowserMedia
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
-
12
- date: 2009-07-02 00:00:00 -04:00
13
- default_executable:
14
- dependencies: []
15
-
16
- description: The Event Module for BrowserCMS
12
+ date: 2012-01-09 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: browsercms
16
+ requirement: &70147159461800 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.3.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70147159461800
25
+ description:
17
26
  email: github@browsermedia.com
18
27
  executables: []
19
-
20
28
  extensions: []
21
-
22
- extra_rdoc_files:
23
- - LICENSE.txt
24
- - README
25
- files:
29
+ extra_rdoc_files:
30
+ - README.markdown
31
+ files:
26
32
  - app/controllers/cms/events_controller.rb
27
33
  - app/models/event.rb
28
34
  - app/portlets/event_portlet.rb
29
35
  - app/portlets/events_portlet.rb
30
36
  - app/views/cms/events/_form.html.erb
31
37
  - app/views/cms/events/render.html.erb
38
+ - app/views/layouts/templates/default.html.erb
32
39
  - app/views/portlets/event/_form.html.erb
33
40
  - app/views/portlets/event/render.html.erb
34
41
  - app/views/portlets/events/_form.html.erb
35
42
  - app/views/portlets/events/render.html.erb
36
43
  - db/migrate/20090504174621_create_events.rb
37
- - lib/bcms_event.rb
44
+ - db/bcms_event.seeds.rb
45
+ - lib/bcms_event/engine.rb
38
46
  - lib/bcms_event/routes.rb
39
- - rails/init.rb
47
+ - lib/bcms_event/version.rb
48
+ - lib/bcms_event.rb
49
+ - lib/generators/bcms_event/install/install_generator.rb
50
+ - lib/generators/bcms_event/install/USAGE
51
+ - Gemfile
40
52
  - LICENSE.txt
41
- - README
42
- has_rdoc: true
43
- homepage: http://browsercms.org
53
+ - COPYRIGHT.txt
54
+ - GPL.txt
55
+ - README.markdown
56
+ homepage: http://www.github.com/browsermedia/bcms_event
57
+ licenses: []
44
58
  post_install_message:
45
- rdoc_options:
46
- - --charset=UTF-8
47
- require_paths:
59
+ rdoc_options: []
60
+ require_paths:
48
61
  - lib
49
- required_ruby_version: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: "0"
54
- version:
55
- required_rubygems_version: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: "0"
60
- version:
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ segments:
69
+ - 0
70
+ hash: -2581123145499977071
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ segments:
78
+ - 0
79
+ hash: -2581123145499977071
61
80
  requirements: []
62
-
63
- rubyforge_project: browsercms
64
- rubygems_version: 1.3.1
81
+ rubyforge_project: bcms_event
82
+ rubygems_version: 1.8.10
65
83
  signing_key:
66
- specification_version: 2
84
+ specification_version: 3
67
85
  summary: The Event Module for BrowserCMS
68
- test_files:
69
- - test/functional/events_portlet_test.rb
70
- - test/performance/browsing_test.rb
71
- - test/test_helper.rb
72
- - test/test_logging.rb
86
+ test_files: []