├── .gitignore ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── README.md ├── README.rdoc ├── Rakefile ├── app ├── assets │ ├── images │ │ └── .keep │ ├── javascripts │ │ ├── application.js │ │ └── media_contents.js │ └── stylesheets │ │ ├── application.css.scss │ │ └── media_contents.css.scss ├── controllers │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ └── media_contents_controller.rb ├── helpers │ ├── application_helper.rb │ └── media_contents_helper.rb ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── concerns │ │ └── .keep │ └── media.rb ├── uploaders │ └── media_uploader.rb └── views │ ├── layouts │ └── application.html.erb │ └── media_contents │ └── index.html.erb ├── bin ├── bundle ├── rails ├── rake └── spring ├── config.ru ├── config ├── application.rb ├── boot.rb ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── assets.rb │ ├── backtrace_silencers.rb │ ├── cookies_serializer.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── session_store.rb │ └── wrap_parameters.rb ├── locales │ └── en.yml ├── routes.rb └── secrets.yml ├── db ├── migrate │ └── 20141122202757_create_media.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── log └── .keep ├── public ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico └── robots.txt ├── test ├── controllers │ ├── .keep │ └── media_contents_controller_test.rb ├── fixtures │ ├── .keep │ └── media.yml ├── helpers │ ├── .keep │ └── media_contents_helper_test.rb ├── integration │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ └── media_test.rb └── test_helper.rb └── vendor └── assets ├── javascripts ├── .keep └── alertify.js └── stylesheets ├── .keep └── alertify.css /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log 16 | /tmp 17 | 18 | #Ignore public/uploads 19 | /public/uploads 20 | 21 | *.rbc 22 | capybara-*.html 23 | .rspec 24 | /public/system 25 | /coverage/ 26 | /spec/tmp 27 | **.orig 28 | rerun.txt 29 | pickle-email-*.html 30 | 31 | # TODO Comment out these rules if you are OK with secrets being uploaded to the repo 32 | config/initializers/secret_token.rb 33 | config/secrets.yml 34 | 35 | ## Environment normalisation: 36 | /.bundle 37 | /vendor/bundle 38 | 39 | # these should all be checked in to normalise the environment: 40 | # Gemfile.lock, .ruby-version, .ruby-gemset 41 | 42 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: 43 | .rvmrc 44 | 45 | # if using bower-rails ignore default bower_components path bower.json files 46 | /vendor/assets/bower_components 47 | *.bowerrc 48 | bower.json 49 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | 4 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 5 | gem 'rails', '4.2.3' 6 | 7 | # Use SCSS for stylesheets 8 | gem 'sass-rails', '~> 5.0' 9 | # Use Uglifier as compressor for JavaScript assets 10 | gem 'uglifier', '>= 1.3.0' 11 | # Use CoffeeScript for .js.coffee assets and views 12 | gem 'coffee-rails', '~> 4.1.0' 13 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes 14 | # gem 'therubyracer', platforms: :ruby 15 | 16 | # Use jquery as the JavaScript library 17 | gem 'jquery-rails' 18 | # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 19 | gem 'turbolinks' 20 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 21 | gem 'jbuilder', '~> 2.0' 22 | # bundle exec rake doc:rails generates the API under doc/api. 23 | gem 'sdoc', '~> 0.4.0', group: :doc 24 | 25 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 26 | gem 'spring', group: :development 27 | 28 | gem 'dropzonejs-rails' 29 | 30 | gem 'carrierwave' 31 | gem 'cloudinary', group: :production 32 | 33 | gem 'bootstrap-sass', '~> 3.3.5' 34 | gem 'autoprefixer-rails' 35 | 36 | group :development do 37 | gem 'sqlite3' 38 | end 39 | 40 | group :production do 41 | gem 'pg' 42 | end 43 | 44 | # Use ActiveModel has_secure_password 45 | # gem 'bcrypt', '~> 3.1.7' 46 | 47 | # Use unicorn as the app server 48 | # gem 'unicorn' 49 | 50 | # Use Capistrano for deployment 51 | # gem 'capistrano-rails', group: :development 52 | 53 | # Use debugger 54 | # gem 'debugger', group: [:development, :test] 55 | 56 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actionmailer (4.2.3) 5 | actionpack (= 4.2.3) 6 | actionview (= 4.2.3) 7 | activejob (= 4.2.3) 8 | mail (~> 2.5, >= 2.5.4) 9 | rails-dom-testing (~> 1.0, >= 1.0.5) 10 | actionpack (4.2.3) 11 | actionview (= 4.2.3) 12 | activesupport (= 4.2.3) 13 | rack (~> 1.6) 14 | rack-test (~> 0.6.2) 15 | rails-dom-testing (~> 1.0, >= 1.0.5) 16 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 17 | actionview (4.2.3) 18 | activesupport (= 4.2.3) 19 | builder (~> 3.1) 20 | erubis (~> 2.7.0) 21 | rails-dom-testing (~> 1.0, >= 1.0.5) 22 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 23 | activejob (4.2.3) 24 | activesupport (= 4.2.3) 25 | globalid (>= 0.3.0) 26 | activemodel (4.2.3) 27 | activesupport (= 4.2.3) 28 | builder (~> 3.1) 29 | activerecord (4.2.3) 30 | activemodel (= 4.2.3) 31 | activesupport (= 4.2.3) 32 | arel (~> 6.0) 33 | activesupport (4.2.3) 34 | i18n (~> 0.7) 35 | json (~> 1.7, >= 1.7.7) 36 | minitest (~> 5.1) 37 | thread_safe (~> 0.3, >= 0.3.4) 38 | tzinfo (~> 1.1) 39 | arel (6.0.3) 40 | autoprefixer-rails (6.0.3) 41 | execjs 42 | json 43 | aws_cf_signer (0.1.3) 44 | bootstrap-sass (3.3.5.1) 45 | autoprefixer-rails (>= 5.0.0.1) 46 | sass (>= 3.3.0) 47 | builder (3.2.2) 48 | carrierwave (0.10.0) 49 | activemodel (>= 3.2.0) 50 | activesupport (>= 3.2.0) 51 | json (>= 1.7) 52 | mime-types (>= 1.16) 53 | cloudinary (1.1.0) 54 | aws_cf_signer 55 | rest-client 56 | coffee-rails (4.1.0) 57 | coffee-script (>= 2.2.0) 58 | railties (>= 4.0.0, < 5.0) 59 | coffee-script (2.4.1) 60 | coffee-script-source 61 | execjs 62 | coffee-script-source (1.9.1.1) 63 | domain_name (0.5.24) 64 | unf (>= 0.0.5, < 1.0.0) 65 | dropzonejs-rails (0.7.1) 66 | rails (> 3.1) 67 | erubis (2.7.0) 68 | execjs (2.6.0) 69 | globalid (0.3.6) 70 | activesupport (>= 4.1.0) 71 | http-cookie (1.0.2) 72 | domain_name (~> 0.5) 73 | i18n (0.7.0) 74 | jbuilder (2.3.1) 75 | activesupport (>= 3.0.0, < 5) 76 | multi_json (~> 1.2) 77 | jquery-rails (4.0.5) 78 | rails-dom-testing (~> 1.0) 79 | railties (>= 4.2.0) 80 | thor (>= 0.14, < 2.0) 81 | json (1.8.3) 82 | loofah (2.0.3) 83 | nokogiri (>= 1.5.9) 84 | mail (2.6.3) 85 | mime-types (>= 1.16, < 3) 86 | mime-types (2.6.2) 87 | mini_portile (0.6.2) 88 | minitest (5.8.0) 89 | multi_json (1.11.2) 90 | netrc (0.10.3) 91 | nokogiri (1.6.6.2) 92 | mini_portile (~> 0.6.0) 93 | pg (0.18.3) 94 | rack (1.6.4) 95 | rack-test (0.6.3) 96 | rack (>= 1.0) 97 | rails (4.2.3) 98 | actionmailer (= 4.2.3) 99 | actionpack (= 4.2.3) 100 | actionview (= 4.2.3) 101 | activejob (= 4.2.3) 102 | activemodel (= 4.2.3) 103 | activerecord (= 4.2.3) 104 | activesupport (= 4.2.3) 105 | bundler (>= 1.3.0, < 2.0) 106 | railties (= 4.2.3) 107 | sprockets-rails 108 | rails-deprecated_sanitizer (1.0.3) 109 | activesupport (>= 4.2.0.alpha) 110 | rails-dom-testing (1.0.7) 111 | activesupport (>= 4.2.0.beta, < 5.0) 112 | nokogiri (~> 1.6.0) 113 | rails-deprecated_sanitizer (>= 1.0.1) 114 | rails-html-sanitizer (1.0.2) 115 | loofah (~> 2.0) 116 | railties (4.2.3) 117 | actionpack (= 4.2.3) 118 | activesupport (= 4.2.3) 119 | rake (>= 0.8.7) 120 | thor (>= 0.18.1, < 2.0) 121 | rake (10.4.2) 122 | rdoc (4.2.0) 123 | rest-client (1.8.0) 124 | http-cookie (>= 1.0.2, < 2.0) 125 | mime-types (>= 1.16, < 3.0) 126 | netrc (~> 0.7) 127 | sass (3.4.18) 128 | sass-rails (5.0.4) 129 | railties (>= 4.0.0, < 5.0) 130 | sass (~> 3.1) 131 | sprockets (>= 2.8, < 4.0) 132 | sprockets-rails (>= 2.0, < 4.0) 133 | tilt (>= 1.1, < 3) 134 | sdoc (0.4.1) 135 | json (~> 1.7, >= 1.7.7) 136 | rdoc (~> 4.0) 137 | spring (1.4.0) 138 | sprockets (3.3.4) 139 | rack (~> 1.0) 140 | sprockets-rails (2.3.3) 141 | actionpack (>= 3.0) 142 | activesupport (>= 3.0) 143 | sprockets (>= 2.8, < 4.0) 144 | sqlite3 (1.3.10) 145 | thor (0.19.1) 146 | thread_safe (0.3.5) 147 | tilt (2.0.1) 148 | turbolinks (2.5.3) 149 | coffee-rails 150 | tzinfo (1.2.2) 151 | thread_safe (~> 0.1) 152 | uglifier (2.7.2) 153 | execjs (>= 0.3.0) 154 | json (>= 1.8.0) 155 | unf (0.1.4) 156 | unf_ext 157 | unf_ext (0.0.7.1) 158 | 159 | PLATFORMS 160 | ruby 161 | 162 | DEPENDENCIES 163 | autoprefixer-rails 164 | bootstrap-sass (~> 3.3.5) 165 | carrierwave 166 | cloudinary 167 | coffee-rails (~> 4.1.0) 168 | dropzonejs-rails 169 | jbuilder (~> 2.0) 170 | jquery-rails 171 | pg 172 | rails (= 4.2.3) 173 | sass-rails (~> 5.0) 174 | sdoc (~> 0.4.0) 175 | spring 176 | sqlite3 177 | turbolinks 178 | uglifier (>= 1.3.0) 179 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Ajax File Upload in Rails using Dropzone + Carrierwave 2 | ====================================================== 3 | 4 | Dropzone + Rails + Carrierwave Demo. Check out the post https://medium.com/rails-ember-beyond/ajax-file-upload-in-rails-using-dropzone-and-carrierwave-6f5436fdfdb0#.rvmq8edgt 5 | 6 | Working [demo](https://shrouded-beyond-2562.herokuapp.com/). [ Heroku + Cloudinary ] 7 | 8 | Getting started: 9 | --------------- 10 | clone or fork this project 11 | 12 | Run ```rake db:migrate``` 13 | 14 | Start the server using ```rails server``` 15 | 16 | Visit [localhost:3000](http://localhost:3000) in your browser. 17 | 18 | ![alt tag](https://cloud.githubusercontent.com/assets/1825853/5156162/d1e0a5c2-7273-11e4-8a77-b7f15b05fc0f.png) 19 | 20 | 21 | **Issues:** 22 | If you have any issues with the demo raise issues here [https://github.com/Just-hack/dropzone-sample/issues](https://github.com/Just-hack/dropzone-sample/issues) 23 | 24 | License: 25 | -------- 26 | This project is licensed under the terms of [MIT License](https://github.com/Just-hack/dropzone-sample/blob/master/LICENSE) 27 | -------------------------------------------------------------------------------- /README.rdoc: -------------------------------------------------------------------------------- 1 | == README 2 | 3 | This README would normally document whatever steps are necessary to get the 4 | application up and running. 5 | 6 | Things you may want to cover: 7 | 8 | * Ruby version 9 | 10 | * System dependencies 11 | 12 | * Configuration 13 | 14 | * Database creation 15 | 16 | * Database initialization 17 | 18 | * How to run the test suite 19 | 20 | * Services (job queues, cache servers, search engines, etc.) 21 | 22 | * Deployment instructions 23 | 24 | * ... 25 | 26 | 27 | Please feel free to use a different markup language if you do not plan to run 28 | rake doc:app. 29 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 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, vendor/assets/javascripts, 5 | // or vendor/assets/javascripts of plugins, if any, 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. 9 | // 10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require dropzone 16 | //= require bootstrap 17 | //= require alertify 18 | //= require_self 19 | //= require_tree . 20 | 21 | $(function(){ 22 | alertify.parent(document.body); 23 | }); 24 | -------------------------------------------------------------------------------- /app/assets/javascripts/media_contents.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | var mediaDropzone = new Dropzone("#media-dropzone"); 3 | Dropzone.options.mediaDropzone = false; 4 | mediaDropzone.options.acceptedFiles = ".jpeg,.jpg,.png,.gif"; 5 | mediaDropzone.on("complete", function(files) { 6 | var _this = this; 7 | if (_this.getUploadingFiles().length === 0 && _this.getQueuedFiles().length === 0) { 8 | setTimeout(function(){ 9 | $('#myModal').modal('hide'); 10 | var acceptedFiles = _this.getAcceptedFiles(); 11 | var rejectedFiles = _this.getRejectedFiles(); 12 | 13 | for(var index = 0; index < acceptedFiles.length; index++) { 14 | var file = acceptedFiles[index]; 15 | var response = JSON.parse(file.xhr.response); 16 | appendContent(response.file_name.url, response.id); 17 | } 18 | 19 | if(acceptedFiles.length != 0) { 20 | alertify.success('Uploaded ' + acceptedFiles.length + ' files successfully.'); 21 | } 22 | if(rejectedFiles.length != 0) { 23 | alertify.error('Error uploading ' + rejectedFiles.length + ' files. Only image files are accepted.'); 24 | } 25 | 26 | _this.removeAllFiles(); 27 | 28 | }, 2000); 29 | } 30 | }); 31 | }); 32 | 33 | var appendContent = function(imageUrl, mediaId) { 34 | $("#media-contents").append('
' + 35 | '
' + 36 | '
' + 37 | '' + 38 | '
' + 39 | '
'); 40 | $("#delete").removeAttr('disabled'); 41 | $("#delete-all").removeAttr('disabled'); 42 | $("#no-media").html(""); 43 | }; 44 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any styles 10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new 11 | * file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | *= require dropzone/dropzone 16 | *= require alertify 17 | */ 18 | 19 | @import "bootstrap-sprockets"; 20 | @import "bootstrap"; 21 | 22 | body { 23 | font-family: 'Lato', sans-serif; 24 | } 25 | 26 | .dropzone { 27 | background: #f4f4f4 !important; 28 | border: none !important; 29 | font-size: 2.5rem; 30 | font-weight: 700; 31 | } 32 | -------------------------------------------------------------------------------- /app/assets/stylesheets/media_contents.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the media_contents controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | end 6 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/media_contents_controller.rb: -------------------------------------------------------------------------------- 1 | class MediaContentsController < ApplicationController 2 | 3 | def index 4 | @media_contents = Media.all 5 | end 6 | 7 | def create 8 | @media = Media.new(file_name: params[:file]) 9 | if @media.save! 10 | render json: @media 11 | else 12 | puts 'Hello' 13 | render json: { error: 'Failed to process' }, status: 422 14 | end 15 | end 16 | 17 | def delete_media 18 | Media.where(id: params[:media_contents]).destroy_all 19 | redirect_to root_url 20 | end 21 | 22 | def delete_all 23 | Media.delete_all 24 | redirect_to root_url 25 | end 26 | 27 | end 28 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/media_contents_helper.rb: -------------------------------------------------------------------------------- 1 | module MediaContentsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/app/mailers/.keep -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/app/models/.keep -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaffeinate/dropzone-rails-demo/1b39ff212aea2d742b09ebf2a7796b26693b574b/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/media.rb: -------------------------------------------------------------------------------- 1 | class Media < ActiveRecord::Base 2 | mount_uploader :file_name, MediaUploader 3 | end 4 | -------------------------------------------------------------------------------- /app/uploaders/media_uploader.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | class MediaUploader < CarrierWave::Uploader::Base 4 | 5 | # Include RMagick or MiniMagick support: 6 | # include CarrierWave::RMagick 7 | # include CarrierWave::MiniMagick 8 | 9 | if Rails.env.production? 10 | include Cloudinary::CarrierWave 11 | end 12 | 13 | # Choose what kind of storage to use for this uploader: 14 | 15 | storage :file if Rails.env.development? 16 | # storage :fog 17 | 18 | # Override the directory where uploaded files will be stored. 19 | # This is a sensible default for uploaders that are meant to be mounted: 20 | if Rails.env.development? 21 | def store_dir 22 | "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" 23 | end 24 | end 25 | 26 | def extension_white_list 27 | %w(png jpg jpeg gif tiff) 28 | end 29 | 30 | # Provide a default URL as a default if there hasn't been a file uploaded: 31 | # def default_url 32 | # # For Rails 3.1+ asset pipeline compatibility: 33 | # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) 34 | # 35 | # "/images/fallback/" + [version_name, "default.png"].compact.join('_') 36 | # end 37 | 38 | # Process files as they are uploaded: 39 | # process :scale => [200, 300] 40 | # 41 | # def scale(width, height) 42 | # # do something 43 | # end 44 | 45 | # Create different versions of your uploaded files: 46 | # version :thumb do 47 | # process :resize_to_fit => [50, 50] 48 | # end 49 | 50 | # Add a white list of extensions which are allowed to be uploaded. 51 | # For images you might use something like this: 52 | # def extension_white_list 53 | # %w(jpg jpeg gif png) 54 | # end 55 | 56 | # Override the filename of the uploaded files: 57 | # Avoid using model.id or version_name here, see uploader/store.rb for details. 58 | # def filename 59 | # "something.jpg" if original_filename 60 | # end 61 | 62 | end 63 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Dropzone Rails demo 5 | 6 | <%= stylesheet_link_tag 'application', media: 'all' %> 7 | <%= javascript_include_tag 'application' %> 8 | <%= csrf_meta_tags %> 9 | 10 | 11 | 12 | <%= yield %> 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/views/media_contents/index.html.erb: -------------------------------------------------------------------------------- 1 | 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 |
No Media Found
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 | 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} --------------------------------------------------------------------------------