Module: Effective::Resources::Paths

Included in:
Effective::Resource
Defined in:
app/models/effective/resources/paths.rb

Instance Method Summary collapse

Instance Method Details

#action_path(action) ⇒ Object



22
23
24
# File 'app/models/effective/resources/paths.rb', line 22

def action_path(action)
  [action, namespace, name, 'path'].compact * '_'
end

#action_path_helper(action, at: true) ⇒ Object



38
39
40
# File 'app/models/effective/resources/paths.rb', line 38

def action_path_helper(action, at: true)
  action_path(action) + '(' + (at ? '@' : '') + name + ')'
end

#controller_file ⇒ Object



47
48
49
# File 'app/models/effective/resources/paths.rb', line 47

def controller_file
  File.join('app/controllers', namespace.to_s, "#{plural_name}_controller.rb")
end

#datatable_file ⇒ Object



51
52
53
# File 'app/models/effective/resources/paths.rb', line 51

def datatable_file
  File.join('app/datatables', namespace.to_s, "#{plural_name}_datatable.rb")
end

#edit_path ⇒ Object



18
19
20
# File 'app/models/effective/resources/paths.rb', line 18

def edit_path
  ['edit', namespace, name, 'path'].compact * '_'
end

#edit_path_helper(at: true) ⇒ Object



34
35
36
# File 'app/models/effective/resources/paths.rb', line 34

def edit_path_helper(at: true)
  edit_path + '(' + (at ? '@' : '') + name + ')'
end

#index_path ⇒ Object Also known as: index_path_helper

Controller REST helper paths



6
7
8
# File 'app/models/effective/resources/paths.rb', line 6

def index_path
  [namespace, plural_name, 'path'].compact * '_'
end

#model_file ⇒ Object

Default file paths



43
44
45
# File 'app/models/effective/resources/paths.rb', line 43

def model_file
  File.join('app/models', class_path.to_s, "#{name}.rb")
end

#new_path ⇒ Object Also known as: new_path_helper



10
11
12
# File 'app/models/effective/resources/paths.rb', line 10

def new_path
  ['new', namespace, name, 'path'].compact * '_'
end

#show_path ⇒ Object



14
15
16
# File 'app/models/effective/resources/paths.rb', line 14

def show_path
  [namespace, name, 'path'].compact * '_'
end

#show_path_helper(at: true) ⇒ Object



30
31
32
# File 'app/models/effective/resources/paths.rb', line 30

def show_path_helper(at: true)
  show_path + '(' + (at ? '@' : '') + name + ')'
end

#view_file(action = :index, partial: false) ⇒ Object



55
56
57
# File 'app/models/effective/resources/paths.rb', line 55

def view_file(action = :index, partial: false)
  File.join('app/views', namespace.to_s, (namespace.present? ? '' : class_path), plural_name, "#{'_' if partial}#{action}.html.haml")
end