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.
- data/app/controllers/refinery/calendar/admin/events_controller.rb +7 -31
- data/app/controllers/refinery/calendar/admin/venues_controller.rb +14 -0
- data/app/controllers/refinery/calendar/events_controller.rb +7 -9
- data/app/controllers/refinery/calendar/venues_controller.rb +6 -0
- data/app/models/refinery/calendar/event.rb +23 -38
- data/app/models/refinery/calendar/venue.rb +9 -0
- data/app/views/refinery/calendar/admin/events/_actions.html.erb +1 -0
- data/app/views/refinery/calendar/admin/events/_event.html.erb +13 -3
- data/app/views/refinery/calendar/admin/events/_form.html.erb +60 -6
- data/app/views/refinery/calendar/admin/events/index.html.erb +1 -1
- data/app/views/refinery/calendar/admin/shared/_links.html.erb +8 -0
- data/app/views/refinery/calendar/admin/venues/_actions.html.erb +26 -0
- data/app/views/refinery/calendar/admin/venues/_form.html.erb +35 -0
- data/app/views/refinery/calendar/admin/venues/_records.html.erb +18 -0
- data/app/views/refinery/calendar/admin/venues/_sortable_list.html.erb +5 -0
- data/app/views/refinery/calendar/admin/venues/_venue.html.erb +20 -0
- data/app/views/refinery/calendar/admin/venues/_venues.html.erb +2 -0
- data/app/views/refinery/calendar/admin/venues/edit.html.erb +1 -0
- data/app/views/refinery/calendar/admin/venues/index.html.erb +8 -0
- data/app/views/refinery/calendar/admin/venues/new.html.erb +1 -0
- data/app/views/refinery/calendar/events/_event.html.erb +8 -0
- data/app/views/refinery/calendar/events/index.html.erb +5 -7
- data/app/views/refinery/calendar/events/show.html.erb +19 -18
- data/app/views/refinery/calendar/venues/index.html.erb +11 -0
- data/app/views/refinery/calendar/venues/show.html.erb +45 -0
- data/app/views/sitemap/index.xml.builder +25 -0
- data/config/database.yml.mysql +20 -0
- data/config/database.yml.postgresql +58 -0
- data/config/database.yml.sqlite3 +18 -0
- data/config/initializers/refinery/authentication.rb +4 -0
- data/config/initializers/refinery/core.rb +48 -0
- data/config/initializers/refinery/images.rb +44 -0
- data/config/initializers/refinery/pages.rb +52 -0
- data/config/initializers/refinery/resources.rb +26 -0
- data/config/locales/en.yml +36 -2
- data/config/locales/es.yml +36 -5
- data/config/locales/fr.yml +34 -4
- data/config/locales/nb.yml +36 -4
- data/config/locales/nl.yml +36 -4
- data/config/routes.rb +24 -2
- data/db/migrate/1_create_calendar_events.rb +34 -0
- data/db/migrate/2_create_calendar_venues.rb +29 -0
- data/db/seeds.rb +5 -2
- data/lib/generators/refinery/calendar_generator.rb +3 -13
- data/lib/refinery/{calendar.rb → events.rb} +2 -9
- data/lib/refinery/{calendar → events}/engine.rb +3 -3
- data/lib/refinery/venues.rb +21 -0
- data/lib/refinery/venues/engine.rb +14 -0
- data/lib/refinerycms-calendar.rb +2 -1
- data/readme.md +11 -7
- metadata +52 -14
- data/app/models/refinery/calendar/core_calendar.rb +0 -36
- data/lib/refinery/calendar/configuration.rb +0 -7
- data/lib/refinery/calendar/version.rb +0 -17
- data/lib/refinery/engine/multi_parameter_assignment.rb +0 -6
@@ -2,40 +2,16 @@ module Refinery
|
|
2
2
|
module Calendar
|
3
3
|
module Admin
|
4
4
|
class EventsController < ::Refinery::AdminController
|
5
|
-
before_filter :
|
5
|
+
before_filter :find_venues, :except => [:index, :destroy]
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
7
|
+
crudify :'refinery/calendar/event',
|
8
|
+
:xhr_paging => true,
|
9
|
+
:sortable => false,
|
10
|
+
:order => "'from' DESC"
|
35
11
|
|
36
12
|
private
|
37
|
-
def
|
38
|
-
@
|
13
|
+
def find_venues
|
14
|
+
@venues = Venue.order('name')
|
39
15
|
end
|
40
16
|
end
|
41
17
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Calendar
|
3
|
+
module Admin
|
4
|
+
class VenuesController < ::Refinery::AdminController
|
5
|
+
|
6
|
+
crudify :'refinery/calendar/venue',
|
7
|
+
:title_attribute => 'name',
|
8
|
+
:xhr_paging => true,
|
9
|
+
:sortable => false,
|
10
|
+
:order => 'created_at DESC'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,11 +1,9 @@
|
|
1
1
|
module Refinery
|
2
2
|
module Calendar
|
3
3
|
class EventsController < ::ApplicationController
|
4
|
-
|
5
|
-
before_filter :find_all_events
|
6
|
-
before_filter :find_page
|
7
|
-
|
8
4
|
def index
|
5
|
+
@events = Event.upcoming.order('refinery_calendar_events.from DESC')
|
6
|
+
|
9
7
|
# you can use meta fields from your model instead (e.g. browser_title)
|
10
8
|
# by swapping @page for @event in the line below:
|
11
9
|
present(@page)
|
@@ -19,14 +17,14 @@ module Refinery
|
|
19
17
|
present(@page)
|
20
18
|
end
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
@events = Event.order('position ASC')
|
20
|
+
def archive
|
21
|
+
@events = Event.archive.order('refinery_calendar_events.from DESC')
|
22
|
+
render :template => 'refinery/calendar/events/index'
|
26
23
|
end
|
27
24
|
|
25
|
+
protected
|
28
26
|
def find_page
|
29
|
-
@page = ::Refinery::Page.where(:link_url => "/events").first
|
27
|
+
@page = ::Refinery::Page.where(:link_url => "/connect/events").first
|
30
28
|
end
|
31
29
|
|
32
30
|
end
|
@@ -1,50 +1,35 @@
|
|
1
1
|
module Refinery
|
2
2
|
module Calendar
|
3
|
-
class Event
|
4
|
-
extend
|
5
|
-
include ActiveModel::Conversion
|
6
|
-
include ActiveModel::Validations
|
3
|
+
class Event < Refinery::Core::BaseModel
|
4
|
+
extend FriendlyId
|
7
5
|
|
8
|
-
|
6
|
+
friendly_id :title, :use => :slugged
|
9
7
|
|
10
|
-
|
8
|
+
belongs_to :venue
|
11
9
|
|
12
|
-
|
13
|
-
setup_parameters(attrs).each do |k,v| send("#{k}=",v) end
|
14
|
-
end
|
10
|
+
validates :title, :presence => true, :uniqueness => true
|
15
11
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
12
|
+
attr_accessible :title, :from, :to, :registration_link,
|
13
|
+
:venue_id, :excerpt, :description,
|
14
|
+
:featured, :position
|
20
15
|
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
delegate :name, :address,
|
17
|
+
:to => :venue,
|
18
|
+
:prefix => true,
|
19
|
+
:allow_nil => true
|
20
|
+
|
21
|
+
class << self
|
22
|
+
def upcoming
|
23
|
+
where('refinery_calendar_events.from >= ?', Time.now)
|
24
|
+
end
|
25
|
+
|
26
|
+
def featured
|
27
|
+
where(:featured => true)
|
28
|
+
end
|
24
29
|
|
25
|
-
|
26
|
-
|
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
|
30
|
+
def archive
|
31
|
+
where('refinery_calendar_events.from < ?', Time.now)
|
46
32
|
end
|
47
|
-
return new_params
|
48
33
|
end
|
49
34
|
end
|
50
35
|
end
|
@@ -8,6 +8,7 @@
|
|
8
8
|
<%= link_to t('.create_new'), refinery.new_calendar_admin_event_path,
|
9
9
|
:class => "add_icon" %>
|
10
10
|
</li>
|
11
|
+
<%= render 'refinery/calendar/admin/shared/links' %>
|
11
12
|
<% if !searching? && ::Refinery::Calendar::Admin::EventsController.sortable? && ::Refinery::Calendar::Event.any? %>
|
12
13
|
<li>
|
13
14
|
<%= link_to t('.reorder', :what => "Events"),
|
@@ -1,10 +1,20 @@
|
|
1
1
|
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(event) -%>">
|
2
2
|
<span class='title'>
|
3
3
|
<%= event.title %>
|
4
|
-
|
5
|
-
<span class='preview'>
|
6
|
-
<%= event.starts.strftime('%b %e, %Y %I:%M%p') %> to <%= event.ends.strftime('%b %e, %Y %I:%M%p') %>
|
4
|
+
|
7
5
|
</span>
|
8
6
|
<span class='actions'>
|
7
|
+
|
8
|
+
<%= link_to refinery_icon_tag("application_go.png"), refinery.calendar_event_path(event),
|
9
|
+
:title => t('.view_live_html'),
|
10
|
+
:target => "_blank" %>
|
11
|
+
|
12
|
+
<%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_calendar_admin_event_path(event),
|
13
|
+
:title => t('.edit') %>
|
14
|
+
<%= link_to refinery_icon_tag("delete.png"), refinery.calendar_admin_event_path(event),
|
15
|
+
:class => "cancel confirm-delete",
|
16
|
+
:title => t('.delete'),
|
17
|
+
:confirm => t('message', :scope => 'refinery.admin.delete', :title => event.title),
|
18
|
+
:method => :delete %>
|
9
19
|
</span>
|
10
20
|
</li>
|
@@ -9,19 +9,56 @@
|
|
9
9
|
<%= f.text_field :title, :class => 'larger widest' -%>
|
10
10
|
</div>
|
11
11
|
|
12
|
+
<div class="field">
|
13
|
+
<p>
|
14
|
+
<%= f.check_box :featured %>
|
15
|
+
<%= f.label :featured, :class => 'stripped' %>
|
16
|
+
</p>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class='field'>
|
20
|
+
<%= f.label :from -%>
|
21
|
+
<%= f.text_field :from, :class => 'datetime_range' -%>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class='field'>
|
25
|
+
<%= f.label :to -%>
|
26
|
+
<%= f.text_field :to, :class => 'datetime_range' -%>
|
27
|
+
</div>
|
28
|
+
|
12
29
|
<div class='field'>
|
13
|
-
<%= f.label :
|
14
|
-
<%= f.
|
30
|
+
<%= f.label :registration_link -%>
|
31
|
+
<%= f.text_field :registration_link, :class => 'larger' -%>
|
15
32
|
</div>
|
16
33
|
|
17
34
|
<div class='field'>
|
18
|
-
<%= f.label :
|
19
|
-
<%= f.
|
35
|
+
<%= f.label :venue_id, 'Venue' %>
|
36
|
+
<%= f.collection_select :venue_id, @venues, :id, :name, { :include_blank => 'None' }, :class => 'chzn-select', :'data-placeholder' => 'Search Venues', :style => 'width: 300px;' %>
|
20
37
|
</div>
|
21
38
|
|
22
39
|
<div class='field'>
|
23
|
-
<%= f.label :
|
24
|
-
<%= f.
|
40
|
+
<%= f.label :excerpt -%>
|
41
|
+
<%= f.text_area :excerpt, :size => '65x5' -%>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div class='field'>
|
45
|
+
<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
|
46
|
+
<ul id='page_parts'>
|
47
|
+
<% [:description].each_with_index do |part, part_index| %>
|
48
|
+
<li class='ui-state-default<%= ' ui-state-active' if part_index == 0 %>'>
|
49
|
+
<%= link_to t("#{part}", :scope => "activerecord.attributes.refinery/calendar/event", :default => part.to_s.titleize), "##{part}" %>
|
50
|
+
</li>
|
51
|
+
<% end %>
|
52
|
+
</ul>
|
53
|
+
<div id='page_part_editors'>
|
54
|
+
<% [:description].each do |part| %>
|
55
|
+
<div class='page_part' id='<%= part %>'>
|
56
|
+
<%= f.text_area part, :rows => 20, :class => 'wymeditor widest' -%>
|
57
|
+
</div>
|
58
|
+
<% end %>
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
|
25
62
|
</div>
|
26
63
|
|
27
64
|
<%= render '/refinery/admin/form_actions', :f => f,
|
@@ -29,3 +66,20 @@
|
|
29
66
|
:delete_title => t('delete', :scope => 'refinery.events.admin.events.event'),
|
30
67
|
:delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @event.title) %>
|
31
68
|
<% end -%>
|
69
|
+
<% content_for :stylesheets do %>
|
70
|
+
<%= stylesheet_link_tag 'chosen' %>
|
71
|
+
<% end %>
|
72
|
+
|
73
|
+
<% content_for :javascripts do %>
|
74
|
+
<%= javascript_include_tag 'chosen.jquery.min' %>
|
75
|
+
<script>
|
76
|
+
$(document).ready(function(){
|
77
|
+
page_options.init(false, '', '');
|
78
|
+
|
79
|
+
$('#event_venue_id').chosen({
|
80
|
+
no_results_text: "No results matched",
|
81
|
+
allow_single_deselect: true
|
82
|
+
});
|
83
|
+
});
|
84
|
+
</script>
|
85
|
+
<% end %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<ul>
|
2
|
+
<% if ::Refinery::Calendar::Admin::VenuesController.searchable? %>
|
3
|
+
<li>
|
4
|
+
<%= render '/refinery/admin/search', :url => refinery.calendar_admin_venues_path %>
|
5
|
+
</li>
|
6
|
+
<% end %>
|
7
|
+
<li>
|
8
|
+
<%= link_to t('.create_new'), refinery.new_calendar_admin_venue_path,
|
9
|
+
:class => "add_icon" %>
|
10
|
+
</li>
|
11
|
+
<%= render 'refinery/calendar/admin/shared/links' %>
|
12
|
+
<% if !searching? && ::Refinery::Calendar::Admin::VenuesController.sortable? && ::Refinery::Calendar::Venue.any? %>
|
13
|
+
<li>
|
14
|
+
<%= link_to t('.reorder', :what => "Venues"),
|
15
|
+
refinery.calendar_admin_venues_path,
|
16
|
+
:id => "reorder_action",
|
17
|
+
:class => "reorder_icon" %>
|
18
|
+
|
19
|
+
<%= link_to t('.reorder_done', :what => "Venues"),
|
20
|
+
refinery.calendar_admin_venues_path,
|
21
|
+
:id => "reorder_action_done",
|
22
|
+
:style => "display: none;",
|
23
|
+
:class => "reorder_icon" %>
|
24
|
+
</li>
|
25
|
+
<% end %>
|
26
|
+
</ul>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<%= form_for [refinery, :calendar_admin, @venue] do |f| -%>
|
2
|
+
<%= render '/refinery/admin/error_messages',
|
3
|
+
:object => @venue,
|
4
|
+
:include_object_name => true %>
|
5
|
+
|
6
|
+
|
7
|
+
<div class='field'>
|
8
|
+
<%= f.label :name -%>
|
9
|
+
<%= f.text_field :name, :class => 'larger widest' -%>
|
10
|
+
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class='field'>
|
14
|
+
<%= f.label :address -%>
|
15
|
+
<%= f.text_field :address, :class => 'larger' -%>
|
16
|
+
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class='field'>
|
20
|
+
<%= f.label :url -%>
|
21
|
+
<%= f.text_field :url, :class => 'larger' -%>
|
22
|
+
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div class='field'>
|
26
|
+
<%= f.label :phone -%>
|
27
|
+
<%= f.text_field :phone -%>
|
28
|
+
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<%= render '/refinery/admin/form_actions', :f => f,
|
32
|
+
:continue_editing => false,
|
33
|
+
:delete_title => t('delete', :scope => 'refinery.venues.admin.venues.venue'),
|
34
|
+
:delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @venue.name) %>
|
35
|
+
<% 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 @venues.any? %>
|
6
|
+
<%= render 'venues' %>
|
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,20 @@
|
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(venue) -%>">
|
2
|
+
<span class='title'>
|
3
|
+
<%= venue.name %>
|
4
|
+
|
5
|
+
</span>
|
6
|
+
<span class='actions'>
|
7
|
+
|
8
|
+
<%= link_to refinery_icon_tag("application_go.png"), refinery.calendar_venue_path(venue),
|
9
|
+
:title => t('.view_live_html'),
|
10
|
+
:target => "_blank" %>
|
11
|
+
|
12
|
+
<%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_calendar_admin_venue_path(venue),
|
13
|
+
:title => t('.edit') %>
|
14
|
+
<%= link_to refinery_icon_tag("delete.png"), refinery.calendar_admin_venue_path(venue),
|
15
|
+
:class => "cancel confirm-delete",
|
16
|
+
:title => t('.delete'),
|
17
|
+
:confirm => t('message', :scope => 'refinery.admin.delete', :title => venue.name),
|
18
|
+
:method => :delete %>
|
19
|
+
</span>
|
20
|
+
</li>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<section id='records'>
|
2
|
+
<h2>Calendar: Venues</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::VenuesController.sortable? and ::Refinery::Calendar::Venue.count > 1 %>
|