administrate-field-active_storage 0.3.4 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +21 -0
  3. data/.gitignore +0 -1
  4. data/.ruby-version +1 -1
  5. data/Gemfile.lock +217 -0
  6. data/README.md +8 -1
  7. data/administrate-field-active_storage.gemspec +3 -2
  8. data/app/views/fields/active_storage/_form.html.erb +4 -1
  9. data/app/views/fields/active_storage/_index.html.erb +19 -8
  10. data/app/views/fields/active_storage/_item.html.erb +2 -1
  11. data/app/views/fields/active_storage/_items.html.erb +6 -1
  12. data/app/views/fields/active_storage/_preview.html.erb +17 -3
  13. data/app/views/fields/active_storage/_show.html.erb +1 -1
  14. data/config/i18n-tasks.yml +8 -0
  15. data/config/locales/administrate-field-active_storage.en.yml +10 -0
  16. data/config/locales/administrate-field-active_storage.ru.yml +10 -0
  17. data/contribute.md +3 -0
  18. data/lib/administrate/field/active_storage.rb +3 -3
  19. data/spec/i18n_spec.rb +35 -0
  20. data/test_app/.browserslistrc +1 -0
  21. data/test_app/.gitattributes +10 -0
  22. data/{example-project → test_app}/.gitignore +9 -7
  23. data/test_app/.ruby-version +1 -0
  24. data/test_app/Gemfile +45 -0
  25. data/test_app/Gemfile.lock +237 -0
  26. data/{example-project → test_app}/README.md +0 -0
  27. data/{example-project → test_app}/Rakefile +1 -1
  28. data/test_app/app/assets/config/manifest.js +4 -0
  29. data/{example-project → test_app}/app/assets/images/.keep +0 -0
  30. data/{example-project → test_app}/app/assets/stylesheets/application.css +0 -0
  31. data/{example-project → test_app}/app/controllers/admin/application_controller.rb +3 -3
  32. data/test_app/app/controllers/admin/posts_controller.rb +46 -0
  33. data/{example-project → test_app}/app/controllers/application_controller.rb +0 -0
  34. data/{example-project/app/dashboards/user_dashboard.rb → test_app/app/dashboards/post_dashboard.rb} +29 -27
  35. data/{example-project → test_app}/app/helpers/application_helper.rb +0 -0
  36. data/test_app/app/javascript/packs/application.js +10 -0
  37. data/{example-project → test_app}/app/models/application_record.rb +0 -0
  38. data/test_app/app/models/post.rb +3 -0
  39. data/test_app/app/views/layouts/application.html.erb +16 -0
  40. data/test_app/bin/bundle +114 -0
  41. data/test_app/bin/rails +4 -0
  42. data/test_app/bin/rake +4 -0
  43. data/{example-project → test_app}/bin/setup +6 -9
  44. data/test_app/config/application.rb +35 -0
  45. data/{example-project/bin/bundle → test_app/config/boot.rb} +2 -2
  46. data/test_app/config/credentials.yml.enc +1 -0
  47. data/{example-project → test_app}/config/database.yml +1 -1
  48. data/{example-project → test_app}/config/environment.rb +1 -1
  49. data/{example-project → test_app}/config/environments/development.rb +21 -11
  50. data/{example-project → test_app}/config/environments/production.rb +36 -24
  51. data/{example-project → test_app}/config/environments/test.rb +20 -14
  52. data/{example-project → test_app}/config/initializers/application_controller_renderer.rb +0 -0
  53. data/{example-project → test_app}/config/initializers/assets.rb +0 -0
  54. data/test_app/config/initializers/backtrace_silencers.rb +8 -0
  55. data/{example-project → test_app}/config/initializers/content_security_policy.rb +5 -0
  56. data/{example-project → test_app}/config/initializers/cookies_serializer.rb +0 -0
  57. data/{example-project → test_app}/config/initializers/filter_parameter_logging.rb +3 -1
  58. data/{example-project → test_app}/config/initializers/inflections.rb +0 -0
  59. data/{example-project → test_app}/config/initializers/mime_types.rb +0 -0
  60. data/test_app/config/initializers/permissions_policy.rb +11 -0
  61. data/{example-project → test_app}/config/initializers/wrap_parameters.rb +0 -0
  62. data/{example-project → test_app}/config/locales/en.yml +1 -1
  63. data/{example-project → test_app}/config/puma.rb +13 -4
  64. data/test_app/config/routes.rb +9 -0
  65. data/{example-project → test_app}/config/storage.yml +0 -0
  66. data/{example-project → test_app}/config.ru +2 -1
  67. data/{example-project/db/migrate/20181221134334_create_active_storage_tables.active_storage.rb → test_app/db/migrate/20210118122804_create_active_storage_tables.active_storage.rb} +15 -5
  68. data/test_app/db/migrate/20210118122927_create_posts.rb +8 -0
  69. data/{example-project → test_app}/db/schema.rb +18 -10
  70. data/{example-project → test_app}/db/seeds.rb +1 -1
  71. data/test_app/lib/active_storage/fixture_set.rb +71 -0
  72. data/{example-project → test_app}/public/404.html +0 -0
  73. data/{example-project → test_app}/public/422.html +0 -0
  74. data/{example-project → test_app}/public/500.html +0 -0
  75. data/{example-project → test_app}/public/apple-touch-icon-precomposed.png +0 -0
  76. data/{example-project → test_app}/public/apple-touch-icon.png +0 -0
  77. data/{example-project → test_app}/public/favicon.ico +0 -0
  78. data/test_app/public/robots.txt +1 -0
  79. data/{example-project → test_app}/test/application_system_test_case.rb +0 -0
  80. data/test_app/test/controllers/admin/posts_controller_test.rb +14 -0
  81. data/test_app/test/fixtures/active_storage/attachments.yml +4 -0
  82. data/test_app/test/fixtures/active_storage/blobs.yml +2 -0
  83. data/test_app/test/fixtures/files/cover_image.jpg +0 -0
  84. data/test_app/test/fixtures/posts.yml +11 -0
  85. data/test_app/test/models/post_test.rb +9 -0
  86. data/test_app/test/test_helper.rb +20 -0
  87. metadata +97 -99
  88. data/Rakefile +0 -22
  89. data/example-project/.ruby-version +0 -1
  90. data/example-project/Gemfile +0 -67
  91. data/example-project/Gemfile.lock +0 -265
  92. data/example-project/app/assets/config/manifest.js +0 -3
  93. data/example-project/app/assets/javascripts/application.js +0 -16
  94. data/example-project/app/assets/javascripts/cable.js +0 -13
  95. data/example-project/app/assets/javascripts/channels/.keep +0 -0
  96. data/example-project/app/channels/application_cable/channel.rb +0 -4
  97. data/example-project/app/channels/application_cable/connection.rb +0 -4
  98. data/example-project/app/controllers/admin/users_controller.rb +0 -27
  99. data/example-project/app/controllers/concerns/.keep +0 -0
  100. data/example-project/app/controllers/users_controller.rb +0 -7
  101. data/example-project/app/jobs/application_job.rb +0 -2
  102. data/example-project/app/mailers/application_mailer.rb +0 -4
  103. data/example-project/app/models/concerns/.keep +0 -0
  104. data/example-project/app/models/user.rb +0 -3
  105. data/example-project/app/views/layouts/application.html.erb +0 -15
  106. data/example-project/app/views/layouts/mailer.html.erb +0 -13
  107. data/example-project/app/views/layouts/mailer.text.erb +0 -1
  108. data/example-project/bin/rails +0 -9
  109. data/example-project/bin/rake +0 -9
  110. data/example-project/bin/spring +0 -17
  111. data/example-project/bin/update +0 -31
  112. data/example-project/bin/yarn +0 -11
  113. data/example-project/config/application.rb +0 -19
  114. data/example-project/config/boot.rb +0 -4
  115. data/example-project/config/cable.yml +0 -10
  116. data/example-project/config/credentials.yml.enc +0 -1
  117. data/example-project/config/initializers/backtrace_silencers.rb +0 -7
  118. data/example-project/config/routes.rb +0 -10
  119. data/example-project/config/spring.rb +0 -6
  120. data/example-project/db/migrate/20181013145025_create_users.rb +0 -9
  121. data/example-project/lib/assets/.keep +0 -0
  122. data/example-project/lib/tasks/.keep +0 -0
  123. data/example-project/log/.keep +0 -0
  124. data/example-project/package.json +0 -5
  125. data/example-project/public/robots.txt +0 -1
  126. data/example-project/test/controllers/.keep +0 -0
  127. data/example-project/test/fixtures/.keep +0 -0
  128. data/example-project/test/fixtures/files/.keep +0 -0
  129. data/example-project/test/fixtures/users.yml +0 -7
  130. data/example-project/test/helpers/.keep +0 -0
  131. data/example-project/test/integration/.keep +0 -0
  132. data/example-project/test/mailers/.keep +0 -0
  133. data/example-project/test/models/.keep +0 -0
  134. data/example-project/test/models/user_test.rb +0 -7
  135. data/example-project/test/system/.keep +0 -0
  136. data/example-project/test/test_helper.rb +0 -10
  137. data/example-project/tmp/.keep +0 -0
  138. data/example-project/vendor/.keep +0 -0
@@ -1,7 +0,0 @@
1
- class UsersController < ApplicationController
2
- def destroy_avatar
3
- avatar = requested_resource.avatars.find(params[:attachment_id])
4
- avatar.purge
5
- redirect_back(fallback_location: requested_resource)
6
- end
7
- end
@@ -1,2 +0,0 @@
1
- class ApplicationJob < ActiveJob::Base
2
- end
@@ -1,4 +0,0 @@
1
- class ApplicationMailer < ActionMailer::Base
2
- default from: 'from@example.com'
3
- layout 'mailer'
4
- end
File without changes
@@ -1,3 +0,0 @@
1
- class User < ApplicationRecord
2
- has_many_attached :avatars
3
- end
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>ExampleProject</title>
5
- <%= csrf_meta_tags %>
6
- <%= csp_meta_tag %>
7
-
8
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
9
- <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
10
- </head>
11
-
12
- <body>
13
- <%= yield %>
14
- </body>
15
- </html>
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
- <style>
6
- /* Email styles need to be inline */
7
- </style>
8
- </head>
9
-
10
- <body>
11
- <%= yield %>
12
- </body>
13
- </html>
@@ -1 +0,0 @@
1
- <%= yield %>
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
- begin
3
- load File.expand_path('../spring', __FILE__)
4
- rescue LoadError => e
5
- raise unless e.message.include?('spring')
6
- end
7
- APP_PATH = File.expand_path('../config/application', __dir__)
8
- require_relative '../config/boot'
9
- require 'rails/commands'
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
- begin
3
- load File.expand_path('../spring', __FILE__)
4
- rescue LoadError => e
5
- raise unless e.message.include?('spring')
6
- end
7
- require_relative '../config/boot'
8
- require 'rake'
9
- Rake.application.run
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # This file loads spring without using Bundler, in order to be fast.
4
- # It gets overwritten when you run the `spring binstub` command.
5
-
6
- unless defined?(Spring)
7
- require 'rubygems'
8
- require 'bundler'
9
-
10
- lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
11
- spring = lockfile.specs.detect { |spec| spec.name == "spring" }
12
- if spring
13
- Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
14
- gem 'spring', spring.version
15
- require 'spring/binstub'
16
- end
17
- end
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'fileutils'
3
- include FileUtils
4
-
5
- # path to your application root.
6
- APP_ROOT = File.expand_path('..', __dir__)
7
-
8
- def system!(*args)
9
- system(*args) || abort("\n== Command #{args} failed ==")
10
- end
11
-
12
- chdir APP_ROOT do
13
- # This script is a way to update your development environment automatically.
14
- # Add necessary update steps to this file.
15
-
16
- puts '== Installing dependencies =='
17
- system! 'gem install bundler --conservative'
18
- system('bundle check') || system!('bundle install')
19
-
20
- # Install JavaScript dependencies if using Yarn
21
- # system('bin/yarn')
22
-
23
- puts "\n== Updating database =="
24
- system! 'bin/rails db:migrate'
25
-
26
- puts "\n== Removing old logs and tempfiles =="
27
- system! 'bin/rails log:clear tmp:clear'
28
-
29
- puts "\n== Restarting application server =="
30
- system! 'bin/rails restart'
31
- end
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path('..', __dir__)
3
- Dir.chdir(APP_ROOT) do
4
- begin
5
- exec "yarnpkg", *ARGV
6
- rescue Errno::ENOENT
7
- $stderr.puts "Yarn executable was not detected in the system."
8
- $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9
- exit 1
10
- end
11
- end
@@ -1,19 +0,0 @@
1
- require_relative 'boot'
2
-
3
- require 'rails/all'
4
-
5
- # Require the gems listed in Gemfile, including any gems
6
- # you've limited to :test, :development, or :production.
7
- Bundler.require(*Rails.groups)
8
-
9
- module ExampleProject
10
- class Application < Rails::Application
11
- # Initialize configuration defaults for originally generated Rails version.
12
- config.load_defaults 5.2
13
-
14
- # Settings in config/environments/* take precedence over those specified here.
15
- # Application configuration can go into files in config/initializers
16
- # -- all .rb files in that directory are automatically loaded after loading
17
- # the framework and any gems in your application.
18
- end
19
- end
@@ -1,4 +0,0 @@
1
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
-
3
- require 'bundler/setup' # Set up gems listed in the Gemfile.
4
- require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
@@ -1,10 +0,0 @@
1
- development:
2
- adapter: async
3
-
4
- test:
5
- adapter: async
6
-
7
- production:
8
- adapter: redis
9
- url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
- channel_prefix: example-project_production
@@ -1 +0,0 @@
1
- Ehr4/EeElhJG0oYPRPzBDgpo29xNONqYKwW7eG1zrUG2L4HBl8XH0cWIXJGnIe95RUibg3kTyPY/pMd23VTyYp8Kc/qaHhmIFoCifOOBpwwG86mOICY47DLYLJqWrEP5gbjvguUoZaJ7pPfv18Vf8nBZp+aE40VZeSPstzL4H4vMSUPx+1w3zEbWHspUrlc/ktceQLP50wlnWJexACYABzatad9ovmnUaQrnjpbhlQ2KWyDtpJQMCXJJHXcmg9NAeE43ugex08SwD02Kx0U/IU8jPT0tdGBBjWQ58l+pWsBxlcCQSGO7T5ZWIFGKoLXxJxoW5/ls9y3sgJ8U+pco4HpVMNTI2GhT3vWXjUB+NberL0fn8t13FNbbR5k4uOIa1lYh9WI/nswxVC8JfE+9//B1w66oZzaEbvYf--PvJQg5PW5ip6v60n--6ClFPpMWAoWltoXkRys2EA==
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,10 +0,0 @@
1
- Rails.application.routes.draw do
2
- namespace :admin do
3
- resources :users do
4
- delete :avatar, on: :member, action: :destroy_avatar
5
- end
6
-
7
- root to: "users#index"
8
- end
9
- # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
10
- end
@@ -1,6 +0,0 @@
1
- %w[
2
- .ruby-version
3
- .rbenv-vars
4
- tmp/restart.txt
5
- tmp/caching-dev.txt
6
- ].each { |path| Spring.watch(path) }
@@ -1,9 +0,0 @@
1
- class CreateUsers < ActiveRecord::Migration[5.2]
2
- def change
3
- create_table :users do |t|
4
- t.string :name
5
-
6
- t.timestamps
7
- end
8
- end
9
- end
File without changes
File without changes
File without changes
@@ -1,5 +0,0 @@
1
- {
2
- "name": "example-project",
3
- "private": true,
4
- "dependencies": {}
5
- }
@@ -1 +0,0 @@
1
- # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
File without changes
File without changes
File without changes
@@ -1,7 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
-
3
- one:
4
- name: MyString
5
-
6
- two:
7
- name: MyString
File without changes
File without changes
File without changes
File without changes
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class UserTest < ActiveSupport::TestCase
4
- # test "the truth" do
5
- # assert true
6
- # end
7
- end
File without changes
@@ -1,10 +0,0 @@
1
- ENV['RAILS_ENV'] ||= 'test'
2
- require_relative '../config/environment'
3
- require 'rails/test_help'
4
-
5
- class ActiveSupport::TestCase
6
- # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
7
- fixtures :all
8
-
9
- # Add more helper methods to be used by all tests here...
10
- end
File without changes
File without changes