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
@@ -0,0 +1,112 @@
|
|
1
|
+
<div id="div_<%= instance_name %>_show">
|
2
|
+
|
3
|
+
<div class="row">
|
4
|
+
|
5
|
+
<div class="col-md-3 col-sm-12 col-xs-12" style="border-right:1px solid #f1f1f1;">
|
6
|
+
<%%= edit_image(@<%= instance_name %>,
|
7
|
+
"cover_image.image.large.url",
|
8
|
+
upload_image_link(@<%= instance_name %>, :cover_image, nil ),
|
9
|
+
remove_image_link(@<%= instance_name %>, :cover_image, nil ),
|
10
|
+
image_options: {assoc_name: :cover_image }) %>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="col-md-6 col-sm-12 col-xs-12" style="border-right:1px solid #f1f1f1;">
|
14
|
+
|
15
|
+
<%%= theme_panel_heading(@<%= instance_name %>.display_name) %>
|
16
|
+
|
17
|
+
<%%#= theme_panel_sub_heading(@<%= instance_name %>.<%= instance_name %>_text, "#") if @<%= instance_name %>.<%= instance_name %>_text %>
|
18
|
+
|
19
|
+
<%%= clear_tag(10) %>
|
20
|
+
|
21
|
+
<%%= display_publishable_status(@<%= instance_name %>) %>
|
22
|
+
|
23
|
+
<%%#= display_featured(@<%= instance_name %>) %>
|
24
|
+
|
25
|
+
<%%= clear_tag(20) %>
|
26
|
+
|
27
|
+
<table class="table table-condensed table-bordered mb-20">
|
28
|
+
<tbody>
|
29
|
+
|
30
|
+
<tr>
|
31
|
+
<th style="width:25%">Starts At</th>
|
32
|
+
<td style="width:25%"><%%#= time_tag(@<%= instance_name %>.starts_at) if @<%= instance_name %>.starts_at %></td>
|
33
|
+
<th style="width:25%">Ends At</th>
|
34
|
+
<td style="width:25%"><%%#= time_tag(@<%= instance_name %>.ends_at) if @<%= instance_name %>.ends_at %></td>
|
35
|
+
</tr>
|
36
|
+
|
37
|
+
</tbody>
|
38
|
+
</table>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div class="col-md-3 col-sm-12 col-xs-12">
|
42
|
+
<%%= display_manage_buttons(@<%= instance_name %>) %>
|
43
|
+
<%%= display_publishable_buttons(@<%= instance_name %>) %>
|
44
|
+
<%%#= display_featurable_buttons(@<%= instance_name %>) %>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<hr>
|
50
|
+
|
51
|
+
<div class="visible-sm visible-xs mb-50"></div>
|
52
|
+
|
53
|
+
<%%= clear_tag(20) %>
|
54
|
+
|
55
|
+
<ul class="nav nav-pills">
|
56
|
+
<li class="active">
|
57
|
+
<a href="#<%= instance_name %>_details" data-toggle="tab" aria-expanded="false">
|
58
|
+
<span class="visible-xs"><i class="fa-database"></i></span>
|
59
|
+
<span class="hidden-xs"><%= model_class %> Details</span>
|
60
|
+
</a>
|
61
|
+
</li>
|
62
|
+
|
63
|
+
<li class="">
|
64
|
+
<a href="#technical_details" data-toggle="tab" aria-expanded="false">
|
65
|
+
<span class="visible-xs"><i class="fa-database"></i></span>
|
66
|
+
<span class="hidden-xs">Technical Details</span>
|
67
|
+
</a>
|
68
|
+
</li>
|
69
|
+
</ul>
|
70
|
+
|
71
|
+
<div class="tab-content">
|
72
|
+
<div class="tab-pane active" id="<%= instance_name %>_details" style="border: 1px solid #000;min-height:200px;padding:20px;margin-bottom:20px;max-height: 400px;overflow-y: auto;">
|
73
|
+
|
74
|
+
<%%= clear_tag(20) %>
|
75
|
+
<%%= raw(@<%= instance_name %>.id) %>
|
76
|
+
<%%= clear_tag(20) %>
|
77
|
+
|
78
|
+
|
79
|
+
</div>
|
80
|
+
<div class="tab-pane" id="technical_details" style="border: 1px solid #000;min-height:200px;padding:20px;margin-bottom:20px;max-height: 400px;overflow-y: auto;">
|
81
|
+
|
82
|
+
<%%= clear_tag(20) %>
|
83
|
+
|
84
|
+
<div class="table-responsive">
|
85
|
+
<table class="table table-striped table-condensed table-bordered mb-60">
|
86
|
+
<tbody>
|
87
|
+
|
88
|
+
<tr>
|
89
|
+
<th>ID</th><td><%%= @<%= instance_name %>.id %></td>
|
90
|
+
<th>Permalink</th><td><%%#= @<%= instance_name %>.to_param %></td>
|
91
|
+
</tr>
|
92
|
+
<tr>
|
93
|
+
<th>Featured</th><td><%%#= @<%= instance_name %>.featured %></td>
|
94
|
+
<th>Status</th><td><%%= @<%= instance_name %>.status %></td>
|
95
|
+
</tr>
|
96
|
+
<tr>
|
97
|
+
<th>Created At</th><td><%%= @<%= instance_name %>.created_at.strftime("%m/%d/%Y - %H:%M:%S") if @<%= instance_name %>.created_at %></td>
|
98
|
+
<th>Updated At</th><td><%%= @<%= instance_name %>.updated_at.strftime("%m/%d/%Y - %H:%M:%S") if @<%= instance_name %>.updated_at %></td>
|
99
|
+
</tr>
|
100
|
+
|
101
|
+
</tbody>
|
102
|
+
</table>
|
103
|
+
</div>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
|
108
|
+
<%%= link_to "Close", "#", onclick: "closeLargeModal();", class: "btn btn-primary pull-right" %>
|
109
|
+
|
110
|
+
<%%= clear_tag %>
|
111
|
+
|
112
|
+
</div>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<div class="row">
|
2
|
+
|
3
|
+
<div class="col-md-12">
|
4
|
+
|
5
|
+
<ul class="nav nav-tabs nav-tabs-justified">
|
6
|
+
<%% <%= model_class %>::STATUS.each do |key, value| %>
|
7
|
+
<li class="<%%= @status == value ? 'active' : '' %>">
|
8
|
+
<%%= link_to <%= instances_name %>_path(st: value), "aria-expanded" => "#{ @status == value ? 'true' : 'false' }" do %>
|
9
|
+
<span class="visible-xs"><i class="fa-gift"></i></span>
|
10
|
+
<span class="hidden-xs"><%%= key %></span>
|
11
|
+
<%% end %>
|
12
|
+
</li>
|
13
|
+
<%% end %>
|
14
|
+
</ul>
|
15
|
+
|
16
|
+
<div class="tab-content">
|
17
|
+
<div class="tab-pane active">
|
18
|
+
|
19
|
+
<div id="div_<%= instance_name %>_action_buttons">
|
20
|
+
|
21
|
+
<div class="row">
|
22
|
+
<div class="col-sm-6">
|
23
|
+
<%%= theme_button('Add a <%= model_name.titlieize %>', 'plus', new_<%= instance_name %>_path(), classes: "pull-left", btn_type: "success") %>
|
24
|
+
|
25
|
+
<%%= theme_button('Refresh', 'refresh', <%= instances_name %>_path(st: @status), classes: "pull-left ml-10", btn_type: "white") %>
|
26
|
+
</div>
|
27
|
+
<div class="col-sm-6">
|
28
|
+
<%%= search_form_kuppayam(Dhatu::<%= model_name %>, <%= instances_name %>_path(st: @status), text: @filters[:query]) %>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
</div>
|
33
|
+
<%%= clear_tag(10) %>
|
34
|
+
|
35
|
+
<div id="div_<%= instance_name %>_index">
|
36
|
+
<%%= render :partial=>"<%= instances_name %>/index" %>
|
37
|
+
</div>
|
38
|
+
<%%= clear_tag(10) %>
|
39
|
+
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
</div>
|
44
|
+
|
45
|
+
</div>
|
46
|
+
|
@@ -0,0 +1,337 @@
|
|
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 controller, view and route entries for CRUD operations of a resource"
|
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_controllers
|
26
|
+
template "controllers/resource_controller.rb", "app/controllers/#{controller_path}_controller.rb"
|
27
|
+
end
|
28
|
+
|
29
|
+
def generate_views
|
30
|
+
template "views/#{framework}/resource/_edit.html.erb", "app/views/#{controller_path}/_edit.html.erb"
|
31
|
+
template "views/#{framework}/resource/_filters.html.erb", "app/views/#{controller_path}/_filters.html.erb"
|
32
|
+
template "views/#{framework}/resource/_field.html.erb", "app/views/#{controller_path}/_field.html.erb"
|
33
|
+
template "views/#{framework}/resource/_form.html.erb", "app/views/#{controller_path}/_form.html.erb"
|
34
|
+
template "views/#{framework}/resource/_index.html.erb", "app/views/#{controller_path}/_index.html.erb"
|
35
|
+
template "views/#{framework}/resource/_drop_down.html.erb", "app/views/#{controller_path}/_drop_down.html.erb"
|
36
|
+
template "views/#{framework}/resource/_item.html.erb", "app/views/#{controller_path}/_item.html.erb"
|
37
|
+
template "views/#{framework}/resource/_nav_filters.html.erb", "app/views/#{controller_path}/_nav_filters.html.erb"
|
38
|
+
template "views/#{framework}/resource/_new.html.erb", "app/views/#{controller_path}/_new.html.erb"
|
39
|
+
template "views/#{framework}/resource/_show.html.erb", "app/views/#{controller_path}/_show.html.erb"
|
40
|
+
template "views/#{framework}/resource/_summary.html.erb", "app/views/#{controller_path}/_summary.html.erb"
|
41
|
+
template "views/#{framework}/resource/create.js.erb", "app/views/#{controller_path}/create.js.erb"
|
42
|
+
template "views/#{framework}/resource/destroy.js.erb", "app/views/#{controller_path}/destroy.js.erb"
|
43
|
+
template "views/#{framework}/resource/edit.js.erb", "app/views/#{controller_path}/edit.js.erb"
|
44
|
+
template "views/#{framework}/resource/index.js.erb", "app/views/#{controller_path}/index.js.erb"
|
45
|
+
template "views/#{framework}/resource/new.js.erb", "app/views/#{controller_path}/new.js.erb"
|
46
|
+
template "views/#{framework}/resource/show.js.erb", "app/views/#{controller_path}/show.js.erb"
|
47
|
+
template "views/#{framework}/resource/update.js.erb", "app/views/#{controller_path}/update.js.erb"
|
48
|
+
template "views/#{framework}/resource/index.html.erb", "app/views/#{controller_path}/index.html.erb"
|
49
|
+
end
|
50
|
+
|
51
|
+
def generate_models
|
52
|
+
template "models/resource.rb", "app/models/#{model_path}.rb"
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def print_args
|
58
|
+
puts ":fields: #{fields}"
|
59
|
+
puts ":form_link_param: #{form_link_param}"
|
60
|
+
puts "name_phrases: #{name_phrases}"
|
61
|
+
puts "controller_path: #{controller_path}"
|
62
|
+
puts "controller_class: #{controller_class}"
|
63
|
+
puts "model_path: #{model_path}"
|
64
|
+
puts "model_class: #{model_class}"
|
65
|
+
puts "instance_name: #{instance_name}"
|
66
|
+
puts "instances_name: #{instances_name}"
|
67
|
+
puts "table_name: #{table_name}"
|
68
|
+
|
69
|
+
puts "index path: #{resource_link}"
|
70
|
+
puts "show path: #{resource_link('show')}"
|
71
|
+
puts "new path: #{resource_link('new')}"
|
72
|
+
puts "edit path: #{resource_link('edit')}"
|
73
|
+
puts "create path: #{resource_link('create')}"
|
74
|
+
puts "update path: #{resource_link('update')}"
|
75
|
+
puts "destroy path: #{resource_link('destroy')}"
|
76
|
+
|
77
|
+
puts "index url: #{resource_link('index','url')}"
|
78
|
+
puts "show url: #{resource_link('show','url')}"
|
79
|
+
puts "new url: #{resource_link('new','url')}"
|
80
|
+
puts "edit url: #{resource_link('edit','url')}"
|
81
|
+
puts "create url: #{resource_link('create','url')}"
|
82
|
+
puts "update url: #{resource_link('update','url')}"
|
83
|
+
puts "destroy url: #{resource_link('destroy','url')}"
|
84
|
+
end
|
85
|
+
|
86
|
+
def name_phrases
|
87
|
+
if resource_name.include?('::')
|
88
|
+
resource_name.split("::")
|
89
|
+
elsif resource_name.include?('/')
|
90
|
+
resource_name.split("/")
|
91
|
+
else
|
92
|
+
[resource_name]
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def controller_path
|
97
|
+
words = name_phrases
|
98
|
+
resource = words.pop
|
99
|
+
if words.any?
|
100
|
+
words.collect(&:downcase).join("/") + "/#{resource.pluralize}"
|
101
|
+
else
|
102
|
+
"#{resource.pluralize}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def controller_class
|
107
|
+
words = name_phrases
|
108
|
+
resource = words.pop
|
109
|
+
if words.any?
|
110
|
+
words.collect(&:camelize).join("::") + "::#{resource.camelize.pluralize}Controller"
|
111
|
+
else
|
112
|
+
"#{resource.camelize.pluralize}Controller"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def model_path
|
117
|
+
name_phrases.last.downcase
|
118
|
+
end
|
119
|
+
|
120
|
+
def model_class
|
121
|
+
name_phrases.last.camelize
|
122
|
+
end
|
123
|
+
|
124
|
+
def instance_name
|
125
|
+
name_phrases.last.underscore
|
126
|
+
end
|
127
|
+
|
128
|
+
def instances_name
|
129
|
+
instance_name.pluralize
|
130
|
+
end
|
131
|
+
|
132
|
+
def instance_title
|
133
|
+
instance_name.titleize
|
134
|
+
end
|
135
|
+
|
136
|
+
def instances_title
|
137
|
+
instances_name.titleize
|
138
|
+
end
|
139
|
+
|
140
|
+
def table_name
|
141
|
+
instances_name
|
142
|
+
end
|
143
|
+
|
144
|
+
def resource_link(actn='index', ltype='path')
|
145
|
+
map = {
|
146
|
+
'index' => '',
|
147
|
+
'show' => '',
|
148
|
+
'edit' => 'edit_',
|
149
|
+
'new' => 'new_',
|
150
|
+
'update' => '',
|
151
|
+
'create' => '',
|
152
|
+
'destroy' => '',
|
153
|
+
}
|
154
|
+
words = name_phrases
|
155
|
+
resource = words.pop
|
156
|
+
if actn == "index"
|
157
|
+
map[actn] + (words.any? ? words.join("_") + "_" : "") + resource.pluralize + "_" + ltype
|
158
|
+
else
|
159
|
+
map[actn] + (words.any? ? words.join("_") + "_" : "") + resource + "_" + ltype
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def form_for_object
|
164
|
+
if name_phrases.size > 1
|
165
|
+
words = name_phrases.dup
|
166
|
+
resource = words.pop
|
167
|
+
"[" + words.map{|x| ":#{x}"}.join(", ") + ", @#{resource}]"
|
168
|
+
else
|
169
|
+
"@#{instance_name}"
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
173
|
+
|
174
|
+
def form_link_param
|
175
|
+
words = name_phrases
|
176
|
+
resource = words.pop
|
177
|
+
if words.any?
|
178
|
+
# to print like this [:admin, :user, :location, @chakka]
|
179
|
+
# in form.html.erb
|
180
|
+
"[" + (words.map{|x| ":" + x.downcase} << "@" + resource.downcase).join(", ") + "]"
|
181
|
+
else
|
182
|
+
"@#{resource.downcase}"
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
## List of all the string fields
|
187
|
+
def string_fields
|
188
|
+
main_field = main_string_field
|
189
|
+
fields.map{|name, type| name if name != main_field && type == "string" }.uniq.compact
|
190
|
+
end
|
191
|
+
|
192
|
+
## List of all the string fields including main field
|
193
|
+
def string_fields_including_main_field
|
194
|
+
main_field = main_string_field
|
195
|
+
fields.map{|name, type| name if type == "string" }.uniq.compact
|
196
|
+
end
|
197
|
+
|
198
|
+
## The main string field like 'name'
|
199
|
+
def main_string_field
|
200
|
+
fields.map{|name, type| name if name.include?("name") && type == "string"}.uniq.compact || fields.keys.any? ? fields.keys.first : "id"
|
201
|
+
end
|
202
|
+
|
203
|
+
def guess_input_type(name, type)
|
204
|
+
case type
|
205
|
+
when "string"
|
206
|
+
if name.include?("url")
|
207
|
+
return "url"
|
208
|
+
elsif name.include?("email")
|
209
|
+
return "email"
|
210
|
+
elsif name.include?("phone") || name.include?("mobile") || name.include?("landline") || name.include?("contact number")
|
211
|
+
return "tel"
|
212
|
+
elsif name.include?("time")
|
213
|
+
return "time"
|
214
|
+
elsif name.include?("date")
|
215
|
+
return "date"
|
216
|
+
elsif name.include?("password")
|
217
|
+
return "password"
|
218
|
+
else
|
219
|
+
"text"
|
220
|
+
end
|
221
|
+
when "text"
|
222
|
+
"textarea"
|
223
|
+
when "integer"
|
224
|
+
"number"
|
225
|
+
when "references"
|
226
|
+
"type"
|
227
|
+
when "date"
|
228
|
+
"date"
|
229
|
+
when "datetime"
|
230
|
+
"datetime-local"
|
231
|
+
when "timestamp", "time"
|
232
|
+
"time"
|
233
|
+
when "boolean"
|
234
|
+
"checkbox"
|
235
|
+
else
|
236
|
+
"text"
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
## Text Fields like description or summary
|
241
|
+
def text_fields
|
242
|
+
fields.map{|name, type| name if type == "text"}.uniq.compact
|
243
|
+
end
|
244
|
+
|
245
|
+
def container_class
|
246
|
+
case framework
|
247
|
+
when "bootstrap3", "gumby"
|
248
|
+
"container"
|
249
|
+
when "bootstrap2"
|
250
|
+
options.fixed? ? "container" : "container-fluid"
|
251
|
+
else
|
252
|
+
"container"
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
def row_class
|
257
|
+
case framework
|
258
|
+
when "bootstrap3", "gumby"
|
259
|
+
"row"
|
260
|
+
when "bootstrap3"
|
261
|
+
options.fixed? ? "row" : "row-fluid"
|
262
|
+
else
|
263
|
+
"row"
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
def column_class(grid_width_value)
|
268
|
+
grid_width_value_hash = {"1" => "one",
|
269
|
+
"2" => "two",
|
270
|
+
"3" => "three",
|
271
|
+
"4" => "four",
|
272
|
+
"5" => "five",
|
273
|
+
"6" => "six",
|
274
|
+
"7" => "seven",
|
275
|
+
"8" => "eight",
|
276
|
+
"9" => "nine",
|
277
|
+
"10" => "ten",
|
278
|
+
"11" => "eleven",
|
279
|
+
"12" => "twelve",
|
280
|
+
"13" => "thirteen",
|
281
|
+
"14" => "fourteen",
|
282
|
+
"15" => "fifteen",
|
283
|
+
"16" => "sixteen"}
|
284
|
+
case framework
|
285
|
+
when "bootstrap3"
|
286
|
+
"col-md-"
|
287
|
+
when "bootstrap2"
|
288
|
+
"span#{grid_width_value}"
|
289
|
+
when "gumby"
|
290
|
+
"#{grid_width_value_hash[grid_width_value.to_s]} columns"
|
291
|
+
else
|
292
|
+
"col#{grid_width_value}"
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
# This function is not used now.
|
297
|
+
def button_class(color, size, rounded="", pretty="")
|
298
|
+
case framework
|
299
|
+
when "bootstrap3"
|
300
|
+
color_hash = {"blue" => "btn-primary",
|
301
|
+
"light-blue" => "btn-info",
|
302
|
+
"grey" => "btn-default",
|
303
|
+
"black" => "btn-inverse",
|
304
|
+
"red" => "btn-danger",
|
305
|
+
"green" => "btn-success",
|
306
|
+
"orange" => "btn-warning"}
|
307
|
+
size_hash = {"large" => "btn-lg",
|
308
|
+
"medium" => "btn-sm",
|
309
|
+
"small" => "btn-xs"}
|
310
|
+
when "bootstrap2"
|
311
|
+
color_hash = {"blue" => "btn-primary",
|
312
|
+
"light-blue" => "btn-info",
|
313
|
+
"grey" => "",
|
314
|
+
"black" => "btn-inverse",
|
315
|
+
"red" => "btn-danger",
|
316
|
+
"green" => "btn-success",
|
317
|
+
"orange" => "btn-warning"}
|
318
|
+
size_hash = {"large" => "btn-large",
|
319
|
+
"medium" => "",
|
320
|
+
"small" => "btn-tiny"}
|
321
|
+
when"gumby"
|
322
|
+
color_hash = {"blue" => "primary",
|
323
|
+
"dark-green" => "secondary",
|
324
|
+
"grey" => "default",
|
325
|
+
"black" => "info",
|
326
|
+
"red" => "danger",
|
327
|
+
"green" => "success",
|
328
|
+
"orange" => "warning"}
|
329
|
+
size_hash = {"xlarge" => "xlarge",
|
330
|
+
"large" => "large",
|
331
|
+
"medium" => "medium",
|
332
|
+
"small" => "small",
|
333
|
+
"green" => "btn-success"}
|
334
|
+
end
|
335
|
+
"#{pretty.blank? ? "" : "#{pretty} "}#{rounded.blank? ? "" : "#{rounded} "}#{size_hash[size]} #{color_hash[color]} btn"
|
336
|
+
end
|
337
|
+
end
|