Class: RaroCrud

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

Constant Summary collapse

@@order_field =
{}
@@per_page =
{}
@@index_fields =
{}
@@form_fields =
{}
@@form_group =
{}
@@form_scripts =
{}
@@view_fields =
{}
@@search_fields =
{}
@@test_fields =
{}
{}
@@title =
{}
@@subtitle_index =
{}
@@description_index =
{}
@@actions =
{}
{}
@@edit_action =
{}
@@condition_edit_action =
{}
@@destroy_action =
{}
@@condition_destroy_action =
{}
@@view_action =
{}
@@condition_view_action =
{}
{}
@@scopes =
{}
[]
@@index_path =
nil

Class Method Summary collapse

Class Method Details

.actions ⇒ Object



110
111
112
# File 'app/raro_crud/raro_crud.rb', line 110

def self.actions
  (@@actions[self.to_s.to_sym]) ? @@actions[self.to_s.to_sym] : []
end


114
115
116
# File 'app/raro_crud/raro_crud.rb', line 114

def self.actions_links
  (@@links[self.to_s.to_sym]) ? @@links[self.to_s.to_sym] : []
end

.add_menus(menu) ⇒ Object



150
151
152
# File 'app/raro_crud/raro_crud.rb', line 150

def self.add_menus(menu)
  @@menus << menu
end

.condition_destroy_action ⇒ Object



48
49
50
# File 'app/raro_crud/raro_crud.rb', line 48

def self.condition_destroy_action
  (@@condition_destroy_action[self.to_s.to_sym]) ? @@condition_destroy_action[self.to_s.to_sym] : nil
end

.condition_edit_action ⇒ Object



36
37
38
# File 'app/raro_crud/raro_crud.rb', line 36

def self.condition_edit_action
  (@@condition_edit_action[self.to_s.to_sym]) ? @@condition_edit_action[self.to_s.to_sym] : nil
end

.condition_view_action ⇒ Object



60
61
62
# File 'app/raro_crud/raro_crud.rb', line 60

def self.condition_view_action
  (@@condition_view_action[self.to_s.to_sym]) ? @@condition_view_action[self.to_s.to_sym] : nil
end

.description(type) ⇒ Object



87
88
89
90
91
92
# File 'app/raro_crud/raro_crud.rb', line 87

def self.description(type)
  case type
  when :index
    @@description_index[self.to_s.to_sym]
  end
end

.destroy_action ⇒ Object



40
41
42
43
44
45
46
# File 'app/raro_crud/raro_crud.rb', line 40

def self.destroy_action
  if @@destroy_action[self.to_s.to_sym] == false
    return false
  else
    return true
  end
end

.edit_action ⇒ Object



28
29
30
31
32
33
34
# File 'app/raro_crud/raro_crud.rb', line 28

def self.edit_action
  if @@edit_action[self.to_s.to_sym] == false
    return false
  else
    return true
  end
end

.form_fields ⇒ Object



122
123
124
# File 'app/raro_crud/raro_crud.rb', line 122

def self.form_fields
  (@@form_fields[self.to_s.to_sym]) ? @@form_fields[self.to_s.to_sym]  : []
end

.form_groups ⇒ Object



126
127
128
# File 'app/raro_crud/raro_crud.rb', line 126

def self.form_groups
  (@@form_group[self.to_s.to_sym]) ? @@form_group[self.to_s.to_sym]  : []
end

.form_scripts ⇒ Object



130
131
132
# File 'app/raro_crud/raro_crud.rb', line 130

def self.form_scripts
  (@@form_scripts[self.to_s.to_sym]) ? @@form_scripts[self.to_s.to_sym]  : []
end

.get_index_path ⇒ Object



72
73
74
# File 'app/raro_crud/raro_crud.rb', line 72

def self.get_index_path
  @@index_path
end

.index_fields ⇒ Object



98
99
100
# File 'app/raro_crud/raro_crud.rb', line 98

def self.index_fields
  (@@index_fields[self.to_s.to_sym]) ? @@index_fields[self.to_s.to_sym] : []
end

.index_path(str) ⇒ Object



68
69
70
# File 'app/raro_crud/raro_crud.rb', line 68

def self.index_path str
  @@index_path = str
end


154
155
156
# File 'app/raro_crud/raro_crud.rb', line 154

def self.menus
  @@menus
end


118
119
120
# File 'app/raro_crud/raro_crud.rb', line 118

def self.options_link
  (@@options_link[self.to_s.to_sym]) ? @@options_link[self.to_s.to_sym] : []
end

.order_field ⇒ Object



102
103
104
# File 'app/raro_crud/raro_crud.rb', line 102

def self.order_field
  (@@order_field[self.to_s.to_sym]).present? ? @@order_field[self.to_s.to_sym] : "id"
end

.per_page ⇒ Object



106
107
108
# File 'app/raro_crud/raro_crud.rb', line 106

def self.per_page
  @@per_page[self.to_s.to_sym]
end

.root_path ⇒ Object



64
65
66
# File 'app/raro_crud/raro_crud.rb', line 64

def self.root_path
  "/crud/#{self.to_s.gsub('Crud', '').underscore}"
end

.scopes ⇒ Object



146
147
148
# File 'app/raro_crud/raro_crud.rb', line 146

def self.scopes
  (@@scopes[self.to_s.to_sym]) ? @@scopes[self.to_s.to_sym]  : []
end

.search_fields ⇒ Object



138
139
140
# File 'app/raro_crud/raro_crud.rb', line 138

def self.search_fields
  (@@search_fields[self.to_s.to_sym]) ? @@search_fields[self.to_s.to_sym]  : []
end

.subtitle(type) ⇒ Object



80
81
82
83
84
85
# File 'app/raro_crud/raro_crud.rb', line 80

def self.subtitle(type)
  case type
  when :index
    @@subtitle_index[self.to_s.to_sym]
  end
end

.test_fields ⇒ Object



142
143
144
# File 'app/raro_crud/raro_crud.rb', line 142

def self.test_fields
  (@@test_fields[self.to_s.to_sym]) ? @@test_fields[self.to_s.to_sym]  : []
end

.title ⇒ Object



76
77
78
# File 'app/raro_crud/raro_crud.rb', line 76

def self.title
  @@title[self.to_s.to_sym]
end


94
95
96
# File 'app/raro_crud/raro_crud.rb', line 94

def self.top_links 
  (@@top_links[self.to_s.to_sym]) ? @@top_links[self.to_s.to_sym] : []
end

.view_action ⇒ Object



52
53
54
55
56
57
58
# File 'app/raro_crud/raro_crud.rb', line 52

def self.view_action
  if @@view_action[self.to_s.to_sym] == false
    return false
  else
    return true
  end
end

.view_fields ⇒ Object



134
135
136
# File 'app/raro_crud/raro_crud.rb', line 134

def self.view_fields
  (@@view_fields[self.to_s.to_sym]) ? @@view_fields[self.to_s.to_sym]  : []
end