eitil 1.2.4 → 1.3.0
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/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/drop_data.rb +3 -1
- data/eitil_integrate/lib/eitil_integrate/application_exporter/initialize.rb +2 -0
- data/eitil_wrapper/lib/eitil_wrapper/decorators/application_decorator.rb +3 -0
- data/eitil_wrapper/lib/eitil_wrapper/decorators/controller_decorator.rb +7 -2
- data/lib/eitil/version.rb +1 -1
- data/spec/dummy_app/Rakefile +6 -0
- data/spec/dummy_app/app/assets/config/manifest.js +4 -0
- data/spec/dummy_app/app/assets/javascripts/application.js +15 -0
- data/spec/dummy_app/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy_app/app/assets/stylesheets/addresses.css +4 -0
- data/spec/dummy_app/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy_app/app/assets/stylesheets/scaffold.css +80 -0
- data/spec/dummy_app/app/assets/stylesheets/users.css +4 -0
- data/spec/dummy_app/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy_app/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy_app/app/controllers/addresses_controller.rb +58 -0
- data/spec/dummy_app/app/controllers/application_controller.rb +5 -0
- data/spec/dummy_app/app/controllers/users_controller.rb +93 -0
- data/spec/dummy_app/app/decorators/address_decorator.rb +3 -0
- data/spec/dummy_app/app/decorators/application_decorator.rb +12 -0
- data/spec/dummy_app/app/decorators/user_decorator.rb +19 -0
- data/spec/dummy_app/app/helpers/addresses_helper.rb +2 -0
- data/spec/dummy_app/app/helpers/application_helper.rb +2 -0
- data/spec/dummy_app/app/helpers/users_helper.rb +2 -0
- data/spec/dummy_app/app/jobs/application_job.rb +2 -0
- data/spec/dummy_app/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy_app/app/models/address.rb +5 -0
- data/spec/dummy_app/app/models/application_record.rb +8 -0
- data/spec/dummy_app/app/models/user.rb +30 -0
- data/spec/dummy_app/app/views/addresses/_form.html.erb +17 -0
- data/spec/dummy_app/app/views/addresses/edit.html.erb +6 -0
- data/spec/dummy_app/app/views/addresses/index.html.erb +25 -0
- data/spec/dummy_app/app/views/addresses/new.html.erb +5 -0
- data/spec/dummy_app/app/views/addresses/show.html.erb +4 -0
- data/spec/dummy_app/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy_app/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy_app/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy_app/app/views/users/_form.html.erb +17 -0
- data/spec/dummy_app/app/views/users/edit.html.erb +6 -0
- data/spec/dummy_app/app/views/users/index.html.erb +25 -0
- data/spec/dummy_app/app/views/users/new.html.erb +5 -0
- data/spec/dummy_app/app/views/users/show.html.erb +4 -0
- data/spec/dummy_app/bin/bundle +3 -0
- data/spec/dummy_app/bin/rails +4 -0
- data/spec/dummy_app/bin/rake +4 -0
- data/spec/dummy_app/bin/setup +36 -0
- data/spec/dummy_app/bin/update +31 -0
- data/spec/dummy_app/bin/yarn +11 -0
- data/spec/dummy_app/config/application.rb +16 -0
- data/spec/dummy_app/config/boot.rb +5 -0
- data/spec/dummy_app/config/cable.yml +10 -0
- data/spec/dummy_app/config/database.yml +25 -0
- data/spec/dummy_app/config/environment.rb +11 -0
- data/spec/dummy_app/config/environments/development.rb +61 -0
- data/spec/dummy_app/config/environments/production.rb +94 -0
- data/spec/dummy_app/config/environments/test.rb +46 -0
- data/spec/dummy_app/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/dummy_app/config/initializers/assets.rb +14 -0
- data/spec/dummy_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy_app/config/initializers/content_security_policy.rb +25 -0
- data/spec/dummy_app/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy_app/config/initializers/inflections.rb +16 -0
- data/spec/dummy_app/config/initializers/mime_types.rb +4 -0
- data/spec/dummy_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy_app/config/locales/en.yml +33 -0
- data/spec/dummy_app/config/puma.rb +34 -0
- data/spec/dummy_app/config/routes.rb +12 -0
- data/spec/dummy_app/config/spring.rb +6 -0
- data/spec/dummy_app/config/storage.yml +34 -0
- data/spec/dummy_app/config.ru +5 -0
- data/spec/dummy_app/db/development.sqlite3 +0 -0
- data/spec/dummy_app/db/migrate/20210907114344_create_users.rb +12 -0
- data/spec/dummy_app/db/migrate/20210907114557_create_addresses.rb +16 -0
- data/spec/dummy_app/db/migrate/20210907131339_add_multiple_columns_to_user.rb +8 -0
- data/spec/dummy_app/db/schema.rb +41 -0
- data/spec/dummy_app/db/test.sqlite3 +0 -0
- data/spec/dummy_app/log/decorator_log.log +42 -0
- data/spec/dummy_app/log/development.log +24 -0
- data/spec/dummy_app/log/test.log +0 -0
- data/spec/dummy_app/package.json +5 -0
- data/spec/dummy_app/public/404.html +67 -0
- data/spec/dummy_app/public/422.html +67 -0
- data/spec/dummy_app/public/500.html +66 -0
- data/spec/dummy_app/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy_app/public/apple-touch-icon.png +0 -0
- data/spec/dummy_app/public/favicon.ico +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/2j/2jWL-rhQuwDjyPsAqfz1_wB_H15Kk2ODQ2dAu-XZKx8.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/6x/6x9nAtWMtOljHkcAvx9LS3_kzIpD7XoM5jqwKXqN8SU.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/7f/7fMKshWzk4gJEbG0FTuuuHVOeF6BG9SoIx1X0yGN4XA.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/8-/8-O-UfzZVhbu8Cty_FaH4c3xNM-Sm6U90BGLWmTPpSo.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/8a/8a5JUS7sZRAe1CpAiN0iy1n_apTjx0H3rkPqGgg_HHs.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/9E/9EI_Wtkx262NF6vdNPozRjkOmUgT5wcyMxwPhhok91Y.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Au/AutOawEb2V5QIxVjqKqmRFpvJ3BHEJvFMIphdZydKPY.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/BZ/BZULOBoPeioJ3yr_GDNL-cF1brDPreCMd34hrDbHvX4.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/CS/CSs23ds7URW15l5Z5w3b3A6CPJS5ODsgzz0mmAHULF0.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Eu/EuFZYEzbxGLRX803DDnrfKQPcMoGo5ITR-9VuBY_35Q.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/FL/FLU4EKYSshHlQjgOqP6RDQ8z7GTRbHhl-2IBWvv363s.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/FL/FLl0vmABYcwCTORqhZlx9KLVZvAw1Sic_8-Vs5Q7F3I.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/KF/KFlEJcPYkMbf3yhDJTUJ73BpWJ8BMzjQUhpLO1CZqUk.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/LN/LNUl7yichb1dUbkovvnOVoVxkVQnhwndYgJRJwoXO_k.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/LU/LUq0pj8f6-F5P5ZpVil-_pBLCVTYTqa-qRzQOVFkgGg.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/N7/N7Q7f6mqtpX5Lxh78v1mILszsC6Oi9hrt9E8bYTCUg8.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/OJ/OJX-7cXh407miinHDx7z55OnuYnifbaiCSjus3I2ETg.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/P-/P-WGZR_jmbgi7zjScSIzMbnxmPRhR0FG-sUCbx-W0jA.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Qd/QdDsJNHB1T-o6r9B1zTqkZ6nDWfFlq7i5HIqxsMqOR8.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Qv/QvPvnJIjqHAUeoUdS4dpH_JVRh4znkA7ig3VHz7onhE.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/RG/RG1PrmlixwaUlG8BV0kcm_3F7OQekxsrLYjBdf403-k.cache +2 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/TE/TEmdPmCEnqBmIu10fP0G66B333eV_jj1DT6NEM9BY5U.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/XM/XMyLLsxd032ZvSGR9P5BcOxAXuQxt_wuaTVdjeuYUeU.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Xn/XnnrCKCkM_Fa5bHMwSjQ_NTBPicUoSK3LOeYu-ZmpYo.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/cj/cjpKTBCb00-jq6B1KoFGJrP4kvsl8JACc_pqZAORMlM.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/ft/ftREOVuSBdqj0d189uIhUmNEThLHS0nXTyt34tl_G9g.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/iD/iDTnVSbZnIij5Xm4jkwCyIXAPDn8RwaRe5Ja8YPKibw.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/iU/iU5Zc6hQ2jwcmv6lE2L4aWBJHHMnS1vrh0_LHR574kw.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/iZ/iZjLEYDTYhysPjIEb36PhNErZ4rRW1BniBfuH7oa1RI.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/ke/keL0ZyrZtXqgSINKKBK3qFEd2fvJSrv8qgU78i1-aqY.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/n_/n_xYqQYhwEMQknb3jFQnjlxxBE9TzMNHCdJ-bEyZFIw.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/nx/nxTv3sKVUQZADJyM3dPaVmUA78MIsMLD_K279yN_GsI.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/pa/pas5TN2JG4i2AUMntaZrRkOZ_AZhFBtsfPaUHKOSdnM.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/qP/qPmv5snMrDw830S6hSICDcnIy7kVEWoFKXhGKT38lG4.cache +2 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/uQ/uQImR-NTBFCJ7TsnJRrKAG0zhTcX7vpg_MFvTWvWSGQ.cache +1 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/uo/uosY6jh1_W3cVpcoQY0hcgG2zDeTVR169am2REYxMtI.cache +0 -0
- data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/yk/ykwP8uOyoTr4wPoEUoyB6Lrx9BG_9mWl6in8AJzBGPw.cache +1 -0
- data/spec/dummy_app/tmp/development_secret.txt +1 -0
- data/spec/dummy_app/tmp/restart.txt +0 -0
- data/spec/eitil_core/argument_helpers/all_args_to_ivars_bang_spec.rb +1 -1
- data/spec/eitil_core/argument_helpers/all_args_to_ivars_spec.rb +1 -1
- data/spec/eitil_core/argument_helpers/all_kwargs_to_ivars_bang_spec.rb +1 -1
- data/spec/eitil_core/argument_helpers/all_kwargs_to_ivars_spec.rb +1 -1
- data/spec/eitil_core/argument_helpers/args_to_h_bang_spec.rb +1 -1
- data/spec/eitil_core/argument_helpers/args_to_h_spec.rb +1 -1
- data/spec/eitil_core/argument_helpers/args_to_ivars_bang_spec.rb +1 -1
- data/spec/eitil_core/argument_helpers/args_to_ivars_spec.rb +1 -1
- data/spec/eitil_core/array/map_strings_spec.rb +2 -2
- data/spec/eitil_core/array/slice_hashes_spec.rb +1 -1
- data/spec/eitil_core/datetime/prettify_spec.rb +1 -1
- data/spec/eitil_core/errors/raise_error_spec.rb +1 -1
- data/spec/eitil_core/float/safe_to_i_spec.rb +1 -1
- data/spec/eitil_core/formatters/duck_set_spec.rb +3 -3
- data/spec/eitil_core/formatters/sql_spec.rb +3 -3
- data/spec/eitil_core/hash/auto_dig_spec.rb +1 -1
- data/spec/eitil_core/hash/transform_string_values_spec.rb +2 -2
- data/spec/eitil_core/safe_executions/safe_call.rb +1 -1
- data/spec/eitil_core/safe_executions/safe_send.rb +1 -1
- data/spec/eitil_core/setters/set_ivars_spec.rb +1 -1
- data/spec/eitil_core/string/strip_base64_header_spec.rb +1 -1
- data/spec/eitil_core/string/to_filename_spec.rb +1 -1
- data/spec/eitil_core/type_checkers/is_num_or_nan_spec.rb +1 -1
- data/spec/eitil_integrate/application_exporter/auto_sum_spec.rb +106 -0
- data/spec/eitil_integrate/application_exporter/initialize_spec.rb +28 -0
- data/spec/eitil_wrapper/callbacks/helper_methods_spec.rb +34 -0
- data/spec/eitil_wrapper/decorators/decorators_spec.rb +49 -0
- data/spec/eitil_wrapper/jobs/single_method_job_spec.rb +72 -0
- data/spec/eitil_wrapper/routes/extended_resources_spec.rb +16 -0
- data/spec/eitil_wrapper/scopes/default_scopes_spec.rb +154 -0
- data/spec/spec_helper.rb +16 -6
- metadata +174 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aefe6597672c5fcabffbce60d0caffb14540331dfe9133d1c4ff01b5ef30c229
|
4
|
+
data.tar.gz: 3dd8b83eb7dceaa7a1ad605a1adfc07963532c563a5df7d62f39183ae8a89c61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 025eb7fe3fe248483babaf55d49c7da4311edc9e4443681cc74b9c41ed39e444ed6f4d0453ed71a5e9191f84fd8bd16ed61f89c328e779d85e2d6cf41eab246a
|
7
|
+
data.tar.gz: d83660005e68ebf2c4a5144679078070ef076f9f7f8f55f6df9e2bfd8e97ffa9928114c1607cfc5abf779b6a21eeea3ead5d4179c1447278d01d668a7d0db7be
|
@@ -25,7 +25,9 @@ module EitilIntegrate::RubyXL
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def drop_empty_values
|
28
|
-
@hash.transform_values!
|
28
|
+
@hash.transform_values! do |array|
|
29
|
+
array.reject { |item| item.respond_to?(:empty?) && item.empty? }
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
33
|
def drop_non_accepted_values
|
@@ -50,17 +50,22 @@ module EitilWrapper
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def set_decorator
|
53
|
-
@dec_class.new ivars
|
53
|
+
@dec_class.new **ivars
|
54
54
|
end
|
55
55
|
|
56
|
+
# Converts the controller_ivars, given in your main application's configuration,
|
57
|
+
# into an hash. If no controller_ivars, continue with converting, in order to avoid
|
58
|
+
# issues due to differing data types.
|
56
59
|
def controller_ivars
|
60
|
+
return {} unless Eitil.controller_ivars.any?
|
61
|
+
|
57
62
|
Eitil.controller_ivars.map do |ivar|
|
58
63
|
{ ivar => instance_variable_get("@#{ivar.to_s}") }
|
59
64
|
end.inject &:merge
|
60
65
|
end
|
61
66
|
|
62
67
|
def ivars
|
63
|
-
@dec_kwargs ? controller_ivars.merge(@dec_kwargs) : controller_ivars
|
68
|
+
@dec_kwargs.any? ? controller_ivars.merge(@dec_kwargs) : controller_ivars
|
64
69
|
end
|
65
70
|
|
66
71
|
end
|
data/lib/eitil/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require rails-ujs
|
14
|
+
//= require activestorage
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Action Cable provides the framework to deal with WebSockets in Rails.
|
2
|
+
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
3
|
+
//
|
4
|
+
//= require action_cable
|
5
|
+
//= require_self
|
6
|
+
//= require_tree ./channels
|
7
|
+
|
8
|
+
(function() {
|
9
|
+
this.App || (this.App = {});
|
10
|
+
|
11
|
+
App.cable = ActionCable.createConsumer();
|
12
|
+
|
13
|
+
}).call(this);
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,80 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #fff;
|
3
|
+
color: #333;
|
4
|
+
margin: 33px;
|
5
|
+
}
|
6
|
+
|
7
|
+
body, p, ol, ul, td {
|
8
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
9
|
+
font-size: 13px;
|
10
|
+
line-height: 18px;
|
11
|
+
}
|
12
|
+
|
13
|
+
pre {
|
14
|
+
background-color: #eee;
|
15
|
+
padding: 10px;
|
16
|
+
font-size: 11px;
|
17
|
+
}
|
18
|
+
|
19
|
+
a {
|
20
|
+
color: #000;
|
21
|
+
}
|
22
|
+
|
23
|
+
a:visited {
|
24
|
+
color: #666;
|
25
|
+
}
|
26
|
+
|
27
|
+
a:hover {
|
28
|
+
color: #fff;
|
29
|
+
background-color: #000;
|
30
|
+
}
|
31
|
+
|
32
|
+
th {
|
33
|
+
padding-bottom: 5px;
|
34
|
+
}
|
35
|
+
|
36
|
+
td {
|
37
|
+
padding: 0 5px 7px;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.field,
|
41
|
+
div.actions {
|
42
|
+
margin-bottom: 10px;
|
43
|
+
}
|
44
|
+
|
45
|
+
#notice {
|
46
|
+
color: green;
|
47
|
+
}
|
48
|
+
|
49
|
+
.field_with_errors {
|
50
|
+
padding: 2px;
|
51
|
+
background-color: red;
|
52
|
+
display: table;
|
53
|
+
}
|
54
|
+
|
55
|
+
#error_explanation {
|
56
|
+
width: 450px;
|
57
|
+
border: 2px solid red;
|
58
|
+
padding: 7px 7px 0;
|
59
|
+
margin-bottom: 20px;
|
60
|
+
background-color: #f0f0f0;
|
61
|
+
}
|
62
|
+
|
63
|
+
#error_explanation h2 {
|
64
|
+
text-align: left;
|
65
|
+
font-weight: bold;
|
66
|
+
padding: 5px 5px 5px 15px;
|
67
|
+
font-size: 12px;
|
68
|
+
margin: -7px -7px 0;
|
69
|
+
background-color: #c00;
|
70
|
+
color: #fff;
|
71
|
+
}
|
72
|
+
|
73
|
+
#error_explanation ul li {
|
74
|
+
font-size: 12px;
|
75
|
+
list-style: square;
|
76
|
+
}
|
77
|
+
|
78
|
+
label {
|
79
|
+
display: block;
|
80
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
class AddressesController < ApplicationController
|
2
|
+
before_action :set_address, only: [:show, :edit, :update, :destroy]
|
3
|
+
|
4
|
+
# GET /addresses
|
5
|
+
def index
|
6
|
+
@addresses = Address.all
|
7
|
+
end
|
8
|
+
|
9
|
+
# GET /addresses/1
|
10
|
+
def show
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /addresses/new
|
14
|
+
def new
|
15
|
+
@address = Address.new
|
16
|
+
end
|
17
|
+
|
18
|
+
# GET /addresses/1/edit
|
19
|
+
def edit
|
20
|
+
end
|
21
|
+
|
22
|
+
# POST /addresses
|
23
|
+
def create
|
24
|
+
@address = Address.new(address_params)
|
25
|
+
|
26
|
+
if @address.save
|
27
|
+
redirect_to @address, notice: 'Address was successfully created.'
|
28
|
+
else
|
29
|
+
render :new
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# PATCH/PUT /addresses/1
|
34
|
+
def update
|
35
|
+
if @address.update(address_params)
|
36
|
+
redirect_to @address, notice: 'Address was successfully updated.'
|
37
|
+
else
|
38
|
+
render :edit
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# DELETE /addresses/1
|
43
|
+
def destroy
|
44
|
+
@address.destroy
|
45
|
+
redirect_to addresses_url, notice: 'Address was successfully destroyed.'
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
# Use callbacks to share common setup or constraints between actions.
|
50
|
+
def set_address
|
51
|
+
@address = Address.find(params[:id])
|
52
|
+
end
|
53
|
+
|
54
|
+
# Only allow a list of trusted parameters through.
|
55
|
+
def address_params
|
56
|
+
params.fetch(:address, {})
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
class UsersController < ApplicationController
|
2
|
+
|
3
|
+
before_action :set_user, only: [:show, :edit, :update, :destroy]
|
4
|
+
|
5
|
+
|
6
|
+
# ---
|
7
|
+
# Tests for EitilWrapper::Decorator
|
8
|
+
|
9
|
+
before_action :set_user, only: [:decorator_a, :decorator_b, :decorator_c, :decorator_d]
|
10
|
+
|
11
|
+
# default
|
12
|
+
def decorator_a
|
13
|
+
hash = decorate(@user)
|
14
|
+
render json: hash
|
15
|
+
end
|
16
|
+
|
17
|
+
# specific dec_method
|
18
|
+
def decorator_b
|
19
|
+
hash = decorate(@user, dec_method: :first_and_last_name)
|
20
|
+
render json: hash
|
21
|
+
end
|
22
|
+
|
23
|
+
# post request, with 'isWeb' and 'isMobile' params
|
24
|
+
def decorator_c
|
25
|
+
hash = decorate(@user)
|
26
|
+
render json: hash
|
27
|
+
end
|
28
|
+
|
29
|
+
# specific dec_class
|
30
|
+
def decorator_d
|
31
|
+
hash = decorate(@user, dec_class: :Application, dec_method: :timestamps)
|
32
|
+
render json: hash
|
33
|
+
end
|
34
|
+
|
35
|
+
# ---
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
# GET /users
|
40
|
+
def index
|
41
|
+
@users = User.all
|
42
|
+
end
|
43
|
+
|
44
|
+
# GET /users/1
|
45
|
+
def show
|
46
|
+
end
|
47
|
+
|
48
|
+
# GET /users/new
|
49
|
+
def new
|
50
|
+
@user = User.new
|
51
|
+
end
|
52
|
+
|
53
|
+
# GET /users/1/edit
|
54
|
+
def edit
|
55
|
+
end
|
56
|
+
|
57
|
+
# POST /users
|
58
|
+
def create
|
59
|
+
@user = User.new(user_params)
|
60
|
+
|
61
|
+
if @user.save
|
62
|
+
redirect_to @user, notice: 'User was successfully created.'
|
63
|
+
else
|
64
|
+
render :new
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# PATCH/PUT /users/1
|
69
|
+
def update
|
70
|
+
if @user.update(user_params)
|
71
|
+
redirect_to @user, notice: 'User was successfully updated.'
|
72
|
+
else
|
73
|
+
render :edit
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# DELETE /users/1
|
78
|
+
def destroy
|
79
|
+
@user.destroy
|
80
|
+
redirect_to users_url, notice: 'User was successfully destroyed.'
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
# Use callbacks to share common setup or constraints between actions.
|
85
|
+
def set_user
|
86
|
+
@user = User.find(params[:id])
|
87
|
+
end
|
88
|
+
|
89
|
+
# Only allow a list of trusted parameters through.
|
90
|
+
def user_params
|
91
|
+
params.fetch(:user, {})
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class UserDecorator < ApplicationDecorator
|
2
|
+
|
3
|
+
def first_and_last_name(user)
|
4
|
+
user.slice(:first_name, :last_name)
|
5
|
+
end
|
6
|
+
|
7
|
+
def app(user)
|
8
|
+
user.slice(:phone, :email)
|
9
|
+
end
|
10
|
+
|
11
|
+
def web(user)
|
12
|
+
user.slice(:age, :wage)
|
13
|
+
end
|
14
|
+
|
15
|
+
def base(user)
|
16
|
+
user.as_json
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|