refinerycms-calendar 1.1.0 → 2.0.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/refinery/calendar/admin/events_controller.rb +43 -0
- data/app/controllers/refinery/calendar/events_controller.rb +34 -0
- data/app/models/refinery/calendar/core_calendar.rb +36 -0
- data/app/models/refinery/calendar/event.rb +51 -0
- data/app/views/refinery/calendar/admin/events/_actions.html.erb +25 -0
- data/app/views/refinery/calendar/admin/events/_event.html.erb +10 -0
- data/app/views/refinery/calendar/admin/events/_events.html.erb +2 -0
- data/app/views/refinery/calendar/admin/events/_form.html.erb +31 -0
- data/app/views/refinery/calendar/admin/events/_records.html.erb +18 -0
- data/app/views/refinery/calendar/admin/events/_sortable_list.html.erb +5 -0
- data/app/views/refinery/calendar/admin/events/edit.html.erb +1 -0
- data/app/views/refinery/calendar/admin/events/index.html.erb +8 -0
- data/app/views/refinery/calendar/admin/events/new.html.erb +1 -0
- data/app/views/refinery/calendar/events/index.html.erb +11 -0
- data/app/views/refinery/calendar/events/show.html.erb +27 -0
- data/config/locales/en.yml +25 -43
- data/config/locales/es.yml +28 -0
- data/config/locales/fr.yml +25 -43
- data/config/locales/nb.yml +25 -18
- data/config/locales/nl.yml +25 -18
- data/config/routes.rb +12 -10
- data/db/seeds.rb +23 -0
- data/lib/generators/refinery/calendar_generator.rb +29 -0
- data/lib/refinery/calendar.rb +28 -0
- data/lib/refinery/calendar/configuration.rb +7 -0
- data/lib/refinery/calendar/engine.rb +26 -0
- data/lib/refinery/calendar/version.rb +17 -0
- data/lib/refinery/engine/multi_parameter_assignment.rb +6 -0
- data/lib/refinerycms-calendar.rb +1 -24
- data/lib/tasks/{events.rake → refinery/calendar.rake} +6 -6
- data/readme.md +8 -40
- metadata +56 -96
- data/app/controllers/admin/event_categories_controller.rb +0 -9
- data/app/controllers/admin/events_controller.rb +0 -26
- data/app/controllers/event_categories_controller.rb +0 -15
- data/app/controllers/events_controller.rb +0 -65
- data/app/helpers/event_categories_helper.rb +0 -3
- data/app/helpers/events_helper.rb +0 -44
- data/app/models/event.rb +0 -86
- data/app/models/event_categorization.rb +0 -4
- data/app/models/event_category.rb +0 -10
- data/app/views/admin/event_categories/_event_categories.html.erb +0 -1
- data/app/views/admin/event_categories/_event_category.html.erb +0 -18
- data/app/views/admin/event_categories/_form.html.erb +0 -26
- data/app/views/admin/event_categories/_sortable_list.html.erb +0 -3
- data/app/views/admin/event_categories/edit.html.erb +0 -1
- data/app/views/admin/event_categories/index.html.erb +0 -40
- data/app/views/admin/event_categories/new.html.erb +0 -1
- data/app/views/admin/events/_event.html.erb +0 -18
- data/app/views/admin/events/_events.html.erb +0 -1
- data/app/views/admin/events/_form.html.erb +0 -126
- data/app/views/admin/events/_sortable_list.html.erb +0 -20
- data/app/views/admin/events/edit.html.erb +0 -1
- data/app/views/admin/events/index.html.erb +0 -41
- data/app/views/admin/events/new.html.erb +0 -1
- data/app/views/event_categories/show.html.erb +0 -15
- data/app/views/events/_event.html.erb +0 -111
- data/app/views/events/_sidebar.html.erb +0 -38
- data/app/views/events/archive.html.erb +0 -17
- data/app/views/events/index.html.erb +0 -17
- data/app/views/events/index.rss.builder +0 -24
- data/app/views/events/show.html.erb +0 -15
- data/app/views/events/show.ics.erb +0 -16
- data/changelog.md +0 -35
- data/config/locales/lolcat.yml +0 -24
- data/db/migrate/01_create_events.rb +0 -33
- data/db/migrate/02_create_event_categories.rb +0 -13
- data/db/migrate/03_create_event_categorizations.rb +0 -17
- data/db/migrate/04_add_cached_slugs.rb +0 -11
- data/db/seeds/events.rb +0 -17
- data/features/manage_events.feature +0 -54
- data/features/step_definitions/event_steps.rb +0 -14
- data/features/support/factories/event_categories.rb +0 -3
- data/features/support/factories/events.rb +0 -6
- data/features/support/paths.rb +0 -17
- data/lib/generators/refinerycms_calendar_generator.rb +0 -6
- data/public/stylesheets/refinerycms-events.css +0 -73
- data/refinerycms-calendar-1.0.4.gem +0 -0
- data/refinerycms-calendar.gemspec +0 -17
- data/spec/controllers/events_controller_spec.rb +0 -14
- data/spec/helpers/events_helper_spec.rb +0 -16
- data/spec/models/event_category_spec.rb +0 -29
- data/spec/models/event_spec.rb +0 -77
@@ -0,0 +1,43 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Calendar
|
3
|
+
module Admin
|
4
|
+
class EventsController < ::Refinery::AdminController
|
5
|
+
before_filter :init_calendar
|
6
|
+
|
7
|
+
def index
|
8
|
+
@events = @calendar.entries
|
9
|
+
end
|
10
|
+
|
11
|
+
def new
|
12
|
+
@event = @calendar.new_event
|
13
|
+
end
|
14
|
+
|
15
|
+
def create
|
16
|
+
@event = @calendar.new_event(params[:event])
|
17
|
+
if @event.publish
|
18
|
+
redirect_to refinery.calendar_admin_events_path
|
19
|
+
else
|
20
|
+
render :new
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.searchable?
|
25
|
+
false
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.pageable?
|
29
|
+
false
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.sortable?
|
33
|
+
false
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
def init_calendar
|
38
|
+
@calendar = REFINERY_CALENDAR
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Calendar
|
3
|
+
class EventsController < ::ApplicationController
|
4
|
+
|
5
|
+
before_filter :find_all_events
|
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 @event in the line below:
|
11
|
+
present(@page)
|
12
|
+
end
|
13
|
+
|
14
|
+
def show
|
15
|
+
@event = Event.find(params[:id])
|
16
|
+
|
17
|
+
# you can use meta fields from your model instead (e.g. browser_title)
|
18
|
+
# by swapping @page for @event in the line below:
|
19
|
+
present(@page)
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
def find_all_events
|
25
|
+
@events = Event.order('position ASC')
|
26
|
+
end
|
27
|
+
|
28
|
+
def find_page
|
29
|
+
@page = ::Refinery::Page.where(:link_url => "/events").first
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Calendar
|
3
|
+
class CoreCalendar
|
4
|
+
attr_accessor :entries
|
5
|
+
attr_writer :event_source
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@entries = []
|
9
|
+
end
|
10
|
+
|
11
|
+
def title
|
12
|
+
Refinery::Calendar.title
|
13
|
+
end
|
14
|
+
|
15
|
+
def new_event(*args)
|
16
|
+
event_source.call(*args).tap do |e|
|
17
|
+
e.calendar = self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_entry(entry)
|
22
|
+
@entries << entry
|
23
|
+
end
|
24
|
+
|
25
|
+
def entries
|
26
|
+
@entries.sort_by { |e| e.starts }
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def event_source
|
32
|
+
@event_source ||= Event.public_method(:new)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Calendar
|
3
|
+
class Event
|
4
|
+
extend ActiveModel::Naming
|
5
|
+
include ActiveModel::Conversion
|
6
|
+
include ActiveModel::Validations
|
7
|
+
|
8
|
+
attr_accessor :title, :starts, :ends, :body, :calendar
|
9
|
+
|
10
|
+
validates :title, :presence => true
|
11
|
+
|
12
|
+
def initialize(attrs={})
|
13
|
+
setup_parameters(attrs).each do |k,v| send("#{k}=",v) end
|
14
|
+
end
|
15
|
+
|
16
|
+
def publish
|
17
|
+
return false unless valid?
|
18
|
+
calendar.add_entry(self)
|
19
|
+
end
|
20
|
+
|
21
|
+
def persisted?
|
22
|
+
false
|
23
|
+
end
|
24
|
+
|
25
|
+
def setup_parameters(attrs={})
|
26
|
+
i = 0
|
27
|
+
datetime = ''
|
28
|
+
new_params = {}
|
29
|
+
attrs.each do |key, value|
|
30
|
+
if (k = key.to_s.match(/^(starts|ends)\(/) { |m| m[1] })
|
31
|
+
sep = '-'
|
32
|
+
sep = 'T' if i == 2
|
33
|
+
sep = ':' if i > 2
|
34
|
+
datetime += "#{value}#{sep}"
|
35
|
+
i += 1
|
36
|
+
else
|
37
|
+
new_params[key] = value
|
38
|
+
end
|
39
|
+
|
40
|
+
if datetime.split(':').length == 2
|
41
|
+
datetime += Time.new.zone
|
42
|
+
new_params[k] = DateTime.parse(datetime.gsub(/:$/,''))
|
43
|
+
datetime = ''
|
44
|
+
i = 0
|
45
|
+
end
|
46
|
+
end
|
47
|
+
return new_params
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<ul>
|
2
|
+
<% if ::Refinery::Calendar::Admin::EventsController.searchable? %>
|
3
|
+
<li>
|
4
|
+
<%= render '/refinery/admin/search', :url => refinery.calendar_admin_events_path %>
|
5
|
+
</li>
|
6
|
+
<% end %>
|
7
|
+
<li>
|
8
|
+
<%= link_to t('.create_new'), refinery.new_calendar_admin_event_path,
|
9
|
+
:class => "add_icon" %>
|
10
|
+
</li>
|
11
|
+
<% if !searching? && ::Refinery::Calendar::Admin::EventsController.sortable? && ::Refinery::Calendar::Event.any? %>
|
12
|
+
<li>
|
13
|
+
<%= link_to t('.reorder', :what => "Events"),
|
14
|
+
refinery.calendar_admin_events_path,
|
15
|
+
:id => "reorder_action",
|
16
|
+
:class => "reorder_icon" %>
|
17
|
+
|
18
|
+
<%= link_to t('.reorder_done', :what => "Events"),
|
19
|
+
refinery.calendar_admin_events_path,
|
20
|
+
:id => "reorder_action_done",
|
21
|
+
:style => "display: none;",
|
22
|
+
:class => "reorder_icon" %>
|
23
|
+
</li>
|
24
|
+
<% end %>
|
25
|
+
</ul>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(event) -%>">
|
2
|
+
<span class='title'>
|
3
|
+
<%= event.title %>
|
4
|
+
</span>
|
5
|
+
<span class='preview'>
|
6
|
+
<%= event.starts.strftime('%b %e, %Y %I:%M%p') %> to <%= event.ends.strftime('%b %e, %Y %I:%M%p') %>
|
7
|
+
</span>
|
8
|
+
<span class='actions'>
|
9
|
+
</span>
|
10
|
+
</li>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%= form_for [refinery, :calendar_admin, @event] do |f| -%>
|
2
|
+
<%= render '/refinery/admin/error_messages',
|
3
|
+
:object => @event,
|
4
|
+
:include_object_name => true %>
|
5
|
+
|
6
|
+
|
7
|
+
<div class='field'>
|
8
|
+
<%= f.label :title -%>
|
9
|
+
<%= f.text_field :title, :class => 'larger widest' -%>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class='field'>
|
13
|
+
<%= f.label :body -%>
|
14
|
+
<%= f.text_area :body, :class => 'wymeditor widest' -%>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div class='field'>
|
18
|
+
<%= f.label :starts %>
|
19
|
+
<%= f.datetime_select :starts %>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div class='field'>
|
23
|
+
<%= f.label :ends %>
|
24
|
+
<%= f.datetime_select :ends %>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<%= render '/refinery/admin/form_actions', :f => f,
|
28
|
+
:continue_editing => false,
|
29
|
+
:delete_title => t('delete', :scope => 'refinery.events.admin.events.event'),
|
30
|
+
:delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @event.title) %>
|
31
|
+
<% end -%>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% if searching? %>
|
2
|
+
<h2><%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %></h2>
|
3
|
+
<% end %>
|
4
|
+
<div class='pagination_container'>
|
5
|
+
<% if @events.any? %>
|
6
|
+
<%= render 'events' %>
|
7
|
+
<% else %>
|
8
|
+
<p>
|
9
|
+
<% unless searching? %>
|
10
|
+
<strong>
|
11
|
+
<%= t('.no_items_yet') %>
|
12
|
+
</strong>
|
13
|
+
<% else %>
|
14
|
+
<%= t('no_results', :scope => 'refinery.admin.search') %>
|
15
|
+
<% end %>
|
16
|
+
</p>
|
17
|
+
<% end %>
|
18
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<section id='records'>
|
2
|
+
<h2><%= @calendar.title %></h2>
|
3
|
+
<%= render 'records' %>
|
4
|
+
</section>
|
5
|
+
<aside id='actions'>
|
6
|
+
<%= render 'actions' %>
|
7
|
+
</aside>
|
8
|
+
<%= render '/refinery/admin/make_sortable', :tree => false if !searching? and ::Refinery::Calendar::Admin::EventsController.sortable? and ::Refinery::Calendar::Event.count > 1 %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<% content_for :body_content_title do %>
|
2
|
+
<%= @event.title %>
|
3
|
+
<% end %>
|
4
|
+
|
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 %>
|
13
|
+
|
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>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<%= render '/refinery/content_page' %>
|
data/config/locales/en.yml
CHANGED
@@ -1,45 +1,27 @@
|
|
1
1
|
en:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
plugins:
|
2
|
+
refinery:
|
3
|
+
plugins:
|
4
|
+
calendar:
|
5
|
+
title: Calendar
|
7
6
|
calendar:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
title: Event Categories
|
30
|
-
create_new: Add New Event Category
|
31
|
-
reorder: Reorder Event Categories
|
32
|
-
reorder_done: Done Reordering Event Categories
|
33
|
-
sorry_no_results: Sorry! There are no results found.
|
34
|
-
no_items_yet: There are no Event Categories yet. Click "Add New Event Category" to add your first event category.
|
35
|
-
manage_events: Manage Events
|
36
|
-
event_category:
|
37
|
-
view_live_html: View this event category live <br/><em>(opens in a new window)</em>
|
38
|
-
edit: Edit this event category
|
39
|
-
delete: Remove this event category forever
|
40
|
-
events:
|
41
|
-
index:
|
42
|
-
archives: Archives
|
43
|
-
show:
|
44
|
-
sidebar:
|
45
|
-
other: Other Events
|
7
|
+
admin:
|
8
|
+
events:
|
9
|
+
actions:
|
10
|
+
create_new: Add New Event
|
11
|
+
reorder: Reorder Events
|
12
|
+
reorder_done: Done Reordering Events
|
13
|
+
records:
|
14
|
+
title: Events
|
15
|
+
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.
|
17
|
+
event:
|
18
|
+
view_live_html: View this event live <br/><em>(opens in a new window)</em>
|
19
|
+
edit: Edit this event
|
20
|
+
delete: Remove this event forever
|
21
|
+
events:
|
22
|
+
show:
|
23
|
+
other: Other Events
|
24
|
+
activerecord:
|
25
|
+
attributes:
|
26
|
+
'refinery/calendar/event':
|
27
|
+
title: Title
|
@@ -0,0 +1,28 @@
|
|
1
|
+
es:
|
2
|
+
refinery:
|
3
|
+
plugins:
|
4
|
+
events:
|
5
|
+
title: Events
|
6
|
+
# article: masculino/femenino
|
7
|
+
calendar:
|
8
|
+
admin:
|
9
|
+
events:
|
10
|
+
actions:
|
11
|
+
create_new: Crear nuevo event
|
12
|
+
reorder: Reordenar events
|
13
|
+
reorder_done: Reordenación de events completada
|
14
|
+
records:
|
15
|
+
title: Events
|
16
|
+
sorry_no_results: Lo siento, no hay resultados
|
17
|
+
no_items_yet: No hay events todavía. Pulsa en "Crear nuevo Event" para crear tu primer event.
|
18
|
+
event:
|
19
|
+
view_live_html: Ver este event como abierto al público <br/><em>(abre en ventana nueva)</em>
|
20
|
+
edit: Editar este event
|
21
|
+
delete: Borrar este event para siempre
|
22
|
+
events:
|
23
|
+
show:
|
24
|
+
other: Otros events
|
25
|
+
activerecord:
|
26
|
+
attributes:
|
27
|
+
'refinery/calendar/event':
|
28
|
+
title: Title
|
data/config/locales/fr.yml
CHANGED
@@ -1,45 +1,27 @@
|
|
1
1
|
fr:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
plugins:
|
2
|
+
refinery:
|
3
|
+
plugins:
|
4
|
+
events:
|
5
|
+
title: Events
|
7
6
|
calendar:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
title: Catégories d'événements
|
30
|
-
create_new: Ajouter une nouvelle catégorie d'événements
|
31
|
-
reorder: Réordrer les catégories d'événements
|
32
|
-
reorder_done: Finir de réordrer les catégories d'événements
|
33
|
-
sorry_no_results: Désolé! Aucun résultat n'a été trouvé
|
34
|
-
no_items_yet: "Il n'y a pas encore de catégories d'événements pour le moment. Cliquez sur "Ajouter une catégorie d'événements" pour en créer une."
|
35
|
-
manage_events: Gérer les événements
|
36
|
-
event_category:
|
37
|
-
view_live_html: Voir cette catégorie <br/><em>(s'ouvre dans une nouvelle fenêtre)</em>
|
38
|
-
edit: Editer cette catégorie d'événements
|
39
|
-
delete: Effacer complètement cette catégorie
|
40
|
-
events:
|
41
|
-
index:
|
42
|
-
archives: Archives
|
43
|
-
show:
|
44
|
-
sidebar:
|
45
|
-
other: Autres événements
|
7
|
+
admin:
|
8
|
+
events:
|
9
|
+
actions:
|
10
|
+
create_new: Créer un(e) nouve(au/l/lle) Event
|
11
|
+
reorder: Réordonner les Events
|
12
|
+
reorder_done: Fin de réordonnancement des Events
|
13
|
+
records:
|
14
|
+
title: Events
|
15
|
+
sorry_no_results: "Désolé ! Aucun résultat."
|
16
|
+
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.'
|
17
|
+
event:
|
18
|
+
view_live_html: Voir ce(t/tte) event <br/><em>(Ouvre une nouvelle fenêtre)</em>
|
19
|
+
edit: Modifier ce(t/tte) event
|
20
|
+
delete: Supprimer définitivement ce(t/tte) event
|
21
|
+
events:
|
22
|
+
show:
|
23
|
+
other: Autres Events
|
24
|
+
activerecord:
|
25
|
+
attributes:
|
26
|
+
'refinery/calendar/event':
|
27
|
+
title: Title
|