administrate-field-active_storage 0.3.6 → 0.4.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.
Files changed (139) 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 +211 -0
  6. data/README.md +22 -3
  7. data/administrate-field-active_storage.gemspec +4 -3
  8. data/app/assets/stylesheets/administrate-field-active_storage/application.css +15 -0
  9. data/app/views/fields/active_storage/_form.html.erb +4 -1
  10. data/app/views/fields/active_storage/_index.html.erb +20 -12
  11. data/app/views/fields/active_storage/_item.html.erb +2 -1
  12. data/app/views/fields/active_storage/_items.html.erb +8 -1
  13. data/app/views/fields/active_storage/_preview.html.erb +8 -4
  14. data/app/views/fields/active_storage/_show.html.erb +1 -1
  15. data/config/i18n-tasks.yml +8 -0
  16. data/config/locales/administrate-field-active_storage.en.yml +10 -0
  17. data/config/locales/administrate-field-active_storage.ru.yml +10 -0
  18. data/contribute.md +1 -0
  19. data/lib/administrate/field/active_storage.rb +10 -1
  20. data/spec/i18n_spec.rb +35 -0
  21. data/test_app/.browserslistrc +1 -0
  22. data/test_app/.gitattributes +10 -0
  23. data/{example-project → test_app}/.gitignore +9 -7
  24. data/test_app/.ruby-version +1 -0
  25. data/test_app/Gemfile +45 -0
  26. data/test_app/Gemfile.lock +240 -0
  27. data/{example-project → test_app}/README.md +0 -0
  28. data/{example-project → test_app}/Rakefile +1 -1
  29. data/test_app/app/assets/config/manifest.js +4 -0
  30. data/{example-project → test_app}/app/assets/images/.keep +0 -0
  31. data/{example-project → test_app}/app/assets/stylesheets/application.css +0 -0
  32. data/{example-project → test_app}/app/controllers/admin/application_controller.rb +3 -3
  33. data/test_app/app/controllers/admin/posts_controller.rb +46 -0
  34. data/{example-project → test_app}/app/controllers/application_controller.rb +0 -0
  35. data/{example-project/app/dashboards/user_dashboard.rb → test_app/app/dashboards/post_dashboard.rb} +29 -27
  36. data/{example-project → test_app}/app/helpers/application_helper.rb +0 -0
  37. data/test_app/app/javascript/packs/application.js +10 -0
  38. data/{example-project → test_app}/app/models/application_record.rb +0 -0
  39. data/test_app/app/models/post.rb +3 -0
  40. data/test_app/app/views/layouts/application.html.erb +16 -0
  41. data/test_app/bin/bundle +114 -0
  42. data/test_app/bin/rails +4 -0
  43. data/test_app/bin/rake +4 -0
  44. data/{example-project → test_app}/bin/setup +6 -9
  45. data/test_app/config/application.rb +35 -0
  46. data/{example-project/bin/bundle → test_app/config/boot.rb} +2 -2
  47. data/test_app/config/credentials.yml.enc +1 -0
  48. data/{example-project → test_app}/config/database.yml +1 -1
  49. data/{example-project → test_app}/config/environment.rb +1 -1
  50. data/{example-project → test_app}/config/environments/development.rb +21 -11
  51. data/{example-project → test_app}/config/environments/production.rb +36 -24
  52. data/{example-project → test_app}/config/environments/test.rb +20 -14
  53. data/{example-project → test_app}/config/initializers/application_controller_renderer.rb +0 -0
  54. data/{example-project → test_app}/config/initializers/assets.rb +0 -0
  55. data/test_app/config/initializers/backtrace_silencers.rb +8 -0
  56. data/{example-project → test_app}/config/initializers/content_security_policy.rb +5 -0
  57. data/{example-project → test_app}/config/initializers/cookies_serializer.rb +0 -0
  58. data/{example-project → test_app}/config/initializers/filter_parameter_logging.rb +3 -1
  59. data/{example-project → test_app}/config/initializers/inflections.rb +0 -0
  60. data/{example-project → test_app}/config/initializers/mime_types.rb +0 -0
  61. data/test_app/config/initializers/permissions_policy.rb +11 -0
  62. data/{example-project → test_app}/config/initializers/wrap_parameters.rb +0 -0
  63. data/{example-project → test_app}/config/locales/en.yml +1 -1
  64. data/{example-project → test_app}/config/puma.rb +13 -4
  65. data/test_app/config/routes.rb +9 -0
  66. data/{example-project → test_app}/config/storage.yml +0 -0
  67. data/{example-project → test_app}/config.ru +2 -1
  68. 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
  69. data/test_app/db/migrate/20210118122927_create_posts.rb +8 -0
  70. data/{example-project → test_app}/db/schema.rb +18 -10
  71. data/{example-project → test_app}/db/seeds.rb +1 -1
  72. data/test_app/lib/active_storage/fixture_set.rb +71 -0
  73. data/{example-project → test_app}/public/404.html +0 -0
  74. data/{example-project → test_app}/public/422.html +0 -0
  75. data/{example-project → test_app}/public/500.html +0 -0
  76. data/{example-project → test_app}/public/apple-touch-icon-precomposed.png +0 -0
  77. data/{example-project → test_app}/public/apple-touch-icon.png +0 -0
  78. data/{example-project → test_app}/public/favicon.ico +0 -0
  79. data/test_app/public/robots.txt +1 -0
  80. data/{example-project → test_app}/test/application_system_test_case.rb +0 -0
  81. data/test_app/test/controllers/admin/posts_controller_test.rb +14 -0
  82. data/test_app/test/fixtures/active_storage/attachments.yml +4 -0
  83. data/test_app/test/fixtures/active_storage/blobs.yml +2 -0
  84. data/test_app/test/fixtures/files/cover_image.jpg +0 -0
  85. data/test_app/test/fixtures/posts.yml +11 -0
  86. data/test_app/test/models/post_test.rb +9 -0
  87. data/test_app/test/test_helper.rb +20 -0
  88. metadata +100 -101
  89. data/Rakefile +0 -22
  90. data/example-project/.ruby-version +0 -1
  91. data/example-project/Gemfile +0 -67
  92. data/example-project/Gemfile.lock +0 -265
  93. data/example-project/app/assets/config/manifest.js +0 -3
  94. data/example-project/app/assets/javascripts/application.js +0 -16
  95. data/example-project/app/assets/javascripts/cable.js +0 -13
  96. data/example-project/app/assets/javascripts/channels/.keep +0 -0
  97. data/example-project/app/channels/application_cable/channel.rb +0 -4
  98. data/example-project/app/channels/application_cable/connection.rb +0 -4
  99. data/example-project/app/controllers/admin/users_controller.rb +0 -27
  100. data/example-project/app/controllers/concerns/.keep +0 -0
  101. data/example-project/app/controllers/users_controller.rb +0 -7
  102. data/example-project/app/jobs/application_job.rb +0 -2
  103. data/example-project/app/mailers/application_mailer.rb +0 -4
  104. data/example-project/app/models/concerns/.keep +0 -0
  105. data/example-project/app/models/user.rb +0 -3
  106. data/example-project/app/views/layouts/application.html.erb +0 -15
  107. data/example-project/app/views/layouts/mailer.html.erb +0 -13
  108. data/example-project/app/views/layouts/mailer.text.erb +0 -1
  109. data/example-project/bin/rails +0 -9
  110. data/example-project/bin/rake +0 -9
  111. data/example-project/bin/spring +0 -17
  112. data/example-project/bin/update +0 -31
  113. data/example-project/bin/yarn +0 -11
  114. data/example-project/config/application.rb +0 -19
  115. data/example-project/config/boot.rb +0 -4
  116. data/example-project/config/cable.yml +0 -10
  117. data/example-project/config/credentials.yml.enc +0 -1
  118. data/example-project/config/initializers/backtrace_silencers.rb +0 -7
  119. data/example-project/config/routes.rb +0 -10
  120. data/example-project/config/spring.rb +0 -6
  121. data/example-project/db/migrate/20181013145025_create_users.rb +0 -9
  122. data/example-project/lib/assets/.keep +0 -0
  123. data/example-project/lib/tasks/.keep +0 -0
  124. data/example-project/log/.keep +0 -0
  125. data/example-project/package.json +0 -5
  126. data/example-project/public/robots.txt +0 -1
  127. data/example-project/test/controllers/.keep +0 -0
  128. data/example-project/test/fixtures/.keep +0 -0
  129. data/example-project/test/fixtures/files/.keep +0 -0
  130. data/example-project/test/fixtures/users.yml +0 -7
  131. data/example-project/test/helpers/.keep +0 -0
  132. data/example-project/test/integration/.keep +0 -0
  133. data/example-project/test/mailers/.keep +0 -0
  134. data/example-project/test/models/.keep +0 -0
  135. data/example-project/test/models/user_test.rb +0 -7
  136. data/example-project/test/system/.keep +0 -0
  137. data/example-project/test/test_helper.rb +0 -10
  138. data/example-project/tmp/.keep +0 -0
  139. data/example-project/vendor/.keep +0 -0
@@ -1,16 +0,0 @@
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, or any plugin's
5
- // 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 turbolinks
16
- //= require_tree .
@@ -1,13 +0,0 @@
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);
@@ -1,4 +0,0 @@
1
- module ApplicationCable
2
- class Channel < ActionCable::Channel::Base
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module ApplicationCable
2
- class Connection < ActionCable::Connection::Base
3
- end
4
- end
@@ -1,27 +0,0 @@
1
- module Admin
2
- class UsersController < Admin::ApplicationController
3
- # To customize the behavior of this controller,
4
- # you can overwrite any of the RESTful actions. For example:
5
- #
6
- def index
7
- super
8
- @resources = User.with_attached_avatars.
9
- page(params[:page]).
10
- per(10)
11
- end
12
-
13
- # Define a custom finder by overriding the `find_resource` method:
14
- # def find_resource(param)
15
- # User.find_by!(slug: param)
16
- # end
17
-
18
- # See https://administrate-prototype.herokuapp.com/customizing_controller_actions
19
- # for more information
20
-
21
- def destroy_avatar
22
- avatar = requested_resource.avatars.find(params[:attachment_id])
23
- avatar.purge
24
- redirect_back(fallback_location: requested_resource)
25
- end
26
- end
27
- end
File without changes
@@ -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