Class: RecurringTodosController::RecurringTodoCreateParamsHelper

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/recurring_todos_controller.rb

Instance Method Summary (collapse)

Constructor Details

- (RecurringTodoCreateParamsHelper) initialize(params)

A new instance of RecurringTodoCreateParamsHelper



210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'app/controllers/recurring_todos_controller.rb', line 210

def initialize(params)
  @params = params['request'] || params
  @attributes = params['request'] && params['request']['recurring_todo']  || params['recurring_todo']
  
  # make sure all selectors (recurring_period, recurrence_selector,
  # daily_selector, monthly_selector and yearly_selector) are first in hash
  # so that they are processed first by the model
  @selector_attributes = {
    'recurring_period' => @attributes['recurring_period'],
    'daily_selector' => @attributes['daily_selector'],
    'monthly_selector' => @attributes['monthly_selector'],
    'yearly_selector' => @attributes['yearly_selector']
  }
end

Instance Method Details

- (Object) attributes



225
226
227
# File 'app/controllers/recurring_todos_controller.rb', line 225

def attributes
  @attributes
end

- (Object) context_name



237
238
239
# File 'app/controllers/recurring_todos_controller.rb', line 237

def context_name
  @params['context_name'].strip unless @params['context_name'].nil?
end

- (Boolean) context_specified_by_name?

Returns:

  • (Boolean)


252
253
254
255
256
# File 'app/controllers/recurring_todos_controller.rb', line 252

def context_specified_by_name?
  return false unless @attributes['context_id'].blank?
  return false if context_name.blank?
  true
end

- (Object) project_name



233
234
235
# File 'app/controllers/recurring_todos_controller.rb', line 233

def project_name
  @params['project_name'].strip unless @params['project_name'].nil?
end

- (Boolean) project_specified_by_name?

Returns:

  • (Boolean)


245
246
247
248
249
250
# File 'app/controllers/recurring_todos_controller.rb', line 245

def project_specified_by_name?
  return false unless @attributes['project_id'].blank?
  return false if project_name.blank?
  return false if project_name == 'None'
  true
end

- (Object) selector_attributes



229
230
231
# File 'app/controllers/recurring_todos_controller.rb', line 229

def selector_attributes
  return @selector_attributes
end

- (Object) tag_list



241
242
243
# File 'app/controllers/recurring_todos_controller.rb', line 241

def tag_list
  @params['tag_list']
end