uploadcare-rails 1.2.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- 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 -69
- data/spec/support/generators.rb +8 -5
- data/spec/support/vcr.rb +14 -0
- data/spec/tmp/config/initializers/uploadcare.rb +138 -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 +59 -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 -351
- data/config/initializers/uploadcare.rb +0 -26
- data/config/uploadcare_defaults.yml +0 -12
- data/lib/generators/templates/uploadcare_config_template.yml +0 -67
- 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 -92
- data/lib/uploadcare/rails/active_record/has_group.rb +0 -89
- 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/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 -4
- data/spec/dummy/app/models/post_with_collection.rb +0 -4
- 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 -4
- 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 -64
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/migrate/20171012001801_create_tables.rb +0 -27
- data/spec/dummy/db/migrate/20181001132710_add_other_file_to_post.rb +0 -8
- data/spec/dummy/db/migrate/20181001141434_add_other_file_to_post_with_collections.rb +0 -8
- data/spec/dummy/db/schema.rb +0 -39
- data/spec/dummy/lib/templates/erb/scaffold/_form.html.erb +0 -13
- 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/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/models/has_several_files_spec.rb +0 -55
- data/spec/models/has_several_groups_spec.rb +0 -62
- 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/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,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,64 +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/docs/uploads/widget/config/
|
16
|
-
# please note, that for options marked 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/docs/uploads/widget/upload_sources/
|
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
|
-
live: true
|
56
|
-
|
57
|
-
development:
|
58
|
-
<<: *defaults
|
59
|
-
|
60
|
-
test:
|
61
|
-
<<: *defaults
|
62
|
-
|
63
|
-
production:
|
64
|
-
<<: *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,39 +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: 2018_10_01_141434) 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
|
-
t.string "other_file"
|
21
|
-
end
|
22
|
-
|
23
|
-
create_table "posts", force: :cascade do |t|
|
24
|
-
t.string "title"
|
25
|
-
t.string "file"
|
26
|
-
t.datetime "created_at", null: false
|
27
|
-
t.datetime "updated_at", null: false
|
28
|
-
t.string "other_file"
|
29
|
-
end
|
30
|
-
|
31
|
-
create_table "posts_with_collection_and_files", force: :cascade do |t|
|
32
|
-
t.string "title"
|
33
|
-
t.string "file"
|
34
|
-
t.string "group"
|
35
|
-
t.datetime "created_at", null: false
|
36
|
-
t.datetime "updated_at", null: false
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
@@ -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 %>
|
data/spec/dummy/public/404.html
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style>
|
6
|
-
body {
|
7
|
-
background-color: #EFEFEF;
|
8
|
-
color: #2E2F30;
|
9
|
-
text-align: center;
|
10
|
-
font-family: arial, sans-serif;
|
11
|
-
}
|
12
|
-
|
13
|
-
div.dialog {
|
14
|
-
width: 25em;
|
15
|
-
margin: 4em auto 0 auto;
|
16
|
-
border: 1px solid #CCC;
|
17
|
-
border-right-color: #999;
|
18
|
-
border-left-color: #999;
|
19
|
-
border-bottom-color: #BBB;
|
20
|
-
border-top: #B00100 solid 4px;
|
21
|
-
border-top-left-radius: 9px;
|
22
|
-
border-top-right-radius: 9px;
|
23
|
-
background-color: white;
|
24
|
-
padding: 7px 4em 0 4em;
|
25
|
-
}
|
26
|
-
|
27
|
-
h1 {
|
28
|
-
font-size: 100%;
|
29
|
-
color: #730E15;
|
30
|
-
line-height: 1.5em;
|
31
|
-
}
|
32
|
-
|
33
|
-
body > p {
|
34
|
-
width: 33em;
|
35
|
-
margin: 0 auto 1em;
|
36
|
-
padding: 1em 0;
|
37
|
-
background-color: #F7F7F7;
|
38
|
-
border: 1px solid #CCC;
|
39
|
-
border-right-color: #999;
|
40
|
-
border-bottom-color: #999;
|
41
|
-
border-bottom-left-radius: 4px;
|
42
|
-
border-bottom-right-radius: 4px;
|
43
|
-
border-top-color: #DADADA;
|
44
|
-
color: #666;
|
45
|
-
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
-
}
|
47
|
-
</style>
|
48
|
-
</head>
|
49
|
-
|
50
|
-
<body>
|
51
|
-
<!-- This file lives in public/404.html -->
|
52
|
-
<div class="dialog">
|
53
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
54
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
55
|
-
</div>
|
56
|
-
<p>If you are the application owner check the logs for more information.</p>
|
57
|
-
</body>
|
58
|
-
</html>
|
data/spec/dummy/public/422.html
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style>
|
6
|
-
body {
|
7
|
-
background-color: #EFEFEF;
|
8
|
-
color: #2E2F30;
|
9
|
-
text-align: center;
|
10
|
-
font-family: arial, sans-serif;
|
11
|
-
}
|
12
|
-
|
13
|
-
div.dialog {
|
14
|
-
width: 25em;
|
15
|
-
margin: 4em auto 0 auto;
|
16
|
-
border: 1px solid #CCC;
|
17
|
-
border-right-color: #999;
|
18
|
-
border-left-color: #999;
|
19
|
-
border-bottom-color: #BBB;
|
20
|
-
border-top: #B00100 solid 4px;
|
21
|
-
border-top-left-radius: 9px;
|
22
|
-
border-top-right-radius: 9px;
|
23
|
-
background-color: white;
|
24
|
-
padding: 7px 4em 0 4em;
|
25
|
-
}
|
26
|
-
|
27
|
-
h1 {
|
28
|
-
font-size: 100%;
|
29
|
-
color: #730E15;
|
30
|
-
line-height: 1.5em;
|
31
|
-
}
|
32
|
-
|
33
|
-
body > p {
|
34
|
-
width: 33em;
|
35
|
-
margin: 0 auto 1em;
|
36
|
-
padding: 1em 0;
|
37
|
-
background-color: #F7F7F7;
|
38
|
-
border: 1px solid #CCC;
|
39
|
-
border-right-color: #999;
|
40
|
-
border-bottom-color: #999;
|
41
|
-
border-bottom-left-radius: 4px;
|
42
|
-
border-bottom-right-radius: 4px;
|
43
|
-
border-top-color: #DADADA;
|
44
|
-
color: #666;
|
45
|
-
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
-
}
|
47
|
-
</style>
|
48
|
-
</head>
|
49
|
-
|
50
|
-
<body>
|
51
|
-
<!-- This file lives in public/422.html -->
|
52
|
-
<div class="dialog">
|
53
|
-
<h1>The change you wanted was rejected.</h1>
|
54
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
55
|
-
</div>
|
56
|
-
<p>If you are the application owner check the logs for more information.</p>
|
57
|
-
</body>
|
58
|
-
</html>
|
data/spec/dummy/public/500.html
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style>
|
6
|
-
body {
|
7
|
-
background-color: #EFEFEF;
|
8
|
-
color: #2E2F30;
|
9
|
-
text-align: center;
|
10
|
-
font-family: arial, sans-serif;
|
11
|
-
}
|
12
|
-
|
13
|
-
div.dialog {
|
14
|
-
width: 25em;
|
15
|
-
margin: 4em auto 0 auto;
|
16
|
-
border: 1px solid #CCC;
|
17
|
-
border-right-color: #999;
|
18
|
-
border-left-color: #999;
|
19
|
-
border-bottom-color: #BBB;
|
20
|
-
border-top: #B00100 solid 4px;
|
21
|
-
border-top-left-radius: 9px;
|
22
|
-
border-top-right-radius: 9px;
|
23
|
-
background-color: white;
|
24
|
-
padding: 7px 4em 0 4em;
|
25
|
-
}
|
26
|
-
|
27
|
-
h1 {
|
28
|
-
font-size: 100%;
|
29
|
-
color: #730E15;
|
30
|
-
line-height: 1.5em;
|
31
|
-
}
|
32
|
-
|
33
|
-
body > p {
|
34
|
-
width: 33em;
|
35
|
-
margin: 0 auto 1em;
|
36
|
-
padding: 1em 0;
|
37
|
-
background-color: #F7F7F7;
|
38
|
-
border: 1px solid #CCC;
|
39
|
-
border-right-color: #999;
|
40
|
-
border-bottom-color: #999;
|
41
|
-
border-bottom-left-radius: 4px;
|
42
|
-
border-bottom-right-radius: 4px;
|
43
|
-
border-top-color: #DADADA;
|
44
|
-
color: #666;
|
45
|
-
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
-
}
|
47
|
-
</style>
|
48
|
-
</head>
|
49
|
-
|
50
|
-
<body>
|
51
|
-
<!-- This file lives in public/500.html -->
|
52
|
-
<div class="dialog">
|
53
|
-
<h1>We're sorry, but something went wrong.</h1>
|
54
|
-
</div>
|
55
|
-
<p>If you are the application owner check the logs for more information.</p>
|
56
|
-
</body>
|
57
|
-
</html>
|
File without changes
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Uploadcare::Rails::ActionView::FormBuilder, type: :helper do
|
4
|
-
before :each do
|
5
|
-
@post = Post.new
|
6
|
-
@form = ActionView::Helpers::FormBuilder.new(:post, @post, helper, {})
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should include uploader tag for name" do
|
10
|
-
# not that post has uc file
|
11
|
-
tag = @form.uploadcare_field :file
|
12
|
-
tag.should be_kind_of(String)
|
13
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="false"]', visible: :all)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should override uploadcare- attribute" do
|
17
|
-
tag = @form.uploadcare_field :file, :uploadcare => {:multiple => true}
|
18
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="false"]', visible: :all)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should override data- attribute" do
|
22
|
-
tag = @form.uploadcare_field :file, :data => {:multiple => true}
|
23
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="false"]', visible: :all)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should override data- and uploadcare- attributes" do
|
27
|
-
tag = @form.uploadcare_field :file, :data => {:multiple => true}, :uploadcare => {:multiple => true}
|
28
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="false"]', visible: :all)
|
29
|
-
end
|
30
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Uploadcare::Rails::ActionView::FormBuilder, type: :helper do
|
4
|
-
before :each do
|
5
|
-
@post = PostWithCollection.new
|
6
|
-
@form = ActionView::Helpers::FormBuilder.new(:post, @post, helper, {})
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should include uploader tag for name" do
|
10
|
-
# not that post has uc file
|
11
|
-
tag = @form.uploadcare_field :file
|
12
|
-
expect(tag).to be_kind_of(String)
|
13
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="true"]', visible: :all)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should override uploadcare- attribute" do
|
17
|
-
tag = @form.uploadcare_field :file, :uploadcare => {:multiple => false}
|
18
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="true"]', visible: :all)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should override data- attribute" do
|
22
|
-
tag = @form.uploadcare_field :file, :data => {:multiple => false}
|
23
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="true"]', visible: :all)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should override data- and uploadcare- attributes" do
|
27
|
-
tag = @form.uploadcare_field :file, :data => {:multiple => false}, :uploadcare => {:multiple => false}
|
28
|
-
expect(tag).to have_selector('input[type="hidden"][data-multiple="true"]', visible: :all)
|
29
|
-
end
|
30
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Uploadcare::Rails::ActionView::FormBuilder, type: :helper do
|
4
|
-
before :each do
|
5
|
-
@post = Post.new
|
6
|
-
@form = ActionView::Helpers::FormBuilder.new(:post, @post, helper, {})
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should include uploader tag for name" do
|
10
|
-
tag = @form.uploadcare_field :file
|
11
|
-
tag.should be_kind_of(String)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should have role attr" do
|
15
|
-
tag = @form.uploadcare_field :file, :uploadcare => {:multiple => true}
|
16
|
-
expect(tag).to have_selector('input[role="uploadcare-uploader"]', visible: :all)
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should have custom data-attributes" do
|
20
|
-
tag = @form.uploadcare_field :file, :data => {:custom => true}
|
21
|
-
expect(tag).to have_selector('input[data-custom="true"]', visible: :all)
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should have uploadcare namespace translated into data- attributes" do
|
25
|
-
tag = @form.uploadcare_field :file, :uploadcare => {:custom => true}
|
26
|
-
expect(tag).to have_selector('input[data-custom="true"]', visible: :all)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should override data namespace with uploadcare namespace" do
|
30
|
-
tag = @form.uploadcare_field :file, :uploadcare => {:custom => true}, :data => {:custom => false}
|
31
|
-
expect(tag).to have_selector('input[data-custom="true"]', visible: :all)
|
32
|
-
end
|
33
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "Uploadcare::Rails::Formtastic", type: :helper do
|
4
|
-
before :each do
|
5
|
-
@post = Post.new
|
6
|
-
@form = Formtastic::FormBuilder.new(:post, @post, helper, {})
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should create smart uploader field' do
|
10
|
-
tag = @form.input :file, as: :uploadcare_uploader
|
11
|
-
expect(tag).to have_selector('input[role="uploadcare-uploader"]', visible: :all)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should create single uploader field' do
|
15
|
-
tag = @form.input :file, as: :uploadcare_single_uploader
|
16
|
-
expect(tag)
|
17
|
-
.to have_selector('input[role="uploadcare-uploader"][data-multiple="false"]', visible: :all)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should create multiple uploader field' do
|
21
|
-
tag = @form.input :file, as: :uploadcare_multiple_uploader
|
22
|
-
expect(tag)
|
23
|
-
.to have_selector('input[role="uploadcare-uploader"][data-multiple="true"]', visible: :all)
|
24
|
-
end
|
25
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Uploadcare::Rails do
|
4
|
-
it 'includes widget from cdn' do
|
5
|
-
tag = helper.include_uploadcare_widget_from_cdn
|
6
|
-
|
7
|
-
expect(tag).to eq(
|
8
|
-
[
|
9
|
-
"<script src=\"https://ucarecdn.com/libs/widget/",
|
10
|
-
UPLOADCARE_SETTINGS.widget_version,
|
11
|
-
'/uploadcare.min.js"></script>'
|
12
|
-
].join
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'for specifyed version' do
|
17
|
-
let(:version) { '0.13.3' }
|
18
|
-
|
19
|
-
it 'uses widget version' do
|
20
|
-
tag = helper.include_uploadcare_widget_from_cdn(version: version)
|
21
|
-
|
22
|
-
expect(tag).to eq(
|
23
|
-
"<script src=\"https://ucarecdn.com/libs/widget/#{ version }/"\
|
24
|
-
'uploadcare.min.js"></script>'
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'loads not minified version' do
|
29
|
-
tag =
|
30
|
-
helper.include_uploadcare_widget_from_cdn(version: version, min: false)
|
31
|
-
|
32
|
-
expect(tag).to eq(
|
33
|
-
"<script src=\"https://ucarecdn.com/libs/widget/#{ version }/"\
|
34
|
-
'uploadcare.js"></script>'
|
35
|
-
)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'uploadcare settings' do
|
40
|
-
let(:subject) { helper.uploadcare_settings }
|
41
|
-
|
42
|
-
it { is_expected.to be_a(String) }
|
43
|
-
it { is_expected.not_to be_empty }
|
44
|
-
%w(
|
45
|
-
UPLOADCARE_LOCALE UPLOADCARE_PREVIEW_STEP
|
46
|
-
UPLOADCARE_PUBLIC_KEY UPLOADCARE_CLEARABLE
|
47
|
-
UPLOADCARE_TABS UPLOADCARE_AUTOSTORE
|
48
|
-
UPLOADCARE_MANUAL_START UPLOADCARE_PATH_VALUE).each do |content|
|
49
|
-
it 'contains expected selector' do
|
50
|
-
is_expected.to have_xpath("//script[text()[contains(.,'UPLOADCARE')]]", visible: :all)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "Uploadcare::Rails::SimpleForm", type: :helper do
|
4
|
-
before :each do
|
5
|
-
@post = Post.new
|
6
|
-
@form = SimpleForm::FormBuilder.new(:post, @post, helper, {})
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should create smart uploader field' do
|
10
|
-
tag = @form.input :file, as: :uploadcare_uploader
|
11
|
-
expect(tag).to have_selector('input[role="uploadcare-uploader"]', visible: :all)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should create single uploader field' do
|
15
|
-
tag = @form.input :file, as: :uploadcare_single_uploader
|
16
|
-
expect(tag)
|
17
|
-
.to have_selector('input[role="uploadcare-uploader"][data-multiple="false"]', visible: :all)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should create multiple uploader field' do
|
21
|
-
tag = @form.input :file, as: :uploadcare_multiple_uploader
|
22
|
-
expect(tag)
|
23
|
-
.to have_selector('input[role="uploadcare-uploader"][data-multiple="true"]', visible: :all)
|
24
|
-
end
|
25
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Uploadcare::Rails::ActionView::UploaderTags do
|
4
|
-
let(:expected_selector) do
|
5
|
-
'input[type="hidden"][role="uploadcare-uploader"][data-path-value="true"]'
|
6
|
-
end
|
7
|
-
|
8
|
-
it "should include uploader tag for name" do
|
9
|
-
tag = helper.uploadcare_uploader_tag :file
|
10
|
-
|
11
|
-
expect(tag).to be_kind_of(String)
|
12
|
-
expect(tag).to have_selector(expected_selector, visible: :all)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should include uploader field for object" do
|
16
|
-
tag = helper.uploadcare_uploader_field :post, :file
|
17
|
-
|
18
|
-
expect(tag).to be_kind_of(String)
|
19
|
-
expect(tag).to have_selector(expected_selector, visible: :all)
|
20
|
-
end
|
21
|
-
end
|