Initial work on recurrent events
This commit is contained in:
parent
b6c5a735f1
commit
8bbece331e
2
Gemfile
2
Gemfile
@ -2,6 +2,8 @@ source 'https://rubygems.org'
|
|||||||
|
|
||||||
# The central piece of this application: the month calendar view
|
# The central piece of this application: the month calendar view
|
||||||
gem 'simple_calendar'
|
gem 'simple_calendar'
|
||||||
|
# The recurrence management library
|
||||||
|
gem 'ice_cube'
|
||||||
|
|
||||||
gem 'rails'
|
gem 'rails'
|
||||||
gem 'has_scope'
|
gem 'has_scope'
|
||||||
|
@ -210,6 +210,7 @@ GEM
|
|||||||
http_accept_language (2.0.5)
|
http_accept_language (2.0.5)
|
||||||
http_parser.rb (0.6.0)
|
http_parser.rb (0.6.0)
|
||||||
i18n (0.7.0)
|
i18n (0.7.0)
|
||||||
|
ice_cube (0.14.0)
|
||||||
inherited_resources (1.6.0)
|
inherited_resources (1.6.0)
|
||||||
actionpack (>= 3.2, < 5)
|
actionpack (>= 3.2, < 5)
|
||||||
has_scope (~> 0.6.0.rc)
|
has_scope (~> 0.6.0.rc)
|
||||||
@ -447,6 +448,7 @@ DEPENDENCIES
|
|||||||
has_scope
|
has_scope
|
||||||
http_accept_language
|
http_accept_language
|
||||||
i18n-active_record!
|
i18n-active_record!
|
||||||
|
ice_cube
|
||||||
jbuilder
|
jbuilder
|
||||||
jquery-rails (< 4.1)
|
jquery-rails (< 4.1)
|
||||||
jquery-sparkline-rails!
|
jquery-sparkline-rails!
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# This is the central ADL class, where are managed all events
|
# This is the central ADL class, where are managed all events
|
||||||
class Event < ActiveRecord::Base
|
class Event < ActiveRecord::Base
|
||||||
extend SimpleCalendar
|
extend SimpleCalendar
|
||||||
|
acts_as_schedulable :schedule
|
||||||
strip_attributes
|
strip_attributes
|
||||||
has_paper_trail ignore: [:last_updated, :secret, :submitter, :decision_time,
|
has_paper_trail ignore: [:last_updated, :secret, :submitter, :decision_time,
|
||||||
:lock_version, :latitude, :longitude]
|
:lock_version, :latitude, :longitude]
|
||||||
|
3
app/models/schedule.rb
Normal file
3
app/models/schedule.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# The data associated to recurrent events
|
||||||
|
class Schedule < Schedulable::Model::Schedule
|
||||||
|
end
|
@ -12,13 +12,17 @@
|
|||||||
|
|
||||||
.field.title
|
.field.title
|
||||||
= f.label :title
|
= f.label :title
|
||||||
= f.text_field :title, required: true, placeholder: "#{t '.title_helper'}"
|
= f.text_field :title, required: true, placeholder: t('.title_helper')
|
||||||
.field.start_time
|
.field.start_time
|
||||||
= f.label :start_time
|
= f.label :start_time
|
||||||
= f.datetime_local_field :start_time, required: true
|
= f.datetime_local_field :start_time, required: true
|
||||||
.field.end_time
|
.field.end_time
|
||||||
= f.label :end_time
|
= f.label :end_time
|
||||||
= f.datetime_local_field :end_time, required: true
|
= f.datetime_local_field :end_time, required: true
|
||||||
|
.field
|
||||||
|
= f.label :schedule
|
||||||
|
= f.schedule_select :schedule, interval: true, until: true
|
||||||
|
|
||||||
.field.description
|
.field.description
|
||||||
.helper
|
.helper
|
||||||
:markdown
|
:markdown
|
||||||
@ -46,7 +50,8 @@
|
|||||||
%option= city
|
%option= city
|
||||||
.field.region
|
.field.region
|
||||||
= f.label :region
|
= f.label :region
|
||||||
= f.collection_select :region_id, Region.all, :id, :name, { include_blank: true }
|
= f.collection_select :region_id, Region.all, :id, :name,
|
||||||
|
include_blank: true
|
||||||
.field.locality
|
.field.locality
|
||||||
= f.label :locality
|
= f.label :locality
|
||||||
%span.radios
|
%span.radios
|
||||||
|
18
db/migrate/20160616190823_create_schedules.rb
Normal file
18
db/migrate/20160616190823_create_schedules.rb
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Manage a schedule for events, that will let adl create recurring events
|
||||||
|
class CreateSchedules < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :schedules do |t|
|
||||||
|
t.string :rule
|
||||||
|
t.string :interval
|
||||||
|
|
||||||
|
t.text :day
|
||||||
|
t.text :day_of_week
|
||||||
|
|
||||||
|
t.datetime :until
|
||||||
|
t.integer :count
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_reference :events, :schedule, index: true
|
||||||
|
end
|
||||||
|
end
|
15
db/schema.rb
15
db/schema.rb
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20160409131029) do
|
ActiveRecord::Schema.define(version: 20160616190823) do
|
||||||
|
|
||||||
create_table "active_admin_comments", force: :cascade do |t|
|
create_table "active_admin_comments", force: :cascade do |t|
|
||||||
t.string "namespace", limit: 255
|
t.string "namespace", limit: 255
|
||||||
@ -81,8 +81,10 @@ ActiveRecord::Schema.define(version: 20160409131029) do
|
|||||||
t.float "longitude", limit: 24
|
t.float "longitude", limit: 24
|
||||||
t.integer "lock_version", limit: 4, default: 0, null: false
|
t.integer "lock_version", limit: 4, default: 0, null: false
|
||||||
t.string "place_name", limit: 255
|
t.string "place_name", limit: 255
|
||||||
|
t.integer "schedule_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "events", ["schedule_id"], name: "index_events_on_schedule_id"
|
||||||
add_index "events", ["start_time", "end_time"], name: "events_date"
|
add_index "events", ["start_time", "end_time"], name: "events_date"
|
||||||
|
|
||||||
create_table "kinds", force: :cascade do |t|
|
create_table "kinds", force: :cascade do |t|
|
||||||
@ -134,6 +136,17 @@ ActiveRecord::Schema.define(version: 20160409131029) do
|
|||||||
t.string "name", limit: 255, default: "", null: false
|
t.string "name", limit: 255, default: "", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "schedules", force: :cascade do |t|
|
||||||
|
t.string "rule"
|
||||||
|
t.string "interval"
|
||||||
|
t.text "day"
|
||||||
|
t.text "day_of_week"
|
||||||
|
t.datetime "until"
|
||||||
|
t.integer "count"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "taggings", force: :cascade do |t|
|
create_table "taggings", force: :cascade do |t|
|
||||||
t.integer "tag_id"
|
t.integer "tag_id"
|
||||||
t.integer "taggable_id"
|
t.integer "taggable_id"
|
||||||
|
Loading…
Reference in New Issue
Block a user