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.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +21 -0
- data/.gitignore +0 -1
- data/.ruby-version +1 -1
- data/Gemfile.lock +211 -0
- data/README.md +22 -3
- data/administrate-field-active_storage.gemspec +4 -3
- data/app/assets/stylesheets/administrate-field-active_storage/application.css +15 -0
- data/app/views/fields/active_storage/_form.html.erb +4 -1
- data/app/views/fields/active_storage/_index.html.erb +20 -12
- data/app/views/fields/active_storage/_item.html.erb +2 -1
- data/app/views/fields/active_storage/_items.html.erb +8 -1
- data/app/views/fields/active_storage/_preview.html.erb +8 -4
- data/app/views/fields/active_storage/_show.html.erb +1 -1
- data/config/i18n-tasks.yml +8 -0
- data/config/locales/administrate-field-active_storage.en.yml +10 -0
- data/config/locales/administrate-field-active_storage.ru.yml +10 -0
- data/contribute.md +1 -0
- data/lib/administrate/field/active_storage.rb +10 -1
- data/spec/i18n_spec.rb +35 -0
- data/test_app/.browserslistrc +1 -0
- data/test_app/.gitattributes +10 -0
- data/{example-project → test_app}/.gitignore +9 -7
- data/test_app/.ruby-version +1 -0
- data/test_app/Gemfile +45 -0
- data/test_app/Gemfile.lock +240 -0
- data/{example-project → test_app}/README.md +0 -0
- data/{example-project → test_app}/Rakefile +1 -1
- data/test_app/app/assets/config/manifest.js +4 -0
- data/{example-project → test_app}/app/assets/images/.keep +0 -0
- data/{example-project → test_app}/app/assets/stylesheets/application.css +0 -0
- data/{example-project → test_app}/app/controllers/admin/application_controller.rb +3 -3
- data/test_app/app/controllers/admin/posts_controller.rb +46 -0
- data/{example-project → test_app}/app/controllers/application_controller.rb +0 -0
- data/{example-project/app/dashboards/user_dashboard.rb → test_app/app/dashboards/post_dashboard.rb} +29 -27
- data/{example-project → test_app}/app/helpers/application_helper.rb +0 -0
- data/test_app/app/javascript/packs/application.js +10 -0
- data/{example-project → test_app}/app/models/application_record.rb +0 -0
- data/test_app/app/models/post.rb +3 -0
- data/test_app/app/views/layouts/application.html.erb +16 -0
- data/test_app/bin/bundle +114 -0
- data/test_app/bin/rails +4 -0
- data/test_app/bin/rake +4 -0
- data/{example-project → test_app}/bin/setup +6 -9
- data/test_app/config/application.rb +35 -0
- data/{example-project/bin/bundle → test_app/config/boot.rb} +2 -2
- data/test_app/config/credentials.yml.enc +1 -0
- data/{example-project → test_app}/config/database.yml +1 -1
- data/{example-project → test_app}/config/environment.rb +1 -1
- data/{example-project → test_app}/config/environments/development.rb +21 -11
- data/{example-project → test_app}/config/environments/production.rb +36 -24
- data/{example-project → test_app}/config/environments/test.rb +20 -14
- data/{example-project → test_app}/config/initializers/application_controller_renderer.rb +0 -0
- data/{example-project → test_app}/config/initializers/assets.rb +0 -0
- data/test_app/config/initializers/backtrace_silencers.rb +8 -0
- data/{example-project → test_app}/config/initializers/content_security_policy.rb +5 -0
- data/{example-project → test_app}/config/initializers/cookies_serializer.rb +0 -0
- data/{example-project → test_app}/config/initializers/filter_parameter_logging.rb +3 -1
- data/{example-project → test_app}/config/initializers/inflections.rb +0 -0
- data/{example-project → test_app}/config/initializers/mime_types.rb +0 -0
- data/test_app/config/initializers/permissions_policy.rb +11 -0
- data/{example-project → test_app}/config/initializers/wrap_parameters.rb +0 -0
- data/{example-project → test_app}/config/locales/en.yml +1 -1
- data/{example-project → test_app}/config/puma.rb +13 -4
- data/test_app/config/routes.rb +9 -0
- data/{example-project → test_app}/config/storage.yml +0 -0
- data/{example-project → test_app}/config.ru +2 -1
- 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
- data/test_app/db/migrate/20210118122927_create_posts.rb +8 -0
- data/{example-project → test_app}/db/schema.rb +18 -10
- data/{example-project → test_app}/db/seeds.rb +1 -1
- data/test_app/lib/active_storage/fixture_set.rb +71 -0
- data/{example-project → test_app}/public/404.html +0 -0
- data/{example-project → test_app}/public/422.html +0 -0
- data/{example-project → test_app}/public/500.html +0 -0
- data/{example-project → test_app}/public/apple-touch-icon-precomposed.png +0 -0
- data/{example-project → test_app}/public/apple-touch-icon.png +0 -0
- data/{example-project → test_app}/public/favicon.ico +0 -0
- data/test_app/public/robots.txt +1 -0
- data/{example-project → test_app}/test/application_system_test_case.rb +0 -0
- data/test_app/test/controllers/admin/posts_controller_test.rb +14 -0
- data/test_app/test/fixtures/active_storage/attachments.yml +4 -0
- data/test_app/test/fixtures/active_storage/blobs.yml +2 -0
- data/test_app/test/fixtures/files/cover_image.jpg +0 -0
- data/test_app/test/fixtures/posts.yml +11 -0
- data/test_app/test/models/post_test.rb +9 -0
- data/test_app/test/test_helper.rb +20 -0
- metadata +100 -101
- data/Rakefile +0 -22
- data/example-project/.ruby-version +0 -1
- data/example-project/Gemfile +0 -67
- data/example-project/Gemfile.lock +0 -265
- data/example-project/app/assets/config/manifest.js +0 -3
- data/example-project/app/assets/javascripts/application.js +0 -16
- data/example-project/app/assets/javascripts/cable.js +0 -13
- data/example-project/app/assets/javascripts/channels/.keep +0 -0
- data/example-project/app/channels/application_cable/channel.rb +0 -4
- data/example-project/app/channels/application_cable/connection.rb +0 -4
- data/example-project/app/controllers/admin/users_controller.rb +0 -27
- data/example-project/app/controllers/concerns/.keep +0 -0
- data/example-project/app/controllers/users_controller.rb +0 -7
- data/example-project/app/jobs/application_job.rb +0 -2
- data/example-project/app/mailers/application_mailer.rb +0 -4
- data/example-project/app/models/concerns/.keep +0 -0
- data/example-project/app/models/user.rb +0 -3
- data/example-project/app/views/layouts/application.html.erb +0 -15
- data/example-project/app/views/layouts/mailer.html.erb +0 -13
- data/example-project/app/views/layouts/mailer.text.erb +0 -1
- data/example-project/bin/rails +0 -9
- data/example-project/bin/rake +0 -9
- data/example-project/bin/spring +0 -17
- data/example-project/bin/update +0 -31
- data/example-project/bin/yarn +0 -11
- data/example-project/config/application.rb +0 -19
- data/example-project/config/boot.rb +0 -4
- data/example-project/config/cable.yml +0 -10
- data/example-project/config/credentials.yml.enc +0 -1
- data/example-project/config/initializers/backtrace_silencers.rb +0 -7
- data/example-project/config/routes.rb +0 -10
- data/example-project/config/spring.rb +0 -6
- data/example-project/db/migrate/20181013145025_create_users.rb +0 -9
- data/example-project/lib/assets/.keep +0 -0
- data/example-project/lib/tasks/.keep +0 -0
- data/example-project/log/.keep +0 -0
- data/example-project/package.json +0 -5
- data/example-project/public/robots.txt +0 -1
- data/example-project/test/controllers/.keep +0 -0
- data/example-project/test/fixtures/.keep +0 -0
- data/example-project/test/fixtures/files/.keep +0 -0
- data/example-project/test/fixtures/users.yml +0 -7
- data/example-project/test/helpers/.keep +0 -0
- data/example-project/test/integration/.keep +0 -0
- data/example-project/test/mailers/.keep +0 -0
- data/example-project/test/models/.keep +0 -0
- data/example-project/test/models/user_test.rb +0 -7
- data/example-project/test/system/.keep +0 -0
- data/example-project/test/test_helper.rb +0 -10
- data/example-project/tmp/.keep +0 -0
- 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);
|
|
File without changes
|
|
@@ -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
|
|
File without changes
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
<%= yield %>
|
data/example-project/bin/rails
DELETED
|
@@ -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'
|
data/example-project/bin/rake
DELETED
data/example-project/bin/spring
DELETED
|
@@ -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
|
data/example-project/bin/update
DELETED
|
@@ -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
|
data/example-project/bin/yarn
DELETED
|
@@ -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 +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
|
|
File without changes
|
|
File without changes
|
data/example-project/log/.keep
DELETED
|
File without changes
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
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
|
data/example-project/tmp/.keep
DELETED
|
File without changes
|
|
File without changes
|