Class: Caboose::EventGroupsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Caboose::EventGroupsController
- Defined in:
- app/controllers/caboose/event_groups_controller.rb
Instance Method Summary collapse
-
#admin_frequency_options ⇒ Object
GET /admin/event-groups/frequency-options.
-
#admin_period_options ⇒ Object
GET /admin/event-groups/period-options.
-
#admin_repeat_by_options ⇒ Object
GET /admin/event-groups/repeat-by-options.
-
#admin_update ⇒ Object
PUT /admin/calendars/:calendar_id/event-groups/:id.
Methods inherited from ApplicationController
#admin_add, #admin_bulk_add, #admin_bulk_delete, #admin_bulk_update, #admin_delete, #admin_edit, #admin_index, #admin_json, #admin_json_single, #before_action, #before_before_action, #hashify_query_string, #init_cart, #logged_in?, #logged_in_user, #login_user, #logout_user, #parse_url_params, #reject_param, #user_is_allowed, #user_is_allowed_to, #validate_cookie, #validate_token, #var, #verify_logged_in
Instance Method Details
#admin_frequency_options ⇒ Object
GET /admin/event-groups/frequency-options
50 51 52 53 |
# File 'app/controllers/caboose/event_groups_controller.rb', line 50 def arr = (1..30).collect{ |i| { 'value' => i, 'text' => i }} render :json => arr end |
#admin_period_options ⇒ Object
GET /admin/event-groups/period-options
40 41 42 43 44 45 46 47 |
# File 'app/controllers/caboose/event_groups_controller.rb', line 40 def render :json => [ { 'value' => CalendarEventGroup::PERIOD_DAY , 'text' => CalendarEventGroup::PERIOD_DAY }, { 'value' => CalendarEventGroup::PERIOD_WEEK , 'text' => CalendarEventGroup::PERIOD_WEEK }, { 'value' => CalendarEventGroup::PERIOD_MONTH , 'text' => CalendarEventGroup::PERIOD_MONTH }, { 'value' => CalendarEventGroup::PERIOD_YEAR , 'text' => CalendarEventGroup::PERIOD_YEAR }, ] end |
#admin_repeat_by_options ⇒ Object
GET /admin/event-groups/repeat-by-options
56 57 58 59 60 61 |
# File 'app/controllers/caboose/event_groups_controller.rb', line 56 def render :json => [ { 'value' => CalendarEventGroup::REPEAT_BY_DAY_OF_MONTH , 'text' => 'same day of the month' }, { 'value' => CalendarEventGroup::REPEAT_BY_DAY_OF_WEEK , 'text' => 'same day of the week' }, ] end |
#admin_update ⇒ Object
PUT /admin/calendars/:calendar_id/event-groups/:id
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/caboose/event_groups_controller.rb', line 8 def admin_update return unless user_is_allowed('calendars', 'edit') resp = StdClass.new g = CalendarEventGroup.find(params[:id]) save = true params.each do |name, value| case name when 'frequency' then g.frequency = value when 'period' then g.period = value when 'repeat_by' then g.repeat_by = value when 'sun' then g.sun = value when 'mon' then g.mon = value when 'tue' then g.tue = value when 'wed' then g.wed = value when 'thu' then g.thu = value when 'fri' then g.fri = value when 'sat' then g.sat = value when 'date_start' then g.date_start = DateTime.strptime(value, '%m/%d/%Y').to_date when 'repeat_count' then g.repeat_count = value when 'date_end' then g.date_end = DateTime.strptime(value, '%m/%d/%Y').to_date end end g.save g.create_events resp.success = true render :json => resp end |