carnival 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +6 -22
- data/app/assets/stylesheets/carnival/actions.css.scss +12 -6
- data/app/assets/stylesheets/carnival/forms.css.scss +19 -9
- data/app/assets/stylesheets/carnival/grid.css +3 -0
- data/app/assets/stylesheets/carnival/menu.css.scss +4 -0
- data/app/assets/stylesheets/carnival/structure.css.scss +5 -3
- data/app/controllers/carnival/base_admin_controller.rb +35 -55
- data/app/helpers/carnival/base_admin_helper.rb +24 -18
- data/app/inputs/admin_relationship_select_input.rb +1 -1
- data/app/inputs/carnival_select_remote_input.rb +1 -1
- data/app/models/carnival/field.rb +8 -3
- data/app/presenters/carnival/base_admin_presenter.rb +45 -32
- data/app/presenters/carnival/menu_presenter.rb +13 -0
- data/app/services/carnival/query_form_creator.rb +1 -1
- data/app/services/carnival/query_service.rb +27 -25
- data/app/view_objects/carnival/nested_form_options.rb +1 -1
- data/app/view_objects/carnival/paginator.rb +12 -14
- data/app/view_objects/carnival/thead_renderer.rb +3 -3
- data/app/views/carnival/base_admin/_index_as_grid.html.haml +2 -1
- data/app/views/carnival/base_admin/_index_as_list.html.haml +2 -1
- data/app/views/carnival/base_admin/_index_as_table.html.haml +4 -2
- data/app/views/carnival/base_admin/_inner_form.html.haml +1 -1
- data/app/views/carnival/base_admin/edit.html.haml +3 -3
- data/app/views/carnival/base_admin/index.csv.haml +5 -5
- data/app/views/carnival/base_admin/new.html.haml +3 -3
- data/app/views/carnival/base_admin/render_inner_form.js.erb +1 -1
- data/app/views/carnival/base_admin/show.html.haml +14 -13
- data/app/views/carnival/shared/form/_field.html.haml +9 -5
- data/app/views/carnival/shared/form/_form.html.haml +26 -10
- data/app/views/carnival/shared/form/_inner_form.html.haml +10 -7
- data/app/views/carnival/shared/form/_nested_form.html.haml +8 -8
- data/app/views/layouts/carnival/_menu.html.haml +10 -7
- data/lib/carnival.rb +4 -2
- data/lib/carnival/config.rb +1 -0
- data/lib/carnival/engine.rb +7 -1
- data/lib/carnival/version.rb +1 -1
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +12 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +56 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/rails_helper.rb +13 -0
- data/spec/spec_helper.rb +9 -0
- metadata +250 -57
- data/test/carnival_test.rb +0 -7
- data/test/integration/navigation_test.rb +0 -10
- data/test/test_helper.rb +0 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b9776fbf2f82b701598d223c42928aeaaf266b40
|
|
4
|
+
data.tar.gz: 9361afb9c6b303e0b7701bc5bf16305ec08da1fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0b09b7d9b078d4848a7944485e1bdf51b7373e3c7c3a29bff68d0a72276ca4a4f55370214e996b67d0ea3fe94cae7b436483eda76f01d2857368a6e329a39616
|
|
7
|
+
data.tar.gz: f3f7be398e760f22f346c753bb89725a26f15dbca358016089deba748d162ef4ea4c5f0ee8b3583cf9ed6f875af7937c8689453127139f53705e603e3adb497b
|
data/Rakefile
CHANGED
|
@@ -4,31 +4,15 @@ rescue LoadError
|
|
|
4
4
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
|
10
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
11
|
-
rdoc.title = 'Carnival'
|
|
12
|
-
rdoc.options << '--line-numbers'
|
|
13
|
-
rdoc.rdoc_files.include('README.rdoc')
|
|
14
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
|
7
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
|
18
8
|
load 'rails/tasks/engine.rake'
|
|
19
9
|
|
|
20
|
-
|
|
21
|
-
|
|
22
10
|
Bundler::GemHelper.install_tasks
|
|
23
11
|
|
|
24
|
-
require '
|
|
25
|
-
|
|
26
|
-
Rake::TestTask.new(:test) do |t|
|
|
27
|
-
t.libs << 'lib'
|
|
28
|
-
t.libs << 'test'
|
|
29
|
-
t.pattern = 'test/**/*_test.rb'
|
|
30
|
-
t.verbose = false
|
|
31
|
-
end
|
|
12
|
+
require 'rspec/core'
|
|
13
|
+
require 'rspec/core/rake_task'
|
|
32
14
|
|
|
15
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
|
16
|
+
RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
|
|
33
17
|
|
|
34
|
-
task default
|
|
18
|
+
task :default => :spec
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
background: -moz-linear-gradient(-90deg, #fff, #f0f0f0);
|
|
26
26
|
background: linear, -90deg, white, #f0f0f0;
|
|
27
27
|
color: #333;
|
|
28
|
-
line-height:
|
|
28
|
+
line-height: 27px;
|
|
29
29
|
border: 1px solid rgba(0, 0, 0, 0.21);
|
|
30
30
|
opacity: 0.7;
|
|
31
31
|
}
|
|
@@ -67,22 +67,22 @@
|
|
|
67
67
|
|
|
68
68
|
.novo, .search-submit{
|
|
69
69
|
background: #007ae1;
|
|
70
|
-
color: #fff;
|
|
70
|
+
color: #fff;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
.novo:hover, .search-submit:hover{
|
|
74
74
|
background: #007ae1;
|
|
75
|
-
color: #fff;
|
|
75
|
+
color: #fff;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
.remover{
|
|
79
79
|
background: #d63e30;
|
|
80
|
-
color: #fff;
|
|
80
|
+
color: #fff;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
.remover:hover{
|
|
84
84
|
background: #d63e30;
|
|
85
|
-
color: #fff;
|
|
85
|
+
color: #fff;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
.apagar{
|
|
@@ -134,7 +134,13 @@
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
.csv:before{
|
|
137
|
-
background-position: -101px -50px;
|
|
137
|
+
background-position: -101px -50px;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
.carnival-action-button.blue{
|
|
141
|
+
background:#007ae1;
|
|
142
|
+
color:#fff;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
140
146
|
/********************** ACTIONS SPECIFIC STYLES ********************* START */
|
|
@@ -24,19 +24,19 @@ input::-webkit-inner-spin-button {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
.carnival-form input{
|
|
27
|
+
-moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box;
|
|
27
28
|
width: 100%;
|
|
28
|
-
outline:none;
|
|
29
|
-
height:21px;
|
|
29
|
+
outline: none;
|
|
30
30
|
border: 1px solid #c8c8c8;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
color:#555;
|
|
31
|
+
padding: 2px 8px;
|
|
32
|
+
color: #555;
|
|
34
33
|
border-radius: 3px;
|
|
35
|
-
|
|
36
|
-
background
|
|
34
|
+
background-clip: padding-box;
|
|
35
|
+
background: #fff;
|
|
37
36
|
box-sizing: border-box;
|
|
38
37
|
-moz-box-sizing: border-box;
|
|
39
38
|
height: 35px;
|
|
39
|
+
font-size: 0.9rem;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.carnival-form input[type='file']{
|
|
@@ -177,8 +177,18 @@ input[type="checkbox"]{
|
|
|
177
177
|
height: auto !important;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
.boolean label{
|
|
181
|
+
float: left;
|
|
182
|
+
width: auto;
|
|
183
|
+
margin-bottom: 10px;
|
|
184
|
+
}
|
|
185
|
+
.boolean input{
|
|
186
|
+
float: left;
|
|
187
|
+
width: auto;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
input, .select2-container{
|
|
191
|
+
margin-bottom:10px !important;
|
|
182
192
|
}
|
|
183
193
|
|
|
184
194
|
.hidden{
|
|
@@ -34,11 +34,14 @@ body, html{
|
|
|
34
34
|
font-size:14px;
|
|
35
35
|
line-height:22px;
|
|
36
36
|
color:#666;
|
|
37
|
-
font-family: 'OpenSansRegular', sans-serif;
|
|
38
37
|
overflow-y: auto !important;
|
|
39
38
|
height: 100%;
|
|
40
39
|
}
|
|
41
40
|
|
|
41
|
+
*{
|
|
42
|
+
font-family: 'OpenSansRegular', sans-serif !important;
|
|
43
|
+
}
|
|
44
|
+
|
|
42
45
|
.link{
|
|
43
46
|
color: #007ae1;
|
|
44
47
|
}
|
|
@@ -47,7 +50,7 @@ li{list-style: none;}
|
|
|
47
50
|
a{text-decoration:none;}
|
|
48
51
|
|
|
49
52
|
.carnival-wrapper{
|
|
50
|
-
width: 100%;
|
|
53
|
+
width: 100%;
|
|
51
54
|
height: 100%;
|
|
52
55
|
}
|
|
53
56
|
|
|
@@ -235,4 +238,3 @@ a.confirm, a.cancel{
|
|
|
235
238
|
margin-left: 10px;
|
|
236
239
|
text-transform: uppercase;
|
|
237
240
|
}
|
|
238
|
-
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
require 'csv'
|
|
2
1
|
module Carnival
|
|
3
2
|
class BaseAdminController < InheritedResources::Base
|
|
4
3
|
respond_to :html, :json
|
|
5
4
|
layout "carnival/admin"
|
|
5
|
+
before_action :instantiate_presenter
|
|
6
|
+
helper_method :back_or_model_path
|
|
6
7
|
|
|
7
8
|
def home
|
|
8
|
-
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def table_items
|
|
@@ -13,9 +13,9 @@ module Carnival
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def render_inner_form
|
|
16
|
-
@
|
|
16
|
+
@presenter = presenter_name(params[:field]).new controller: self
|
|
17
17
|
model_class = params[:field].classify.constantize
|
|
18
|
-
@model_object = model_class.
|
|
18
|
+
@model_object = model_class.find(params[:id])
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def presenter_name field
|
|
@@ -25,89 +25,61 @@ module Carnival
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def index
|
|
28
|
-
@presenter = instantiate_presenter
|
|
29
28
|
@query_form = Carnival::QueryFormCreator.create(@presenter, params)
|
|
30
|
-
@model =
|
|
31
|
-
|
|
32
|
-
@query_service = Carnival::QueryService.new(base_query, @presenter, @query_form)
|
|
29
|
+
@model = @presenter.model_class
|
|
30
|
+
@query_service = Carnival::QueryService.new(table_items || @model, @presenter, @query_form)
|
|
33
31
|
|
|
34
32
|
respond_to do |format|
|
|
35
|
-
format.html do
|
|
33
|
+
format.html do
|
|
36
34
|
@records = @query_service.get_query
|
|
37
35
|
last_page = (@query_service.total_records / @presenter.items_per_page.to_f).ceil
|
|
38
36
|
@paginator = Carnival::Paginator.new @query_form.page, last_page
|
|
39
37
|
@thead_renderer = Carnival::TheadRenderer.new @presenter.fields_for_action(:index), @query_form.sort_column, @query_form.sort_direction
|
|
40
|
-
render 'index' and return
|
|
41
38
|
end
|
|
42
39
|
format.csv do
|
|
43
40
|
@records = @query_service.records_without_pagination
|
|
44
|
-
render :csv =>
|
|
41
|
+
render :csv => @model.model_name.human
|
|
45
42
|
end
|
|
46
43
|
format.pdf do
|
|
47
44
|
@records = @query_service.records_without_pagination
|
|
48
45
|
@thead_renderer = Carnival::TheadRenderer.new @presenter.fields_for_action(:index), @query_form.sort_column, @query_form.sort_direction
|
|
49
|
-
render :pdf => t("activerecord.attributes.#{@presenter.full_model_name}.pdf_name") , :template => 'carnival/base_admin/index.pdf.haml', :show_as_html => params[:debug].present?
|
|
46
|
+
render :pdf => t("activerecord.attributes.#{@presenter.full_model_name}.pdf_name") , :template => 'carnival/base_admin/index.pdf.haml', :show_as_html => params[:debug].present?
|
|
50
47
|
end
|
|
51
48
|
end
|
|
52
49
|
end
|
|
53
50
|
|
|
54
51
|
def show
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
@model = instance_variable_get("@#{resource_instance_name}")
|
|
58
|
-
format.html do |render|
|
|
59
|
-
render 'show' and return
|
|
60
|
-
end
|
|
52
|
+
show! do
|
|
53
|
+
instantiate_model
|
|
61
54
|
end
|
|
62
55
|
end
|
|
63
56
|
|
|
64
57
|
def new
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
@model = instance_variable_get("@#{resource_instance_name}")
|
|
68
|
-
format.html do |render|
|
|
69
|
-
render 'new' and return
|
|
70
|
-
end
|
|
58
|
+
new! do
|
|
59
|
+
instantiate_model
|
|
71
60
|
end
|
|
72
61
|
end
|
|
73
62
|
|
|
74
63
|
def edit
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
@model = instance_variable_get("@#{resource_instance_name}")
|
|
78
|
-
format.html do |render|
|
|
79
|
-
render 'edit' and return
|
|
80
|
-
end
|
|
64
|
+
edit! do
|
|
65
|
+
instantiate_model
|
|
81
66
|
end
|
|
82
67
|
end
|
|
83
68
|
|
|
84
69
|
def create
|
|
85
|
-
@model_presenter = instantiate_presenter
|
|
86
70
|
create! do |success, failure|
|
|
87
|
-
success.html{ redirect_to
|
|
88
|
-
failure.html
|
|
89
|
-
@model = instance_variable_get("@#{resource_instance_name}")
|
|
90
|
-
render 'new' and return
|
|
91
|
-
end
|
|
71
|
+
success.html { redirect_to back_or_model_path, :notice => I18n.t("messages.created") }
|
|
72
|
+
failure.html { instantiate_model and render 'new' }
|
|
92
73
|
end
|
|
93
74
|
end
|
|
94
75
|
|
|
95
76
|
def update
|
|
96
|
-
@model_presenter = instantiate_presenter
|
|
97
77
|
update! do |success, failure|
|
|
98
|
-
success.html{ redirect_to
|
|
99
|
-
failure.html
|
|
100
|
-
@model = instance_variable_get("@#{resource_instance_name}")
|
|
101
|
-
render 'edit' and return
|
|
102
|
-
end
|
|
78
|
+
success.html { redirect_to back_or_model_path, :notice => I18n.t("messages.updated") }
|
|
79
|
+
failure.html { instantiate_model and render 'edit' }
|
|
103
80
|
end
|
|
104
81
|
end
|
|
105
82
|
|
|
106
|
-
def render_popup partial
|
|
107
|
-
@application_modal = partial
|
|
108
|
-
render '/carnival/shared/render_popup' and return
|
|
109
|
-
end
|
|
110
|
-
|
|
111
83
|
def load_dependent_select_options
|
|
112
84
|
presenter = params[:presenter].constantize.send(:new, :controller => self)
|
|
113
85
|
model = presenter.relation_model(params[:field].gsub("_id", "").to_sym)
|
|
@@ -127,14 +99,15 @@ module Carnival
|
|
|
127
99
|
|
|
128
100
|
render :json => list
|
|
129
101
|
end
|
|
130
|
-
private
|
|
131
102
|
|
|
132
|
-
|
|
133
|
-
|
|
103
|
+
protected
|
|
104
|
+
|
|
105
|
+
def instantiate_model
|
|
106
|
+
@model = instance_variable_get("@#{resource_instance_name}")
|
|
134
107
|
end
|
|
135
108
|
|
|
136
109
|
def instantiate_presenter
|
|
137
|
-
carnival_presenter_class.new controller: self
|
|
110
|
+
@presenter = carnival_presenter_class.new controller: self
|
|
138
111
|
end
|
|
139
112
|
|
|
140
113
|
def carnival_presenter_class
|
|
@@ -147,10 +120,17 @@ module Carnival
|
|
|
147
120
|
end
|
|
148
121
|
|
|
149
122
|
def extract_namespace
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
123
|
+
module_class_split = self.class.to_s.split("::")
|
|
124
|
+
if module_class_split.size > 1
|
|
125
|
+
module_class_split[0]
|
|
126
|
+
else
|
|
127
|
+
''
|
|
128
|
+
end
|
|
154
129
|
end
|
|
130
|
+
|
|
131
|
+
def back_or_model_path
|
|
132
|
+
params[:HTTP_REFERER] || @presenter.model_path(:index)
|
|
133
|
+
end
|
|
134
|
+
|
|
155
135
|
end
|
|
156
136
|
end
|
|
@@ -86,22 +86,26 @@ module Carnival
|
|
|
86
86
|
end
|
|
87
87
|
end
|
|
88
88
|
|
|
89
|
-
def field_to_show(presenter, field_name, record,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
def field_to_show(presenter, field_name, record, show_only_values=false)
|
|
90
|
+
if presenter.fields[field_name].params[:as] == :partial
|
|
91
|
+
raw(render field_name.to_s, record: record)
|
|
92
|
+
else
|
|
93
|
+
rendered = field_value_and_type presenter, field_name, record
|
|
94
|
+
field_type = rendered[:field_type]
|
|
95
|
+
value = rendered[:value]
|
|
93
96
|
|
|
94
|
-
|
|
97
|
+
is_relation = presenter.relation_field?(field_name)
|
|
95
98
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
unless value.nil?
|
|
100
|
+
formatted_field = format_field(presenter, field_name, field_type, value)
|
|
101
|
+
if is_relation and !show_only_values
|
|
102
|
+
link_to(formatted_field, presenter.relation_path(field_name, record))
|
|
103
|
+
else
|
|
104
|
+
formatted_field
|
|
105
|
+
end
|
|
100
106
|
else
|
|
101
|
-
|
|
107
|
+
nil
|
|
102
108
|
end
|
|
103
|
-
else
|
|
104
|
-
nil
|
|
105
109
|
end
|
|
106
110
|
end
|
|
107
111
|
|
|
@@ -180,12 +184,14 @@ module Carnival
|
|
|
180
184
|
|
|
181
185
|
def list_buttons(presenter, record)
|
|
182
186
|
result = ""
|
|
183
|
-
presenter.actions_for_record.each do |key,
|
|
184
|
-
if
|
|
185
|
-
if
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
presenter.actions_for_record.each do |key, record_action|
|
|
188
|
+
if presenter.render_action?(record, record_action, params[:action])
|
|
189
|
+
if record_action.show(record)
|
|
190
|
+
if record_action.remote?
|
|
191
|
+
result << button_action_remote(record_action, presenter, record)
|
|
192
|
+
else
|
|
193
|
+
result << button_action(record_action, presenter, record)
|
|
194
|
+
end
|
|
189
195
|
end
|
|
190
196
|
end
|
|
191
197
|
end
|
|
@@ -15,7 +15,7 @@ class AdminRelationshipSelectInput < SimpleForm::Inputs::CollectionSelectInput
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
@builder.collection_select(
|
|
18
|
-
"#{@builder.object.class.name.constantize.reflections[attribute_name.to_sym].foreign_key}",
|
|
18
|
+
"#{HashWithIndifferentAccess.new(@builder.object.class.name.constantize.reflections)[attribute_name.to_sym].foreign_key}",
|
|
19
19
|
collection,
|
|
20
20
|
:first, :last,
|
|
21
21
|
{prompt: I18n.t("#{@builder.object.class.to_s.gsub(/^.*::/, '').downcase}.lista_#{attribute_name}.selecione", default: I18n.t("messages.select"))},
|
|
@@ -18,7 +18,7 @@ class CarnivalSelectRemoteInput < SimpleForm::Inputs::CollectionSelectInput
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
html = @builder.collection_select(
|
|
21
|
-
"#{@builder.object.class.name.constantize.reflections[attribute_name.to_sym].foreign_key}",
|
|
21
|
+
"#{HashWithIndifferentAccess.new(@builder.object.class.name.constantize.reflections)[attribute_name.to_sym].foreign_key}",
|
|
22
22
|
collection,
|
|
23
23
|
:first, :last,
|
|
24
24
|
{prompt: I18n.t("#{@builder.object.class.to_s.gsub(/^.*::/, '').downcase}.lista_#{attribute_name}.selecione", default: I18n.t("messages.select"))},
|