refinerycms-calendar 2.0.0.alpha → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/app/controllers/refinery/calendar/admin/events_controller.rb +7 -31
  2. data/app/controllers/refinery/calendar/admin/venues_controller.rb +14 -0
  3. data/app/controllers/refinery/calendar/events_controller.rb +7 -9
  4. data/app/controllers/refinery/calendar/venues_controller.rb +6 -0
  5. data/app/models/refinery/calendar/event.rb +23 -38
  6. data/app/models/refinery/calendar/venue.rb +9 -0
  7. data/app/views/refinery/calendar/admin/events/_actions.html.erb +1 -0
  8. data/app/views/refinery/calendar/admin/events/_event.html.erb +13 -3
  9. data/app/views/refinery/calendar/admin/events/_form.html.erb +60 -6
  10. data/app/views/refinery/calendar/admin/events/index.html.erb +1 -1
  11. data/app/views/refinery/calendar/admin/shared/_links.html.erb +8 -0
  12. data/app/views/refinery/calendar/admin/venues/_actions.html.erb +26 -0
  13. data/app/views/refinery/calendar/admin/venues/_form.html.erb +35 -0
  14. data/app/views/refinery/calendar/admin/venues/_records.html.erb +18 -0
  15. data/app/views/refinery/calendar/admin/venues/_sortable_list.html.erb +5 -0
  16. data/app/views/refinery/calendar/admin/venues/_venue.html.erb +20 -0
  17. data/app/views/refinery/calendar/admin/venues/_venues.html.erb +2 -0
  18. data/app/views/refinery/calendar/admin/venues/edit.html.erb +1 -0
  19. data/app/views/refinery/calendar/admin/venues/index.html.erb +8 -0
  20. data/app/views/refinery/calendar/admin/venues/new.html.erb +1 -0
  21. data/app/views/refinery/calendar/events/_event.html.erb +8 -0
  22. data/app/views/refinery/calendar/events/index.html.erb +5 -7
  23. data/app/views/refinery/calendar/events/show.html.erb +19 -18
  24. data/app/views/refinery/calendar/venues/index.html.erb +11 -0
  25. data/app/views/refinery/calendar/venues/show.html.erb +45 -0
  26. data/app/views/sitemap/index.xml.builder +25 -0
  27. data/config/database.yml.mysql +20 -0
  28. data/config/database.yml.postgresql +58 -0
  29. data/config/database.yml.sqlite3 +18 -0
  30. data/config/initializers/refinery/authentication.rb +4 -0
  31. data/config/initializers/refinery/core.rb +48 -0
  32. data/config/initializers/refinery/images.rb +44 -0
  33. data/config/initializers/refinery/pages.rb +52 -0
  34. data/config/initializers/refinery/resources.rb +26 -0
  35. data/config/locales/en.yml +36 -2
  36. data/config/locales/es.yml +36 -5
  37. data/config/locales/fr.yml +34 -4
  38. data/config/locales/nb.yml +36 -4
  39. data/config/locales/nl.yml +36 -4
  40. data/config/routes.rb +24 -2
  41. data/db/migrate/1_create_calendar_events.rb +34 -0
  42. data/db/migrate/2_create_calendar_venues.rb +29 -0
  43. data/db/seeds.rb +5 -2
  44. data/lib/generators/refinery/calendar_generator.rb +3 -13
  45. data/lib/refinery/{calendar.rb → events.rb} +2 -9
  46. data/lib/refinery/{calendar → events}/engine.rb +3 -3
  47. data/lib/refinery/venues.rb +21 -0
  48. data/lib/refinery/venues/engine.rb +14 -0
  49. data/lib/refinerycms-calendar.rb +2 -1
  50. data/readme.md +11 -7
  51. metadata +52 -14
  52. data/app/models/refinery/calendar/core_calendar.rb +0 -36
  53. data/lib/refinery/calendar/configuration.rb +0 -7
  54. data/lib/refinery/calendar/version.rb +0 -17
  55. data/lib/refinery/engine/multi_parameter_assignment.rb +0 -6
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1,8 @@
1
+ <%= div_for event do -%>
2
+ <time class="date" datetime="<%= event.from %>">
3
+ <%= event.from.strftime('%b %d').html_safe %>
4
+ </time>
5
+
6
+ <h1><%= link_to event.title, refinery.calendar_event_path(event) %></h1>
7
+ <p><%= event.excerpt %></p>
8
+ <% end -%>
@@ -1,11 +1,9 @@
1
1
  <% content_for :body_content_left do %>
2
- <ul id="events">
3
- <% @events.each do |event| %>
4
- <li>
5
- <%= link_to event.title, refinery.calendar_event_path(event) %>
6
- </li>
7
- <% end %>
8
- </ul>
2
+ <section id="events">
3
+ <%= render @events %>
4
+ </section>
9
5
  <% end %>
10
6
 
7
+ <% content_for :stylesheets, stylesheet_link_tag('events') %>
8
+
11
9
  <%= render '/refinery/content_page' %>
@@ -3,25 +3,26 @@
3
3
  <% end %>
4
4
 
5
5
  <% content_for :body_content_left do %>
6
- <section>
7
- <h1>Title</h1>
8
- <p>
9
- <%=raw @event.title %>
10
- </p>
11
- </section>
12
- <% end %>
6
+ <h4>Event details</h4>
7
+ <h5><%= @event.venue_name %></h5>
8
+
9
+ <p>From <%= @event.from.strftime('%B %d, %Y %I:%M%p') %> to
10
+ <br><%= @event.to.strftime('%B %d, %Y %I:%M%p') %></p>
11
+
12
+ <% if @event.registration_link.present? %>
13
+ <p><%= link_to 'Register for this event', @event.registration_link %></p>
14
+ <% end -%>
13
15
 
14
- <% content_for :body_content_right do %>
15
- <aside>
16
- <h2><%= t('.other') %></h2>
17
- <ul id="events">
18
- <% @events.each do |event| %>
19
- <li>
20
- <%= link_to event.title, refinery.calendar_event_path(event) %>
21
- </li>
22
- <% end %>
23
- </ul>
24
- </aside>
16
+ <% if @event.venue_address.present? %>
17
+ <p><%= link_to 'View it on a map', "http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=#{CGI::escape(@event.venue.address)}&ie=UTF8&z=16" %></p>
18
+ <% end -%>
19
+
20
+ <div class="event_description">
21
+ <h4><%= @event.excerpt %></h4>
22
+ <%=raw @event.description %>
23
+ </div>
25
24
  <% end %>
26
25
 
26
+ <% content_for :stylesheets, stylesheet_link_tag('events') %>
27
+
27
28
  <%= render '/refinery/content_page' %>
@@ -0,0 +1,11 @@
1
+ <% content_for :body_content_left do %>
2
+ <ul id="venues">
3
+ <% @venues.each do |venue| %>
4
+ <li>
5
+ <%= link_to venue.name, refinery.calendar_venue_path(venue) %>
6
+ </li>
7
+ <% end %>
8
+ </ul>
9
+ <% end %>
10
+
11
+ <%= render '/refinery/content_page' %>
@@ -0,0 +1,45 @@
1
+ <% content_for :body_content_title do %>
2
+ <%= @venue.name %>
3
+ <% end %>
4
+
5
+ <% content_for :body_content_left do %>
6
+ <section>
7
+ <h1>Name</h1>
8
+ <p>
9
+ <%=raw @venue.name %>
10
+ </p>
11
+ </section>
12
+ <section>
13
+ <h1>Address</h1>
14
+ <p>
15
+ <%=raw @venue.address %>
16
+ </p>
17
+ </section>
18
+ <section>
19
+ <h1>Url</h1>
20
+ <p>
21
+ <%=raw @venue.url %>
22
+ </p>
23
+ </section>
24
+ <section>
25
+ <h1>Phone</h1>
26
+ <p>
27
+ <%=raw @venue.phone %>
28
+ </p>
29
+ </section>
30
+ <% end %>
31
+
32
+ <% content_for :body_content_right do %>
33
+ <aside>
34
+ <h2><%= t('.other') %></h2>
35
+ <ul id="venues">
36
+ <% @venues.each do |venue| %>
37
+ <li>
38
+ <%= link_to venue.name, refinery.calendar_venue_path(venue) %>
39
+ </li>
40
+ <% end %>
41
+ </ul>
42
+ </aside>
43
+ <% end %>
44
+
45
+ <%= render '/refinery/content_page' %>
@@ -0,0 +1,25 @@
1
+ xml.instruct!
2
+
3
+ xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
4
+
5
+ @locales.each do |locale|
6
+ ::I18n.locale = locale
7
+ ::Refinery::Page.live.in_menu.includes(:parts).each do |page|
8
+ # exclude sites that are external to our own domain.
9
+ page_url = if page.url.is_a?(Hash)
10
+ # This is how most pages work without being overriden by link_url
11
+ page.url.merge({:only_path => false})
12
+ elsif page.url.to_s !~ /^http/
13
+ # handle relative link_url addresses.
14
+ [request.protocol, request.host_with_port, page.url].join
15
+ end
16
+
17
+ # Add XML entry only if there is a valid page_url found above.
18
+ xml.url do
19
+ xml.loc url_for(page_url)
20
+ xml.lastmod page.updated_at.to_date
21
+ end if page_url.present? and page.show_in_menu?
22
+ end
23
+ end
24
+
25
+ end
@@ -0,0 +1,20 @@
1
+ development: &development
2
+ adapter: mysql2
3
+ host: localhost
4
+ username: root
5
+ password:
6
+ database: your_local_database
7
+
8
+ test: &test
9
+ adapter: mysql2
10
+ host: localhost
11
+ username: root
12
+ password:
13
+ database: your_test_database
14
+
15
+ production: &production
16
+ adapter: mysql2
17
+ host: localhost
18
+ database: your_production_database
19
+ username: your_production_database_login
20
+ password: your_production_database_password
@@ -0,0 +1,58 @@
1
+ # PostgreSQL. Versions 7.4 and 8.x are supported.
2
+ #
3
+ # Install the pg driver:
4
+ # gem install pg
5
+ # On Mac OS X with macports:
6
+ # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
7
+ # On Windows:
8
+ # gem install pg
9
+ # Choose the win32 build.
10
+ # Install PostgreSQL and put its /bin directory on your path.
11
+ #
12
+ # Configure Using Gemfile
13
+ # gem 'pg'
14
+ #
15
+ development:
16
+ adapter: postgresql
17
+ encoding: unicode
18
+ database: refinery_database_development
19
+ pool: 5
20
+ username: postgres
21
+ password: postgres
22
+ min_messages: warning
23
+
24
+ # Connect on a TCP socket. Omitted by default since the client uses a
25
+ # domain socket that doesn't need configuration. Windows does not have
26
+ # domain sockets, so uncomment these lines.
27
+ #host: localhost
28
+ #port: 5432
29
+
30
+ # Schema search path. The server defaults to $user,public
31
+ #schema_search_path: myapp,sharedapp,public
32
+
33
+ # Minimum log levels, in increasing order:
34
+ # debug5, debug4, debug3, debug2, debug1,
35
+ # log, notice, warning, error, fatal, and panic
36
+ # The server defaults to notice.
37
+ #min_messages: warning
38
+
39
+ # Warning: The database defined as "test" will be erased and
40
+ # re-generated from your development database when you run "rake".
41
+ # Do not set this db to the same as development or production.
42
+ test:
43
+ adapter: postgresql
44
+ encoding: unicode
45
+ database: refinery_database_test
46
+ pool: 5
47
+ username: postgres
48
+ password: postgres
49
+ min_messages: warning
50
+
51
+ production:
52
+ adapter: postgresql
53
+ encoding: unicode
54
+ database: refinery_database_production
55
+ pool: 5
56
+ username: postgres
57
+ password: postgres
58
+ min_messages: warning
@@ -0,0 +1,18 @@
1
+ # SQLite version 3.x
2
+ development:
3
+ adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3
4
+ database: db/development.sqlite3
5
+ timeout: 5000
6
+
7
+ # Warning: The database defined as 'test' will be erased and
8
+ # re-generated from your development database when you run 'rake'.
9
+ # Do not set this db to the same as development or production.
10
+ test:
11
+ adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3
12
+ database: db/test.sqlite3
13
+ timeout: 5000
14
+
15
+ production:
16
+ adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3
17
+ database: db/production.sqlite3
18
+ timeout: 5000
@@ -0,0 +1,4 @@
1
+ Refinery::Authentication.configure do |config|
2
+ # Configure whether to allow superuser to assign roles
3
+ # config.superuser_can_assign_roles = false
4
+ end
@@ -0,0 +1,48 @@
1
+ Refinery::Core.configure do |config|
2
+ # When true will rescue all not found errors and display a friendly error page
3
+ config.rescue_not_found = Rails.env.production?
4
+
5
+ # When true will use Amazon's Simple Storage Service instead of
6
+ # the default file system for storing resources and images
7
+ config.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?)
8
+
9
+ # Whenever Refinery caches anything and can set a cache key, it will add
10
+ # a prefix to the cache key containing the string you set here.
11
+ # config.base_cache_key = :refinery
12
+
13
+ # Site name
14
+ # config.site_name = "Company Name"
15
+
16
+ # This activates Google Analytics tracking within your website. If this
17
+ # config is left blank or set to UA-xxxxxx-x then no remote calls to
18
+ # Google Analytics are made.
19
+ # config.google_analytics_page_code = "UA-xxxxxx-x"
20
+
21
+ # Enable/disable authenticity token on frontend
22
+ # config.authenticity_token_on_frontend = true
23
+
24
+ # Hide/show child pages in menu
25
+ # config.menu_hide_children = false
26
+
27
+ # CSS class selectors for menu helper
28
+ # config.menu_css = {:selected=>"selected", :first=>"first", :last=>"last"}
29
+
30
+ # Should set this if concerned about DOS attacks. See
31
+ # http://markevans.github.com/dragonfly/file.Configuration.html#Configuration
32
+ # config.dragonfly_secret = "3133e393cf9a9c61355f3511ea078802e3fbb313245f1154"
33
+
34
+ # Show/hide IE6 upgrade message in the backend
35
+ # config.ie6_upgrade_message_enabled = true
36
+
37
+ # Show/hide browser update message in the backend
38
+ # config.show_internet_explorer_upgrade_message = false
39
+
40
+ # Add extra tags to the wymeditor whitelist e.g. = {'tag' => {'attributes' => {'1' => 'href'}}} or just {'tag' => {}}
41
+ # config.wymeditor_whitelist_tags = {}
42
+
43
+ # Register extra javascript for backend
44
+ # config.register_javascript "prototype-rails"
45
+
46
+ # Register extra stylesheet for backend (optional options)
47
+ # config.register_stylesheet "custom", :media => 'screen'
48
+ end
@@ -0,0 +1,44 @@
1
+ Refinery::Images.configure do |config|
2
+ # Configures the maximum allowed upload size (in bytes) for an image
3
+ # config.max_image_size = 5242880
4
+
5
+ # Configure how many images per page should be displayed when a dialog is presented that contains images
6
+ # config.pages_per_dialog = 18
7
+
8
+ # Configure how many images per page should be displayed when a dialog is presented that
9
+ # contains images and image resize options
10
+ # config.pages_per_dialog_that_have_size_options = 12
11
+
12
+ # Configure how many images per page should be displayed in the list of images in the admin area
13
+ # config.pages_per_admin_index = 20
14
+
15
+ # Configure image sizes
16
+ # config.user_image_sizes = {:small=>"110x110>", :medium=>"225x255>", :large=>"450x450>"}
17
+
18
+ # Configure white-listed mime types for validation
19
+ # config.whitelisted_mime_types = ["image/jpeg", "image/png", "image/gif", "image/tiff"]
20
+
21
+ # Configure image view options
22
+ # config.image_views = [:grid, :list]
23
+
24
+ # Configure default image view
25
+ # config.preferred_image_view = :grid
26
+
27
+ # Configure S3 (you can also use ENV for this)
28
+ # The s3_backend setting by default defers to the core setting for this but can be set just for images.
29
+ # config.s3_backend = Refinery::Core.s3_backend
30
+ # config.s3_bucket_name = ENV['S3_BUCKET']
31
+ # config.s3_access_key_id = ENV['S3_KEY']
32
+ # config.s3_secret_access_key = ENV['S3_SECRET']
33
+ # config.s3_region = ENV['S3_REGION]
34
+
35
+ # Configure Dragonfly
36
+ # This is where in the middleware stack to insert the Dragonfly middleware
37
+ # config.dragonfly_insert_before = "ActionDispatch::Callbacks"
38
+ # config.dragonfly_secret = "3133e393cf9a9c61355f3511ea078802e3fbb313245f1154"
39
+ # If you decide to trust file extensions replace :ext below with :format
40
+ # config.dragonfly_url_format = "/system/images/:job/:basename.:ext"
41
+ # config.datastore_root_path = "/Users/joe/code/refinerycms-calendar/spec/dummy/public/system/refinery/images"
42
+ # config.trust_file_extensions = false
43
+
44
+ end
@@ -0,0 +1,52 @@
1
+ Refinery::Pages.configure do |config|
2
+ # Configure specific page templates
3
+ # config.types.register :home do |home|
4
+ # home.parts = %w[intro body]
5
+ # end
6
+
7
+ # Configure global page default parts
8
+ # config.default_parts = ["Body", "Side Body"]
9
+
10
+ # Configure whether to allow adding new page parts
11
+ # config.new_page_parts = false
12
+
13
+ # Configure whether to enable marketable_urls
14
+ # config.marketable_urls = true
15
+
16
+ # Configure how many pages per page should be displayed when a dialog is presented that contains a links to pages
17
+ # config.pages_per_dialog = 14
18
+
19
+ # Configure how many pages per page should be displayed in the list of pages in the admin area
20
+ # config.pages_per_admin_index = 20
21
+
22
+ # Configure whether to strip diacritics from Western characters
23
+ # config.approximate_ascii = false
24
+
25
+ # Configure whether to strip non-ASCII characters from the friendly_id string
26
+ # config.strip_non_ascii = false
27
+
28
+ # Set this to true if you want to override slug which automatically gets generated
29
+ # when you create a page
30
+ # config.use_custom_slugs = false
31
+
32
+ # Set this to true if you want backend pages to be cached
33
+ # config.cache_pages_backend = false
34
+
35
+ # Set this to true to activate full-page-cache
36
+ # config.cache_pages_full = false
37
+
38
+ # Set this to true to fully expand the page hierarchy in the admin
39
+ # config.auto_expand_admin_tree = true
40
+
41
+ # config.layout_template_whitelist = ["application"]
42
+
43
+ # config.view_template_whitelist = ["home", "show"]
44
+
45
+ # config.use_layout_templates = false
46
+
47
+ # config.use_view_templates = false
48
+
49
+ # config.page_title = {:chain_page_title=>false, :ancestors=>{:separator=>" | ", :class=>"ancestors", :tag=>"span"}, :page_title=>{:class=>nil, :tag=>nil, :wrap_if_not_chained=>false}}
50
+
51
+ # config.absolute_page_links = false
52
+ end
@@ -0,0 +1,26 @@
1
+ Refinery::Resources.configure do |config|
2
+ # Configures the maximum allowed upload size (in bytes) for a file upload
3
+ # config.max_file_size = 52428800
4
+
5
+ # Configure how many resources per page should be displayed when a dialog is presented that contains resources
6
+ # config.pages_per_dialog = 12
7
+
8
+ # Configure how many resources per page should be displayed in the list of resources in the admin area
9
+ # config.pages_per_admin_index = 20
10
+
11
+ # Configure S3 (you can also use ENV for this)
12
+ # The s3_backend setting by default defers to the core setting for this but can be set just for resources.
13
+ # config.s3_backend = Refinery::Core.s3_backend
14
+ # config.s3_bucket_name = ENV['S3_BUCKET']
15
+ # config.s3_access_key_id = ENV['S3_KEY']
16
+ # config.s3_secret_access_key = ENV['S3_SECRET']
17
+ # config.s3_region = ENV['S3_REGION]
18
+
19
+ # Configure Dragonfly
20
+ # This is where in the middleware stack to insert the Dragonfly middleware
21
+ # config.dragonfly_insert_before = "ActionDispatch::Callbacks"
22
+ # config.dragonfly_secret = "3133e393cf9a9c61355f3511ea078802e3fbb313245f1154"
23
+ # config.dragonfly_url_format = "/system/resources/:job/:basename.:format"
24
+ # config.datastore_root_path = "/Users/joe/code/refinerycms-calendar/spec/dummy/public/system/refinery/resources"
25
+
26
+ end
@@ -1,10 +1,30 @@
1
1
  en:
2
2
  refinery:
3
3
  plugins:
4
+ venues:
5
+ title: Venues
4
6
  calendar:
5
7
  title: Calendar
6
8
  calendar:
7
9
  admin:
10
+ shared:
11
+ links:
12
+ manage_events: Manage Events
13
+ manage_venues: Manage Venues
14
+ venues:
15
+ actions:
16
+ create_new: Add New Venue
17
+ reorder: Reorder Venues
18
+ reorder_done: Done Reordering Venues
19
+ records:
20
+ title: Venues
21
+ sorry_no_results: Sorry! There are no results found.
22
+ no_items_yet: There are no Venues yet. Click "Add New Venue" to add your
23
+ first venue.
24
+ venue:
25
+ view_live_html: View this venue live <br/><em>(opens in a new window)</em>
26
+ edit: Edit this venue
27
+ delete: Remove this venue forever
8
28
  events:
9
29
  actions:
10
30
  create_new: Add New Event
@@ -13,15 +33,29 @@ en:
13
33
  records:
14
34
  title: Events
15
35
  sorry_no_results: Sorry! There are no results found.
16
- no_items_yet: There are no Events yet. Click "Add New Event" to add your first event.
36
+ no_items_yet: There are no Events yet. Click "Add New Event" to add your
37
+ first event.
17
38
  event:
18
39
  view_live_html: View this event live <br/><em>(opens in a new window)</em>
19
40
  edit: Edit this event
20
41
  delete: Remove this event forever
42
+ venues:
43
+ show:
44
+ other: Other Venues
21
45
  events:
22
46
  show:
23
47
  other: Other Events
24
48
  activerecord:
25
49
  attributes:
26
- 'refinery/calendar/event':
50
+ refinery/calendar/venue:
51
+ name: Name
52
+ address: Address
53
+ url: Url
54
+ phone: Phone
55
+ refinery/calendar/event:
27
56
  title: Title
57
+ from: From
58
+ to: To
59
+ registration_link: Registration Link
60
+ excerpt: Excerpt
61
+ description: Description