kuppayam 0.1.15 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/kuppayam/utilities.js +9 -0
- data/app/controllers/kuppayam/base_controller.rb +1 -0
- data/app/helpers/filter_helper.rb +4 -3
- data/app/helpers/image_helper.rb +7 -10
- data/app/helpers/navigation_helper.rb +11 -2
- data/app/helpers/resource_helper.rb +32 -0
- data/app/helpers/resource_view_helper.rb +227 -0
- data/app/models/concerns/approvable.rb +47 -0
- data/app/models/concerns/featureable.rb +23 -0
- data/app/models/concerns/publishable.rb +46 -0
- data/app/models/image/cover_image.rb +3 -0
- data/app/models/image/gallery_image.rb +11 -0
- data/app/models/image/logo_image.rb +3 -0
- data/app/models/image/profile_image.rb +3 -0
- data/app/uploaders/cover_image_uploader.rb +22 -0
- data/app/uploaders/gallery_image_uploader.rb +22 -0
- data/app/uploaders/logo_image_uploader.rb +22 -0
- data/app/uploaders/profile_image_uploader.rb +22 -0
- data/app/views/kuppayam/api/docs/_navbar.html.erb +12 -0
- data/app/views/kuppayam/api/docs/_navigation.html.erb +12 -19
- data/app/views/kuppayam/api/docs/show.html.erb +70 -80
- data/app/views/kuppayam/images/_form.html.erb +7 -1
- data/app/views/kuppayam/images/_multiple_images.html.erb +29 -0
- data/app/views/kuppayam/images/create.html.erb +20 -7
- data/app/views/kuppayam/images/destroy.js.erb +10 -2
- data/app/views/kuppayam/images/update.html.erb +2 -2
- data/app/views/layouts/dashboard/_items.html.erb +20 -0
- data/app/views/layouts/kuppayam/docs.html.erb +31 -55
- data/config/initializers/validators.rb +5 -1
- data/lib/generators/kuppayam/resource_generator.rb +254 -0
- data/lib/generators/kuppayam/templates/controllers/resource_controller.rb +84 -0
- data/lib/generators/kuppayam/templates/db/migrate/create_resources.rb +14 -0
- data/lib/generators/kuppayam/templates/models/resource.rb +72 -0
- data/lib/generators/kuppayam/templates/spec/controllers/resource_controller_spec.rb +154 -0
- data/lib/generators/kuppayam/templates/spec/factories/resource.rb +42 -0
- data/lib/generators/kuppayam/templates/spec/models/resource_spec.rb +36 -0
- data/lib/generators/kuppayam/templates/views/_form.html.erb +63 -0
- data/lib/generators/kuppayam/templates/views/_index.html.erb +53 -0
- data/lib/generators/kuppayam/templates/views/_row.html.erb +26 -0
- data/lib/generators/kuppayam/templates/views/_show.html.erb +112 -0
- data/lib/generators/kuppayam/templates/views/index.html.erb +46 -0
- data/lib/generators/resource/resource_generator.rb +337 -0
- data/lib/kuppayam/action_view/form_helper.rb +10 -2
- data/lib/kuppayam/action_view/theme_helper.rb +4 -2
- data/lib/kuppayam/version.rb +1 -1
- metadata +58 -2
@@ -1,7 +1,15 @@
|
|
1
1
|
<% if @destroyed %>
|
2
|
+
|
3
|
+
<% if params[:multiple] && ["true", "t", "yes", "1"].include?(params[:multiple]) %>
|
4
|
+
|
5
|
+
$("#<%= params[:id] %>-multiple-image").remove();
|
6
|
+
|
7
|
+
<% else %>
|
8
|
+
|
9
|
+
$(".<%= @image.imageable_id %>-large-image").attr("src", "/assets/kuppayam/defaults/default-large.png");
|
10
|
+
$(".<%= @image.imageable_id %>-small-image").attr("src", "/assets/kuppayam/defaults/default-small.png");
|
2
11
|
|
3
|
-
|
4
|
-
$(".<%= @id %>-small-image").attr("src", "/assets/kuppayam/defaults/default-small.png");
|
12
|
+
<% end %>
|
5
13
|
|
6
14
|
// Showing Growl Like Message
|
7
15
|
notifySuccess("<%= escape_javascript(@notification[:title]) %>", "<%= escape_javascript(@notification[:message]) %>");
|
@@ -29,8 +29,8 @@
|
|
29
29
|
// this.parent.showGenericModal(heading, bodyContent, true);
|
30
30
|
// this.parent.cropImage("form_crop_photo");
|
31
31
|
|
32
|
-
this.parent.$(".<%= @image.
|
33
|
-
this.parent.$(".<%= @image.
|
32
|
+
this.parent.$(".<%= @image.imageable_id %>-large-image").attr("src", "<%= @image.image.large.url %>");
|
33
|
+
this.parent.$(".<%= @image.imageable_id %>-small-image").attr("src", "<%= @image.image.small.url %>");
|
34
34
|
|
35
35
|
<% end %>
|
36
36
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<% items.each do |key, values| %>
|
3
|
+
<% next unless values[:has_permission] %>
|
4
|
+
<div class="col-lg-2 col-md-3 col-sm-6 col-xs-12">
|
5
|
+
|
6
|
+
<div class="xe-widget xe-vertical-counter xe-vertical-counter-white" data-count=".num" data-from="0" data-to="128" data-duration="4">
|
7
|
+
<%= link_to values[:url] do %>
|
8
|
+
<div class="xe-icon" style="padding:0px;">
|
9
|
+
<i class="<%= values[:icon_class] %>"></i>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="xe-label">
|
13
|
+
<span style="font-size:14px;color:#898989;"><%= values[:text] %></span>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
</div>
|
19
|
+
<% end %>
|
20
|
+
</div>
|
@@ -5,6 +5,12 @@
|
|
5
5
|
<%= render :partial=>"/layouts/kuppayam/head" -%>
|
6
6
|
|
7
7
|
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
|
8
|
+
|
9
|
+
<style type="text/css">
|
10
|
+
.panel-positive h4.panel-title a { color: #68b828 !important; }
|
11
|
+
.panel-negative h4.panel-title a { color: #cc3f44 !important; }
|
12
|
+
</style>
|
13
|
+
|
8
14
|
</head>
|
9
15
|
|
10
16
|
<body class="page-body">
|
@@ -14,20 +20,38 @@
|
|
14
20
|
</div> -->
|
15
21
|
|
16
22
|
<div class="page-container">
|
23
|
+
|
24
|
+
<!-- Sidebar Navigation -->
|
25
|
+
<%= render :partial=>"/layouts/kuppayam/sidebar" -%>
|
17
26
|
|
18
27
|
<div class="main-content">
|
19
28
|
|
20
29
|
<!-- Heading & Breadcrumbs -->
|
21
30
|
<%= render :partial=>"/layouts/kuppayam/heading" -%>
|
22
31
|
|
23
|
-
|
24
|
-
<div
|
25
|
-
|
26
|
-
|
32
|
+
<%= render :partial=>"/kuppayam/api/docs/navbar" -%>
|
33
|
+
<div class="tab-content">
|
34
|
+
<div class="tab-pane active">
|
35
|
+
|
36
|
+
<div class="row gallery-env">
|
37
|
+
<!-- Navbar -->
|
38
|
+
<div class="col-sm-3 gallery-left">
|
39
|
+
<%= render :partial=>"/kuppayam/api/docs/navigation" -%>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<%#* Page Content Starts here -%>
|
43
|
+
<div id="div_page_content_main" class="col-sm-9 gallery-right">
|
44
|
+
|
45
|
+
<%#* Show flash messages if controller has set any. -%>
|
46
|
+
<div id="div_flash_message" class="mt-10">
|
47
|
+
<%= flash_message(false) if defined?(flash) -%>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<%= yield %>
|
51
|
+
</div>
|
52
|
+
</div>
|
27
53
|
|
28
|
-
|
29
|
-
<div id="div_page_content_main">
|
30
|
-
<%= yield %>
|
54
|
+
</div>
|
31
55
|
</div>
|
32
56
|
|
33
57
|
<!-- Footer -->
|
@@ -37,54 +61,6 @@
|
|
37
61
|
|
38
62
|
</div>
|
39
63
|
|
40
|
-
<div id="div_modal_generic" class="modal" style="z-index: 1056;">
|
41
|
-
<div class="modal-dialog">
|
42
|
-
<div class="modal-content">
|
43
|
-
<div class="modal-header">
|
44
|
-
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
45
|
-
<h3 class="modal-title">Modal title</h3>
|
46
|
-
</div>
|
47
|
-
<div class="modal-body-main"></div>
|
48
|
-
</div><!-- /.modal-content -->
|
49
|
-
</div><!-- /.modal-dialog -->
|
50
|
-
</div><!-- /.modal -->
|
51
|
-
|
52
|
-
<div id="div_modal_large" class="modal">
|
53
|
-
<div class="modal-dialog modal-lg" style="width: 96%">
|
54
|
-
<div class="modal-content">
|
55
|
-
<div class="modal-header">
|
56
|
-
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
57
|
-
<h3 class="modal-title">Modal title</h3>
|
58
|
-
</div>
|
59
|
-
<div class="modal-body-main"></div>
|
60
|
-
</div><!-- /.modal-content -->
|
61
|
-
</div><!-- /.modal-dialog -->
|
62
|
-
</div><!-- /.modal -->
|
63
|
-
|
64
|
-
<div id="div_modal_message" class="modal fade">
|
65
|
-
<div class="modal-dialog">
|
66
|
-
<div class="modal-content">
|
67
|
-
<div class="modal-header">
|
68
|
-
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
69
|
-
<h3 class="modal-title">Modal title</h3>
|
70
|
-
</div>
|
71
|
-
<div class="modal-body">
|
72
|
-
<p>One fine body…</p>
|
73
|
-
</div>
|
74
|
-
<div class="modal-footer">
|
75
|
-
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
|
76
|
-
</div>
|
77
|
-
</div><!-- /.modal-content -->
|
78
|
-
</div><!-- /.modal-dialog -->
|
79
|
-
</div><!-- /.modal -->
|
80
|
-
|
81
|
-
<script type="text/javascript">
|
82
|
-
$('.modal').on('shown.bs.modal', function(e){
|
83
|
-
$(this).modal('handleUpdate'); //Update backdrop on modal show
|
84
|
-
$(this).scrollTop(0); //reset modal to top position
|
85
|
-
});
|
86
|
-
</script>
|
87
|
-
|
88
64
|
<%#* Loading Javascripts -%>
|
89
65
|
<%= javascript_include_tag @javascript_filename -%>
|
90
66
|
|
@@ -46,7 +46,11 @@ module Kuppayam
|
|
46
46
|
|
47
47
|
def validate_email(attribute, **options)
|
48
48
|
reg_exp = /\A(|(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6})\z/i
|
49
|
-
options.
|
49
|
+
options.reverse_merge!(
|
50
|
+
mandatory: true,
|
51
|
+
format: reg_exp,
|
52
|
+
uniqueness: {:case_sensitive => false}
|
53
|
+
)
|
50
54
|
voptions = generate_validation_options(attribute, options)
|
51
55
|
validates attribute, **voptions
|
52
56
|
end
|
@@ -0,0 +1,254 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
class Kuppayam::ResourceGenerator < Rails::Generators::Base
|
5
|
+
|
6
|
+
include Rails::Generators::Migration
|
7
|
+
|
8
|
+
def self.next_migration_number(path)
|
9
|
+
@migration_number = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i.to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
source_root File.expand_path('../templates', __FILE__)
|
13
|
+
|
14
|
+
desc "Generates a migration, model and it specs"
|
15
|
+
|
16
|
+
argument :resource_name, :type=>:string
|
17
|
+
argument :fields, :type=>:hash, :banner =>"Resource Fields."
|
18
|
+
|
19
|
+
class_option :debug, :type => :boolean, :default => false, :desc => "This will print the arguments for debugging"
|
20
|
+
|
21
|
+
def debug_args
|
22
|
+
print_args if options.debug?
|
23
|
+
end
|
24
|
+
|
25
|
+
def generate_migrations
|
26
|
+
migration_dir = "db/migrate"
|
27
|
+
migration_file_name = "create_#{instances_name}.rb"
|
28
|
+
destination = self.class.migration_exists?(migration_dir, migration_file_name)
|
29
|
+
if destination
|
30
|
+
say_status("skipped", "Migration #{migration_file_name}.rb already exists")
|
31
|
+
else
|
32
|
+
migration_template "db/migrate/create_resources.rb", "db/migrate/create_#{instances_name}.rb"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def generate_model
|
37
|
+
template "models/resource.rb", "app/models/#{model_path}.rb"
|
38
|
+
end
|
39
|
+
|
40
|
+
def generate_factory
|
41
|
+
template "spec/factories/resource.rb", "spec/factories/#{model_path}.rb"
|
42
|
+
end
|
43
|
+
|
44
|
+
def generate_model_spec
|
45
|
+
template "spec/models/resource_spec.rb", "spec/models/#{model_path}_spec.rb"
|
46
|
+
end
|
47
|
+
|
48
|
+
def generate_controllers
|
49
|
+
template "controllers/resource_controller.rb", "app/controllers/#{controller_path}_controller.rb"
|
50
|
+
end
|
51
|
+
|
52
|
+
def generate_controller_spec
|
53
|
+
template "spec/controllers/resource_controller_spec.rb", "spec/controllers/#{controller_path}_controller_spec.rb"
|
54
|
+
end
|
55
|
+
|
56
|
+
def generate_views
|
57
|
+
template "views/_form.html.erb", "app/views/#{controller_path}/_form.html.erb"
|
58
|
+
template "views/_index.html.erb", "app/views/#{controller_path}/_index.html.erb"
|
59
|
+
template "views/_row.html.erb", "app/views/#{controller_path}/_row.html.erb"
|
60
|
+
template "views/_show.html.erb", "app/views/#{controller_path}/_show.html.erb"
|
61
|
+
template "views/index.html.erb", "app/views/#{controller_path}/index.html.erb"
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def print_args
|
67
|
+
puts ":fields: #{fields}"
|
68
|
+
puts ":form_link_param: #{form_link_param}"
|
69
|
+
puts "name_phrases: #{name_phrases}"
|
70
|
+
puts "controller_path: #{controller_path}"
|
71
|
+
puts "controller_class: #{controller_class}"
|
72
|
+
puts "model_path: #{model_path}"
|
73
|
+
puts "model_class: #{model_class}"
|
74
|
+
puts "instance_name: #{instance_name}"
|
75
|
+
puts "instances_name: #{instances_name}"
|
76
|
+
puts "table_name: #{table_name}"
|
77
|
+
|
78
|
+
puts "index path: #{resource_link}"
|
79
|
+
puts "show path: #{resource_link('show')}"
|
80
|
+
puts "new path: #{resource_link('new')}"
|
81
|
+
puts "edit path: #{resource_link('edit')}"
|
82
|
+
puts "create path: #{resource_link('create')}"
|
83
|
+
puts "update path: #{resource_link('update')}"
|
84
|
+
puts "destroy path: #{resource_link('destroy')}"
|
85
|
+
|
86
|
+
puts "index url: #{resource_link('index','url')}"
|
87
|
+
puts "show url: #{resource_link('show','url')}"
|
88
|
+
puts "new url: #{resource_link('new','url')}"
|
89
|
+
puts "edit url: #{resource_link('edit','url')}"
|
90
|
+
puts "create url: #{resource_link('create','url')}"
|
91
|
+
puts "update url: #{resource_link('update','url')}"
|
92
|
+
puts "destroy url: #{resource_link('destroy','url')}"
|
93
|
+
end
|
94
|
+
|
95
|
+
def name_phrases
|
96
|
+
if resource_name.include?('::')
|
97
|
+
resource_name.split("::")
|
98
|
+
elsif resource_name.include?('/')
|
99
|
+
resource_name.split("/")
|
100
|
+
else
|
101
|
+
[resource_name]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def controller_path
|
106
|
+
words = name_phrases
|
107
|
+
resource = words.pop
|
108
|
+
if words.any?
|
109
|
+
words.collect(&:downcase).join("/") + "/#{resource.pluralize}"
|
110
|
+
else
|
111
|
+
"#{resource.pluralize}"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def controller_class
|
116
|
+
words = name_phrases
|
117
|
+
resource = words.pop
|
118
|
+
if words.any?
|
119
|
+
words.collect(&:camelize).join("::") + "::#{resource.camelize.pluralize}Controller"
|
120
|
+
else
|
121
|
+
"#{resource.camelize.pluralize}Controller"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def model_path
|
126
|
+
name_phrases.last.downcase
|
127
|
+
end
|
128
|
+
|
129
|
+
def model_class
|
130
|
+
name_phrases.last.camelize
|
131
|
+
end
|
132
|
+
|
133
|
+
def instance_name
|
134
|
+
name_phrases.last.underscore
|
135
|
+
end
|
136
|
+
|
137
|
+
def instances_name
|
138
|
+
instance_name.pluralize
|
139
|
+
end
|
140
|
+
|
141
|
+
def instance_title
|
142
|
+
instance_name.titleize
|
143
|
+
end
|
144
|
+
|
145
|
+
def instances_title
|
146
|
+
instances_name.titleize
|
147
|
+
end
|
148
|
+
|
149
|
+
def table_name
|
150
|
+
instances_name
|
151
|
+
end
|
152
|
+
|
153
|
+
def resource_link(actn='index', ltype='path')
|
154
|
+
map = {
|
155
|
+
'index' => '',
|
156
|
+
'show' => '',
|
157
|
+
'edit' => 'edit_',
|
158
|
+
'new' => 'new_',
|
159
|
+
'update' => '',
|
160
|
+
'create' => '',
|
161
|
+
'destroy' => '',
|
162
|
+
}
|
163
|
+
words = name_phrases
|
164
|
+
resource = words.pop
|
165
|
+
if actn == "index"
|
166
|
+
map[actn] + (words.any? ? words.join("_") + "_" : "") + resource.pluralize + "_" + ltype
|
167
|
+
else
|
168
|
+
map[actn] + (words.any? ? words.join("_") + "_" : "") + resource + "_" + ltype
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def form_for_object
|
173
|
+
if name_phrases.size > 1
|
174
|
+
words = name_phrases.dup
|
175
|
+
resource = words.pop
|
176
|
+
"[" + words.map{|x| ":#{x}"}.join(", ") + ", @#{resource}]"
|
177
|
+
else
|
178
|
+
"@#{instance_name}"
|
179
|
+
end
|
180
|
+
|
181
|
+
end
|
182
|
+
|
183
|
+
def form_link_param
|
184
|
+
words = name_phrases
|
185
|
+
resource = words.pop
|
186
|
+
if words.any?
|
187
|
+
# to print like this [:admin, :user, :location, @chakka]
|
188
|
+
# in form.html.erb
|
189
|
+
"[" + (words.map{|x| ":" + x.downcase} << "@" + resource.downcase).join(", ") + "]"
|
190
|
+
else
|
191
|
+
"@#{resource.downcase}"
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
## List of all the string fields
|
196
|
+
def string_fields
|
197
|
+
main_field = main_string_field
|
198
|
+
fields.map{|name, type| name if name != main_field && type == "string" }.uniq.compact
|
199
|
+
end
|
200
|
+
|
201
|
+
## List of all the string fields including main field
|
202
|
+
def string_fields_including_main_field
|
203
|
+
main_field = main_string_field
|
204
|
+
fields.map{|name, type| name if type == "string" }.uniq.compact
|
205
|
+
end
|
206
|
+
|
207
|
+
## The main string field like 'name'
|
208
|
+
def main_string_field
|
209
|
+
fields.map{|name, type| name if name.include?("name") && type == "string"}.uniq.compact || fields.keys.any? ? fields.keys.first : "id"
|
210
|
+
end
|
211
|
+
|
212
|
+
def guess_input_type(name, type)
|
213
|
+
case type
|
214
|
+
when "string"
|
215
|
+
if name.include?("url")
|
216
|
+
return "url"
|
217
|
+
elsif name.include?("email")
|
218
|
+
return "email"
|
219
|
+
elsif name.include?("phone") || name.include?("mobile") || name.include?("landline") || name.include?("contact number")
|
220
|
+
return "tel"
|
221
|
+
elsif name.include?("time")
|
222
|
+
return "time"
|
223
|
+
elsif name.include?("date")
|
224
|
+
return "date"
|
225
|
+
elsif name.include?("password")
|
226
|
+
return "password"
|
227
|
+
else
|
228
|
+
"text"
|
229
|
+
end
|
230
|
+
when "text"
|
231
|
+
"textarea"
|
232
|
+
when "integer"
|
233
|
+
"number"
|
234
|
+
when "references"
|
235
|
+
"type"
|
236
|
+
when "date"
|
237
|
+
"date"
|
238
|
+
when "datetime"
|
239
|
+
"datetime-local"
|
240
|
+
when "timestamp", "time"
|
241
|
+
"time"
|
242
|
+
when "boolean"
|
243
|
+
"checkbox"
|
244
|
+
else
|
245
|
+
"text"
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
## Text Fields like description or summary
|
250
|
+
def text_fields
|
251
|
+
fields.map{|name, type| name if type == "text"}.uniq.compact
|
252
|
+
end
|
253
|
+
|
254
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module Kuppayam
|
2
|
+
class <%= controller_class -%> < ResourceController
|
3
|
+
|
4
|
+
private
|
5
|
+
|
6
|
+
def permitted_params
|
7
|
+
params.require(:<%= instance_name %>).permit(<%= fields.keys.map{|x| ":" + x.downcase }.join(", ") %>)
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_collections
|
11
|
+
@relation = <%= model_class %>.includes(:cover_image).where("")
|
12
|
+
params[:st] = "published" if params[:st].nil?
|
13
|
+
parse_filters
|
14
|
+
apply_filters
|
15
|
+
@<%= instances_name %> = @r_objects = @relation.page(@current_page).per(@per_page)
|
16
|
+
return true
|
17
|
+
end
|
18
|
+
|
19
|
+
def apply_filters
|
20
|
+
@relation = @relation.search(@query) if @query
|
21
|
+
@relation = @relation.status(@status) if @status
|
22
|
+
|
23
|
+
@order_by = "created_at desc" unless @order_by
|
24
|
+
@relation = @relation.order(@order_by)
|
25
|
+
end
|
26
|
+
|
27
|
+
def configure_filter_settings
|
28
|
+
@filter_settings = {
|
29
|
+
string_filters: [
|
30
|
+
{ filter_name: :query },
|
31
|
+
{ filter_name: :status }
|
32
|
+
],
|
33
|
+
|
34
|
+
boolean_filters: [],
|
35
|
+
|
36
|
+
reference_filters: [],
|
37
|
+
variable_filters: [],
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def configure_filter_ui_settings
|
42
|
+
@filter_ui_settings = {
|
43
|
+
status: {
|
44
|
+
object_filter: false,
|
45
|
+
select_label: "Select Status",
|
46
|
+
display_hash: <%= model_class %>::STATUS,
|
47
|
+
current_value: @status,
|
48
|
+
values: <%= model_class %>::STATUS_REVERSE,
|
49
|
+
current_filters: @filters,
|
50
|
+
filters_to_remove: [],
|
51
|
+
filters_to_add: {},
|
52
|
+
url_method_name: '<%= instances_name %>_url',
|
53
|
+
show_all_filter_on_top: true
|
54
|
+
}
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def resource_controller_configuration
|
59
|
+
{
|
60
|
+
page_title: "<%= model_class.pluralize.titleize %>",
|
61
|
+
js_view_path: "/kuppayam/workflows/peacock",
|
62
|
+
view_path: "<%= instances_name %>",
|
63
|
+
collection_name: :<%= instances_name %>,
|
64
|
+
item_name: :<%= instance_name %>,
|
65
|
+
class: <%= model_class %>
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
def breadcrumbs_configuration
|
70
|
+
{
|
71
|
+
heading: "Manage <%= model_class.pluralize.titleize %>",
|
72
|
+
icon: "fa-map-marker",
|
73
|
+
description: "Listing all <%= model_class.pluralize.titleize %>",
|
74
|
+
links: [{name: "Dashboard", link: dashboard_path, icon: 'fa-dashboard'},
|
75
|
+
{name: "Manage <%= model_class.pluralize.titleize %>", link: dhatu.<%= instances_name %>_path, icon: 'fa-calendar', active: true}]
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
def set_navs
|
80
|
+
set_nav("<%= instance_name %>")
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|