radiant-event_calendar-extension 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,3 @@
1
- - include_stylesheet "admin/event_calendar"
2
- - include_javascript "admin/event_calendar"
3
-
4
1
  - if defined? TinyMceFilter
5
2
  - include_javascript "tiny_mce/tiny_mce"
6
3
  - include_javascript "tiny_mce/tiny_mce_settings"
@@ -10,104 +7,111 @@
10
7
  - @event.event_venue ||= EventVenue.new
11
8
  - @event.recurrence_rules.build unless @event.recurrence_rules.any?
12
9
 
13
- - form_for [:admin, @event] do |f|
14
- = f.hidden_field :lock_version
15
- = render_region :form_top
16
-
17
- #event_form.form-area.container_12
18
- - render_region :form do |form|
10
+ - imported = @event.status == Status[:imported]
19
11
 
20
- - form.edit_event do
21
- .title
22
- %p.event_title
23
- = f.label :title, "Title"
24
- = f.text_field :title, :class => 'textbox'
25
- %p.keywords
26
- = f.label :keywords, "Tags"
27
- = f.text_field :keywords, :class => 'textbox'
12
+ - if imported
13
+ %p
14
+ This event comes from a calendar subscription, but you can add keywords here and give more information about its location.
15
+ Please note that changes to the location will affect any other events linked to the same place.
28
16
 
29
- .url
30
- %p.url
31
- = f.label :url, "Link to"
32
- = f.text_field :url, :class => 'textbox'
17
+ = render_region :form_top
33
18
 
34
- .description
35
- %p.description
36
- - if defined? TinyMceFilter
37
- = link_to image('mce', :alt=> 'toolbar icon'), '#', :class => 'toggleMCE', :rel => 'toggle[event_description]'
38
- = f.label :description, "Description"
39
- = f.text_area :description, :class => 'textarea', :style => "width: 100%; height: 8em;"
40
- %p.calendar
41
- = f.label :calendar_id, "Calendar"
42
- = f.select :calendar_id, Calendar.all.map {|c| [c.name, c.id]}, {:include_blank => true}, :class => 'textbox'
43
- %span.note
44
- This is optional but can be used to file your events or to mix local events into a subscribed calendar.
45
-
19
+ #event_form.form-area
20
+ .main
21
+ - render_region :form do |form|
22
+ - form.edit_event do
23
+ %p.title
24
+ = f.label :title, "Title"
25
+ = f.text_field :title, :class => 'textbox', :disabled => imported
26
+
46
27
  - form.edit_date do
47
- .date
48
- %p.start_date
49
- = f.label :start_date, "Start date and time"
50
- = f.text_field :start_date, :class => 'textbox date time'
51
- = f.check_box :all_day
52
- = f.label :all_day, 'All-day event?', :class => 'minor'
53
- %span.note
54
- (times will be ignored)
55
- %p.end_date
56
- = f.label :end_date, "end date and time"
57
- = f.text_field :end_date, :class => 'textbox date time'
58
- %p#event_note.note
59
- If you specify an end date and later change the start date, the end will shift to preserve the event's duration.
28
+ %p.start_date
29
+ = f.label :start_date, "Start date and time"
30
+ = f.text_field :start_date, :class => 'textbox date time', :disabled => imported
31
+ = f.check_box :all_day, :disabled => imported
32
+ = f.label :all_day, 'All-day event?', :class => 'minor'
33
+ %p.end_date
34
+ = f.label :end_date, "end date and time"
35
+ = f.text_field :end_date, :class => 'textbox date time', :disabled => imported
60
36
 
61
37
  .recurrence
62
38
  - f.fields_for :recurrence_rules do |rf|
63
-
39
+
64
40
  %p.recurrence
65
- = rf.check_box 'active', :class => 'toggle', :rel => "toggle[recurrence_detail]", :style => 'margin-left: 15px;'
41
+ = rf.check_box 'active', :class => 'toggle', :rel => "toggle[recurrence_detail]", :disabled => imported
66
42
  = rf.label :active, 'Repeats', :class => 'minor'
67
43
  %span.note
68
44
  (this is for separate similar events. For events that span several days you only need to set the start and end.)
69
-
70
- %span#recurrence_detail
71
- %span#recurrence_interval
72
- = rf.label :interval, "Every"
73
- = rf.text_field :interval, :class => 'textbox short'
74
- %span#recurrence_period
75
- = rf.label :period, " "
76
- = rf.select :period, [['day', 'daily'], ['week', 'weekly'], ['month', 'monthly'], ['year', 'yearly']], {}, :class => 'textbox'
77
- %span#recurrence_basis
78
- = rf.label :basis, " "
79
- = rf.select :basis, [['forever', 'unbounded'],['until', 'limit'], ['for', 'count']], {}, :class => 'textbox basis'
80
- %span#recurrence_unbounded
81
- %span#recurrence_limit
82
- = rf.label :limiting_date, " "
83
- = rf.text_field :limiting_date, :class => 'textbox date'
84
- %span#recurrence_count
85
- = rf.label :limiting_count, "this many times:", :class => 'inline'
86
- = rf.text_field :limiting_count, :class => 'textbox short'
87
45
 
88
- - form.edit_venue do
89
- - prefer_new = @venues.empty? || @event.event_venue.new_record?
90
- - toggle_precedence = prefer_new ? "new_venue,venue" : "venue,new_venue"
91
-
92
- - if @venues.any?
93
- #venue
46
+ %p#recurrence_detail
47
+ %span#recurrence_interval
48
+ = rf.label :interval, "Repeats every"
49
+ = rf.text_field :interval, :class => 'textbox short'
50
+ %span#recurrence_period
51
+ = rf.label :period, " "
52
+ = rf.select :period, [['day', 'daily'], ['week', 'weekly'], ['month', 'monthly'], ['year', 'yearly']], {}, :class => 'textbox'
53
+ %span#recurrence_basis
54
+ = rf.label :basis, " "
55
+ = rf.select :basis, [['forever', 'unbounded'],['until', 'limit'], ['for', 'count']], {}, :class => 'textbox basis'
56
+ %span#recurrence_unbounded
57
+ %span#recurrence_limit
58
+ = rf.label :limiting_date, " "
59
+ = rf.text_field :limiting_date, :class => 'textbox date'
60
+ %span#recurrence_count
61
+ = rf.label :limiting_count, "this many times:", :class => 'inline'
62
+ = rf.text_field :limiting_count, :class => 'textbox short'
63
+
64
+ - form.edit_description do
65
+ %p.description
66
+ - if !imported && defined? TinyMceFilter
67
+ = link_to image('mce', :alt=> 'toolbar icon'), '#', :class => 'toggleMCE', :rel => 'toggle[event_description]'
68
+ = f.label :description, "Description"
69
+ = f.text_area :description, :class => 'textarea', :style => "width: 100%; height: 8em;", :disabled => imported
70
+
71
+ - render_region :form_bottom do |form_bottom|
72
+ - form_bottom.edit_metadata do
73
+ .metadata
74
+ %p.keywords
75
+ = f.label :keywords
76
+ = f.text_field :keywords, :class => "textbox"
77
+ %p.calendar
78
+ = f.label :calendar_id, "Calendar"
79
+ = f.select :calendar_id, Calendar.all.map {|c| [c.name, c.id]}, {:include_blank => true}, :class => 'textbox', :disabled => imported
80
+ %br
81
+ %span.note
82
+ This is optional but can be used to file your events or to mix local events into a subscribed calendar.
83
+ %p.url
84
+ = f.label :url, "Event url"
85
+ = f.text_field :url, :class => 'textbox', :disabled => imported
86
+
87
+ - form_bottom.edit_venue do
88
+ - toggle_precedence = %w{venue new_venue}
89
+ - toggle_precedence.reverse! if @venues.empty? || @event.event_venue.new_record?
90
+
91
+ - if imported
92
+ - f.fields_for :event_venue, @event.event_venue do |ef|
93
+ = render :partial => 'admin/event_venues/form', :locals => {:event_venue => @event.event_venue, :f => ef, :or_choose => false, :compact => true}
94
+
95
+ - else
96
+ -if @venues.any?
97
+ #venue.main
94
98
  %p#existing_venue
95
99
  = f.label :event_venue_id, "Choose a place"
96
- = f.select :event_venue_id, @venues.map {|v| [v.title, v.id]}, {:include_blank => true}, :class => 'textbox'
97
- = link_to "add a new place", new_admin_event_venue_url, :class => 'swapper', :rel => "toggle[#{toggle_precedence}]"
98
- %p.note
99
- You can
100
- = link_to "edit the venue list", admin_event_venues_url
101
- to update addresses and directions for all relevant events.
102
-
100
+ = f.select :event_venue_id, @venues.map {|v| [v.title, v.id]}, {:include_blank => true}, :class => 'textbox', :disabled => imported
101
+ - if imported
102
+ = link_to "edit this location", admin_event_venue_url(@event.event_venue)
103
+ to add title, description and directions
104
+ - else
105
+ = link_to "add a new place", new_admin_event_venue_url, :class => 'swapper', :rel => "toggle[#{toggle_precedence.join(',')}]"
103
106
  #new_venue
104
- - event_venue = @event.event_venue.new_record? ? @event.event_venue : EventVenue.new
105
- - f.fields_for :event_venue, event_venue do |ef|
106
- = render :partial => 'admin/event_venues/form', :locals => {:event_venue => event_venue, :f => ef, :or_choose => @venues.any?, :compact => true}
107
+ - @event.build_event_venue unless @event.event_venue
108
+ - f.fields_for :event_venue, @event.event_venue do |ef|
109
+ = render :partial => 'admin/event_venues/form', :locals => {:event_venue => @event.event_venue, :f => ef, :or_choose => @venues.any?, :compact => true}
110
+
107
111
 
108
- - render_region :form_bottom do |form_bottom|
109
112
  - form_bottom.edit_timestamp do
110
113
  = updated_stamp @event
114
+
111
115
  - form_bottom.edit_buttons do
112
116
  %p.buttons
113
117
  = save_model_button(@event)
@@ -1,6 +1,11 @@
1
+ - include_stylesheet "admin/event_calendar"
2
+ - include_javascript "admin/event_calendar"
3
+
1
4
  - render_region :main do |main|
2
5
  - main.edit_header do
3
6
  %h1
4
7
  Edit Event
8
+
5
9
  - main.edit_form do
6
- = render :partial => 'form'
10
+ - form_for :event, @event, :url => admin_event_path(@calendar), :html => { :method => "put", :multipart => true } do |f|
11
+ = render :partial => 'form', :locals => { :f => f }
@@ -1,6 +1,11 @@
1
+ - include_stylesheet "admin/event_calendar"
2
+ - include_javascript "admin/event_calendar"
3
+
1
4
  - render_region :main do |main|
2
5
  - main.edit_header do
3
6
  %h1
4
7
  Add an event to the calendar
8
+
5
9
  - main.edit_form do
6
- = render :partial => 'form'
10
+ - form_for :event, @event, :url => admin_events_path do |f|
11
+ = render :partial => "form", :locals => { :f => f }
@@ -17,13 +17,21 @@
17
17
  = link_to event.title, event.url, :class => 'title'
18
18
  - else
19
19
  = event.title
20
+ - event.attached_tags.each do |tag|
21
+ %span.tag
22
+ = tag.name
23
+
20
24
  %p.practicalities
21
25
  = event.summarize_start
22
26
  - if event.event_venue
23
- %br
24
- = link_to event.event_venue.title, event.event_venue.url
27
+ at
28
+ - if event.event_venue.url
29
+ = link_to event.event_venue.title, event.event_venue.url
30
+ - else
31
+ = event.event_venue.title
25
32
  = event.event_venue.address
26
-
33
+ - elsif event.location
34
+ = event.location
27
35
  - unless repeating
28
36
  = event.description_paragraph
29
37
 
@@ -7,7 +7,7 @@ class MoreEventData < ActiveRecord::Migration
7
7
  add_column :events, :keywords, :string
8
8
  add_column :events, :contact, :string
9
9
  add_column :events, :postcode, :string
10
- add_column :events, :lock_version, :integer
10
+ add_column :events, :lock_version, :integer, :default => 0
11
11
  add_column :events, :created_by_id, :integer
12
12
  add_column :events, :created_at, :datetime
13
13
  add_column :events, :updated_by_id, :integer
@@ -0,0 +1,11 @@
1
+ class AmendedEvents < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :events, :amended, :boolean
4
+ add_column :events, :deleted, :boolean
5
+ end
6
+
7
+ def self.down
8
+ remove_column :events, :amended
9
+ remove_column :events, :deleted
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ class CalendarKeywords < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :calendars, :keywords, :string
4
+ add_column :event_venues, :keywords, :string
5
+ add_column :event_venues, :location, :string
6
+ add_index :event_venues, :location
7
+ end
8
+
9
+ def self.down
10
+ remove_column :calendars, :keywords
11
+ remove_column :event_venues, :keywords
12
+ remove_column :event_venues, :location
13
+ end
14
+ end
@@ -23,8 +23,8 @@ module EventCalendarAdminUI
23
23
  returning OpenStruct.new do |calendar|
24
24
  calendar.edit = Radiant::AdminUI::RegionSet.new do |edit|
25
25
  edit.main.concat %w{edit_header edit_form}
26
- edit.form.concat %w{edit_name edit_ical}
27
- edit.form_bottom.concat %w{edit_timestamp edit_buttons}
26
+ edit.form.concat %w{edit_name edit_ical edit_filing edit_description}
27
+ edit.form_bottom.concat %w{edit_metadata edit_timestamp edit_buttons}
28
28
  end
29
29
  calendar.index = Radiant::AdminUI::RegionSet.new do |index|
30
30
  index.thead.concat %w{name_header url_header refresh_header action_header}
@@ -40,8 +40,8 @@ module EventCalendarAdminUI
40
40
  returning OpenStruct.new do |event|
41
41
  event.edit = Radiant::AdminUI::RegionSet.new do |edit|
42
42
  edit.main.concat %w{edit_header edit_form}
43
- edit.form.concat %w{edit_event edit_date edit_venue}
44
- edit.form_bottom.concat %w{edit_timestamp edit_buttons}
43
+ edit.form.concat %w{edit_event edit_date edit_description}
44
+ edit.form_bottom.concat %w{edit_metadata edit_venue edit_timestamp edit_buttons}
45
45
  end
46
46
  event.index = Radiant::AdminUI::RegionSet.new do |index|
47
47
  index.top.concat %w{help_text}