3 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
Media
17 |
18 |
19 | <%= form_tag '/delete_media', method: :delete do %>
20 | <%= submit_tag 'Delete', id: 'delete', class: 'btn btn-danger', disabled: @media_contents.empty? %>
21 |
22 |
23 |
24 | <% if @media_contents.empty? %>
25 |
26 | <% else %>
27 | <% @media_contents.each do |media| %>
28 |
29 |
30 | <%= image_tag media.file_name.url %>
31 |
32 |
33 | <%= check_box_tag 'media_contents[]', media.id %>
34 |
35 |
36 |
37 |
38 | <% end %>
39 | <% end %>
40 |
41 |
42 | <% end %>
43 |
44 |
45 | <%= link_to 'Delete All', delete_all_path, method: :delete, id: 'delete-all', class: 'btn btn-danger', disabled: @media_contents.empty? %>
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
60 |
61 | <%= form_tag '/media_contents', method: :post, class: 'dropzone form', id: 'media-dropzone' do %>
62 |
63 | <%= file_field_tag 'media', multiple: true %>
64 |
65 | <% end %>
66 |
67 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/bin/spring:
--------------------------------------------------------------------------------
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 | if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m)
11 | ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
12 | ENV["GEM_HOME"] = ""
13 | Gem.paths = ENV
14 |
15 | gem "spring", match[1]
16 | require "spring/binstub"
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
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 DropzoneSample
10 | class Application < Rails::Application
11 | # Settings in config/environments/* take precedence over those specified here.
12 | # Application configuration should go into files in config/initializers
13 | # -- all .rb files in that directory are automatically loaded.
14 |
15 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17 | # config.time_zone = 'Central Time (US & Canada)'
18 |
19 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21 | # config.i18n.default_locale = :de
22 | config.active_record.raise_in_transactional_callbacks = true
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | # SQLite version 3.x
2 | # gem install sqlite3
3 | #
4 | # Ensure the SQLite 3 gem is defined in your Gemfile
5 | # gem 'sqlite3'
6 | #
7 | default: &default
8 | adapter: sqlite3
9 | pool: 5
10 | timeout: 5000
11 |
12 | development:
13 | <<: *default
14 | database: db/development.sqlite3
15 |
16 | # Warning: The database defined as "test" will be erased and
17 | # re-generated from your development database when you run "rake".
18 | # Do not set this db to the same as development or production.
19 | test:
20 | <<: *default
21 | database: db/test.sqlite3
22 |
23 | production:
24 | <<: *default
25 | database: db/production.sqlite3
26 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Do not eager load code on boot.
10 | config.eager_load = false
11 |
12 | # Show full error reports and disable caching.
13 | config.consider_all_requests_local = true
14 | config.action_controller.perform_caching = false
15 |
16 | # Don't care if the mailer can't send.
17 | config.action_mailer.raise_delivery_errors = false
18 |
19 | # Print deprecation notices to the Rails logger.
20 | config.active_support.deprecation = :log
21 |
22 | # Raise an error on page load if there are pending migrations.
23 | config.active_record.migration_error = :page_load
24 |
25 | # Debug mode disables concatenation and preprocessing of assets.
26 | # This option may cause significant delays in view rendering with a large
27 | # number of complex assets.
28 | config.assets.debug = true
29 |
30 | # Adds additional error checking when serving assets at runtime.
31 | # Checks for improperly declared sprockets dependencies.
32 | # Raises helpful error messages.
33 | config.assets.raise_runtime_errors = true
34 |
35 | # Raises error for missing translations
36 | # config.action_view.raise_on_missing_translations = true
37 | end
38 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # Code is not reloaded between requests.
5 | config.cache_classes = true
6 |
7 | # Eager load code on boot. This eager loads most of Rails and
8 | # your application in memory, allowing both threaded web servers
9 | # and those relying on copy on write to perform better.
10 | # Rake tasks automatically ignore this option for performance.
11 | config.eager_load = true
12 |
13 | # Full error reports are disabled and caching is turned on.
14 | config.consider_all_requests_local = false
15 | config.action_controller.perform_caching = true
16 |
17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application
18 | # Add `rack-cache` to your Gemfile before enabling this.
19 | # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20 | # config.action_dispatch.rack_cache = true
21 |
22 | # Disable Rails's static asset server (Apache or nginx will already do this).
23 | config.serve_static_assets = false
24 |
25 | # Compress JavaScripts and CSS.
26 | config.assets.js_compressor = :uglifier
27 | # config.assets.css_compressor = :sass
28 |
29 | # Do not fallback to assets pipeline if a precompiled asset is missed.
30 | config.assets.compile = true
31 |
32 | # Generate digests for assets URLs.
33 | config.assets.digest = true
34 |
35 | # `config.assets.precompile` has moved to config/initializers/assets.rb
36 |
37 | # Specifies the header that your server uses for sending files.
38 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
39 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
40 |
41 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
42 | # config.force_ssl = true
43 |
44 | # Set to :debug to see everything in the log.
45 | config.log_level = :info
46 |
47 | # Prepend all log lines with the following tags.
48 | # config.log_tags = [ :subdomain, :uuid ]
49 |
50 | # Use a different logger for distributed setups.
51 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
52 |
53 | # Use a different cache store in production.
54 | # config.cache_store = :mem_cache_store
55 |
56 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
57 | # config.action_controller.asset_host = "http://assets.example.com"
58 |
59 | # Precompile additional assets.
60 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
61 | # config.assets.precompile += %w( search.js )
62 |
63 | # Ignore bad email addresses and do not raise email delivery errors.
64 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
65 | # config.action_mailer.raise_delivery_errors = false
66 |
67 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
68 | # the I18n.default_locale when a translation cannot be found).
69 | config.i18n.fallbacks = true
70 |
71 | # Send deprecation notices to registered listeners.
72 | config.active_support.deprecation = :notify
73 |
74 | # Disable automatic flushing of the log to improve performance.
75 | # config.autoflush_log = false
76 |
77 | # Use default logging formatter so that PID and timestamp are not suppressed.
78 | config.log_formatter = ::Logger::Formatter.new
79 |
80 | # Do not dump schema after migrations.
81 | config.active_record.dump_schema_after_migration = false
82 | end
83 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure static asset server for tests with Cache-Control for performance.
16 | config.serve_static_assets = true
17 | config.static_cache_control = 'public, max-age=3600'
18 |
19 | # Show full error reports and disable caching.
20 | config.consider_all_requests_local = true
21 | config.action_controller.perform_caching = false
22 |
23 | # Raise exceptions instead of rendering exception templates.
24 | config.action_dispatch.show_exceptions = false
25 |
26 | # Disable request forgery protection in test environment.
27 | config.action_controller.allow_forgery_protection = false
28 |
29 | # Tell Action Mailer not to deliver emails to the real world.
30 | # The :test delivery method accumulates sent emails in the
31 | # ActionMailer::Base.deliveries array.
32 | config.action_mailer.delivery_method = :test
33 |
34 | # Print deprecation notices to the stderr.
35 | config.active_support.deprecation = :stderr
36 |
37 | # Raises error for missing translations
38 | # config.action_view.raise_on_missing_translations = true
39 | end
40 |
--------------------------------------------------------------------------------
/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Version of your assets, change this if you want to expire all your assets.
4 | Rails.application.config.assets.version = '1.0'
5 |
6 | # Precompile additional assets.
7 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
8 | # Rails.application.config.assets.precompile += %w( search.js )
9 |
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
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!
8 |
--------------------------------------------------------------------------------
/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym 'RESTful'
16 | # end
17 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_dropzone-sample_session'
4 |
--------------------------------------------------------------------------------
/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
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
15 |
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
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"
24 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | # The priority is based upon order of creation: first created -> highest priority.
3 | # See how all your routes lay out with "rake routes".
4 |
5 | # You can have the root of your site routed with "root"
6 | # root 'welcome#index'
7 |
8 | root 'media_contents#index'
9 |
10 | resources :media_contents, only: [:create]
11 |
12 | delete 'delete_media', to: "media_contents#delete_media"
13 | delete 'delete_all', to: 'media_contents#delete_all'
14 | # Example of regular route:
15 | # get 'products/:id' => 'catalog#view'
16 |
17 | # Example of named route that can be invoked with purchase_url(id: product.id)
18 | # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
19 |
20 | # Example resource route (maps HTTP verbs to controller actions automatically):
21 | # resources :products
22 |
23 | # Example resource route with options:
24 | # resources :products do
25 | # member do
26 | # get 'short'
27 | # post 'toggle'
28 | # end
29 | #
30 | # collection do
31 | # get 'sold'
32 | # end
33 | # end
34 |
35 | # Example resource route with sub-resources:
36 | # resources :products do
37 | # resources :comments, :sales
38 | # resource :seller
39 | # end
40 |
41 | # Example resource route with more complex sub-resources:
42 | # resources :products do
43 | # resources :comments
44 | # resources :sales do
45 | # get 'recent', on: :collection
46 | # end
47 | # end
48 |
49 | # Example resource route with concerns:
50 | # concern :toggleable do
51 | # post 'toggle'
52 | # end
53 | # resources :posts, concerns: :toggleable
54 | # resources :photos, concerns: :toggleable
55 |
56 | # Example resource route within a namespace:
57 | # namespace :admin do
58 | # # Directs /admin/products/* to Admin::ProductsController
59 | # # (app/controllers/admin/products_controller.rb)
60 | # resources :products
61 | # end
62 | end
63 |
--------------------------------------------------------------------------------
/config/secrets.yml:
--------------------------------------------------------------------------------
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 the secrets in this file are kept private
11 | # if you're sharing your code publicly.
12 |
13 | development:
14 | secret_key_base: 6f719d77a9cdeae68534d30c9054a43c1e8a4f61d22fba58e83bcf9010e43cf649444d5961389f475bb8887bb3ac53d12ee5d5e5a2404681a1b49638c348370c
15 |
16 | test:
17 | secret_key_base: 35cf08fd5058ab239e4992b1929bd541c13da6e7020cf78b1849ccccf9fc7e1aa0e813df03f87aa5111bdcaefc0fa76ff0944433fb2ef40394037d5b6f380e75
18 |
19 | # Do not keep production secrets in the repository,
20 | # instead read values from the environment.
21 | production:
22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
23 |
--------------------------------------------------------------------------------
/db/migrate/20141122202757_create_media.rb:
--------------------------------------------------------------------------------
1 | class CreateMedia < ActiveRecord::Migration
2 | def change
3 | create_table :media do |t|
4 | t.string :file_name
5 |
6 | t.timestamps
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # encoding: UTF-8
2 | # This file is auto-generated from the current state of the database. Instead
3 | # of editing this file, please use the migrations feature of Active Record to
4 | # incrementally modify your database, and then regenerate this schema definition.
5 | #
6 | # Note that this schema.rb definition is the authoritative source for your
7 | # database schema. If you need to create the application database on another
8 | # system, you should be using db:schema:load, not running all the migrations
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10 | # you'll amass, the slower it'll run and the greater likelihood for issues).
11 | #
12 | # It's strongly recommended that you check this file into your version control system.
13 |
14 | ActiveRecord::Schema.define(version: 20141122202757) do
15 |
16 | create_table "media", force: :cascade do |t|
17 | t.string "file_name"
18 | t.datetime "created_at"
19 | t.datetime "updated_at"
20 | end
21 |
22 | end
23 |
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7 | # Mayor.create(name: 'Emanuel', city: cities.first)
8 |
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/lib/assets/.keep
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/lib/tasks/.keep
--------------------------------------------------------------------------------
/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/log/.keep
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
The change you wanted was rejected (422)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The change you wanted was rejected.
62 |
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
If you are the application owner check the logs for more information.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/public/favicon.ico
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/test/controllers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/test/controllers/.keep
--------------------------------------------------------------------------------
/test/controllers/media_contents_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class MediaContentsControllerTest < ActionController::TestCase
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/test/fixtures/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/test/fixtures/.keep
--------------------------------------------------------------------------------
/test/fixtures/media.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 |
3 | one:
4 | file_name: MyString
5 |
6 | two:
7 | file_name: MyString
8 |
--------------------------------------------------------------------------------
/test/helpers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/test/helpers/.keep
--------------------------------------------------------------------------------
/test/helpers/media_contents_helper_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class MediaContentsHelperTest < ActionView::TestCase
4 | end
5 |
--------------------------------------------------------------------------------
/test/integration/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/test/integration/.keep
--------------------------------------------------------------------------------
/test/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/test/mailers/.keep
--------------------------------------------------------------------------------
/test/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/test/models/.keep
--------------------------------------------------------------------------------
/test/models/media_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class MediaTest < ActiveSupport::TestCase
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | ENV['RAILS_ENV'] ||= 'test'
2 | require File.expand_path('../../config/environment', __FILE__)
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
11 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/vendor/assets/javascripts/alertify.js:
--------------------------------------------------------------------------------
1 | (function() {
2 |
3 | "use strict";
4 |
5 | var TRANSITION_FALLBACK_DURATION = 500;
6 | var hideElement = function(el) {
7 |
8 | if (! el) {
9 | return;
10 | }
11 |
12 | var removeThis = function() {
13 | if (el && el.parentNode) {
14 | el.parentNode.removeChild(el);
15 | }
16 | };
17 |
18 | el.classList.remove("show");
19 | el.classList.add("hide");
20 | el.addEventListener("transitionend", removeThis);
21 |
22 | // Fallback for no transitions.
23 | setTimeout(removeThis, TRANSITION_FALLBACK_DURATION);
24 |
25 | };
26 |
27 | function Alertify() {
28 |
29 | /**
30 | * Alertify private object
31 | * @type {Object}
32 | */
33 | var _alertify = {
34 |
35 | parent: document.body,
36 | version: "1.0.10",
37 | defaultOkLabel: "Ok",
38 | okLabel: "Ok",
39 | defaultCancelLabel: "Cancel",
40 | cancelLabel: "Cancel",
41 | defaultMaxLogItems: 2,
42 | maxLogItems: 2,
43 | promptValue: "",
44 | promptPlaceholder: "",
45 | closeLogOnClick: false,
46 | closeLogOnClickDefault: false,
47 | delay: 5000,
48 | defaultDelay: 5000,
49 | logContainerClass: "alertify-logs",
50 | logContainerDefaultClass: "alertify-logs",
51 | dialogs: {
52 | buttons: {
53 | holder: "
",
54 | ok: "
",
55 | cancel: "
"
56 | },
57 | input: "
",
58 | message: "
{{message}}
",
59 | log: "
{{message}}
"
60 | },
61 |
62 | defaultDialogs: {
63 | buttons: {
64 | holder: "
",
65 | ok: "
",
66 | cancel: "
"
67 | },
68 | input: "
",
69 | message: "
{{message}}
",
70 | log: "
{{message}}
"
71 | },
72 |
73 | /**
74 | * Build the proper message box
75 | *
76 | * @param {Object} item Current object in the queue
77 | *
78 | * @return {String} An HTML string of the message box
79 | */
80 | build: function(item) {
81 |
82 | var btnTxt = this.dialogs.buttons.ok;
83 | var html = "
" + "
" + this.dialogs.message.replace("{{message}}", item.message);
84 |
85 | if(item.type === "confirm" || item.type === "prompt") {
86 | btnTxt = this.dialogs.buttons.cancel + this.dialogs.buttons.ok;
87 | }
88 |
89 | if (item.type === "prompt") {
90 | html += this.dialogs.input;
91 | }
92 |
93 | html = (html + this.dialogs.buttons.holder + "
" + "
")
94 | .replace("{{buttons}}", btnTxt)
95 | .replace("{{ok}}", this.okLabel)
96 | .replace("{{cancel}}", this.cancelLabel);
97 |
98 | return html;
99 |
100 | },
101 |
102 | setCloseLogOnClick: function(bool) {
103 | this.closeLogOnClick = !! bool;
104 | },
105 |
106 | /**
107 | * Close the log messages
108 | *
109 | * @param {Object} elem HTML Element of log message to close
110 | * @param {Number} wait [optional] Time (in ms) to wait before automatically hiding the message, if 0 never hide
111 | *
112 | * @return {undefined}
113 | */
114 | close: function(elem, wait) {
115 |
116 | if (this.closeLogOnClick) {
117 | elem.addEventListener("click", function() {
118 | hideElement(elem);
119 | });
120 | }
121 |
122 | wait = wait && !isNaN(+wait) ? +wait : this.delay;
123 |
124 | if (wait < 0) {
125 | hideElement(elem);
126 | } else if(wait > 0) {
127 | setTimeout(function() {
128 | hideElement(elem);
129 | }, wait);
130 | }
131 |
132 | },
133 |
134 | /**
135 | * Create a dialog box
136 | *
137 | * @param {String} message The message passed from the callee
138 | * @param {String} type Type of dialog to create
139 | * @param {Function} onOkay [Optional] Callback function when clicked okay.
140 | * @param {Function} onCancel [Optional] Callback function when cancelled.
141 | *
142 | * @return {Object}
143 | */
144 | dialog: function(message, type, onOkay, onCancel) {
145 | return this.setup({
146 | type: type,
147 | message: message,
148 | onOkay: onOkay,
149 | onCancel: onCancel
150 | });
151 | },
152 |
153 | /**
154 | * Show a new log message box
155 | *
156 | * @param {String} message The message passed from the callee
157 | * @param {String} type [Optional] Optional type of log message
158 | * @param {Number} wait [Optional] Time (in ms) to wait before auto-hiding the log
159 | *
160 | * @return {Object}
161 | */
162 | log: function(message, type, click) {
163 |
164 | var existing = document.querySelectorAll(".alertify-logs > div");
165 | if (existing) {
166 | var diff = existing.length - this.maxLogItems;
167 | if (diff >= 0) {
168 | for (var i = 0, _i = diff + 1; i < _i; i++) {
169 | this.close(existing[i], -1);
170 | }
171 | }
172 | }
173 |
174 | this.notify(message, type, click);
175 | },
176 |
177 | setLogPosition: function(str) {
178 | this.logContainerClass = "alertify-logs " + str;
179 | },
180 |
181 | setupLogContainer: function() {
182 |
183 | var elLog = document.querySelector(".alertify-logs");
184 | var className = this.logContainerClass;
185 | if (! elLog) {
186 | elLog = document.createElement("div");
187 | elLog.className = className;
188 | this.parent.appendChild(elLog);
189 | }
190 |
191 | // Make sure it's positioned properly.
192 | if (elLog.className !== className) {
193 | elLog.className = className;
194 | }
195 |
196 | return elLog;
197 |
198 | },
199 |
200 | /**
201 | * Add new log message
202 | * If a type is passed, a class name "{type}" will get added.
203 | * This allows for custom look and feel for various types of notifications.
204 | *
205 | * @param {String} message The message passed from the callee
206 | * @param {String} type [Optional] Type of log message
207 | * @param {Number} wait [Optional] Time (in ms) to wait before auto-hiding
208 | *
209 | * @return {undefined}
210 | */
211 | notify: function(message, type, click) {
212 |
213 | var elLog = this.setupLogContainer();
214 | var log = document.createElement("div");
215 |
216 | log.className = (type || "default");
217 | if (_alertify.logTemplateMethod) {
218 | log.innerHTML = _alertify.logTemplateMethod(message);
219 | } else {
220 | log.innerHTML = message;
221 | }
222 |
223 | // Add the click handler, if specified.
224 | if ("function" === typeof click) {
225 | log.addEventListener("click", click);
226 | }
227 |
228 | elLog.appendChild(log);
229 | setTimeout(function() {
230 | log.className += " show";
231 | }, 10);
232 |
233 | this.close(log, this.delay);
234 |
235 | },
236 |
237 | /**
238 | * Initiate all the required pieces for the dialog box
239 | *
240 | * @return {undefined}
241 | */
242 | setup: function(item) {
243 |
244 | var el = document.createElement("div");
245 | el.className = "alertify hide";
246 | el.innerHTML = this.build(item);
247 |
248 | var btnOK = el.querySelector(".ok");
249 | var btnCancel = el.querySelector(".cancel");
250 | var input = el.querySelector("input");
251 | var label = el.querySelector("label");
252 |
253 | // Set default value/placeholder of input
254 | if (input) {
255 | if (typeof this.promptPlaceholder === "string") {
256 | // Set the label, if available, for MDL, etc.
257 | if (label) {
258 | label.textContent = this.promptPlaceholder;
259 | } else {
260 | input.placeholder = this.promptPlaceholder;
261 | }
262 | }
263 | if (typeof this.promptValue === "string") {
264 | input.value = this.promptValue;
265 | }
266 | }
267 |
268 | function setupHandlers(resolve) {
269 | if ("function" !== typeof resolve) {
270 | // promises are not available so resolve is a no-op
271 | resolve = function () {};
272 | }
273 |
274 | if (btnOK) {
275 | btnOK.addEventListener("click", function(ev) {
276 | if (item.onOkay && "function" === typeof item.onOkay) {
277 | if (input) {
278 | item.onOkay(input.value, ev);
279 | } else {
280 | item.onOkay(ev);
281 | }
282 | }
283 |
284 | if (input) {
285 | resolve({
286 | buttonClicked: "ok",
287 | inputValue: input.value,
288 | event: ev
289 | });
290 | } else {
291 | resolve({
292 | buttonClicked: "ok",
293 | event: ev
294 | });
295 | }
296 |
297 | hideElement(el);
298 | });
299 | }
300 |
301 | if (btnCancel) {
302 | btnCancel.addEventListener("click", function(ev) {
303 | if (item.onCancel && "function" === typeof item.onCancel) {
304 | item.onCancel(ev);
305 | }
306 |
307 | resolve({
308 | buttonClicked: "cancel",
309 | event: ev
310 | });
311 |
312 | hideElement(el);
313 | });
314 | }
315 | }
316 |
317 | var promise;
318 |
319 | if (typeof Promise === "function") {
320 | promise = new Promise(setupHandlers);
321 | } else {
322 | setupHandlers();
323 | }
324 |
325 | this.parent.appendChild(el);
326 | setTimeout(function() {
327 | el.classList.remove("hide");
328 | if(input && item.type && item.type === "prompt") {
329 | input.select();
330 | input.focus();
331 | } else {
332 | if (btnOK) {
333 | btnOK.focus();
334 | }
335 | }
336 | }, 100);
337 |
338 | return promise;
339 | },
340 |
341 | okBtn: function(label) {
342 | this.okLabel = label;
343 | return this;
344 | },
345 |
346 | setDelay: function(time) {
347 | time = time || 0;
348 | this.delay = isNaN(time) ? this.defaultDelay : parseInt(time, 10);
349 | return this;
350 | },
351 |
352 | cancelBtn: function(str) {
353 | this.cancelLabel = str;
354 | return this;
355 | },
356 |
357 | setMaxLogItems: function(num) {
358 | this.maxLogItems = parseInt(num || this.defaultMaxLogItems);
359 | },
360 |
361 | theme: function(themeStr) {
362 | switch(themeStr.toLowerCase()) {
363 | case "bootstrap":
364 | this.dialogs.buttons.ok = "
";
365 | this.dialogs.buttons.cancel = "
";
366 | this.dialogs.input = "
";
367 | break;
368 | case "purecss":
369 | this.dialogs.buttons.ok = "
";
370 | this.dialogs.buttons.cancel = "
";
371 | break;
372 | case "mdl":
373 | case "material-design-light":
374 | this.dialogs.buttons.ok = "
";
375 | this.dialogs.buttons.cancel = "
";
376 | this.dialogs.input = "
";
377 | break;
378 | case "angular-material":
379 | this.dialogs.buttons.ok = "
";
380 | this.dialogs.buttons.cancel = "
";
381 | this.dialogs.input = "
";
382 | break;
383 | case "default":
384 | default:
385 | this.dialogs.buttons.ok = this.defaultDialogs.buttons.ok;
386 | this.dialogs.buttons.cancel = this.defaultDialogs.buttons.cancel;
387 | this.dialogs.input = this.defaultDialogs.input;
388 | break;
389 | }
390 | },
391 |
392 | reset: function() {
393 | this.parent = document.body;
394 | this.theme("default");
395 | this.okBtn(this.defaultOkLabel);
396 | this.cancelBtn(this.defaultCancelLabel);
397 | this.setMaxLogItems();
398 | this.promptValue = "";
399 | this.promptPlaceholder = "";
400 | this.delay = this.defaultDelay;
401 | this.setCloseLogOnClick(this.closeLogOnClickDefault);
402 | this.setLogPosition("bottom left");
403 | this.logTemplateMethod = null;
404 | },
405 |
406 | injectCSS: function() {
407 | if (!document.querySelector("#alertifyCSS")) {
408 | var head = document.getElementsByTagName("head")[0];
409 | var css = document.createElement("style");
410 | css.type = "text/css";
411 | css.id = "alertifyCSS";
412 | css.innerHTML = "/* style.css */";
413 | head.insertBefore(css, head.firstChild);
414 | }
415 | },
416 |
417 | removeCSS: function() {
418 | var css = document.querySelector("#alertifyCSS");
419 | if (css && css.parentNode) {
420 | css.parentNode.removeChild(css);
421 | }
422 | }
423 |
424 | };
425 |
426 | _alertify.injectCSS();
427 |
428 | return {
429 | _$$alertify: _alertify,
430 | parent: function(elem) {
431 | _alertify.parent = elem;
432 | },
433 | reset: function() {
434 | _alertify.reset();
435 | return this;
436 | },
437 | alert: function(message, onOkay, onCancel) {
438 | return _alertify.dialog(message, "alert", onOkay, onCancel) || this;
439 | },
440 | confirm: function(message, onOkay, onCancel) {
441 | return _alertify.dialog(message, "confirm", onOkay, onCancel) || this;
442 | },
443 | prompt: function(message, onOkay, onCancel) {
444 | return _alertify.dialog(message, "prompt", onOkay, onCancel) || this;
445 | },
446 | log: function(message, click) {
447 | _alertify.log(message, "default", click);
448 | return this;
449 | },
450 | theme: function(themeStr) {
451 | _alertify.theme(themeStr);
452 | return this;
453 | },
454 | success: function(message, click) {
455 | _alertify.log(message, "success", click);
456 | return this;
457 | },
458 | error: function(message, click) {
459 | _alertify.log(message, "error", click);
460 | return this;
461 | },
462 | cancelBtn: function(label) {
463 | _alertify.cancelBtn(label);
464 | return this;
465 | },
466 | okBtn: function(label) {
467 | _alertify.okBtn(label);
468 | return this;
469 | },
470 | delay: function(time) {
471 | _alertify.setDelay(time);
472 | return this;
473 | },
474 | placeholder: function(str) {
475 | _alertify.promptPlaceholder = str;
476 | return this;
477 | },
478 | defaultValue: function(str) {
479 | _alertify.promptValue = str;
480 | return this;
481 | },
482 | maxLogItems: function(num) {
483 | _alertify.setMaxLogItems(num);
484 | return this;
485 | },
486 | closeLogOnClick: function(bool) {
487 | _alertify.setCloseLogOnClick(!! bool);
488 | return this;
489 | },
490 | logPosition: function(str) {
491 | _alertify.setLogPosition(str || "");
492 | return this;
493 | },
494 | setLogTemplate: function(templateMethod) {
495 | _alertify.logTemplateMethod = templateMethod;
496 | return this;
497 | },
498 | clearLogs: function() {
499 | _alertify.setupLogContainer().innerHTML = "";
500 | return this;
501 | },
502 | version: _alertify.version
503 | };
504 | }
505 |
506 | // AMD, window, and NPM support
507 | if ("undefined" !== typeof module && !! module && !! module.exports) {
508 | // Preserve backwards compatibility
509 | module.exports = function() {
510 | return new Alertify();
511 | };
512 | var obj = new Alertify();
513 | for (var key in obj) {
514 | module.exports[key] = obj[key];
515 | }
516 | } else if (typeof define === "function" && define.amd) {
517 | define(function() {
518 | return new Alertify();
519 | });
520 | } else {
521 | window.alertify = new Alertify();
522 | }
523 |
524 | }());
525 |
--------------------------------------------------------------------------------
/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
/vendor/assets/stylesheets/alertify.css:
--------------------------------------------------------------------------------
1 | .alertify-logs>*{padding:12px 24px;color:#fff;box-shadow:0 2px 5px 0 rgba(0,0,0,.2);border-radius:1px}.alertify-logs>*,.alertify-logs>.default{background:rgba(0,0,0,.8)}.alertify-logs>.error{background:rgba(244,67,54,.8)}.alertify-logs>.success{background:rgba(76,175,80,.9)}.alertify{position:fixed;background-color:rgba(0,0,0,.3);left:0;right:0;top:0;bottom:0;width:100%;height:100%;z-index:2}.alertify.hide{opacity:0;pointer-events:none}.alertify,.alertify.show{box-sizing:border-box;transition:all .33s cubic-bezier(.25,.8,.25,1)}.alertify,.alertify *{box-sizing:border-box}.alertify .dialog{padding:12px}.alertify .alert,.alertify .dialog{width:100%;margin:0 auto;position:relative;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.alertify .alert>*,.alertify .dialog>*{width:400px;max-width:95%;margin:0 auto;text-align:center;padding:12px;background:#fff;box-shadow:0 2px 4px -1px rgba(0,0,0,.14),0 4px 5px 0 rgba(0,0,0,.098),0 1px 10px 0 rgba(0,0,0,.084)}.alertify .alert .msg,.alertify .dialog .msg{padding:12px;margin-bottom:12px;margin:0;text-align:left}.alertify .alert input:not(.form-control),.alertify .dialog input:not(.form-control){margin-bottom:15px;width:100%;font-size:100%;padding:12px}.alertify .alert input:not(.form-control):focus,.alertify .dialog input:not(.form-control):focus{outline-offset:-2px}.alertify .alert nav,.alertify .dialog nav{text-align:right}.alertify .alert nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button),.alertify .dialog nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button){background:transparent;box-sizing:border-box;color:rgba(0,0,0,.87);position:relative;outline:0;border:0;display:inline-block;-webkit-align-items:center;-ms-flex-align:center;-ms-grid-row-align:center;align-items:center;padding:0 6px;margin:6px 8px;line-height:36px;min-height:36px;white-space:nowrap;min-width:88px;text-align:center;text-transform:uppercase;font-size:14px;text-decoration:none;cursor:pointer;border:1px solid transparent;border-radius:2px}.alertify .alert nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):active,.alertify .alert nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):hover,.alertify .dialog nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):active,.alertify .dialog nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):hover{background-color:rgba(0,0,0,.05)}.alertify .alert nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):focus,.alertify .dialog nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):focus{border:1px solid rgba(0,0,0,.1)}.alertify .alert nav button.btn,.alertify .dialog nav button.btn{margin:6px 4px}.alertify-logs{position:fixed;z-index:1}.alertify-logs.bottom,.alertify-logs:not(.top){bottom:16px}.alertify-logs.left,.alertify-logs:not(.right){left:16px}.alertify-logs.left>*,.alertify-logs:not(.right)>*{float:left;-webkit-transform:translateZ(0);transform:translateZ(0);height:auto}.alertify-logs.left>.show,.alertify-logs:not(.right)>.show{left:0}.alertify-logs.left>*,.alertify-logs.left>.hide,.alertify-logs:not(.right)>*,.alertify-logs:not(.right)>.hide{left:-110%}.alertify-logs.right{right:16px}.alertify-logs.right>*{float:right;-webkit-transform:translateZ(0);transform:translateZ(0)}.alertify-logs.right>.show{right:0;opacity:1}.alertify-logs.right>*,.alertify-logs.right>.hide{right:-110%;opacity:0}.alertify-logs.top{top:0}.alertify-logs>*{box-sizing:border-box;transition:all .4s cubic-bezier(.25,.8,.25,1);position:relative;clear:both;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000;perspective:1000;max-height:0;margin:0;padding:0;overflow:hidden;opacity:0;pointer-events:none}.alertify-logs>.show{margin-top:12px;opacity:1;max-height:1000px;padding:12px;pointer-events:auto}
--------------------------------------------------------------------------------