uploadcare-rails 1.2.0.pre.alpha3 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +5 -16
- data/lib/generators/templates/uploadcare_config_template.erb +138 -0
- data/lib/generators/uploadcare_config_generator.rb +7 -4
- data/lib/uploadcare/errors/type_error.rb +7 -0
- data/lib/uploadcare/rails/action_view/uploadcare_include_tags.rb +48 -0
- data/lib/uploadcare/rails/action_view/uploadcare_uploader_tags.rb +57 -0
- data/lib/uploadcare/rails/active_record/mount_uploadcare_file.rb +62 -0
- data/lib/uploadcare/rails/active_record/mount_uploadcare_file_group.rb +58 -0
- data/lib/uploadcare/rails/api/rest/base.rb +14 -0
- data/lib/uploadcare/rails/api/rest/conversion_api.rb +42 -0
- data/lib/uploadcare/rails/api/rest/file_api.rb +69 -0
- data/lib/uploadcare/rails/api/rest/group_api.rb +48 -0
- data/lib/uploadcare/rails/api/rest/project_api.rb +27 -0
- data/lib/uploadcare/rails/api/rest/webhook_api.rb +45 -0
- data/lib/uploadcare/rails/api/upload/base.rb +13 -0
- data/lib/uploadcare/rails/api/upload/upload_api.rb +53 -0
- data/lib/uploadcare/rails/configuration.rb +57 -0
- data/lib/uploadcare/rails/engine.rb +13 -17
- data/lib/uploadcare/rails/jobs/delete_file_job.rb +14 -0
- data/lib/uploadcare/rails/jobs/store_file_job.rb +14 -0
- data/lib/uploadcare/rails/jobs/store_group_job.rb +14 -0
- data/lib/uploadcare/rails/objects/concerns/loadable.rb +46 -0
- data/lib/uploadcare/rails/objects/file.rb +40 -20
- data/lib/uploadcare/rails/objects/group.rb +51 -57
- data/lib/uploadcare/rails/services/files_count_extractor.rb +14 -0
- data/lib/uploadcare/rails/services/id_extractor.rb +15 -0
- data/lib/uploadcare/rails/transformations/image_transformations.rb +45 -0
- data/lib/uploadcare/rails/version.rb +3 -1
- data/lib/uploadcare/rails.rb +10 -0
- data/lib/uploadcare-rails.rb +27 -16
- data/spec/fixtures/kitten.jpeg +0 -0
- data/spec/fixtures/vcr_cassettes/conversion_api_convert_document.yml +62 -0
- data/spec/fixtures/vcr_cassettes/conversion_api_convert_document_with_error.yml +62 -0
- data/spec/fixtures/vcr_cassettes/conversion_api_convert_video.yml +62 -0
- data/spec/fixtures/vcr_cassettes/conversion_api_convert_video_with_error.yml +62 -0
- data/spec/fixtures/vcr_cassettes/conversion_api_get_document_conversion_status.yml +59 -0
- data/spec/fixtures/vcr_cassettes/conversion_api_get_video_conversion_status.yml +59 -0
- data/spec/fixtures/vcr_cassettes/file_api_copy_file.yml +60 -0
- data/spec/fixtures/vcr_cassettes/file_api_delete_file.yml +58 -0
- data/spec/fixtures/vcr_cassettes/file_api_delete_files.yml +58 -0
- data/spec/fixtures/vcr_cassettes/file_api_get_file.yml +58 -0
- data/spec/fixtures/vcr_cassettes/file_api_get_files.yml +61 -0
- data/spec/fixtures/vcr_cassettes/file_api_load_file.yml +57 -0
- data/spec/fixtures/vcr_cassettes/file_api_store_file.yml +58 -0
- data/spec/fixtures/vcr_cassettes/file_api_store_files.yml +57 -0
- data/spec/fixtures/vcr_cassettes/group_api_create_group.yml +57 -0
- data/spec/fixtures/vcr_cassettes/group_api_get_group.yml +52 -0
- data/spec/fixtures/vcr_cassettes/group_api_get_groups.yml +57 -0
- data/spec/fixtures/vcr_cassettes/group_api_store_group.yml +57 -0
- data/spec/fixtures/vcr_cassettes/project_api_get_project.yml +59 -0
- data/spec/fixtures/vcr_cassettes/upload_upload_many_files.yml +55 -0
- data/spec/fixtures/vcr_cassettes/upload_upload_one_file.yml +105 -0
- data/spec/fixtures/vcr_cassettes/upload_upload_one_file_from_cdn.yml +111 -0
- data/spec/fixtures/vcr_cassettes/webhook_api_create_webhook.yml +59 -0
- data/spec/fixtures/vcr_cassettes/webhook_api_delete_webhook.yml +57 -0
- data/spec/fixtures/vcr_cassettes/webhook_api_get_webhooks.yml +59 -0
- data/spec/fixtures/vcr_cassettes/webhook_api_update_webhook.yml +59 -0
- data/spec/generators/uploadcare_config_generator_spec.rb +18 -26
- data/spec/spec_helper.rb +17 -62
- data/spec/support/generators.rb +8 -5
- data/spec/support/vcr.rb +14 -0
- data/spec/uploadcare/rails/action_view/uploadcare_uploader_tags_spec.rb +40 -0
- data/spec/uploadcare/rails/action_view/uploadcare_widget_tags_spec.rb +46 -0
- data/spec/uploadcare/rails/active_record/mount_uploadcare_file_spec.rb +33 -0
- data/spec/uploadcare/rails/active_record/mount_uploadcare_group_spec.rb +32 -0
- data/spec/uploadcare/rails/api/rest/conversion_api_spec.rb +110 -0
- data/spec/uploadcare/rails/api/rest/file_api_spec.rb +85 -0
- data/spec/uploadcare/rails/api/rest/group_api_spec.rb +61 -0
- data/spec/uploadcare/rails/api/rest/project_api_spec.rb +33 -0
- data/spec/uploadcare/rails/api/rest/webhook_api_spec.rb +67 -0
- data/spec/uploadcare/rails/api/upload/upload_api_spec.rb +82 -0
- data/spec/uploadcare/rails/jobs/delete_file_job_spec.rb +15 -0
- data/spec/uploadcare/rails/jobs/store_file_job_spec.rb +15 -0
- data/spec/uploadcare/rails/jobs/store_group_job_spec.rb +15 -0
- data/spec/uploadcare/rails/objects/file_spec.rb +77 -0
- data/spec/uploadcare/rails/objects/group_spec.rb +87 -0
- data/spec/uploadcare/rails/services/id_extractor_spec.rb +26 -0
- data/spec/uploadcare/rails/transformations/image_transformations_spec.rb +120 -0
- data/spec/uploadcare/rails_spec.rb +7 -0
- metadata +129 -393
- data/config/initializers/uploadcare.rb +0 -26
- data/config/uploadcare_defaults.yml +0 -12
- data/lib/generators/templates/uploadcare_config_template.yml +0 -71
- data/lib/tasks/uploadcare_rails_tasks.rake +0 -4
- data/lib/uploadcare/rails/action_view/include_tags.rb +0 -47
- data/lib/uploadcare/rails/action_view/uploader_tags.rb +0 -76
- data/lib/uploadcare/rails/active_record/has_file.rb +0 -89
- data/lib/uploadcare/rails/active_record/has_group.rb +0 -84
- data/lib/uploadcare/rails/active_record/has_object.rb +0 -9
- data/lib/uploadcare/rails/formtastic/formtastic.rb +0 -73
- data/lib/uploadcare/rails/operations.rb +0 -57
- data/lib/uploadcare/rails/settings.rb +0 -81
- data/lib/uploadcare/rails/simple_form/simple_form.rb +0 -63
- data/spec/caching/file_caching_spec.rb +0 -26
- data/spec/caching/group_caching_spec.rb +0 -40
- data/spec/cassettes/Uploadcare_Rails_File/should_load_itself.yml +0 -263
- data/spec/cassettes/Uploadcare_Rails_Group/group_should_stay_loaded.yml +0 -263
- data/spec/cassettes/Uploadcare_Rails_Group/rails_cache_should_updates_after_load_call.yml +0 -263
- data/spec/cassettes/group_cahsing_file_load.yml +0 -263
- data/spec/cassettes/has_uploadcare_file/object_with_uploadcare_file/deletes_file_after_destroy.yml +0 -1763
- data/spec/cassettes/has_uploadcare_file/object_with_uploadcare_file/stores_file_after_save.yml +0 -543
- data/spec/cassettes/has_uploadcare_group/object_attachment/contains_files_inside.yml +0 -679
- data/spec/cassettes/has_uploadcare_group_save.yml +0 -705
- data/spec/cassettes/load_group.yml +0 -263
- data/spec/dummy/README.rdoc +0 -28
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/javascripts/post_with_collections.js +0 -2
- data/spec/dummy/app/assets/javascripts/posts.js +0 -2
- data/spec/dummy/app/assets/javascripts/posts_with_collection_and_files.js +0 -2
- data/spec/dummy/app/assets/stylesheets/application.css +0 -13
- data/spec/dummy/app/assets/stylesheets/post_with_collections.css +0 -4
- data/spec/dummy/app/assets/stylesheets/posts.css +0 -4
- data/spec/dummy/app/assets/stylesheets/posts_with_collection_and_files.css +0 -4
- data/spec/dummy/app/assets/stylesheets/scaffold.css +0 -56
- data/spec/dummy/app/controllers/application_controller.rb +0 -5
- data/spec/dummy/app/controllers/post_with_collections_controller.rb +0 -58
- data/spec/dummy/app/controllers/posts_controller.rb +0 -58
- data/spec/dummy/app/controllers/posts_with_collection_and_files_controller.rb +0 -58
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/helpers/post_with_collections_helper.rb +0 -2
- data/spec/dummy/app/helpers/posts_helper.rb +0 -2
- data/spec/dummy/app/helpers/posts_with_collection_and_files_helper.rb +0 -2
- data/spec/dummy/app/models/post.rb +0 -3
- data/spec/dummy/app/models/post_with_collection.rb +0 -3
- data/spec/dummy/app/models/posts_with_collection_and_file.rb +0 -4
- data/spec/dummy/app/views/layouts/application.html.erb +0 -16
- data/spec/dummy/app/views/post_with_collections/_form.html.erb +0 -25
- data/spec/dummy/app/views/post_with_collections/edit.html.erb +0 -6
- data/spec/dummy/app/views/post_with_collections/index.html.erb +0 -29
- data/spec/dummy/app/views/post_with_collections/new.html.erb +0 -5
- data/spec/dummy/app/views/post_with_collections/show.html.erb +0 -14
- data/spec/dummy/app/views/post_with_collections/show.json.jbuilder +0 -1
- data/spec/dummy/app/views/posts/_form.html.erb +0 -31
- data/spec/dummy/app/views/posts/edit.html.erb +0 -6
- data/spec/dummy/app/views/posts/index.html.erb +0 -37
- data/spec/dummy/app/views/posts/new.html.erb +0 -5
- data/spec/dummy/app/views/posts/post.json.builder +0 -1
- data/spec/dummy/app/views/posts/show.html.erb +0 -15
- data/spec/dummy/app/views/posts_with_collection_and_files/_form.html.erb +0 -27
- data/spec/dummy/app/views/posts_with_collection_and_files/edit.html.erb +0 -6
- data/spec/dummy/app/views/posts_with_collection_and_files/index.html.erb +0 -25
- data/spec/dummy/app/views/posts_with_collection_and_files/new.html.erb +0 -5
- data/spec/dummy/app/views/posts_with_collection_and_files/show.html.erb +0 -4
- data/spec/dummy/app/views/posts_with_collection_and_files/show.json.jbuilder +0 -1
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/config/application.rb +0 -23
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -29
- data/spec/dummy/config/environments/production.rb +0 -80
- data/spec/dummy/config/environments/test.rb +0 -36
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/formtastic.rb +0 -111
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -12
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/simple_form.rb +0 -167
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -23
- data/spec/dummy/config/locales/simple_form.en.yml +0 -31
- data/spec/dummy/config/routes.rb +0 -63
- data/spec/dummy/config/uploadcare.yml +0 -68
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/migrate/20171012001801_create_tables.rb +0 -27
- data/spec/dummy/db/schema.rb +0 -37
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/templates/erb/scaffold/_form.html.erb +0 -13
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +0 -3276
- data/spec/dummy/public/404.html +0 -58
- data/spec/dummy/public/422.html +0 -58
- data/spec/dummy/public/500.html +0 -57
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/cache/293/091/https%3A%2F%2Fucarecdn.com%2F19073296-2315-4726-817b-46398b2c7431%7E2%2F +0 -0
- data/spec/dummy/tmp/cache/2AF/761/https%3A%2F%2Fucarecdn.com%2F595319d0-a113-459f-91bd-b29c7183467b%2F +0 -0
- data/spec/dummy/tmp/cache/301/D41/https%3A%2F%2Fucarecdn.com%2F81332043-fa2c-452f-936b-737d87ab2ae2%2F +0 -0
- data/spec/dummy/tmp/cache/30A/7C1/https%3A%2F%2Fucarecdn.com%2F39b34128-a001-46fd-9773-1b6ad46e6b9e%2F +0 -0
- data/spec/dummy/tmp/cache/340/A41/https%3A%2F%2Fucarecdn.com%2F090bcb5f-6d19-456c-b4a3-d753e690926f%2F +0 -0
- data/spec/dummy/tmp/cache/3AB/5A1/https%3A%2F%2Fucarecdn.com%2F7eb0161b-cebe-4316-946b-694de6f77ef9%2F +0 -0
- data/spec/dummy/tmp/cache/3FC/5C1/https%3A%2F%2Fucarecdn.com%2Fc3f0464b-ce9a-4281-8eaa-5c55783ccedf%2F +0 -0
- data/spec/dummy/tmp/cache/431/5C1/https%3A%2F%2Fucarecdn.com%2Fa1b1bb40-bd89-4f9c-b809-e84920f24a01%7E2%2F +0 -0
- data/spec/dummy/tmp/cache/44B/7A1/https%3A%2F%2Fucarecdn.com%2Fd6c785a8-9761-4602-88de-65ddb04ddc6a%7E2%2F +0 -0
- data/spec/dummy/tmp/cache/45B/F31/https%3A%2F%2Fucarecdn.com%2F73e3cdbc-6495-4cf2-bbd1-413e6cb70004%7E2%2F +0 -0
- data/spec/dummy/tmp/cache/461/AA1/https%3A%2F%2Fucarecdn.com%2Fc50e9a53-0b95-48ac-a4a9-6744052dbdab%7E2%2F +0 -0
- data/spec/helpers/form_helpers_has_file_spec.rb +0 -30
- data/spec/helpers/form_helpers_has_group_spec.rb +0 -30
- data/spec/helpers/form_helpers_spec.rb +0 -33
- data/spec/helpers/formtastic_spec.rb +0 -25
- data/spec/helpers/include_tags_spec.rb +0 -54
- data/spec/helpers/simple_form_spec.rb +0 -25
- data/spec/helpers/uploader_tags_spec.rb +0 -21
- data/spec/models/has_both_file_and_group_spec.rb +0 -43
- data/spec/models/has_file_spec.rb +0 -46
- data/spec/models/has_group_spec.rb +0 -57
- data/spec/objects/file_spec.rb +0 -27
- data/spec/objects/group_spec.rb +0 -51
- data/spec/operations_spec.rb +0 -28
- data/spec/tmp/config/uploadcare.yml +0 -71
- data/spec/uploadcare/rails/settings_spec.rb +0 -136
- data/spec/uploadcare_rails_settings_spec.rb +0 -56
- data/spec/view.png +0 -0
- data/spec/view2.jpg +0 -0
@@ -1,12 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
|
6
|
-
# Make sure the secret is at least 30 characters and all random,
|
7
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
-
# You can use `rake secret` to generate a secure secret key.
|
9
|
-
|
10
|
-
# Make sure your secret_key_base is kept private
|
11
|
-
# if you're sharing your code publicly.
|
12
|
-
Dummy::Application.config.secret_key_base = 'e9cc66eda006b0dbc31fda62cbc513e20fbd55f110eabf1dfc843ebd79759e2028edf86654f5c6a6100a60b7c96c9c5a7d46293da22dfd24db2726880313f1a7'
|
@@ -1,167 +0,0 @@
|
|
1
|
-
require "simple_form"
|
2
|
-
# Use this setup block to configure all options available in SimpleForm.
|
3
|
-
SimpleForm.setup do |config|
|
4
|
-
# Wrappers are used by the form builder to generate a
|
5
|
-
# complete input. You can remove any component from the
|
6
|
-
# wrapper, change the order or even add your own to the
|
7
|
-
# stack. The options given below are used to wrap the
|
8
|
-
# whole input.
|
9
|
-
config.wrappers :default, class: :input,
|
10
|
-
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
|
11
|
-
## Extensions enabled by default
|
12
|
-
# Any of these extensions can be disabled for a
|
13
|
-
# given input by passing: `f.input EXTENSION_NAME => false`.
|
14
|
-
# You can make any of these extensions optional by
|
15
|
-
# renaming `b.use` to `b.optional`.
|
16
|
-
|
17
|
-
# Determines whether to use HTML5 (:email, :url, ...)
|
18
|
-
# and required attributes
|
19
|
-
b.use :html5
|
20
|
-
|
21
|
-
# Calculates placeholders automatically from I18n
|
22
|
-
# You can also pass a string as f.input placeholder: "Placeholder"
|
23
|
-
b.use :placeholder
|
24
|
-
|
25
|
-
## Optional extensions
|
26
|
-
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
|
27
|
-
# to the input. If so, they will retrieve the values from the model
|
28
|
-
# if any exists. If you want to enable any of those
|
29
|
-
# extensions by default, you can change `b.optional` to `b.use`.
|
30
|
-
|
31
|
-
# Calculates maxlength from length validations for string inputs
|
32
|
-
b.optional :maxlength
|
33
|
-
|
34
|
-
# Calculates pattern from format validations for string inputs
|
35
|
-
b.optional :pattern
|
36
|
-
|
37
|
-
# Calculates min and max from length validations for numeric inputs
|
38
|
-
b.optional :min_max
|
39
|
-
|
40
|
-
# Calculates readonly automatically from readonly attributes
|
41
|
-
b.optional :readonly
|
42
|
-
|
43
|
-
## Inputs
|
44
|
-
b.use :label_input
|
45
|
-
b.use :hint, wrap_with: { tag: :span, class: :hint }
|
46
|
-
b.use :error, wrap_with: { tag: :span, class: :error }
|
47
|
-
|
48
|
-
## full_messages_for
|
49
|
-
# If you want to display the full error message for the attribute, you can
|
50
|
-
# use the component :full_error, like:
|
51
|
-
#
|
52
|
-
# b.use :full_error, wrap_with: { tag: :span, class: :error }
|
53
|
-
end
|
54
|
-
|
55
|
-
# The default wrapper to be used by the FormBuilder.
|
56
|
-
config.default_wrapper = :default
|
57
|
-
|
58
|
-
# Define the way to render check boxes / radio buttons with labels.
|
59
|
-
# Defaults to :nested for bootstrap config.
|
60
|
-
# inline: input + label
|
61
|
-
# nested: label > input
|
62
|
-
config.boolean_style = :nested
|
63
|
-
|
64
|
-
# Default class for buttons
|
65
|
-
config.button_class = 'btn'
|
66
|
-
|
67
|
-
# Method used to tidy up errors. Specify any Rails Array method.
|
68
|
-
# :first lists the first message for each field.
|
69
|
-
# Use :to_sentence to list all errors for each field.
|
70
|
-
# config.error_method = :first
|
71
|
-
|
72
|
-
# Default tag used for error notification helper.
|
73
|
-
config.error_notification_tag = :div
|
74
|
-
|
75
|
-
# CSS class to add for error notification helper.
|
76
|
-
config.error_notification_class = 'error_notification'
|
77
|
-
|
78
|
-
# ID to add for error notification helper.
|
79
|
-
# config.error_notification_id = nil
|
80
|
-
|
81
|
-
# Series of attempts to detect a default label method for collection.
|
82
|
-
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
83
|
-
|
84
|
-
# Series of attempts to detect a default value method for collection.
|
85
|
-
# config.collection_value_methods = [ :id, :to_s ]
|
86
|
-
|
87
|
-
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
88
|
-
# config.collection_wrapper_tag = nil
|
89
|
-
|
90
|
-
# You can define the class to use on all collection wrappers. Defaulting to none.
|
91
|
-
# config.collection_wrapper_class = nil
|
92
|
-
|
93
|
-
# You can wrap each item in a collection of radio/check boxes with a tag,
|
94
|
-
# defaulting to :span. Please note that when using :boolean_style = :nested,
|
95
|
-
# SimpleForm will force this option to be a label.
|
96
|
-
# config.item_wrapper_tag = :span
|
97
|
-
|
98
|
-
# You can define a class to use in all item wrappers. Defaulting to none.
|
99
|
-
# config.item_wrapper_class = nil
|
100
|
-
|
101
|
-
# How the label text should be generated altogether with the required text.
|
102
|
-
# config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
|
103
|
-
|
104
|
-
# You can define the class to use on all labels. Default is nil.
|
105
|
-
# config.label_class = nil
|
106
|
-
|
107
|
-
# You can define the default class to be used on forms. Can be overriden
|
108
|
-
# with `html: { :class }`. Defaulting to none.
|
109
|
-
# config.default_form_class = nil
|
110
|
-
|
111
|
-
# You can define which elements should obtain additional classes
|
112
|
-
# config.generate_additional_classes_for = [:wrapper, :label, :input]
|
113
|
-
|
114
|
-
# Whether attributes are required by default (or not). Default is true.
|
115
|
-
# config.required_by_default = true
|
116
|
-
|
117
|
-
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
|
118
|
-
# These validations are enabled in SimpleForm's internal config but disabled by default
|
119
|
-
# in this configuration, which is recommended due to some quirks from different browsers.
|
120
|
-
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
|
121
|
-
# change this configuration to true.
|
122
|
-
config.browser_validations = false
|
123
|
-
|
124
|
-
# Collection of methods to detect if a file type was given.
|
125
|
-
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
|
126
|
-
|
127
|
-
# Custom mappings for input types. This should be a hash containing a regexp
|
128
|
-
# to match as key, and the input type that will be used when the field name
|
129
|
-
# matches the regexp as value.
|
130
|
-
# config.input_mappings = { /count/ => :integer }
|
131
|
-
|
132
|
-
# Custom wrappers for input types. This should be a hash containing an input
|
133
|
-
# type as key and the wrapper that will be used for all inputs with specified type.
|
134
|
-
# config.wrapper_mappings = { string: :prepend }
|
135
|
-
|
136
|
-
# Namespaces where SimpleForm should look for custom input classes that
|
137
|
-
# override default inputs.
|
138
|
-
# config.custom_inputs_namespaces << "CustomInputs"
|
139
|
-
|
140
|
-
# Default priority for time_zone inputs.
|
141
|
-
# config.time_zone_priority = nil
|
142
|
-
|
143
|
-
# Default priority for country inputs.
|
144
|
-
# config.country_priority = nil
|
145
|
-
|
146
|
-
# When false, do not use translations for labels.
|
147
|
-
# config.translate_labels = true
|
148
|
-
|
149
|
-
# Automatically discover new inputs in Rails' autoload path.
|
150
|
-
# config.inputs_discovery = true
|
151
|
-
|
152
|
-
# Cache SimpleForm inputs discovery
|
153
|
-
# config.cache_discovery = !Rails.env.development?
|
154
|
-
|
155
|
-
# Default class for inputs
|
156
|
-
# config.input_class = nil
|
157
|
-
|
158
|
-
# Define the default class of the input wrapper of the boolean input.
|
159
|
-
config.boolean_label_class = 'checkbox'
|
160
|
-
|
161
|
-
# Defines if the default input wrapper class should be included in radio
|
162
|
-
# collection wrappers.
|
163
|
-
# config.include_default_input_wrapper_class = true
|
164
|
-
|
165
|
-
# Defines which i18n scope will be used in Simple Form.
|
166
|
-
# config.i18n_scope = 'simple_form'
|
167
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
-
# is enabled by default.
|
5
|
-
|
6
|
-
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
-
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
-
end
|
10
|
-
|
11
|
-
# To enable root element in JSON for ActiveRecord objects.
|
12
|
-
# ActiveSupport.on_load(:active_record) do
|
13
|
-
# self.include_root_in_json = true
|
14
|
-
# end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# Files in the config/locales directory are used for internationalization
|
2
|
-
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
-
# than English, add the necessary files in this directory.
|
4
|
-
#
|
5
|
-
# To use the locales, use `I18n.t`:
|
6
|
-
#
|
7
|
-
# I18n.t 'hello'
|
8
|
-
#
|
9
|
-
# In views, this is aliased to just `t`:
|
10
|
-
#
|
11
|
-
# <%= t('hello') %>
|
12
|
-
#
|
13
|
-
# To use a different locale, set it with `I18n.locale`:
|
14
|
-
#
|
15
|
-
# I18n.locale = :es
|
16
|
-
#
|
17
|
-
# This would use the information in config/locales/es.yml.
|
18
|
-
#
|
19
|
-
# To learn more, please read the Rails Internationalization guide
|
20
|
-
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
-
|
22
|
-
en:
|
23
|
-
hello: "Hello world"
|
@@ -1,31 +0,0 @@
|
|
1
|
-
en:
|
2
|
-
simple_form:
|
3
|
-
"yes": 'Yes'
|
4
|
-
"no": 'No'
|
5
|
-
required:
|
6
|
-
text: 'required'
|
7
|
-
mark: '*'
|
8
|
-
# You can uncomment the line below if you need to overwrite the whole required html.
|
9
|
-
# When using html, text and mark won't be used.
|
10
|
-
# html: '<abbr title="required">*</abbr>'
|
11
|
-
error_notification:
|
12
|
-
default_message: "Please review the problems below:"
|
13
|
-
# Examples
|
14
|
-
# labels:
|
15
|
-
# defaults:
|
16
|
-
# password: 'Password'
|
17
|
-
# user:
|
18
|
-
# new:
|
19
|
-
# email: 'E-mail to sign in.'
|
20
|
-
# edit:
|
21
|
-
# email: 'E-mail.'
|
22
|
-
# hints:
|
23
|
-
# defaults:
|
24
|
-
# username: 'User name to sign in.'
|
25
|
-
# password: 'No special characters, please.'
|
26
|
-
# include_blanks:
|
27
|
-
# defaults:
|
28
|
-
# age: 'Rather not say'
|
29
|
-
# prompts:
|
30
|
-
# defaults:
|
31
|
-
# age: 'Select your age'
|
data/spec/dummy/config/routes.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
Dummy::Application.routes.draw do
|
2
|
-
resources :posts_with_collection_and_files
|
3
|
-
|
4
|
-
root to: "posts#new"
|
5
|
-
resources :posts
|
6
|
-
resources :post_with_collections
|
7
|
-
|
8
|
-
|
9
|
-
# The priority is based upon order of creation: first created -> highest priority.
|
10
|
-
# See how all your routes lay out with "rake routes".
|
11
|
-
|
12
|
-
# You can have the root of your site routed with "root"
|
13
|
-
# root 'welcome#index'
|
14
|
-
|
15
|
-
# Example of regular route:
|
16
|
-
# get 'products/:id' => 'catalog#view'
|
17
|
-
|
18
|
-
# Example of named route that can be invoked with purchase_url(id: product.id)
|
19
|
-
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
20
|
-
|
21
|
-
# Example resource route (maps HTTP verbs to controller actions automatically):
|
22
|
-
# resources :products
|
23
|
-
|
24
|
-
# Example resource route with options:
|
25
|
-
# resources :products do
|
26
|
-
# member do
|
27
|
-
# get 'short'
|
28
|
-
# post 'toggle'
|
29
|
-
# end
|
30
|
-
#
|
31
|
-
# collection do
|
32
|
-
# get 'sold'
|
33
|
-
# end
|
34
|
-
# end
|
35
|
-
|
36
|
-
# Example resource route with sub-resources:
|
37
|
-
# resources :products do
|
38
|
-
# resources :comments, :sales
|
39
|
-
# resource :seller
|
40
|
-
# end
|
41
|
-
|
42
|
-
# Example resource route with more complex sub-resources:
|
43
|
-
# resources :products do
|
44
|
-
# resources :comments
|
45
|
-
# resources :sales do
|
46
|
-
# get 'recent', on: :collection
|
47
|
-
# end
|
48
|
-
# end
|
49
|
-
|
50
|
-
# Example resource route with concerns:
|
51
|
-
# concern :toggleable do
|
52
|
-
# post 'toggle'
|
53
|
-
# end
|
54
|
-
# resources :posts, concerns: :toggleable
|
55
|
-
# resources :photos, concerns: :toggleable
|
56
|
-
|
57
|
-
# Example resource route within a namespace:
|
58
|
-
# namespace :admin do
|
59
|
-
# # Directs /admin/products/* to Admin::ProductsController
|
60
|
-
# # (app/controllers/admin/products_controller.rb)
|
61
|
-
# resources :products
|
62
|
-
# end
|
63
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
defaults: &defaults
|
2
|
-
public_key: "demopublickey" # replace it with your public key
|
3
|
-
private_key: "demoprivatekey" # replace it with your private key
|
4
|
-
|
5
|
-
cache_files: true
|
6
|
-
|
7
|
-
cache_groups: true
|
8
|
-
|
9
|
-
# store file or group after model is created or updated
|
10
|
-
store_after_save: true
|
11
|
-
|
12
|
-
# deletes file or group after model object is deleted
|
13
|
-
delete_after_destroy: true
|
14
|
-
|
15
|
-
# Avaliable options are listed at https://uploadcare.com/documentation/widget/#advanced-configuration
|
16
|
-
# please note, that for options marker as Global: N/A - there is no practical meaning
|
17
|
-
# of putting this option here, as it will not have any effect.
|
18
|
-
# But it also will not break anything.
|
19
|
-
|
20
|
-
# for preview step use:
|
21
|
-
preview_step: false # true or false
|
22
|
-
|
23
|
-
# for clearable option (allows user to remove uploaded file from widget) use:
|
24
|
-
clearable: false # true or false
|
25
|
-
|
26
|
-
# for setting tabs use tabs option:
|
27
|
-
tabs: "url file facebook" # etc
|
28
|
-
# read more here: https://uploadcare.com/documentation/widget/#tabs
|
29
|
-
#
|
30
|
-
# Full list of tabs:
|
31
|
-
# |----------------------------------------|
|
32
|
-
# | Code | File Source | Default |
|
33
|
-
# |------------|-----------------|---------|
|
34
|
-
# | url | Any URL | On |
|
35
|
-
# | file | Local disk | On |
|
36
|
-
# | facebook | Facebook | On |
|
37
|
-
# | dropbox | Dropbox | Off |
|
38
|
-
# | gdrive | Google Drive | On |
|
39
|
-
# | box | Box | On |
|
40
|
-
# | skydrive | SkyDrive | On |
|
41
|
-
# | instagram | Instagram | On |
|
42
|
-
# | evernote | Evernote | On |
|
43
|
-
# | vk | VK | Off |
|
44
|
-
# |________________________________________|
|
45
|
-
|
46
|
-
# for locale option use:
|
47
|
-
locale: "en"
|
48
|
-
|
49
|
-
# for autostore option use:
|
50
|
-
autostore: true #true or false
|
51
|
-
|
52
|
-
# for manual start (which means you will need to initialize uploaders yourself) use:
|
53
|
-
manual_start: false # true or false
|
54
|
-
|
55
|
-
# for path value use:
|
56
|
-
path_value: true # true or false
|
57
|
-
# (important for input values - see https://uploadcare.com/documentation/widget/#input-value)
|
58
|
-
|
59
|
-
live: true
|
60
|
-
|
61
|
-
development:
|
62
|
-
<<: *defaults
|
63
|
-
|
64
|
-
test:
|
65
|
-
<<: *defaults
|
66
|
-
|
67
|
-
production:
|
68
|
-
<<: *defaults
|
data/spec/dummy/config.ru
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
superclass = ActiveRecord::Migration
|
2
|
-
superclass = ActiveRecord::Migration[5.0] if superclass.respond_to?(:[])
|
3
|
-
|
4
|
-
class CreateTables < superclass
|
5
|
-
def change
|
6
|
-
create_table :posts do |t|
|
7
|
-
t.string :title
|
8
|
-
t.string :file
|
9
|
-
|
10
|
-
t.timestamps
|
11
|
-
end
|
12
|
-
|
13
|
-
create_table :post_with_collections do |t|
|
14
|
-
t.string :title
|
15
|
-
t.string :file
|
16
|
-
|
17
|
-
t.timestamps
|
18
|
-
end
|
19
|
-
|
20
|
-
create_table :posts_with_collection_and_files do |t|
|
21
|
-
t.string :title
|
22
|
-
t.string :file
|
23
|
-
t.string :group
|
24
|
-
t.timestamps
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/spec/dummy/db/schema.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# This file is auto-generated from the current state of the database. Instead
|
2
|
-
# of editing this file, please use the migrations feature of Active Record to
|
3
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
-
#
|
5
|
-
# Note that this schema.rb definition is the authoritative source for your
|
6
|
-
# database schema. If you need to create the application database on another
|
7
|
-
# system, you should be using db:schema:load, not running all the migrations
|
8
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
-
#
|
11
|
-
# It's strongly recommended that you check this file into your version control system.
|
12
|
-
|
13
|
-
ActiveRecord::Schema.define(version: 20171012001801) do
|
14
|
-
|
15
|
-
create_table "post_with_collections", force: :cascade do |t|
|
16
|
-
t.string "title"
|
17
|
-
t.string "file"
|
18
|
-
t.datetime "created_at", null: false
|
19
|
-
t.datetime "updated_at", null: false
|
20
|
-
end
|
21
|
-
|
22
|
-
create_table "posts", force: :cascade do |t|
|
23
|
-
t.string "title"
|
24
|
-
t.string "file"
|
25
|
-
t.datetime "created_at", null: false
|
26
|
-
t.datetime "updated_at", null: false
|
27
|
-
end
|
28
|
-
|
29
|
-
create_table "posts_with_collection_and_files", force: :cascade do |t|
|
30
|
-
t.string "title"
|
31
|
-
t.string "file"
|
32
|
-
t.string "group"
|
33
|
-
t.datetime "created_at", null: false
|
34
|
-
t.datetime "updated_at", null: false
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
data/spec/dummy/db/test.sqlite3
DELETED
Binary file
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
|
2
|
-
<%%= f.error_notification %>
|
3
|
-
|
4
|
-
<div class="form-inputs">
|
5
|
-
<%- attributes.each do |attribute| -%>
|
6
|
-
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
|
7
|
-
<%- end -%>
|
8
|
-
</div>
|
9
|
-
|
10
|
-
<div class="form-actions">
|
11
|
-
<%%= f.button :submit %>
|
12
|
-
</div>
|
13
|
-
<%% end %>
|
File without changes
|