houston-core 0.5.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +46 -0
- data/.gitignore +23 -0
- data/.gitmodules +0 -0
- data/Gemfile +24 -0
- data/Gemfile.lock +354 -0
- data/README.md +133 -0
- data/Rakefile +8 -0
- data/app/adapters/houston/adapters.rb +51 -0
- data/app/adapters/houston/adapters/ci_server.rb +5 -0
- data/app/adapters/houston/adapters/ci_server/errors.rb +16 -0
- data/app/adapters/houston/adapters/ci_server/jenkins_adapter.rb +21 -0
- data/app/adapters/houston/adapters/ci_server/jenkins_adapter/job.rb +245 -0
- data/app/adapters/houston/adapters/ci_server/none_adapter.rb +21 -0
- data/app/adapters/houston/adapters/ci_server/none_adapter/job.rb +25 -0
- data/app/adapters/houston/adapters/deployment/engineyard.rb +107 -0
- data/app/adapters/houston/adapters/deployment/engineyard/config.rb +18 -0
- data/app/adapters/houston/adapters/error_tracker.rb +5 -0
- data/app/adapters/houston/adapters/error_tracker/errbit_adapter.rb +69 -0
- data/app/adapters/houston/adapters/error_tracker/errbit_adapter/app.rb +48 -0
- data/app/adapters/houston/adapters/error_tracker/errbit_adapter/connection.rb +153 -0
- data/app/adapters/houston/adapters/error_tracker/errbit_adapter/notice.rb +26 -0
- data/app/adapters/houston/adapters/error_tracker/errbit_adapter/problem.rb +98 -0
- data/app/adapters/houston/adapters/error_tracker/errors.rb +0 -0
- data/app/adapters/houston/adapters/error_tracker/none_adapter.rb +31 -0
- data/app/adapters/houston/adapters/error_tracker/null_app.rb +40 -0
- data/app/adapters/houston/adapters/ticket_tracker.rb +5 -0
- data/app/adapters/houston/adapters/ticket_tracker/errors.rb +23 -0
- data/app/adapters/houston/adapters/ticket_tracker/github_adapter.rb +27 -0
- data/app/adapters/houston/adapters/ticket_tracker/github_adapter/connection.rb +167 -0
- data/app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb +99 -0
- data/app/adapters/houston/adapters/ticket_tracker/houston_adapter.rb +23 -0
- data/app/adapters/houston/adapters/ticket_tracker/houston_adapter/connection.rb +48 -0
- data/app/adapters/houston/adapters/ticket_tracker/houston_adapter/ticket.rb +65 -0
- data/app/adapters/houston/adapters/ticket_tracker/none_adapter.rb +21 -0
- data/app/adapters/houston/adapters/ticket_tracker/null_connection.rb +46 -0
- data/app/adapters/houston/adapters/ticket_tracker/null_ticket.rb +71 -0
- data/app/adapters/houston/adapters/ticket_tracker/unfuddle_adapter.rb +43 -0
- data/app/adapters/houston/adapters/ticket_tracker/unfuddle_adapter/connection.rb +224 -0
- data/app/adapters/houston/adapters/ticket_tracker/unfuddle_adapter/milestone.rb +42 -0
- data/app/adapters/houston/adapters/ticket_tracker/unfuddle_adapter/ticket.rb +240 -0
- data/app/adapters/houston/adapters/version_control.rb +5 -0
- data/app/adapters/houston/adapters/version_control/commit.rb +29 -0
- data/app/adapters/houston/adapters/version_control/errors.rb +37 -0
- data/app/adapters/houston/adapters/version_control/git_adapter.rb +96 -0
- data/app/adapters/houston/adapters/version_control/git_adapter/diff_changes.rb +49 -0
- data/app/adapters/houston/adapters/version_control/git_adapter/github_repo.rb +65 -0
- data/app/adapters/houston/adapters/version_control/git_adapter/remote_repo.rb +104 -0
- data/app/adapters/houston/adapters/version_control/git_adapter/repo.rb +247 -0
- data/app/adapters/houston/adapters/version_control/none_adapter.rb +21 -0
- data/app/adapters/houston/adapters/version_control/null_commit.rb +21 -0
- data/app/adapters/houston/adapters/version_control/null_repo.rb +65 -0
- data/app/assets/font/octicons.eot +0 -0
- data/app/assets/font/octicons.svg +198 -0
- data/app/assets/font/octicons.ttf +0 -0
- data/app/assets/font/octicons.woff +0 -0
- data/app/assets/font/roboto-black-webfont.eot +0 -0
- data/app/assets/font/roboto-black-webfont.svg +675 -0
- data/app/assets/font/roboto-black-webfont.ttf +0 -0
- data/app/assets/font/roboto-black-webfont.woff +0 -0
- data/app/assets/font/roboto-blackitalic-webfont.eot +0 -0
- data/app/assets/font/roboto-blackitalic-webfont.svg +677 -0
- data/app/assets/font/roboto-blackitalic-webfont.ttf +0 -0
- data/app/assets/font/roboto-blackitalic-webfont.woff +0 -0
- data/app/assets/font/roboto-bold-webfont.eot +0 -0
- data/app/assets/font/roboto-bold-webfont.svg +675 -0
- data/app/assets/font/roboto-bold-webfont.ttf +0 -0
- data/app/assets/font/roboto-bold-webfont.woff +0 -0
- data/app/assets/font/roboto-bolditalic-webfont.eot +0 -0
- data/app/assets/font/roboto-bolditalic-webfont.svg +677 -0
- data/app/assets/font/roboto-bolditalic-webfont.ttf +0 -0
- data/app/assets/font/roboto-bolditalic-webfont.woff +0 -0
- data/app/assets/font/roboto-italic-webfont.eot +0 -0
- data/app/assets/font/roboto-italic-webfont.svg +668 -0
- data/app/assets/font/roboto-italic-webfont.ttf +0 -0
- data/app/assets/font/roboto-italic-webfont.woff +0 -0
- data/app/assets/font/roboto-light-webfont.eot +0 -0
- data/app/assets/font/roboto-light-webfont.svg +666 -0
- data/app/assets/font/roboto-light-webfont.ttf +0 -0
- data/app/assets/font/roboto-light-webfont.woff +0 -0
- data/app/assets/font/roboto-lightitalic-webfont.eot +0 -0
- data/app/assets/font/roboto-lightitalic-webfont.svg +668 -0
- data/app/assets/font/roboto-lightitalic-webfont.ttf +0 -0
- data/app/assets/font/roboto-lightitalic-webfont.woff +0 -0
- data/app/assets/font/roboto-medium-webfont.eot +0 -0
- data/app/assets/font/roboto-medium-webfont.svg +675 -0
- data/app/assets/font/roboto-medium-webfont.ttf +0 -0
- data/app/assets/font/roboto-medium-webfont.woff +0 -0
- data/app/assets/font/roboto-mediumitalic-webfont.eot +0 -0
- data/app/assets/font/roboto-mediumitalic-webfont.svg +677 -0
- data/app/assets/font/roboto-mediumitalic-webfont.ttf +0 -0
- data/app/assets/font/roboto-mediumitalic-webfont.woff +0 -0
- data/app/assets/font/roboto-regular-webfont.eot +0 -0
- data/app/assets/font/roboto-regular-webfont.svg +666 -0
- data/app/assets/font/roboto-regular-webfont.ttf +0 -0
- data/app/assets/font/roboto-regular-webfont.woff +0 -0
- data/app/assets/font/roboto-thin-webfont.eot +0 -0
- data/app/assets/font/roboto-thin-webfont.svg +666 -0
- data/app/assets/font/roboto-thin-webfont.ttf +0 -0
- data/app/assets/font/roboto-thin-webfont.woff +0 -0
- data/app/assets/font/roboto-thinitalic-webfont.eot +0 -0
- data/app/assets/font/roboto-thinitalic-webfont.svg +668 -0
- data/app/assets/font/roboto-thinitalic-webfont.ttf +0 -0
- data/app/assets/font/roboto-thinitalic-webfont.woff +0 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/images/bug-fixed-128.png +0 -0
- data/app/assets/images/bug-fixed-32.png +0 -0
- data/app/assets/images/bug-fixed-48.png +0 -0
- data/app/assets/images/bug-new-128.png +0 -0
- data/app/assets/images/bug-new-32.png +0 -0
- data/app/assets/images/bug-new-48.png +0 -0
- data/app/assets/images/bug-open-32.png +0 -0
- data/app/assets/images/bug-zero-128.png +0 -0
- data/app/assets/images/bug-zero-48.png +0 -0
- data/app/assets/javascripts/app/boot.coffee +22 -0
- data/app/assets/javascripts/app/emoji.coffee.erb +2 -0
- data/app/assets/javascripts/app/infinite_scroll.coffee +32 -0
- data/app/assets/javascripts/app/models/commit.coffee +9 -0
- data/app/assets/javascripts/app/models/release.coffee +9 -0
- data/app/assets/javascripts/app/models/task.coffee +5 -0
- data/app/assets/javascripts/app/models/tester.coffee +8 -0
- data/app/assets/javascripts/app/models/testing_note.coffee +18 -0
- data/app/assets/javascripts/app/models/ticket.coffee +165 -0
- data/app/assets/javascripts/app/models/user.coffee +3 -0
- data/app/assets/javascripts/app/mousetrap-bind-scoped.js +37 -0
- data/app/assets/javascripts/app/releases.coffee +55 -0
- data/app/assets/javascripts/app/stacked_area_graph.coffee +113 -0
- data/app/assets/javascripts/app/stacked_bar_graph.coffee +108 -0
- data/app/assets/javascripts/app/table_row_expander.coffee +52 -0
- data/app/assets/javascripts/app/ticket_tracker_refresh.coffee +73 -0
- data/app/assets/javascripts/app/views/_show_sprint_view.coffee +84 -0
- data/app/assets/javascripts/app/views/_tickets_view.coffee +62 -0
- data/app/assets/javascripts/app/views/all_tickets_view.coffee +29 -0
- data/app/assets/javascripts/app/views/commit_view.coffee +13 -0
- data/app/assets/javascripts/app/views/edit_sprint_view.coffee +327 -0
- data/app/assets/javascripts/app/views/edit_ticket_view.coffee +67 -0
- data/app/assets/javascripts/app/views/find_or_create_ticket_view.coffee +75 -0
- data/app/assets/javascripts/app/views/keyboard_shortcuts_modal.coffee +42 -0
- data/app/assets/javascripts/app/views/new_ticket_modal.coffee +24 -0
- data/app/assets/javascripts/app/views/new_ticket_view.coffee +207 -0
- data/app/assets/javascripts/app/views/problems_view.coffee +114 -0
- data/app/assets/javascripts/app/views/reports_view.coffee +51 -0
- data/app/assets/javascripts/app/views/testing_note_view.coffee +85 -0
- data/app/assets/javascripts/app/views/testing_report_view.coffee +29 -0
- data/app/assets/javascripts/app/views/testing_ticket_view.coffee +203 -0
- data/app/assets/javascripts/app/views/ticket_modal_view.coffee +77 -0
- data/app/assets/javascripts/application.js +18 -0
- data/app/assets/javascripts/core/app.coffee +169 -0
- data/app/assets/javascripts/core/burndown_chart.coffee +111 -0
- data/app/assets/javascripts/core/core_ext/number.coffee +48 -0
- data/app/assets/javascripts/core/errors.coffee +26 -0
- data/app/assets/javascripts/core/handlebars_helpers.coffee +164 -0
- data/app/assets/javascripts/core/helpers.coffee +18 -0
- data/app/assets/javascripts/core/jquery_extensions.coffee +176 -0
- data/app/assets/javascripts/dashboard.js +23 -0
- data/app/assets/javascripts/dashboard/refresher.coffee +120 -0
- data/app/assets/javascripts/vendor.js +26 -0
- data/app/assets/stylesheets/application.css +14 -0
- data/app/assets/stylesheets/application/ansi.scss +38 -0
- data/app/assets/stylesheets/application/commit.scss +6 -0
- data/app/assets/stylesheets/application/emoji.scss +5 -0
- data/app/assets/stylesheets/application/exceptions.scss +64 -0
- data/app/assets/stylesheets/application/find_or_create_ticket.scss +12 -0
- data/app/assets/stylesheets/application/follow_up.scss +44 -0
- data/app/assets/stylesheets/application/forms.scss +46 -0
- data/app/assets/stylesheets/application/freight_train.css.scss +46 -0
- data/app/assets/stylesheets/application/full_screen.scss +8 -0
- data/app/assets/stylesheets/application/infinite_scroll.scss +17 -0
- data/app/assets/stylesheets/application/keyboard_shortcuts.scss +31 -0
- data/app/assets/stylesheets/application/markdown.scss +27 -0
- data/app/assets/stylesheets/application/mobile.scss +3 -0
- data/app/assets/stylesheets/application/modals.scss +3 -0
- data/app/assets/stylesheets/application/navigation.scss +212 -0
- data/app/assets/stylesheets/application/new_ticket_view.scss +89 -0
- data/app/assets/stylesheets/application/omnibar.scss +55 -0
- data/app/assets/stylesheets/application/project_banner_buttons.scss +70 -0
- data/app/assets/stylesheets/application/project_tiles.scss +26 -0
- data/app/assets/stylesheets/application/projects.css.scss +96 -0
- data/app/assets/stylesheets/application/pull_requests.scss +68 -0
- data/app/assets/stylesheets/application/queue.scss +11 -0
- data/app/assets/stylesheets/application/release_form.scss +67 -0
- data/app/assets/stylesheets/application/releases.scss +164 -0
- data/app/assets/stylesheets/application/sortable_table.scss +26 -0
- data/app/assets/stylesheets/application/sprint.scss +83 -0
- data/app/assets/stylesheets/application/tables.scss +74 -0
- data/app/assets/stylesheets/application/test_run.scss +145 -0
- data/app/assets/stylesheets/application/testing_report.scss +279 -0
- data/app/assets/stylesheets/application/ticket.scss +156 -0
- data/app/assets/stylesheets/application/ticket_modal.scss +173 -0
- data/app/assets/stylesheets/application/tickets.scss +36 -0
- data/app/assets/stylesheets/application/timeline.scss +206 -0
- data/app/assets/stylesheets/application/tips.scss +5 -0
- data/app/assets/stylesheets/application/typeahead.scss +29 -0
- data/app/assets/stylesheets/application/uploading.scss +101 -0
- data/app/assets/stylesheets/application/user_wall.scss +4 -0
- data/app/assets/stylesheets/application/users.scss +22 -0
- data/app/assets/stylesheets/application/welcome.scss +48 -0
- data/app/assets/stylesheets/core/alerts.scss +14 -0
- data/app/assets/stylesheets/core/avatars.scss +22 -0
- data/app/assets/stylesheets/core/burndown_chart.scss +92 -0
- data/app/assets/stylesheets/core/colors.scss.erb +106 -0
- data/app/assets/stylesheets/core/misc.scss +165 -0
- data/app/assets/stylesheets/core/octicons-icons.scss +221 -0
- data/app/assets/stylesheets/core/octicons.scss.erb +9 -0
- data/app/assets/stylesheets/core/overrides.scss +48 -0
- data/app/assets/stylesheets/core/roboto.scss.erb +131 -0
- data/app/assets/stylesheets/core/scores.scss +123 -0
- data/app/assets/stylesheets/dashboard.css +14 -0
- data/app/assets/stylesheets/dashboard/dashboard.scss +110 -0
- data/app/assets/stylesheets/print.css.scss +22 -0
- data/app/assets/stylesheets/vendor.css +16 -0
- data/app/assets/templates/commit.hbs +9 -0
- data/app/assets/templates/keyboard_shortcuts.hbs +14 -0
- data/app/assets/templates/new_ticket/form.hbs +14 -0
- data/app/assets/templates/new_ticket/modal.hbs +9 -0
- data/app/assets/templates/new_ticket/suggestion.hbs +3 -0
- data/app/assets/templates/omnibar/commit.hbs +6 -0
- data/app/assets/templates/omnibar/modal.hbs +5 -0
- data/app/assets/templates/omnibar/project.hbs +5 -0
- data/app/assets/templates/omnibar/ticket.hbs +6 -0
- data/app/assets/templates/problems/index.hbs +3 -0
- data/app/assets/templates/problems/show.hbs +48 -0
- data/app/assets/templates/sprints/edit.hbs +50 -0
- data/app/assets/templates/sprints/show.hbs +1 -0
- data/app/assets/templates/sprints/task.hbs +17 -0
- data/app/assets/templates/sprints/typeahead.hbs +7 -0
- data/app/assets/templates/testing_notes/edit.hbs +20 -0
- data/app/assets/templates/testing_notes/new.hbs +27 -0
- data/app/assets/templates/testing_notes/show.hbs +11 -0
- data/app/assets/templates/testing_report/description.hbs +12 -0
- data/app/assets/templates/testing_report/ticket.hbs +21 -0
- data/app/assets/templates/testing_report/verdict.hbs +4 -0
- data/app/assets/templates/tickets/find_or_create.hbs +4 -0
- data/app/assets/templates/tickets/index.hbs +19 -0
- data/app/assets/templates/tickets/modal.hbs +5 -0
- data/app/assets/templates/tickets/show.hbs +62 -0
- data/app/assets/templates/tickets/typeahead.hbs +2 -0
- data/app/concerns/belongs_to_commit.rb +22 -0
- data/app/concerns/commit_synchronizer.rb +94 -0
- data/app/concerns/feature_state.rb +27 -0
- data/app/concerns/feature_support.rb +15 -0
- data/app/concerns/historical_weekly_stats.rb +15 -0
- data/app/concerns/milestone_synchronizer.rb +60 -0
- data/app/concerns/nosync.rb +21 -0
- data/app/concerns/project_adapter.rb +81 -0
- data/app/concerns/retirement.rb +28 -0
- data/app/concerns/ticket_synchronizer.rb +120 -0
- data/app/concerns/unique_add.rb +7 -0
- data/app/controllers/api/v1/sprint_tasks_controller.rb +97 -0
- data/app/controllers/api/v1/ticket_tasks_controller.rb +75 -0
- data/app/controllers/application_controller.rb +151 -0
- data/app/controllers/commits_controller.rb +33 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/controllers/deploys_controller.rb +43 -0
- data/app/controllers/home_controller.rb +9 -0
- data/app/controllers/hooks_controller.rb +31 -0
- data/app/controllers/jobs_controller.rb +13 -0
- data/app/controllers/oauth_consumers_controller.rb +68 -0
- data/app/controllers/omnibar_controller.rb +64 -0
- data/app/controllers/project_exceptions_controller.rb +36 -0
- data/app/controllers/project_hooks_controller.rb +30 -0
- data/app/controllers/project_options_controller.rb +27 -0
- data/app/controllers/project_pretickets_controller.rb +27 -0
- data/app/controllers/project_roles_controller.rb +22 -0
- data/app/controllers/project_tickets_controller.rb +153 -0
- data/app/controllers/project_tickets_sync_controller.rb +22 -0
- data/app/controllers/projects_controller.rb +97 -0
- data/app/controllers/releases_controller.rb +130 -0
- data/app/controllers/reports_controller.rb +215 -0
- data/app/controllers/sessions_controller.rb +8 -0
- data/app/controllers/settings_controller.rb +14 -0
- data/app/controllers/sprint_task_locks_controller.rb +47 -0
- data/app/controllers/sprints_controller.rb +99 -0
- data/app/controllers/tasks_controller.rb +40 -0
- data/app/controllers/test_runs_controller.rb +35 -0
- data/app/controllers/tester_bar_controller.rb +12 -0
- data/app/controllers/testing_notes_controller.rb +50 -0
- data/app/controllers/testing_report_controller.rb +38 -0
- data/app/controllers/tickets_controller.rb +48 -0
- data/app/controllers/uploads_controller.rb +56 -0
- data/app/controllers/user_credentials_controller.rb +24 -0
- data/app/controllers/user_options_controller.rb +19 -0
- data/app/controllers/users_controller.rb +115 -0
- data/app/controllers/welcome_controller.rb +28 -0
- data/app/helpers/ansi_helper.rb +46 -0
- data/app/helpers/application_helper.rb +97 -0
- data/app/helpers/avatar_helper.rb +32 -0
- data/app/helpers/backtrace_helper.rb +7 -0
- data/app/helpers/breadcrumbs_helper.rb +60 -0
- data/app/helpers/commit_helper.rb +60 -0
- data/app/helpers/demo_helper.rb +23 -0
- data/app/helpers/email_helper.rb +13 -0
- data/app/helpers/emoji_helper.rb +13 -0
- data/app/helpers/excel_helpers.rb +7 -0
- data/app/helpers/exposure_helper.rb +11 -0
- data/app/helpers/flash_message_helper.rb +22 -0
- data/app/helpers/maintenance_light_helper.rb +19 -0
- data/app/helpers/markdown_helper.rb +17 -0
- data/app/helpers/navigation_helper.rb +67 -0
- data/app/helpers/project_helper.rb +33 -0
- data/app/helpers/release_helper.rb +47 -0
- data/app/helpers/score_card_helper.rb +85 -0
- data/app/helpers/sprint_helper.rb +11 -0
- data/app/helpers/static_chart_helper.rb +7 -0
- data/app/helpers/test_run_helper.rb +36 -0
- data/app/helpers/ticket_helper.rb +70 -0
- data/app/helpers/timeline_helper.rb +39 -0
- data/app/helpers/url_helper.rb +75 -0
- data/app/helpers/user_helper.rb +15 -0
- data/app/helpers/version_helper.rb +9 -0
- data/app/interactors/push_gemfile_to_gemnasium.rb +88 -0
- data/app/interactors/test_run_comparer.rb +46 -0
- data/app/interactors/ticket_report.rb +66 -0
- data/app/jobs/sync_all_tickets_job.rb +48 -0
- data/app/jobs/sync_commits_job.rb +13 -0
- data/app/jobs/sync_project_tickets_job.rb +32 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/mailers/.keep +0 -0
- data/app/mailers/deploy_notification.rb +33 -0
- data/app/mailers/project_notification.rb +131 -0
- data/app/mailers/view_mailer.rb +117 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/.keep +0 -0
- data/app/models/ability.rb +53 -0
- data/app/models/activity_feed.rb +111 -0
- data/app/models/antecedent.rb +15 -0
- data/app/models/code_climate/coverage_report.rb +167 -0
- data/app/models/commit.rb +255 -0
- data/app/models/concerns/.keep +0 -0
- data/app/models/consumer_token.rb +13 -0
- data/app/models/deploy.rb +103 -0
- data/app/models/environment.rb +39 -0
- data/app/models/gemnasium/alert.rb +25 -0
- data/app/models/github/comment_event.rb +29 -0
- data/app/models/github/commit_comment_event.rb +7 -0
- data/app/models/github/commit_status_report.rb +73 -0
- data/app/models/github/diff_comment_event.rb +7 -0
- data/app/models/github/event.rb +20 -0
- data/app/models/github/issue_comment_event.rb +16 -0
- data/app/models/github/post_receive_event.rb +14 -0
- data/app/models/github/pull_request.rb +133 -0
- data/app/models/github/pull_request_event.rb +43 -0
- data/app/models/github/unauthorized.rb +4 -0
- data/app/models/github_token.rb +8 -0
- data/app/models/historical_head.rb +5 -0
- data/app/models/key_dependency.rb +45 -0
- data/app/models/maintenance_light.rb +12 -0
- data/app/models/measurement.rb +110 -0
- data/app/models/menu_item.rb +19 -0
- data/app/models/menu_item_divider.rb +11 -0
- data/app/models/milestone.rb +106 -0
- data/app/models/output_stream.rb +26 -0
- data/app/models/post_receive_payload.rb +30 -0
- data/app/models/project.rb +247 -0
- data/app/models/project_dependencies.rb +52 -0
- data/app/models/project_dependency.rb +108 -0
- data/app/models/project_menu_item.rb +12 -0
- data/app/models/release.rb +217 -0
- data/app/models/release_change.rb +54 -0
- data/app/models/role.rb +55 -0
- data/app/models/rubygems/gem.rb +76 -0
- data/app/models/run_tests_on_post_receive.rb +180 -0
- data/app/models/setting.rb +10 -0
- data/app/models/settings.rb +38 -0
- data/app/models/source_file_coverage.rb +10 -0
- data/app/models/sprint.rb +75 -0
- data/app/models/sprint_report.rb +56 -0
- data/app/models/sprint_task.rb +32 -0
- data/app/models/static_chart.rb +137 -0
- data/app/models/static_chart/area.rb +70 -0
- data/app/models/task.rb +217 -0
- data/app/models/test.rb +8 -0
- data/app/models/test_error.rb +8 -0
- data/app/models/test_result.rb +10 -0
- data/app/models/test_run.rb +366 -0
- data/app/models/test_run_statistics.rb +54 -0
- data/app/models/testing_note.rb +64 -0
- data/app/models/ticket.rb +368 -0
- data/app/models/ticket_antecedent.rb +39 -0
- data/app/models/ticket_comment.rb +21 -0
- data/app/models/ticket_committer.rb +11 -0
- data/app/models/ticket_tag.rb +25 -0
- data/app/models/user.rb +160 -0
- data/app/models/user_credentials.rb +48 -0
- data/app/models/value_statement.rb +9 -0
- data/app/presenters/commit_presenter.rb +52 -0
- data/app/presenters/full_ticket_presenter.rb +78 -0
- data/app/presenters/one_or_many.rb +22 -0
- data/app/presenters/problem_presenter.rb +49 -0
- data/app/presenters/release_presenter.rb +20 -0
- data/app/presenters/sprint_task_presenter.rb +49 -0
- data/app/presenters/task_presenter.rb +44 -0
- data/app/presenters/tasks_excel_presenter.rb +107 -0
- data/app/presenters/tester_presenter.rb +15 -0
- data/app/presenters/testing_note_presenter.rb +27 -0
- data/app/presenters/testing_report_ticket_presenter.rb +71 -0
- data/app/presenters/ticket_presenter.rb +36 -0
- data/app/views/activity/_events.html.erb +24 -0
- data/app/views/commits/show.html.erb +49 -0
- data/app/views/configuration_error/_invalid_repo.html.erb +7 -0
- data/app/views/configuration_error/_no_ticket_tracker.html.erb +7 -0
- data/app/views/configuration_error/_no_version_control.html.erb +7 -0
- data/app/views/deploys/show.html.erb +39 -0
- data/app/views/devise/_links.erb +25 -0
- data/app/views/devise/confirmations/new.html.erb +12 -0
- data/app/views/devise/invitations/edit.html.erb +26 -0
- data/app/views/devise/invitations/new.html.erb +12 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/invitation_instructions.html.erb +8 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +28 -0
- data/app/views/devise/passwords/new.html.erb +19 -0
- data/app/views/devise/registrations/edit.html.erb +25 -0
- data/app/views/devise/registrations/new.html.erb +18 -0
- data/app/views/devise/sessions/new.html.erb +43 -0
- data/app/views/devise/unlocks/new.html.erb +12 -0
- data/app/views/home/index.html.erb +0 -0
- data/app/views/jobs/show.html.erb +82 -0
- data/app/views/layouts/_navigation.html.erb +96 -0
- data/app/views/layouts/_tester_bar.html.erb +6 -0
- data/app/views/layouts/application.html.erb +83 -0
- data/app/views/layouts/dashboard.html.erb +48 -0
- data/app/views/layouts/email.html.erb +217 -0
- data/app/views/layouts/minimal.html.erb +54 -0
- data/app/views/layouts/naked_dashboard.html.erb +46 -0
- data/app/views/oauth_consumers/error.html.erb +5 -0
- data/app/views/oauth_consumers/index.html.erb +29 -0
- data/app/views/oauth_consumers/show.html.erb +7 -0
- data/app/views/project_notification/ci_configuration_error.html.erb +15 -0
- data/app/views/project_notification/follow_up.html.erb +26 -0
- data/app/views/project_notification/new_release.html.erb +31 -0
- data/app/views/project_notification/test_run.html.erb +141 -0
- data/app/views/project_notification/testing_note.html.erb +9 -0
- data/app/views/project_pretickets/show.html.erb +49 -0
- data/app/views/project_tickets/_tickets.html.erb +37 -0
- data/app/views/project_tickets/bugs.html.erb +13 -0
- data/app/views/project_tickets/ideas.html.erb +13 -0
- data/app/views/project_tickets/index.html.erb +13 -0
- data/app/views/project_tickets/index.xls.erb +130 -0
- data/app/views/project_tickets/new.html.erb +18 -0
- data/app/views/project_tickets/no_ticket_tracker.html.erb +8 -0
- data/app/views/project_tickets/open.html.erb +13 -0
- data/app/views/project_tickets/open_bugs.html.erb +13 -0
- data/app/views/project_tickets/open_ideas.html.erb +13 -0
- data/app/views/project_tickets/show.html.erb +76 -0
- data/app/views/projects/_form.html.erb +174 -0
- data/app/views/projects/_header.html.erb +11 -0
- data/app/views/projects/_keyboard_shortcuts.html.erb +8 -0
- data/app/views/projects/_new_ticket.html.erb +8 -0
- data/app/views/projects/_ticket_tracker_refresh.html.erb +4 -0
- data/app/views/projects/edit.html.erb +3 -0
- data/app/views/projects/index.html.erb +157 -0
- data/app/views/projects/new.html.erb +7 -0
- data/app/views/releases/_antecedents.html.erb +12 -0
- data/app/views/releases/_changelog.html.erb +48 -0
- data/app/views/releases/_commits.html.erb +18 -0
- data/app/views/releases/_form.html.erb +126 -0
- data/app/views/releases/_new_release.html.erb +15 -0
- data/app/views/releases/_tickets.html.erb +12 -0
- data/app/views/releases/edit.html.erb +19 -0
- data/app/views/releases/index.html.erb +80 -0
- data/app/views/releases/new.html.erb +72 -0
- data/app/views/releases/show.html.erb +3 -0
- data/app/views/reports/index.html.erb +9 -0
- data/app/views/reports/sprint.html.erb +21 -0
- data/app/views/reports/velocity.html.erb +104 -0
- data/app/views/settings/show.html.erb +20 -0
- data/app/views/sprints/dashboard.html.erb +29 -0
- data/app/views/sprints/show.html.erb +39 -0
- data/app/views/test_runs/confirm_retry.html.erb +3 -0
- data/app/views/testing_report/_scripts.html.erb +12 -0
- data/app/views/testing_report/index.html.erb +31 -0
- data/app/views/testing_report/show.html.erb +29 -0
- data/app/views/tickets/new.html.erb +18 -0
- data/app/views/users/_form.html.erb +115 -0
- data/app/views/users/_header.html.erb +10 -0
- data/app/views/users/edit.html.erb +3 -0
- data/app/views/users/index.html.erb +80 -0
- data/app/views/users/new.html.erb +8 -0
- data/app/views/users/show.html.erb +13 -0
- data/app/views/welcome/_tdl.html.erb +31 -0
- data/app/views/welcome/index.html.erb +29 -0
- data/bin/bundle +3 -0
- data/bin/rails +4 -0
- data/bin/rake +4 -0
- data/config/application.rb +91 -0
- data/config/boot.rb +4 -0
- data/config/database.yml +21 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +48 -0
- data/config/environments/production.rb +86 -0
- data/config/environments/test.rb +45 -0
- data/config/initializers/action_view_field_error_proc.rb +30 -0
- data/config/initializers/add_navigation_renderers.rb +66 -0
- data/config/initializers/assets.rb +9 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/constants.rb +9 -0
- data/config/initializers/cookies_serializer.rb +3 -0
- data/config/initializers/devise.rb +287 -0
- data/config/initializers/filter_parameter_logging.rb +4 -0
- data/config/initializers/hard_coded_knowledge.rb +141 -0
- data/config/initializers/houston_async.rb +13 -0
- data/config/initializers/houston_benchmark.rb +11 -0
- data/config/initializers/houston_report_exception.rb +27 -0
- data/config/initializers/houston_scheduler.rb +23 -0
- data/config/initializers/houston_tdl.rb +104 -0
- data/config/initializers/houston_try.rb +24 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/oauth_consumers.rb +18 -0
- data/config/initializers/profile_gc.rb +1 -0
- data/config/initializers/requirements.rb +4 -0
- data/config/initializers/run_tests_on_post_receive.rb +1 -0
- data/config/initializers/secret_token.rb +16 -0
- data/config/initializers/session_store.rb +3 -0
- data/config/initializers/sync_commits_on_post_receive.rb +8 -0
- data/config/initializers/unfuddle.rb +6 -0
- data/config/initializers/vestal_versions.rb +9 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/devise.en.yml +59 -0
- data/config/locales/devise_invitable.en.yml +10 -0
- data/config/locales/en.yml +23 -0
- data/config/routes.rb +279 -0
- data/db/fixtures/projects.yml +21 -0
- data/db/fixtures/roles.yml +9 -0
- data/db/fixtures/users.yml +36 -0
- data/db/migrate/20120324185914_create_projects.rb +12 -0
- data/db/migrate/20120324202224_create_environments.rb +11 -0
- data/db/migrate/20120324212848_create_releases.rb +12 -0
- data/db/migrate/20120324212946_create_changes.rb +11 -0
- data/db/migrate/20120324230038_create_commits.rb +13 -0
- data/db/migrate/20120406185643_add_initial_commit_to_environments.rb +5 -0
- data/db/migrate/20120408155047_add_kanban_fields_to_projects.rb +9 -0
- data/db/migrate/20120417175450_devise_create_users.rb +52 -0
- data/db/migrate/20120417175841_devise_invitable_add_to_users.rb +23 -0
- data/db/migrate/20120417190504_add_role_to_users.rb +5 -0
- data/db/migrate/20120417195313_create_tickets.rb +12 -0
- data/db/migrate/20120417195433_create_ticket_queues.rb +11 -0
- data/db/migrate/20120424212706_create_testing_notes.rb +14 -0
- data/db/migrate/20120501230243_add_unfuddle_id_to_tickets.rb +9 -0
- data/db/migrate/20120501231817_add_expires_at_to_testing_notes.rb +5 -0
- data/db/migrate/20120501231948_add_unfuddle_id_to_testing_notes.rb +5 -0
- data/db/migrate/20120504143615_link_tickets_and_releases.rb +19 -0
- data/db/migrate/20120525013703_add_health_fields_to_projects.rb +6 -0
- data/db/migrate/20120607124115_add_cached_queries_to_projects.rb +5 -0
- data/db/migrate/20120626140242_add_deployment_to_tickets.rb +5 -0
- data/db/migrate/20120626150333_add_last_release_at_to_tickets.rb +14 -0
- data/db/migrate/20120626151320_link_tickets_and_commits.rb +17 -0
- data/db/migrate/20120626152020_add_committer_email_to_commits.rb +13 -0
- data/db/migrate/20120626152949_replace_committer_info_with_author_info.rb +12 -0
- data/db/migrate/20120715230526_change_testing_notes_comment_to_text.rb +9 -0
- data/db/migrate/20120715230922_create_user_notifications.rb +19 -0
- data/db/migrate/20120716010743_add_user_to_releases.rb +14 -0
- data/db/migrate/20120726212620_add_message_to_release.rb +5 -0
- data/db/migrate/20120726231754_link_projects_and_maintainers.rb +22 -0
- data/db/migrate/20120804003344_add_goldmine_to_tickets.rb +5 -0
- data/db/migrate/20120823025935_add_errbit_app_id_to_projects.rb +5 -0
- data/db/migrate/20120826022643_add_authentication_token_to_users.rb +13 -0
- data/db/migrate/20120827190634_add_git_last_sync_at_to_projects.rb +5 -0
- data/db/migrate/20120913020218_add_new_relic_id_to_projects.rb +5 -0
- data/db/migrate/20120920023251_add_administrator_to_users.rb +17 -0
- data/db/migrate/20120922010212_add_unfuddle_id_to_users.rb +5 -0
- data/db/migrate/20121026014457_split_users_name_into_first_and_last.rb +22 -0
- data/db/migrate/20121027160548_create_deploys.rb +11 -0
- data/db/migrate/20121027171215_add_deploy_id_to_releases.rb +6 -0
- data/db/migrate/20121104233305_add_tag_slug_to_changes.rb +5 -0
- data/db/migrate/20121126005019_add_retired_at_to_projects.rb +5 -0
- data/db/migrate/20121214025558_add_estimated_effort_and_estimated_value_to_tickets.rb +6 -0
- data/db/migrate/20121219202734_add_category_to_projects.rb +5 -0
- data/db/migrate/20121220031008_add_expires_at_to_tickets.rb +5 -0
- data/db/migrate/20121222170917_add_version_control_adapter_to_projects.rb +17 -0
- data/db/migrate/20121222223325_remove_unused_fields_from_projects.rb +21 -0
- data/db/migrate/20121222223635_add_ticket_tracking_adapter_to_projects.rb +17 -0
- data/db/migrate/20121224212623_rename_environments.rb +29 -0
- data/db/migrate/20121225175106_replace_environment_id_with_environment_name.rb +39 -0
- data/db/migrate/20121230173644_setup_hstore.rb +9 -0
- data/db/migrate/20121230174234_create_test_runs.rb +22 -0
- data/db/migrate/20130105200429_add_c_i_adapter_to_projects.rb +5 -0
- data/db/migrate/20130106184327_replace_test_runs_details_with_tests.rb +11 -0
- data/db/migrate/20130106185425_add_total_count_to_test_runs.rb +5 -0
- data/db/migrate/20130119203853_remove_cached_queries_from_projects.rb +9 -0
- data/db/migrate/20130119204608_add_extended_attributes_to_tickets.rb +35 -0
- data/db/migrate/20130119211540_remove_estimated_effort_and_estimated_value_from_tickets.rb +11 -0
- data/db/migrate/20130119212008_rename_tickets_unfuddle_id_to_remote_id.rb +5 -0
- data/db/migrate/20130120182026_create_ticket_prerequisites.rb +13 -0
- data/db/migrate/20130211015046_add_min_passing_verdicts_to_projects.rb +5 -0
- data/db/migrate/20130302205014_change_default_role_for_users.rb +8 -0
- data/db/migrate/20130306023456_add_agent_email_to_test_runs.rb +5 -0
- data/db/migrate/20130306023613_add_branch_to_test_runs.rb +5 -0
- data/db/migrate/20130312224911_create_errors.rb +12 -0
- data/db/migrate/20130319003918_add_coverage_to_test_runs.rb +7 -0
- data/db/migrate/20130407195450_create_roles.rb +14 -0
- data/db/migrate/20130407200624_populate_roles.rb +43 -0
- data/db/migrate/20130407220039_add_project_id_to_testing_notes.rb +26 -0
- data/db/migrate/20130407220937_add_project_id_to_commits.rb +26 -0
- data/db/migrate/20130416020627_add_environments_subscribed_to_to_users.rb +17 -0
- data/db/migrate/20130420151334_rename_ticket_tracking_to_ticket_tracker.rb +6 -0
- data/db/migrate/20130420155332_rename_projects_version_control_adapter_to_version_control_name.rb +5 -0
- data/db/migrate/20130420172322_rename_projects_ci_adapter_to_ci_server_name.rb +5 -0
- data/db/migrate/20130420174002_rename_projects_errbit_app_id_to_error_tracker_id.rb +5 -0
- data/db/migrate/20130420174126_add_error_tracker_name_to_projects.rb +11 -0
- data/db/migrate/20130427223925_create_project_quotas.rb +14 -0
- data/db/migrate/20130428005808_create_settings.rb +8 -0
- data/db/migrate/20130504014802_add_extended_attributes_to_projects.rb +19 -0
- data/db/migrate/20130504135741_add_antecedents_to_tickets.rb +26 -0
- data/db/migrate/20130505144446_add_tags_to_tickets.rb +9 -0
- data/db/migrate/20130505162039_add_type_to_tickets.rb +9 -0
- data/db/migrate/20130505212838_add_closed_at_to_tickets.rb +9 -0
- data/db/migrate/20130518224352_drop_environments.rb +9 -0
- data/db/migrate/20130518224406_drop_projects_maintainers.rb +9 -0
- data/db/migrate/20130518224655_remove_goldmine_from_tickets.rb +9 -0
- data/db/migrate/20130518224722_remove_pre_adapter_fields_from_projects.rb +11 -0
- data/db/migrate/20130519163615_create_user_credentials.rb +18 -0
- data/db/migrate/20130525192607_add_reporter_email_and_reporter_id_to_tickets.rb +6 -0
- data/db/migrate/20130525222131_add_regression_count_to_test_runs.rb +5 -0
- data/db/migrate/20130526024851_give_default_values_for_counts_from_test_runs.rb +19 -0
- data/db/migrate/20130706141443_drop_deprecated_project_roles.rb +9 -0
- data/db/migrate/20130710233849_add_authored_at_to_commits.rb +52 -0
- data/db/migrate/20130711004558_downcase_commits_committer_emails.rb +10 -0
- data/db/migrate/20130711013156_link_commits_and_users.rb +35 -0
- data/db/migrate/20130728191005_add_retired_at_to_users.rb +5 -0
- data/db/migrate/20130806143651_link_commits_and_releases.rb +18 -0
- data/db/migrate/20130815232527_add_unreachable_to_commits.rb +6 -0
- data/db/migrate/20130914152419_rename_test_runs_commit_to_sha.rb +9 -0
- data/db/migrate/20130914155044_add_code_climate_repo_token_to_projects.rb +5 -0
- data/db/migrate/20130921141449_create_milestones.rb +19 -0
- data/db/migrate/20131002005512_add_last_ticket_tracker_sync_at_to_projects.rb +5 -0
- data/db/migrate/20131002015547_add_ticket_tracker_sync_started_at_to_projects.rb +5 -0
- data/db/migrate/20131002145620_add_destroyed_at_to_tickets.rb +6 -0
- data/db/migrate/20131003014023_add_destroyed_at_to_milestones.rb +6 -0
- data/db/migrate/20131004015452_add_resolution_to_tickets.rb +6 -0
- data/db/migrate/20131004185618_add_first_release_at_to_tickets.rb +14 -0
- data/db/migrate/20131012152403_create_sprints.rb +15 -0
- data/db/migrate/20131013185636_add_checked_out_to_tickets.rb +6 -0
- data/db/migrate/20131027214942_add_priority_to_tickets.rb +5 -0
- data/db/migrate/20131112010815_delete_duplicate_commits.rb +33 -0
- data/db/migrate/20131216014505_create_oauth_consumer_tokens.rb +20 -0
- data/db/migrate/20131223194246_add_reopened_at_to_tickets.rb +5 -0
- data/db/migrate/20140106212047_add_options_to_projects.rb +5 -0
- data/db/migrate/20140106212305_add_options_to_users.rb +5 -0
- data/db/migrate/20140114014144_add_deployer_to_deploys.rb +5 -0
- data/db/migrate/20140217150735_drop_table_user_notifications.rb +9 -0
- data/db/migrate/20140217160450_add_email_addresses_to_users.rb +18 -0
- data/db/migrate/20140217195942_add_prerequisites_to_tickets.rb +5 -0
- data/db/migrate/20140327020121_drop_ticket_prerequisites.rb +9 -0
- data/db/migrate/20140401234330_add_index_to_ticket_queues.rb +6 -0
- data/db/migrate/20140406183224_remove_new_relic_id_from_projects.rb +9 -0
- data/db/migrate/20140406230121_delete_automatically_generated_messages_for_releases.rb +12 -0
- data/db/migrate/20140407010111_drop_sprints_project_id.rb +9 -0
- data/db/migrate/20140411214022_add_invitation_created_at_to_user.rb +5 -0
- data/db/migrate/20140418133005_change_ticket_antecedents_to_text_array.rb +9 -0
- data/db/migrate/20140419152214_add_gemnasium_slug_to_projects.rb +5 -0
- data/db/migrate/20140425141946_embed_changes_in_releases.rb +19 -0
- data/db/migrate/20140427235508_prevent_release_changes_from_being_null.rb +6 -0
- data/db/migrate/20140428023146_prevent_ticket_number_from_being_null.rb +5 -0
- data/db/migrate/20140429000919_add_feature_states_to_projects.rb +5 -0
- data/db/migrate/20140506032958_add_locked_to_sprints.rb +5 -0
- data/db/migrate/20140506035755_create_value_statements.rb +9 -0
- data/db/migrate/20140511024021_rename_testing_notes_unfuddle_id_to_remote_id.rb +5 -0
- data/db/migrate/20140515174322_create_tasks.rb +20 -0
- data/db/migrate/20140515200824_link_tasks_and_commits.rb +8 -0
- data/db/migrate/20140516005310_link_tasks_and_releases.rb +8 -0
- data/db/migrate/20140516012049_create_tasks_for_existing_tickets.rb +33 -0
- data/db/migrate/20140517012626_prevent_hstore_fields_from_being_null.rb +22 -0
- data/db/migrate/20140521014652_allow_task_descriptions_to_be_null.rb +13 -0
- data/db/migrate/20140526155845_add_commit_id_to_deploys.rb +31 -0
- data/db/migrate/20140526162645_add_commit_before_id_and_commit_after_id_to_releases.rb +28 -0
- data/db/migrate/20140526180608_associate_remaining_deploys_and_releases.rb +60 -0
- data/db/migrate/20140606232907_create_vestal_versions.rb +28 -0
- data/db/migrate/20140724231918_create_sprints_tasks.rb +17 -0
- data/db/migrate/20140806233301_add_position_to_milestones.rb +5 -0
- data/db/migrate/20140810224209_add_size_and_units_to_milestones.rb +7 -0
- data/db/migrate/20140824194031_add_project_id_to_tasks.rb +11 -0
- data/db/migrate/20140824194526_add_completed_at_to_tasks.rb +20 -0
- data/db/migrate/20140824211249_require_sprints_to_be_unique.rb +9 -0
- data/db/migrate/20140907012329_drop_table_changes.rb +9 -0
- data/db/migrate/20140907013836_drop_table_errors.rb +9 -0
- data/db/migrate/20140921190022_add_checked_out_to_sprints_tasks.rb +19 -0
- data/db/migrate/20140921201441_drop_users_name.rb +9 -0
- data/db/migrate/20140925021043_rename_deploys_commit_to_sha.rb +17 -0
- data/db/migrate/20140929004347_create_historical_heads.rb +23 -0
- data/db/migrate/20141027194819_make_users_environments_subscribed_to_an_array.rb +18 -0
- data/db/migrate/20141202004123_add_duration_to_deploys.rb +5 -0
- data/db/migrate/20141226171730_create_measurements.rb +17 -0
- data/db/migrate/20150116153233_add_timestamps_to_measurements.rb +6 -0
- data/db/migrate/20150119154013_drop_unused_fields_from_milestones.rb +13 -0
- data/db/migrate/20150220215154_add_branch_to_deploys.rb +5 -0
- data/db/migrate/20150222205616_add_features_to_projects.rb +12 -0
- data/db/migrate/20150222214124_add_current_project_to_users.rb +5 -0
- data/db/migrate/20150223013721_add_nickname_to_users.rb +5 -0
- data/db/migrate/20150302153319_add_username_to_users.rb +5 -0
- data/db/migrate/20150323004452_add_deploys_completed_at.rb +10 -0
- data/db/migrate/20150323011050_add_output_to_deploy.rb +5 -0
- data/db/migrate/20150805180939_add_commit_id_to_test_runs.rb +30 -0
- data/db/migrate/20150805233946_add_user_id_to_test_runs.rb +23 -0
- data/db/migrate/20150806032230_create_tests.rb +33 -0
- data/db/migrate/20150808161729_create_test_errors.rb +10 -0
- data/db/migrate/20150808161805_create_test_results.rb +72 -0
- data/db/migrate/20150808162928_index_test_runs_on_commit_id.rb +5 -0
- data/db/migrate/20150808192103_index_commits_on_sha.rb +5 -0
- data/db/migrate/20150808193354_add_parent_sha_to_commits.rb +43 -0
- data/db/migrate/20150809132417_rename_test_results_regression_to_difference.rb +11 -0
- data/db/migrate/20150809201942_add_compared_to_test_runs.rb +5 -0
- data/db/migrate/20150817232311_create_pull_requests.rb +25 -0
- data/db/migrate/20150820023708_add_labels_to_pull_requests.rb +5 -0
- data/db/migrate/20150902005758_downcase_environment_names.rb +19 -0
- data/db/migrate/20150902010629_add_user_id_to_deploys.rb +5 -0
- data/db/migrate/20150902010853_populate_deploys_user.rb +13 -0
- data/db/seeds.rb +9 -0
- data/db/structure.sql +2282 -0
- data/houston.gemspec +99 -0
- data/lib/configuration.rb +764 -0
- data/lib/core_ext/duration.rb +21 -0
- data/lib/core_ext/exception.rb +7 -0
- data/lib/core_ext/hash.rb +51 -0
- data/lib/core_ext/kernel.rb +23 -0
- data/lib/houston/application.rb +1 -0
- data/lib/houston/version.rb +3 -0
- data/lib/houston_daemonize.rb +37 -0
- data/lib/houston_observer.rb +69 -0
- data/lib/houston_server.rb +31 -0
- data/lib/parallel_enumerable.rb +56 -0
- data/lib/patches/sprockets_output_path_for_assets.rb +29 -0
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/.keep +0 -0
- data/lib/tasks/config.rake +255 -0
- data/lib/tasks/keypair.rake +18 -0
- data/lib/unexpected_response.rb +22 -0
- data/log/.gitkeep +0 -0
- data/log/.keep +0 -0
- data/script/bootstrap +14 -0
- data/script/cibuild +9 -0
- data/support/award.ai +4409 -19
- data/support/badges.ai +4621 -19
- data/support/bugs-1.ai +1364 -1
- data/support/bugs-2.ai +806 -1
- data/support/chevron.ai +4431 -19
- data/support/favicon.psd +0 -0
- data/support/flask.ai +386 -1
- data/support/headings.ai +394 -0
- data/support/new-window-link-12.gif +0 -0
- data/support/newrelic.ai +204 -0
- data/support/newrelic.png +0 -0
- data/support/wrench.ai +4389 -20
- data/vendor/assets/javascripts/.gitkeep +0 -0
- data/vendor/assets/javascripts/.keep +0 -0
- data/vendor/assets/javascripts/Markdown.Converter.js +1412 -0
- data/vendor/assets/javascripts/alertify.js +1 -0
- data/vendor/assets/javascripts/bootstrap.js +2280 -0
- data/vendor/assets/javascripts/d3.v3.js +9274 -0
- data/vendor/assets/javascripts/dropzone.js +1728 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.accordion.js +572 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.autocomplete.js +608 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.button.js +419 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.core.js +324 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.datepicker.js +2050 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.dialog.js +799 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.draggable.js +943 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.droppable.js +371 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.effect-blind.js +82 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.effect-bounce.js +113 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.effect-clip.js +67 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.effect-drop.js +65 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.effect-explode.js +97 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.effect-fade.js +30 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.effect-fold.js +76 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.effect-highlight.js +50 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.effect-pulsate.js +63 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.effect-scale.js +318 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.effect-shake.js +74 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.effect-slide.js +64 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.effect-transfer.js +47 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.effect.js +1268 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.menu.js +621 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.mouse.js +169 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.position.js +497 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.progressbar.js +145 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.resizable.js +946 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.selectable.js +277 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.slider.js +672 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.sortable.js +1250 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.spinner.js +492 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.tabs.js +846 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.tooltip.js +402 -0
- data/vendor/assets/javascripts/jquery-ui-1.10.1/jquery.ui.widget.js +521 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery-ui-i18n.js +1379 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-af.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-ar-DZ.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-ar.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-az.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-bg.js +24 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-bs.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-ca.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-cs.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-da.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-de.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-el.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-en-AU.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-en-GB.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-en-NZ.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-eo.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-es.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-et.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-eu.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-fa.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-fi.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-fo.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-fr-CH.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-fr.js +25 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-gl.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-he.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-hr.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-hu.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-hy.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-id.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-is.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-it.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-ja.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-ko.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-kz.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-lt.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-lv.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-ml.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-ms.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-nl.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-no.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-pl.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-pt-BR.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-pt.js +22 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-rm.js +21 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-ro.js +26 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-ru.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-sk.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-sl.js +24 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-sq.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-sr-SR.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-sr.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-sv.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-ta.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-th.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-tj.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-tr.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-uk.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-vi.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-zh-CN.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-zh-HK.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/i18n/jquery.ui.datepicker-zh-TW.js +23 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.effects.blind.js +49 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.effects.bounce.js +78 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.effects.clip.js +54 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.effects.core.js +746 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.effects.drop.js +50 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.effects.explode.js +79 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.effects.fade.js +32 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.effects.fold.js +56 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.effects.highlight.js +49 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.effects.pulsate.js +51 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.effects.scale.js +178 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.effects.shake.js +57 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.effects.slide.js +50 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.effects.transfer.js +45 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.accordion.js +611 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.autocomplete.js +612 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.button.js +416 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.core.js +312 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.datepicker.js +1814 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.dialog.js +879 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.draggable.js +823 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.droppable.js +296 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.mouse.js +160 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.position.js +252 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.progressbar.js +109 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.resizable.js +842 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.selectable.js +266 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.slider.js +666 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.sortable.js +1077 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.tabs.js +758 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.4/jquery.ui.widget.js +262 -0
- data/vendor/assets/javascripts/jquery-ui.js +55 -0
- data/vendor/assets/javascripts/jquery.autosize.js +242 -0
- data/vendor/assets/javascripts/jquery.pjax.js +817 -0
- data/vendor/assets/javascripts/jquery.tablesorter.js +1032 -0
- data/vendor/assets/javascripts/jquery.timeago.js +214 -0
- data/vendor/assets/javascripts/md5.js +202 -0
- data/vendor/assets/javascripts/mousetrap.js +953 -0
- data/vendor/assets/stylesheets/.gitkeep +0 -0
- data/vendor/assets/stylesheets/.keep +0 -0
- data/vendor/assets/stylesheets/alertify-bootstrap-3.css +2 -0
- data/vendor/assets/stylesheets/alertify-bootstrap.css +2 -0
- data/vendor/assets/stylesheets/alertify.css +2 -0
- data/vendor/assets/stylesheets/bootstrap-responsive.css +800 -0
- data/vendor/assets/stylesheets/bootstrap.css +6163 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.accordion.css +38 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.autocomplete.css +16 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.button.css +114 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.core.css +93 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.datepicker.css +178 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.dialog.css +69 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.menu.css +77 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.progressbar.css +28 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.resizable.css +78 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.selectable.css +15 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.slider.css +73 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.spinner.css +65 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.tabs.css +52 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.theme.css +406 -0
- data/vendor/assets/stylesheets/jquery-ui-1.10.1/jquery.ui.tooltip.css +19 -0
- data/vendor/assets/stylesheets/jquery-ui.css +28 -0
- data/vendor/images/fa-bank.svg +9 -0
- data/vendor/images/fa-bell.svg +9 -0
- data/vendor/images/fa-bomb.svg +9 -0
- data/vendor/images/fa-bug.svg +9 -0
- data/vendor/images/fa-bullhorn.svg +6 -0
- data/vendor/images/fa-burndown.svg +15 -0
- data/vendor/images/fa-calendar-o.svg +9 -0
- data/vendor/images/fa-comment.svg +9 -0
- data/vendor/images/fa-comments.svg +9 -0
- data/vendor/images/fa-database.svg +9 -0
- data/vendor/images/fa-fire-extinguisher.svg +9 -0
- data/vendor/images/fa-gear.svg +6 -0
- data/vendor/images/fa-lightbulb-o.svg +9 -0
- data/vendor/images/fa-paper-plane.svg +9 -0
- data/vendor/images/fa-road.svg +9 -0
- data/vendor/images/fa-user.svg +9 -0
- metadata +1611 -0
@@ -0,0 +1,1728 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
*
|
4
|
+
* More info at [www.dropzonejs.com](http://www.dropzonejs.com)
|
5
|
+
*
|
6
|
+
* Copyright (c) 2012, Matias Meno
|
7
|
+
*
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
13
|
+
* furnished to do so, subject to the following conditions:
|
14
|
+
*
|
15
|
+
* The above copyright notice and this permission notice shall be included in
|
16
|
+
* all copies or substantial portions of the Software.
|
17
|
+
*
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
* THE SOFTWARE.
|
25
|
+
*
|
26
|
+
*/
|
27
|
+
|
28
|
+
(function() {
|
29
|
+
var Dropzone, Emitter, camelize, contentLoaded, detectVerticalSquash, drawImageIOSFix, noop, without,
|
30
|
+
__slice = [].slice,
|
31
|
+
__hasProp = {}.hasOwnProperty,
|
32
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
33
|
+
|
34
|
+
noop = function() {};
|
35
|
+
|
36
|
+
Emitter = (function() {
|
37
|
+
function Emitter() {}
|
38
|
+
|
39
|
+
Emitter.prototype.addEventListener = Emitter.prototype.on;
|
40
|
+
|
41
|
+
Emitter.prototype.on = function(event, fn) {
|
42
|
+
this._callbacks = this._callbacks || {};
|
43
|
+
if (!this._callbacks[event]) {
|
44
|
+
this._callbacks[event] = [];
|
45
|
+
}
|
46
|
+
this._callbacks[event].push(fn);
|
47
|
+
return this;
|
48
|
+
};
|
49
|
+
|
50
|
+
Emitter.prototype.emit = function() {
|
51
|
+
var args, callback, callbacks, event, _i, _len;
|
52
|
+
event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
53
|
+
this._callbacks = this._callbacks || {};
|
54
|
+
callbacks = this._callbacks[event];
|
55
|
+
if (callbacks) {
|
56
|
+
for (_i = 0, _len = callbacks.length; _i < _len; _i++) {
|
57
|
+
callback = callbacks[_i];
|
58
|
+
callback.apply(this, args);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
return this;
|
62
|
+
};
|
63
|
+
|
64
|
+
Emitter.prototype.removeListener = Emitter.prototype.off;
|
65
|
+
|
66
|
+
Emitter.prototype.removeAllListeners = Emitter.prototype.off;
|
67
|
+
|
68
|
+
Emitter.prototype.removeEventListener = Emitter.prototype.off;
|
69
|
+
|
70
|
+
Emitter.prototype.off = function(event, fn) {
|
71
|
+
var callback, callbacks, i, _i, _len;
|
72
|
+
if (!this._callbacks || arguments.length === 0) {
|
73
|
+
this._callbacks = {};
|
74
|
+
return this;
|
75
|
+
}
|
76
|
+
callbacks = this._callbacks[event];
|
77
|
+
if (!callbacks) {
|
78
|
+
return this;
|
79
|
+
}
|
80
|
+
if (arguments.length === 1) {
|
81
|
+
delete this._callbacks[event];
|
82
|
+
return this;
|
83
|
+
}
|
84
|
+
for (i = _i = 0, _len = callbacks.length; _i < _len; i = ++_i) {
|
85
|
+
callback = callbacks[i];
|
86
|
+
if (callback === fn) {
|
87
|
+
callbacks.splice(i, 1);
|
88
|
+
break;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
return this;
|
92
|
+
};
|
93
|
+
|
94
|
+
return Emitter;
|
95
|
+
|
96
|
+
})();
|
97
|
+
|
98
|
+
Dropzone = (function(_super) {
|
99
|
+
var extend, resolveOption;
|
100
|
+
|
101
|
+
__extends(Dropzone, _super);
|
102
|
+
|
103
|
+
Dropzone.prototype.Emitter = Emitter;
|
104
|
+
|
105
|
+
|
106
|
+
/*
|
107
|
+
This is a list of all available events you can register on a dropzone object.
|
108
|
+
|
109
|
+
You can register an event handler like this:
|
110
|
+
|
111
|
+
dropzone.on("dragEnter", function() { });
|
112
|
+
*/
|
113
|
+
|
114
|
+
Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "addedfile", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded", "maxfilesreached", "queuecomplete"];
|
115
|
+
|
116
|
+
Dropzone.prototype.defaultOptions = {
|
117
|
+
url: null,
|
118
|
+
method: "post",
|
119
|
+
withCredentials: false,
|
120
|
+
parallelUploads: 2,
|
121
|
+
uploadMultiple: false,
|
122
|
+
maxFilesize: 256,
|
123
|
+
paramName: "file",
|
124
|
+
createImageThumbnails: true,
|
125
|
+
maxThumbnailFilesize: 10,
|
126
|
+
thumbnailWidth: 120,
|
127
|
+
thumbnailHeight: 120,
|
128
|
+
filesizeBase: 1000,
|
129
|
+
maxFiles: null,
|
130
|
+
filesizeBase: 1000,
|
131
|
+
params: {},
|
132
|
+
clickable: true,
|
133
|
+
ignoreHiddenFiles: true,
|
134
|
+
acceptedFiles: null,
|
135
|
+
acceptedMimeTypes: null,
|
136
|
+
autoProcessQueue: true,
|
137
|
+
autoQueue: true,
|
138
|
+
addRemoveLinks: false,
|
139
|
+
previewsContainer: null,
|
140
|
+
capture: null,
|
141
|
+
dictDefaultMessage: "Drop files here to upload",
|
142
|
+
dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
|
143
|
+
dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
|
144
|
+
dictFileTooBig: "File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",
|
145
|
+
dictInvalidFileType: "You can't upload files of this type.",
|
146
|
+
dictResponseError: "Server responded with {{statusCode}} code.",
|
147
|
+
dictCancelUpload: "Cancel upload",
|
148
|
+
dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?",
|
149
|
+
dictRemoveFile: "Remove file",
|
150
|
+
dictRemoveFileConfirmation: null,
|
151
|
+
dictMaxFilesExceeded: "You can not upload any more files.",
|
152
|
+
accept: function(file, done) {
|
153
|
+
return done();
|
154
|
+
},
|
155
|
+
init: function() {
|
156
|
+
return noop;
|
157
|
+
},
|
158
|
+
forceFallback: false,
|
159
|
+
fallback: function() {
|
160
|
+
var child, messageElement, span, _i, _len, _ref;
|
161
|
+
this.element.className = "" + this.element.className + " dz-browser-not-supported";
|
162
|
+
_ref = this.element.getElementsByTagName("div");
|
163
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
164
|
+
child = _ref[_i];
|
165
|
+
if (/(^| )dz-message($| )/.test(child.className)) {
|
166
|
+
messageElement = child;
|
167
|
+
child.className = "dz-message";
|
168
|
+
continue;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
if (!messageElement) {
|
172
|
+
messageElement = Dropzone.createElement("<div class=\"dz-message\"><span></span></div>");
|
173
|
+
this.element.appendChild(messageElement);
|
174
|
+
}
|
175
|
+
span = messageElement.getElementsByTagName("span")[0];
|
176
|
+
if (span) {
|
177
|
+
span.textContent = this.options.dictFallbackMessage;
|
178
|
+
}
|
179
|
+
return this.element.appendChild(this.getFallbackForm());
|
180
|
+
},
|
181
|
+
resize: function(file) {
|
182
|
+
var info, srcRatio, trgRatio;
|
183
|
+
info = {
|
184
|
+
srcX: 0,
|
185
|
+
srcY: 0,
|
186
|
+
srcWidth: file.width,
|
187
|
+
srcHeight: file.height
|
188
|
+
};
|
189
|
+
srcRatio = file.width / file.height;
|
190
|
+
info.optWidth = this.options.thumbnailWidth;
|
191
|
+
info.optHeight = this.options.thumbnailHeight;
|
192
|
+
if ((info.optWidth == null) && (info.optHeight == null)) {
|
193
|
+
info.optWidth = info.srcWidth;
|
194
|
+
info.optHeight = info.srcHeight;
|
195
|
+
} else if (info.optWidth == null) {
|
196
|
+
info.optWidth = srcRatio * info.optHeight;
|
197
|
+
} else if (info.optHeight == null) {
|
198
|
+
info.optHeight = (1 / srcRatio) * info.optWidth;
|
199
|
+
}
|
200
|
+
trgRatio = info.optWidth / info.optHeight;
|
201
|
+
if (file.height < info.optHeight || file.width < info.optWidth) {
|
202
|
+
info.trgHeight = info.srcHeight;
|
203
|
+
info.trgWidth = info.srcWidth;
|
204
|
+
} else {
|
205
|
+
if (srcRatio > trgRatio) {
|
206
|
+
info.srcHeight = file.height;
|
207
|
+
info.srcWidth = info.srcHeight * trgRatio;
|
208
|
+
} else {
|
209
|
+
info.srcWidth = file.width;
|
210
|
+
info.srcHeight = info.srcWidth / trgRatio;
|
211
|
+
}
|
212
|
+
}
|
213
|
+
info.srcX = (file.width - info.srcWidth) / 2;
|
214
|
+
info.srcY = (file.height - info.srcHeight) / 2;
|
215
|
+
return info;
|
216
|
+
},
|
217
|
+
|
218
|
+
/*
|
219
|
+
Those functions register themselves to the events on init and handle all
|
220
|
+
the user interface specific stuff. Overwriting them won't break the upload
|
221
|
+
but can break the way it's displayed.
|
222
|
+
You can overwrite them if you don't like the default behavior. If you just
|
223
|
+
want to add an additional event handler, register it on the dropzone object
|
224
|
+
and don't overwrite those options.
|
225
|
+
*/
|
226
|
+
drop: function(e) {
|
227
|
+
return this.element.classList.remove("dz-drag-hover");
|
228
|
+
},
|
229
|
+
dragstart: noop,
|
230
|
+
dragend: function(e) {
|
231
|
+
return this.element.classList.remove("dz-drag-hover");
|
232
|
+
},
|
233
|
+
dragenter: function(e) {
|
234
|
+
return this.element.classList.add("dz-drag-hover");
|
235
|
+
},
|
236
|
+
dragover: function(e) {
|
237
|
+
return this.element.classList.add("dz-drag-hover");
|
238
|
+
},
|
239
|
+
dragleave: function(e) {
|
240
|
+
return this.element.classList.remove("dz-drag-hover");
|
241
|
+
},
|
242
|
+
paste: noop,
|
243
|
+
reset: function() {
|
244
|
+
return this.element.classList.remove("dz-started");
|
245
|
+
},
|
246
|
+
addedfile: function(file) {
|
247
|
+
var node, removeFileEvent, removeLink, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _results;
|
248
|
+
if (this.element === this.previewsContainer) {
|
249
|
+
this.element.classList.add("dz-started");
|
250
|
+
}
|
251
|
+
if (this.previewsContainer) {
|
252
|
+
file.previewElement = Dropzone.createElement(this.options.previewTemplate.trim());
|
253
|
+
file.previewTemplate = file.previewElement;
|
254
|
+
this.previewsContainer.appendChild(file.previewElement);
|
255
|
+
_ref = file.previewElement.querySelectorAll("[data-dz-name]");
|
256
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
257
|
+
node = _ref[_i];
|
258
|
+
node.textContent = file.name;
|
259
|
+
}
|
260
|
+
_ref1 = file.previewElement.querySelectorAll("[data-dz-size]");
|
261
|
+
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
262
|
+
node = _ref1[_j];
|
263
|
+
node.innerHTML = this.filesize(file.size);
|
264
|
+
}
|
265
|
+
if (this.options.addRemoveLinks) {
|
266
|
+
file._removeLink = Dropzone.createElement("<a class=\"dz-remove\" href=\"javascript:undefined;\" data-dz-remove>" + this.options.dictRemoveFile + "</a>");
|
267
|
+
file.previewElement.appendChild(file._removeLink);
|
268
|
+
}
|
269
|
+
removeFileEvent = (function(_this) {
|
270
|
+
return function(e) {
|
271
|
+
e.preventDefault();
|
272
|
+
e.stopPropagation();
|
273
|
+
if (file.status === Dropzone.UPLOADING) {
|
274
|
+
return Dropzone.confirm(_this.options.dictCancelUploadConfirmation, function() {
|
275
|
+
return _this.removeFile(file);
|
276
|
+
});
|
277
|
+
} else {
|
278
|
+
if (_this.options.dictRemoveFileConfirmation) {
|
279
|
+
return Dropzone.confirm(_this.options.dictRemoveFileConfirmation, function() {
|
280
|
+
return _this.removeFile(file);
|
281
|
+
});
|
282
|
+
} else {
|
283
|
+
return _this.removeFile(file);
|
284
|
+
}
|
285
|
+
}
|
286
|
+
};
|
287
|
+
})(this);
|
288
|
+
_ref2 = file.previewElement.querySelectorAll("[data-dz-remove]");
|
289
|
+
_results = [];
|
290
|
+
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
|
291
|
+
removeLink = _ref2[_k];
|
292
|
+
_results.push(removeLink.addEventListener("click", removeFileEvent));
|
293
|
+
}
|
294
|
+
return _results;
|
295
|
+
}
|
296
|
+
},
|
297
|
+
removedfile: function(file) {
|
298
|
+
var _ref;
|
299
|
+
if (file.previewElement) {
|
300
|
+
if ((_ref = file.previewElement) != null) {
|
301
|
+
_ref.parentNode.removeChild(file.previewElement);
|
302
|
+
}
|
303
|
+
}
|
304
|
+
return this._updateMaxFilesReachedClass();
|
305
|
+
},
|
306
|
+
thumbnail: function(file, dataUrl) {
|
307
|
+
var thumbnailElement, _i, _len, _ref;
|
308
|
+
if (file.previewElement) {
|
309
|
+
file.previewElement.classList.remove("dz-file-preview");
|
310
|
+
_ref = file.previewElement.querySelectorAll("[data-dz-thumbnail]");
|
311
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
312
|
+
thumbnailElement = _ref[_i];
|
313
|
+
thumbnailElement.alt = file.name;
|
314
|
+
thumbnailElement.src = dataUrl;
|
315
|
+
}
|
316
|
+
return setTimeout(((function(_this) {
|
317
|
+
return function() {
|
318
|
+
return file.previewElement.classList.add("dz-image-preview");
|
319
|
+
};
|
320
|
+
})(this)), 1);
|
321
|
+
}
|
322
|
+
},
|
323
|
+
error: function(file, message) {
|
324
|
+
var node, _i, _len, _ref, _results;
|
325
|
+
if (file.previewElement) {
|
326
|
+
file.previewElement.classList.add("dz-error");
|
327
|
+
if (typeof message !== "String" && message.error) {
|
328
|
+
message = message.error;
|
329
|
+
}
|
330
|
+
_ref = file.previewElement.querySelectorAll("[data-dz-errormessage]");
|
331
|
+
_results = [];
|
332
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
333
|
+
node = _ref[_i];
|
334
|
+
_results.push(node.textContent = message);
|
335
|
+
}
|
336
|
+
return _results;
|
337
|
+
}
|
338
|
+
},
|
339
|
+
errormultiple: noop,
|
340
|
+
processing: function(file) {
|
341
|
+
if (file.previewElement) {
|
342
|
+
file.previewElement.classList.add("dz-processing");
|
343
|
+
if (file._removeLink) {
|
344
|
+
return file._removeLink.textContent = this.options.dictCancelUpload;
|
345
|
+
}
|
346
|
+
}
|
347
|
+
},
|
348
|
+
processingmultiple: noop,
|
349
|
+
uploadprogress: function(file, progress, bytesSent) {
|
350
|
+
var node, _i, _len, _ref, _results;
|
351
|
+
if (file.previewElement) {
|
352
|
+
_ref = file.previewElement.querySelectorAll("[data-dz-uploadprogress]");
|
353
|
+
_results = [];
|
354
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
355
|
+
node = _ref[_i];
|
356
|
+
if (node.nodeName === 'PROGRESS') {
|
357
|
+
_results.push(node.value = progress);
|
358
|
+
} else {
|
359
|
+
_results.push(node.style.width = "" + progress + "%");
|
360
|
+
}
|
361
|
+
}
|
362
|
+
return _results;
|
363
|
+
}
|
364
|
+
},
|
365
|
+
totaluploadprogress: noop,
|
366
|
+
sending: noop,
|
367
|
+
sendingmultiple: noop,
|
368
|
+
success: function(file) {
|
369
|
+
if (file.previewElement) {
|
370
|
+
return file.previewElement.classList.add("dz-success");
|
371
|
+
}
|
372
|
+
},
|
373
|
+
successmultiple: noop,
|
374
|
+
canceled: function(file) {
|
375
|
+
return this.emit("error", file, "Upload canceled.");
|
376
|
+
},
|
377
|
+
canceledmultiple: noop,
|
378
|
+
complete: function(file) {
|
379
|
+
if (file._removeLink) {
|
380
|
+
file._removeLink.textContent = this.options.dictRemoveFile;
|
381
|
+
}
|
382
|
+
if (file.previewElement) {
|
383
|
+
return file.previewElement.classList.add("dz-complete");
|
384
|
+
}
|
385
|
+
},
|
386
|
+
completemultiple: noop,
|
387
|
+
maxfilesexceeded: noop,
|
388
|
+
maxfilesreached: noop,
|
389
|
+
queuecomplete: noop,
|
390
|
+
previewTemplate: "<div class=\"dz-preview dz-file-preview\">\n <div class=\"dz-image\"><img data-dz-thumbnail /></div>\n <div class=\"dz-details\">\n <div class=\"dz-size\"><span data-dz-size></span></div>\n <div class=\"dz-filename\"><span data-dz-name></span></div>\n </div>\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n <div class=\"dz-success-mark\">\n <svg width=\"54px\" height=\"54px\" viewBox=\"0 0 54 54\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\">\n <title>Check</title>\n <defs></defs>\n <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" sketch:type=\"MSPage\">\n <path d=\"M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z\" id=\"Oval-2\" stroke-opacity=\"0.198794158\" stroke=\"#747474\" fill-opacity=\"0.816519475\" fill=\"#FFFFFF\" sketch:type=\"MSShapeGroup\"></path>\n </g>\n </svg>\n </div>\n <div class=\"dz-error-mark\">\n <svg width=\"54px\" height=\"54px\" viewBox=\"0 0 54 54\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\">\n <title>Error</title>\n <defs></defs>\n <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" sketch:type=\"MSPage\">\n <g id=\"Check-+-Oval-2\" sketch:type=\"MSLayerGroup\" stroke=\"#747474\" stroke-opacity=\"0.198794158\" fill=\"#FFFFFF\" fill-opacity=\"0.816519475\">\n <path d=\"M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z\" id=\"Oval-2\" sketch:type=\"MSShapeGroup\"></path>\n </g>\n </g>\n </svg>\n </div>\n</div>"
|
391
|
+
};
|
392
|
+
|
393
|
+
extend = function() {
|
394
|
+
var key, object, objects, target, val, _i, _len;
|
395
|
+
target = arguments[0], objects = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
396
|
+
for (_i = 0, _len = objects.length; _i < _len; _i++) {
|
397
|
+
object = objects[_i];
|
398
|
+
for (key in object) {
|
399
|
+
val = object[key];
|
400
|
+
target[key] = val;
|
401
|
+
}
|
402
|
+
}
|
403
|
+
return target;
|
404
|
+
};
|
405
|
+
|
406
|
+
function Dropzone(element, options) {
|
407
|
+
var elementOptions, fallback, _ref;
|
408
|
+
this.element = element;
|
409
|
+
this.version = Dropzone.version;
|
410
|
+
this.defaultOptions.previewTemplate = this.defaultOptions.previewTemplate.replace(/\n*/g, "");
|
411
|
+
this.clickableElements = [];
|
412
|
+
this.listeners = [];
|
413
|
+
this.files = [];
|
414
|
+
if (typeof this.element === "string") {
|
415
|
+
this.element = document.querySelector(this.element);
|
416
|
+
}
|
417
|
+
if (!(this.element && (this.element.nodeType != null))) {
|
418
|
+
throw new Error("Invalid dropzone element.");
|
419
|
+
}
|
420
|
+
if (this.element.dropzone) {
|
421
|
+
throw new Error("Dropzone already attached.");
|
422
|
+
}
|
423
|
+
Dropzone.instances.push(this);
|
424
|
+
this.element.dropzone = this;
|
425
|
+
elementOptions = (_ref = Dropzone.optionsForElement(this.element)) != null ? _ref : {};
|
426
|
+
this.options = extend({}, this.defaultOptions, elementOptions, options != null ? options : {});
|
427
|
+
if (this.options.forceFallback || !Dropzone.isBrowserSupported()) {
|
428
|
+
return this.options.fallback.call(this);
|
429
|
+
}
|
430
|
+
if (this.options.url == null) {
|
431
|
+
this.options.url = this.element.getAttribute("action");
|
432
|
+
}
|
433
|
+
if (!this.options.url) {
|
434
|
+
throw new Error("No URL provided.");
|
435
|
+
}
|
436
|
+
if (this.options.acceptedFiles && this.options.acceptedMimeTypes) {
|
437
|
+
throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");
|
438
|
+
}
|
439
|
+
if (this.options.acceptedMimeTypes) {
|
440
|
+
this.options.acceptedFiles = this.options.acceptedMimeTypes;
|
441
|
+
delete this.options.acceptedMimeTypes;
|
442
|
+
}
|
443
|
+
this.options.method = this.options.method.toUpperCase();
|
444
|
+
if ((fallback = this.getExistingFallback()) && fallback.parentNode) {
|
445
|
+
fallback.parentNode.removeChild(fallback);
|
446
|
+
}
|
447
|
+
if (this.options.previewsContainer !== false) {
|
448
|
+
if (this.options.previewsContainer) {
|
449
|
+
this.previewsContainer = Dropzone.getElement(this.options.previewsContainer, "previewsContainer");
|
450
|
+
} else {
|
451
|
+
this.previewsContainer = this.element;
|
452
|
+
}
|
453
|
+
}
|
454
|
+
if (this.options.clickable) {
|
455
|
+
if (this.options.clickable === true) {
|
456
|
+
this.clickableElements = [this.element];
|
457
|
+
} else {
|
458
|
+
this.clickableElements = Dropzone.getElements(this.options.clickable, "clickable");
|
459
|
+
}
|
460
|
+
}
|
461
|
+
this.init();
|
462
|
+
}
|
463
|
+
|
464
|
+
Dropzone.prototype.getAcceptedFiles = function() {
|
465
|
+
var file, _i, _len, _ref, _results;
|
466
|
+
_ref = this.files;
|
467
|
+
_results = [];
|
468
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
469
|
+
file = _ref[_i];
|
470
|
+
if (file.accepted) {
|
471
|
+
_results.push(file);
|
472
|
+
}
|
473
|
+
}
|
474
|
+
return _results;
|
475
|
+
};
|
476
|
+
|
477
|
+
Dropzone.prototype.getRejectedFiles = function() {
|
478
|
+
var file, _i, _len, _ref, _results;
|
479
|
+
_ref = this.files;
|
480
|
+
_results = [];
|
481
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
482
|
+
file = _ref[_i];
|
483
|
+
if (!file.accepted) {
|
484
|
+
_results.push(file);
|
485
|
+
}
|
486
|
+
}
|
487
|
+
return _results;
|
488
|
+
};
|
489
|
+
|
490
|
+
Dropzone.prototype.getFilesWithStatus = function(status) {
|
491
|
+
var file, _i, _len, _ref, _results;
|
492
|
+
_ref = this.files;
|
493
|
+
_results = [];
|
494
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
495
|
+
file = _ref[_i];
|
496
|
+
if (file.status === status) {
|
497
|
+
_results.push(file);
|
498
|
+
}
|
499
|
+
}
|
500
|
+
return _results;
|
501
|
+
};
|
502
|
+
|
503
|
+
Dropzone.prototype.getQueuedFiles = function() {
|
504
|
+
return this.getFilesWithStatus(Dropzone.QUEUED);
|
505
|
+
};
|
506
|
+
|
507
|
+
Dropzone.prototype.getUploadingFiles = function() {
|
508
|
+
return this.getFilesWithStatus(Dropzone.UPLOADING);
|
509
|
+
};
|
510
|
+
|
511
|
+
Dropzone.prototype.getActiveFiles = function() {
|
512
|
+
var file, _i, _len, _ref, _results;
|
513
|
+
_ref = this.files;
|
514
|
+
_results = [];
|
515
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
516
|
+
file = _ref[_i];
|
517
|
+
if (file.status === Dropzone.UPLOADING || file.status === Dropzone.QUEUED) {
|
518
|
+
_results.push(file);
|
519
|
+
}
|
520
|
+
}
|
521
|
+
return _results;
|
522
|
+
};
|
523
|
+
|
524
|
+
Dropzone.prototype.init = function() {
|
525
|
+
var eventName, noPropagation, setupHiddenFileInput, _i, _len, _ref, _ref1;
|
526
|
+
if (this.element.tagName === "form") {
|
527
|
+
this.element.setAttribute("enctype", "multipart/form-data");
|
528
|
+
}
|
529
|
+
if (this.element.classList.contains("dropzone") && !this.element.querySelector(".dz-message")) {
|
530
|
+
this.element.appendChild(Dropzone.createElement("<div class=\"dz-default dz-message\"><span>" + this.options.dictDefaultMessage + "</span></div>"));
|
531
|
+
}
|
532
|
+
if (this.clickableElements.length) {
|
533
|
+
setupHiddenFileInput = (function(_this) {
|
534
|
+
return function() {
|
535
|
+
if (_this.hiddenFileInput) {
|
536
|
+
document.body.removeChild(_this.hiddenFileInput);
|
537
|
+
}
|
538
|
+
_this.hiddenFileInput = document.createElement("input");
|
539
|
+
_this.hiddenFileInput.setAttribute("type", "file");
|
540
|
+
if ((_this.options.maxFiles == null) || _this.options.maxFiles > 1) {
|
541
|
+
_this.hiddenFileInput.setAttribute("multiple", "multiple");
|
542
|
+
}
|
543
|
+
_this.hiddenFileInput.className = "dz-hidden-input";
|
544
|
+
if (_this.options.acceptedFiles != null) {
|
545
|
+
_this.hiddenFileInput.setAttribute("accept", _this.options.acceptedFiles);
|
546
|
+
}
|
547
|
+
if (_this.options.capture != null) {
|
548
|
+
_this.hiddenFileInput.setAttribute("capture", _this.options.capture);
|
549
|
+
}
|
550
|
+
_this.hiddenFileInput.style.visibility = "hidden";
|
551
|
+
_this.hiddenFileInput.style.position = "absolute";
|
552
|
+
_this.hiddenFileInput.style.top = "0";
|
553
|
+
_this.hiddenFileInput.style.left = "0";
|
554
|
+
_this.hiddenFileInput.style.height = "0";
|
555
|
+
_this.hiddenFileInput.style.width = "0";
|
556
|
+
document.body.appendChild(_this.hiddenFileInput);
|
557
|
+
return _this.hiddenFileInput.addEventListener("change", function() {
|
558
|
+
var file, files, _i, _len;
|
559
|
+
files = _this.hiddenFileInput.files;
|
560
|
+
if (files.length) {
|
561
|
+
for (_i = 0, _len = files.length; _i < _len; _i++) {
|
562
|
+
file = files[_i];
|
563
|
+
_this.addFile(file);
|
564
|
+
}
|
565
|
+
}
|
566
|
+
return setupHiddenFileInput();
|
567
|
+
});
|
568
|
+
};
|
569
|
+
})(this);
|
570
|
+
setupHiddenFileInput();
|
571
|
+
}
|
572
|
+
this.URL = (_ref = window.URL) != null ? _ref : window.webkitURL;
|
573
|
+
_ref1 = this.events;
|
574
|
+
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
575
|
+
eventName = _ref1[_i];
|
576
|
+
this.on(eventName, this.options[eventName]);
|
577
|
+
}
|
578
|
+
this.on("uploadprogress", (function(_this) {
|
579
|
+
return function() {
|
580
|
+
return _this.updateTotalUploadProgress();
|
581
|
+
};
|
582
|
+
})(this));
|
583
|
+
this.on("removedfile", (function(_this) {
|
584
|
+
return function() {
|
585
|
+
return _this.updateTotalUploadProgress();
|
586
|
+
};
|
587
|
+
})(this));
|
588
|
+
this.on("canceled", (function(_this) {
|
589
|
+
return function(file) {
|
590
|
+
return _this.emit("complete", file);
|
591
|
+
};
|
592
|
+
})(this));
|
593
|
+
this.on("complete", (function(_this) {
|
594
|
+
return function(file) {
|
595
|
+
if (_this.getUploadingFiles().length === 0 && _this.getQueuedFiles().length === 0) {
|
596
|
+
return setTimeout((function() {
|
597
|
+
return _this.emit("queuecomplete");
|
598
|
+
}), 0);
|
599
|
+
}
|
600
|
+
};
|
601
|
+
})(this));
|
602
|
+
noPropagation = function(e) {
|
603
|
+
e.stopPropagation();
|
604
|
+
if (e.preventDefault) {
|
605
|
+
return e.preventDefault();
|
606
|
+
} else {
|
607
|
+
return e.returnValue = false;
|
608
|
+
}
|
609
|
+
};
|
610
|
+
this.listeners = [
|
611
|
+
{
|
612
|
+
element: this.element,
|
613
|
+
events: {
|
614
|
+
"dragstart": (function(_this) {
|
615
|
+
return function(e) {
|
616
|
+
return _this.emit("dragstart", e);
|
617
|
+
};
|
618
|
+
})(this),
|
619
|
+
"dragenter": (function(_this) {
|
620
|
+
return function(e) {
|
621
|
+
noPropagation(e);
|
622
|
+
return _this.emit("dragenter", e);
|
623
|
+
};
|
624
|
+
})(this),
|
625
|
+
"dragover": (function(_this) {
|
626
|
+
return function(e) {
|
627
|
+
var efct;
|
628
|
+
try {
|
629
|
+
efct = e.dataTransfer.effectAllowed;
|
630
|
+
} catch (_error) {}
|
631
|
+
e.dataTransfer.dropEffect = 'move' === efct || 'linkMove' === efct ? 'move' : 'copy';
|
632
|
+
noPropagation(e);
|
633
|
+
return _this.emit("dragover", e);
|
634
|
+
};
|
635
|
+
})(this),
|
636
|
+
"dragleave": (function(_this) {
|
637
|
+
return function(e) {
|
638
|
+
return _this.emit("dragleave", e);
|
639
|
+
};
|
640
|
+
})(this),
|
641
|
+
"drop": (function(_this) {
|
642
|
+
return function(e) {
|
643
|
+
noPropagation(e);
|
644
|
+
return _this.drop(e);
|
645
|
+
};
|
646
|
+
})(this),
|
647
|
+
"dragend": (function(_this) {
|
648
|
+
return function(e) {
|
649
|
+
return _this.emit("dragend", e);
|
650
|
+
};
|
651
|
+
})(this)
|
652
|
+
}
|
653
|
+
}
|
654
|
+
];
|
655
|
+
this.clickableElements.forEach((function(_this) {
|
656
|
+
return function(clickableElement) {
|
657
|
+
return _this.listeners.push({
|
658
|
+
element: clickableElement,
|
659
|
+
events: {
|
660
|
+
"click": function(evt) {
|
661
|
+
if ((clickableElement !== _this.element) || (evt.target === _this.element || Dropzone.elementInside(evt.target, _this.element.querySelector(".dz-message")))) {
|
662
|
+
return _this.hiddenFileInput.click();
|
663
|
+
}
|
664
|
+
}
|
665
|
+
}
|
666
|
+
});
|
667
|
+
};
|
668
|
+
})(this));
|
669
|
+
this.enable();
|
670
|
+
return this.options.init.call(this);
|
671
|
+
};
|
672
|
+
|
673
|
+
Dropzone.prototype.destroy = function() {
|
674
|
+
var _ref;
|
675
|
+
this.disable();
|
676
|
+
this.removeAllFiles(true);
|
677
|
+
if ((_ref = this.hiddenFileInput) != null ? _ref.parentNode : void 0) {
|
678
|
+
this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);
|
679
|
+
this.hiddenFileInput = null;
|
680
|
+
}
|
681
|
+
delete this.element.dropzone;
|
682
|
+
return Dropzone.instances.splice(Dropzone.instances.indexOf(this), 1);
|
683
|
+
};
|
684
|
+
|
685
|
+
Dropzone.prototype.updateTotalUploadProgress = function() {
|
686
|
+
var activeFiles, file, totalBytes, totalBytesSent, totalUploadProgress, _i, _len, _ref;
|
687
|
+
totalBytesSent = 0;
|
688
|
+
totalBytes = 0;
|
689
|
+
activeFiles = this.getActiveFiles();
|
690
|
+
if (activeFiles.length) {
|
691
|
+
_ref = this.getActiveFiles();
|
692
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
693
|
+
file = _ref[_i];
|
694
|
+
totalBytesSent += file.upload.bytesSent;
|
695
|
+
totalBytes += file.upload.total;
|
696
|
+
}
|
697
|
+
totalUploadProgress = 100 * totalBytesSent / totalBytes;
|
698
|
+
} else {
|
699
|
+
totalUploadProgress = 100;
|
700
|
+
}
|
701
|
+
return this.emit("totaluploadprogress", totalUploadProgress, totalBytes, totalBytesSent);
|
702
|
+
};
|
703
|
+
|
704
|
+
Dropzone.prototype._getParamName = function(n) {
|
705
|
+
if (typeof this.options.paramName === "function") {
|
706
|
+
return this.options.paramName(n);
|
707
|
+
} else {
|
708
|
+
return "" + this.options.paramName + (this.options.uploadMultiple ? "[" + n + "]" : "");
|
709
|
+
}
|
710
|
+
};
|
711
|
+
|
712
|
+
Dropzone.prototype.getFallbackForm = function() {
|
713
|
+
var existingFallback, fields, fieldsString, form;
|
714
|
+
if (existingFallback = this.getExistingFallback()) {
|
715
|
+
return existingFallback;
|
716
|
+
}
|
717
|
+
fieldsString = "<div class=\"dz-fallback\">";
|
718
|
+
if (this.options.dictFallbackText) {
|
719
|
+
fieldsString += "<p>" + this.options.dictFallbackText + "</p>";
|
720
|
+
}
|
721
|
+
fieldsString += "<input type=\"file\" name=\"" + (this._getParamName(0)) + "\" " + (this.options.uploadMultiple ? 'multiple="multiple"' : void 0) + " /><input type=\"submit\" value=\"Upload!\"></div>";
|
722
|
+
fields = Dropzone.createElement(fieldsString);
|
723
|
+
if (this.element.tagName !== "FORM") {
|
724
|
+
form = Dropzone.createElement("<form action=\"" + this.options.url + "\" enctype=\"multipart/form-data\" method=\"" + this.options.method + "\"></form>");
|
725
|
+
form.appendChild(fields);
|
726
|
+
} else {
|
727
|
+
this.element.setAttribute("enctype", "multipart/form-data");
|
728
|
+
this.element.setAttribute("method", this.options.method);
|
729
|
+
}
|
730
|
+
return form != null ? form : fields;
|
731
|
+
};
|
732
|
+
|
733
|
+
Dropzone.prototype.getExistingFallback = function() {
|
734
|
+
var fallback, getFallback, tagName, _i, _len, _ref;
|
735
|
+
getFallback = function(elements) {
|
736
|
+
var el, _i, _len;
|
737
|
+
for (_i = 0, _len = elements.length; _i < _len; _i++) {
|
738
|
+
el = elements[_i];
|
739
|
+
if (/(^| )fallback($| )/.test(el.className)) {
|
740
|
+
return el;
|
741
|
+
}
|
742
|
+
}
|
743
|
+
};
|
744
|
+
_ref = ["div", "form"];
|
745
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
746
|
+
tagName = _ref[_i];
|
747
|
+
if (fallback = getFallback(this.element.getElementsByTagName(tagName))) {
|
748
|
+
return fallback;
|
749
|
+
}
|
750
|
+
}
|
751
|
+
};
|
752
|
+
|
753
|
+
Dropzone.prototype.setupEventListeners = function() {
|
754
|
+
var elementListeners, event, listener, _i, _len, _ref, _results;
|
755
|
+
_ref = this.listeners;
|
756
|
+
_results = [];
|
757
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
758
|
+
elementListeners = _ref[_i];
|
759
|
+
_results.push((function() {
|
760
|
+
var _ref1, _results1;
|
761
|
+
_ref1 = elementListeners.events;
|
762
|
+
_results1 = [];
|
763
|
+
for (event in _ref1) {
|
764
|
+
listener = _ref1[event];
|
765
|
+
_results1.push(elementListeners.element.addEventListener(event, listener, false));
|
766
|
+
}
|
767
|
+
return _results1;
|
768
|
+
})());
|
769
|
+
}
|
770
|
+
return _results;
|
771
|
+
};
|
772
|
+
|
773
|
+
Dropzone.prototype.removeEventListeners = function() {
|
774
|
+
var elementListeners, event, listener, _i, _len, _ref, _results;
|
775
|
+
_ref = this.listeners;
|
776
|
+
_results = [];
|
777
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
778
|
+
elementListeners = _ref[_i];
|
779
|
+
_results.push((function() {
|
780
|
+
var _ref1, _results1;
|
781
|
+
_ref1 = elementListeners.events;
|
782
|
+
_results1 = [];
|
783
|
+
for (event in _ref1) {
|
784
|
+
listener = _ref1[event];
|
785
|
+
_results1.push(elementListeners.element.removeEventListener(event, listener, false));
|
786
|
+
}
|
787
|
+
return _results1;
|
788
|
+
})());
|
789
|
+
}
|
790
|
+
return _results;
|
791
|
+
};
|
792
|
+
|
793
|
+
Dropzone.prototype.disable = function() {
|
794
|
+
var file, _i, _len, _ref, _results;
|
795
|
+
this.clickableElements.forEach(function(element) {
|
796
|
+
return element.classList.remove("dz-clickable");
|
797
|
+
});
|
798
|
+
this.removeEventListeners();
|
799
|
+
_ref = this.files;
|
800
|
+
_results = [];
|
801
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
802
|
+
file = _ref[_i];
|
803
|
+
_results.push(this.cancelUpload(file));
|
804
|
+
}
|
805
|
+
return _results;
|
806
|
+
};
|
807
|
+
|
808
|
+
Dropzone.prototype.enable = function() {
|
809
|
+
this.clickableElements.forEach(function(element) {
|
810
|
+
return element.classList.add("dz-clickable");
|
811
|
+
});
|
812
|
+
return this.setupEventListeners();
|
813
|
+
};
|
814
|
+
|
815
|
+
Dropzone.prototype.filesize = function(size) {
|
816
|
+
var cutoff, i, selectedSize, selectedUnit, unit, units, _i, _len;
|
817
|
+
units = ['TB', 'GB', 'MB', 'KB', 'b'];
|
818
|
+
selectedSize = selectedUnit = null;
|
819
|
+
for (i = _i = 0, _len = units.length; _i < _len; i = ++_i) {
|
820
|
+
unit = units[i];
|
821
|
+
cutoff = Math.pow(this.options.filesizeBase, 4 - i) / 10;
|
822
|
+
if (size >= cutoff) {
|
823
|
+
selectedSize = size / Math.pow(this.options.filesizeBase, 4 - i);
|
824
|
+
selectedUnit = unit;
|
825
|
+
break;
|
826
|
+
}
|
827
|
+
}
|
828
|
+
selectedSize = Math.round(10 * selectedSize) / 10;
|
829
|
+
return "<strong>" + selectedSize + "</strong> " + selectedUnit;
|
830
|
+
};
|
831
|
+
|
832
|
+
Dropzone.prototype._updateMaxFilesReachedClass = function() {
|
833
|
+
if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) {
|
834
|
+
if (this.getAcceptedFiles().length === this.options.maxFiles) {
|
835
|
+
this.emit('maxfilesreached', this.files);
|
836
|
+
}
|
837
|
+
return this.element.classList.add("dz-max-files-reached");
|
838
|
+
} else {
|
839
|
+
return this.element.classList.remove("dz-max-files-reached");
|
840
|
+
}
|
841
|
+
};
|
842
|
+
|
843
|
+
Dropzone.prototype.drop = function(e) {
|
844
|
+
var files, items;
|
845
|
+
if (!e.dataTransfer) {
|
846
|
+
return;
|
847
|
+
}
|
848
|
+
this.emit("drop", e);
|
849
|
+
files = e.dataTransfer.files;
|
850
|
+
if (files.length) {
|
851
|
+
items = e.dataTransfer.items;
|
852
|
+
if (items && items.length && (items[0].webkitGetAsEntry != null)) {
|
853
|
+
this._addFilesFromItems(items);
|
854
|
+
} else {
|
855
|
+
this.handleFiles(files);
|
856
|
+
}
|
857
|
+
}
|
858
|
+
};
|
859
|
+
|
860
|
+
Dropzone.prototype.paste = function(e) {
|
861
|
+
var items, _ref;
|
862
|
+
if ((e != null ? (_ref = e.clipboardData) != null ? _ref.items : void 0 : void 0) == null) {
|
863
|
+
return;
|
864
|
+
}
|
865
|
+
this.emit("paste", e);
|
866
|
+
items = e.clipboardData.items;
|
867
|
+
if (items.length) {
|
868
|
+
return this._addFilesFromItems(items);
|
869
|
+
}
|
870
|
+
};
|
871
|
+
|
872
|
+
Dropzone.prototype.handleFiles = function(files) {
|
873
|
+
var file, _i, _len, _results;
|
874
|
+
_results = [];
|
875
|
+
for (_i = 0, _len = files.length; _i < _len; _i++) {
|
876
|
+
file = files[_i];
|
877
|
+
_results.push(this.addFile(file));
|
878
|
+
}
|
879
|
+
return _results;
|
880
|
+
};
|
881
|
+
|
882
|
+
Dropzone.prototype._addFilesFromItems = function(items) {
|
883
|
+
var entry, item, _i, _len, _results;
|
884
|
+
_results = [];
|
885
|
+
for (_i = 0, _len = items.length; _i < _len; _i++) {
|
886
|
+
item = items[_i];
|
887
|
+
if ((item.webkitGetAsEntry != null) && (entry = item.webkitGetAsEntry())) {
|
888
|
+
if (entry.isFile) {
|
889
|
+
_results.push(this.addFile(item.getAsFile()));
|
890
|
+
} else if (entry.isDirectory) {
|
891
|
+
_results.push(this._addFilesFromDirectory(entry, entry.name));
|
892
|
+
} else {
|
893
|
+
_results.push(void 0);
|
894
|
+
}
|
895
|
+
} else if (item.getAsFile != null) {
|
896
|
+
if ((item.kind == null) || item.kind === "file") {
|
897
|
+
_results.push(this.addFile(item.getAsFile()));
|
898
|
+
} else {
|
899
|
+
_results.push(void 0);
|
900
|
+
}
|
901
|
+
} else {
|
902
|
+
_results.push(void 0);
|
903
|
+
}
|
904
|
+
}
|
905
|
+
return _results;
|
906
|
+
};
|
907
|
+
|
908
|
+
Dropzone.prototype._addFilesFromDirectory = function(directory, path) {
|
909
|
+
var dirReader, entriesReader;
|
910
|
+
dirReader = directory.createReader();
|
911
|
+
entriesReader = (function(_this) {
|
912
|
+
return function(entries) {
|
913
|
+
var entry, _i, _len;
|
914
|
+
for (_i = 0, _len = entries.length; _i < _len; _i++) {
|
915
|
+
entry = entries[_i];
|
916
|
+
if (entry.isFile) {
|
917
|
+
entry.file(function(file) {
|
918
|
+
if (_this.options.ignoreHiddenFiles && file.name.substring(0, 1) === '.') {
|
919
|
+
return;
|
920
|
+
}
|
921
|
+
file.fullPath = "" + path + "/" + file.name;
|
922
|
+
return _this.addFile(file);
|
923
|
+
});
|
924
|
+
} else if (entry.isDirectory) {
|
925
|
+
_this._addFilesFromDirectory(entry, "" + path + "/" + entry.name);
|
926
|
+
}
|
927
|
+
}
|
928
|
+
};
|
929
|
+
})(this);
|
930
|
+
return dirReader.readEntries(entriesReader, function(error) {
|
931
|
+
return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0;
|
932
|
+
});
|
933
|
+
};
|
934
|
+
|
935
|
+
Dropzone.prototype.accept = function(file, done) {
|
936
|
+
if (file.size > this.options.maxFilesize * 1024 * 1024) {
|
937
|
+
return done(this.options.dictFileTooBig.replace("{{filesize}}", Math.round(file.size / 1024 / 10.24) / 100).replace("{{maxFilesize}}", this.options.maxFilesize));
|
938
|
+
} else if (!Dropzone.isValidFile(file, this.options.acceptedFiles)) {
|
939
|
+
return done(this.options.dictInvalidFileType);
|
940
|
+
} else if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) {
|
941
|
+
done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}", this.options.maxFiles));
|
942
|
+
return this.emit("maxfilesexceeded", file);
|
943
|
+
} else {
|
944
|
+
return this.options.accept.call(this, file, done);
|
945
|
+
}
|
946
|
+
};
|
947
|
+
|
948
|
+
Dropzone.prototype.addFile = function(file) {
|
949
|
+
file.upload = {
|
950
|
+
progress: 0,
|
951
|
+
total: file.size,
|
952
|
+
bytesSent: 0
|
953
|
+
};
|
954
|
+
this.files.push(file);
|
955
|
+
file.status = Dropzone.ADDED;
|
956
|
+
this.emit("addedfile", file);
|
957
|
+
this._enqueueThumbnail(file);
|
958
|
+
return this.accept(file, (function(_this) {
|
959
|
+
return function(error) {
|
960
|
+
if (error) {
|
961
|
+
file.accepted = false;
|
962
|
+
_this._errorProcessing([file], error);
|
963
|
+
} else {
|
964
|
+
file.accepted = true;
|
965
|
+
if (_this.options.autoQueue) {
|
966
|
+
_this.enqueueFile(file);
|
967
|
+
}
|
968
|
+
}
|
969
|
+
return _this._updateMaxFilesReachedClass();
|
970
|
+
};
|
971
|
+
})(this));
|
972
|
+
};
|
973
|
+
|
974
|
+
Dropzone.prototype.enqueueFiles = function(files) {
|
975
|
+
var file, _i, _len;
|
976
|
+
for (_i = 0, _len = files.length; _i < _len; _i++) {
|
977
|
+
file = files[_i];
|
978
|
+
this.enqueueFile(file);
|
979
|
+
}
|
980
|
+
return null;
|
981
|
+
};
|
982
|
+
|
983
|
+
Dropzone.prototype.enqueueFile = function(file) {
|
984
|
+
if (file.status === Dropzone.ADDED && file.accepted === true) {
|
985
|
+
file.status = Dropzone.QUEUED;
|
986
|
+
if (this.options.autoProcessQueue) {
|
987
|
+
return setTimeout(((function(_this) {
|
988
|
+
return function() {
|
989
|
+
return _this.processQueue();
|
990
|
+
};
|
991
|
+
})(this)), 0);
|
992
|
+
}
|
993
|
+
} else {
|
994
|
+
throw new Error("This file can't be queued because it has already been processed or was rejected.");
|
995
|
+
}
|
996
|
+
};
|
997
|
+
|
998
|
+
Dropzone.prototype._thumbnailQueue = [];
|
999
|
+
|
1000
|
+
Dropzone.prototype._processingThumbnail = false;
|
1001
|
+
|
1002
|
+
Dropzone.prototype._enqueueThumbnail = function(file) {
|
1003
|
+
if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1024 * 1024) {
|
1004
|
+
this._thumbnailQueue.push(file);
|
1005
|
+
return setTimeout(((function(_this) {
|
1006
|
+
return function() {
|
1007
|
+
return _this._processThumbnailQueue();
|
1008
|
+
};
|
1009
|
+
})(this)), 0);
|
1010
|
+
}
|
1011
|
+
};
|
1012
|
+
|
1013
|
+
Dropzone.prototype._processThumbnailQueue = function() {
|
1014
|
+
if (this._processingThumbnail || this._thumbnailQueue.length === 0) {
|
1015
|
+
return;
|
1016
|
+
}
|
1017
|
+
this._processingThumbnail = true;
|
1018
|
+
return this.createThumbnail(this._thumbnailQueue.shift(), (function(_this) {
|
1019
|
+
return function() {
|
1020
|
+
_this._processingThumbnail = false;
|
1021
|
+
return _this._processThumbnailQueue();
|
1022
|
+
};
|
1023
|
+
})(this));
|
1024
|
+
};
|
1025
|
+
|
1026
|
+
Dropzone.prototype.removeFile = function(file) {
|
1027
|
+
if (file.status === Dropzone.UPLOADING) {
|
1028
|
+
this.cancelUpload(file);
|
1029
|
+
}
|
1030
|
+
this.files = without(this.files, file);
|
1031
|
+
this.emit("removedfile", file);
|
1032
|
+
if (this.files.length === 0) {
|
1033
|
+
return this.emit("reset");
|
1034
|
+
}
|
1035
|
+
};
|
1036
|
+
|
1037
|
+
Dropzone.prototype.removeAllFiles = function(cancelIfNecessary) {
|
1038
|
+
var file, _i, _len, _ref;
|
1039
|
+
if (cancelIfNecessary == null) {
|
1040
|
+
cancelIfNecessary = false;
|
1041
|
+
}
|
1042
|
+
_ref = this.files.slice();
|
1043
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1044
|
+
file = _ref[_i];
|
1045
|
+
if (file.status !== Dropzone.UPLOADING || cancelIfNecessary) {
|
1046
|
+
this.removeFile(file);
|
1047
|
+
}
|
1048
|
+
}
|
1049
|
+
return null;
|
1050
|
+
};
|
1051
|
+
|
1052
|
+
Dropzone.prototype.createThumbnail = function(file, callback) {
|
1053
|
+
var fileReader;
|
1054
|
+
fileReader = new FileReader;
|
1055
|
+
fileReader.onload = (function(_this) {
|
1056
|
+
return function() {
|
1057
|
+
if (file.type === "image/svg+xml") {
|
1058
|
+
_this.emit("thumbnail", file, fileReader.result);
|
1059
|
+
if (callback != null) {
|
1060
|
+
callback();
|
1061
|
+
}
|
1062
|
+
return;
|
1063
|
+
}
|
1064
|
+
return _this.createThumbnailFromUrl(file, fileReader.result, callback);
|
1065
|
+
};
|
1066
|
+
})(this);
|
1067
|
+
return fileReader.readAsDataURL(file);
|
1068
|
+
};
|
1069
|
+
|
1070
|
+
Dropzone.prototype.createThumbnailFromUrl = function(file, imageUrl, callback) {
|
1071
|
+
var img;
|
1072
|
+
img = document.createElement("img");
|
1073
|
+
img.onload = (function(_this) {
|
1074
|
+
return function() {
|
1075
|
+
var canvas, ctx, resizeInfo, thumbnail, _ref, _ref1, _ref2, _ref3;
|
1076
|
+
file.width = img.width;
|
1077
|
+
file.height = img.height;
|
1078
|
+
resizeInfo = _this.options.resize.call(_this, file);
|
1079
|
+
if (resizeInfo.trgWidth == null) {
|
1080
|
+
resizeInfo.trgWidth = resizeInfo.optWidth;
|
1081
|
+
}
|
1082
|
+
if (resizeInfo.trgHeight == null) {
|
1083
|
+
resizeInfo.trgHeight = resizeInfo.optHeight;
|
1084
|
+
}
|
1085
|
+
canvas = document.createElement("canvas");
|
1086
|
+
ctx = canvas.getContext("2d");
|
1087
|
+
canvas.width = resizeInfo.trgWidth;
|
1088
|
+
canvas.height = resizeInfo.trgHeight;
|
1089
|
+
drawImageIOSFix(ctx, img, (_ref = resizeInfo.srcX) != null ? _ref : 0, (_ref1 = resizeInfo.srcY) != null ? _ref1 : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, (_ref2 = resizeInfo.trgX) != null ? _ref2 : 0, (_ref3 = resizeInfo.trgY) != null ? _ref3 : 0, resizeInfo.trgWidth, resizeInfo.trgHeight);
|
1090
|
+
thumbnail = canvas.toDataURL("image/png");
|
1091
|
+
_this.emit("thumbnail", file, thumbnail);
|
1092
|
+
if (callback != null) {
|
1093
|
+
return callback();
|
1094
|
+
}
|
1095
|
+
};
|
1096
|
+
})(this);
|
1097
|
+
if (callback != null) {
|
1098
|
+
img.onerror = callback;
|
1099
|
+
}
|
1100
|
+
return img.src = imageUrl;
|
1101
|
+
};
|
1102
|
+
|
1103
|
+
Dropzone.prototype.processQueue = function() {
|
1104
|
+
var i, parallelUploads, processingLength, queuedFiles;
|
1105
|
+
parallelUploads = this.options.parallelUploads;
|
1106
|
+
processingLength = this.getUploadingFiles().length;
|
1107
|
+
i = processingLength;
|
1108
|
+
if (processingLength >= parallelUploads) {
|
1109
|
+
return;
|
1110
|
+
}
|
1111
|
+
queuedFiles = this.getQueuedFiles();
|
1112
|
+
if (!(queuedFiles.length > 0)) {
|
1113
|
+
return;
|
1114
|
+
}
|
1115
|
+
if (this.options.uploadMultiple) {
|
1116
|
+
return this.processFiles(queuedFiles.slice(0, parallelUploads - processingLength));
|
1117
|
+
} else {
|
1118
|
+
while (i < parallelUploads) {
|
1119
|
+
if (!queuedFiles.length) {
|
1120
|
+
return;
|
1121
|
+
}
|
1122
|
+
this.processFile(queuedFiles.shift());
|
1123
|
+
i++;
|
1124
|
+
}
|
1125
|
+
}
|
1126
|
+
};
|
1127
|
+
|
1128
|
+
Dropzone.prototype.processFile = function(file) {
|
1129
|
+
return this.processFiles([file]);
|
1130
|
+
};
|
1131
|
+
|
1132
|
+
Dropzone.prototype.processFiles = function(files) {
|
1133
|
+
var file, _i, _len;
|
1134
|
+
for (_i = 0, _len = files.length; _i < _len; _i++) {
|
1135
|
+
file = files[_i];
|
1136
|
+
file.processing = true;
|
1137
|
+
file.status = Dropzone.UPLOADING;
|
1138
|
+
this.emit("processing", file);
|
1139
|
+
}
|
1140
|
+
if (this.options.uploadMultiple) {
|
1141
|
+
this.emit("processingmultiple", files);
|
1142
|
+
}
|
1143
|
+
return this.uploadFiles(files);
|
1144
|
+
};
|
1145
|
+
|
1146
|
+
Dropzone.prototype._getFilesWithXhr = function(xhr) {
|
1147
|
+
var file, files;
|
1148
|
+
return files = (function() {
|
1149
|
+
var _i, _len, _ref, _results;
|
1150
|
+
_ref = this.files;
|
1151
|
+
_results = [];
|
1152
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1153
|
+
file = _ref[_i];
|
1154
|
+
if (file.xhr === xhr) {
|
1155
|
+
_results.push(file);
|
1156
|
+
}
|
1157
|
+
}
|
1158
|
+
return _results;
|
1159
|
+
}).call(this);
|
1160
|
+
};
|
1161
|
+
|
1162
|
+
Dropzone.prototype.cancelUpload = function(file) {
|
1163
|
+
var groupedFile, groupedFiles, _i, _j, _len, _len1, _ref;
|
1164
|
+
if (file.status === Dropzone.UPLOADING) {
|
1165
|
+
groupedFiles = this._getFilesWithXhr(file.xhr);
|
1166
|
+
for (_i = 0, _len = groupedFiles.length; _i < _len; _i++) {
|
1167
|
+
groupedFile = groupedFiles[_i];
|
1168
|
+
groupedFile.status = Dropzone.CANCELED;
|
1169
|
+
}
|
1170
|
+
file.xhr.abort();
|
1171
|
+
for (_j = 0, _len1 = groupedFiles.length; _j < _len1; _j++) {
|
1172
|
+
groupedFile = groupedFiles[_j];
|
1173
|
+
this.emit("canceled", groupedFile);
|
1174
|
+
}
|
1175
|
+
if (this.options.uploadMultiple) {
|
1176
|
+
this.emit("canceledmultiple", groupedFiles);
|
1177
|
+
}
|
1178
|
+
} else if ((_ref = file.status) === Dropzone.ADDED || _ref === Dropzone.QUEUED) {
|
1179
|
+
file.status = Dropzone.CANCELED;
|
1180
|
+
this.emit("canceled", file);
|
1181
|
+
if (this.options.uploadMultiple) {
|
1182
|
+
this.emit("canceledmultiple", [file]);
|
1183
|
+
}
|
1184
|
+
}
|
1185
|
+
if (this.options.autoProcessQueue) {
|
1186
|
+
return this.processQueue();
|
1187
|
+
}
|
1188
|
+
};
|
1189
|
+
|
1190
|
+
resolveOption = function() {
|
1191
|
+
var args, option;
|
1192
|
+
option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
1193
|
+
if (typeof option === 'function') {
|
1194
|
+
return option.apply(this, args);
|
1195
|
+
}
|
1196
|
+
return option;
|
1197
|
+
};
|
1198
|
+
|
1199
|
+
Dropzone.prototype.uploadFile = function(file) {
|
1200
|
+
return this.uploadFiles([file]);
|
1201
|
+
};
|
1202
|
+
|
1203
|
+
Dropzone.prototype.uploadFiles = function(files) {
|
1204
|
+
var file, formData, handleError, headerName, headerValue, headers, i, input, inputName, inputType, key, method, option, progressObj, response, updateProgress, url, value, xhr, _i, _j, _k, _l, _len, _len1, _len2, _len3, _m, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
1205
|
+
xhr = new XMLHttpRequest();
|
1206
|
+
for (_i = 0, _len = files.length; _i < _len; _i++) {
|
1207
|
+
file = files[_i];
|
1208
|
+
file.xhr = xhr;
|
1209
|
+
}
|
1210
|
+
method = resolveOption(this.options.method, files);
|
1211
|
+
url = resolveOption(this.options.url, files);
|
1212
|
+
xhr.open(method, url, true);
|
1213
|
+
xhr.withCredentials = !!this.options.withCredentials;
|
1214
|
+
response = null;
|
1215
|
+
handleError = (function(_this) {
|
1216
|
+
return function() {
|
1217
|
+
var _j, _len1, _results;
|
1218
|
+
_results = [];
|
1219
|
+
for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
|
1220
|
+
file = files[_j];
|
1221
|
+
_results.push(_this._errorProcessing(files, response || _this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr));
|
1222
|
+
}
|
1223
|
+
return _results;
|
1224
|
+
};
|
1225
|
+
})(this);
|
1226
|
+
updateProgress = (function(_this) {
|
1227
|
+
return function(e) {
|
1228
|
+
var allFilesFinished, progress, _j, _k, _l, _len1, _len2, _len3, _results;
|
1229
|
+
if (e != null) {
|
1230
|
+
progress = 100 * e.loaded / e.total;
|
1231
|
+
for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
|
1232
|
+
file = files[_j];
|
1233
|
+
file.upload = {
|
1234
|
+
progress: progress,
|
1235
|
+
total: e.total,
|
1236
|
+
bytesSent: e.loaded
|
1237
|
+
};
|
1238
|
+
}
|
1239
|
+
} else {
|
1240
|
+
allFilesFinished = true;
|
1241
|
+
progress = 100;
|
1242
|
+
for (_k = 0, _len2 = files.length; _k < _len2; _k++) {
|
1243
|
+
file = files[_k];
|
1244
|
+
if (!(file.upload.progress === 100 && file.upload.bytesSent === file.upload.total)) {
|
1245
|
+
allFilesFinished = false;
|
1246
|
+
}
|
1247
|
+
file.upload.progress = progress;
|
1248
|
+
file.upload.bytesSent = file.upload.total;
|
1249
|
+
}
|
1250
|
+
if (allFilesFinished) {
|
1251
|
+
return;
|
1252
|
+
}
|
1253
|
+
}
|
1254
|
+
_results = [];
|
1255
|
+
for (_l = 0, _len3 = files.length; _l < _len3; _l++) {
|
1256
|
+
file = files[_l];
|
1257
|
+
_results.push(_this.emit("uploadprogress", file, progress, file.upload.bytesSent));
|
1258
|
+
}
|
1259
|
+
return _results;
|
1260
|
+
};
|
1261
|
+
})(this);
|
1262
|
+
xhr.onload = (function(_this) {
|
1263
|
+
return function(e) {
|
1264
|
+
var _ref;
|
1265
|
+
if (files[0].status === Dropzone.CANCELED) {
|
1266
|
+
return;
|
1267
|
+
}
|
1268
|
+
if (xhr.readyState !== 4) {
|
1269
|
+
return;
|
1270
|
+
}
|
1271
|
+
response = xhr.responseText;
|
1272
|
+
if (xhr.getResponseHeader("content-type") && ~xhr.getResponseHeader("content-type").indexOf("application/json")) {
|
1273
|
+
try {
|
1274
|
+
response = JSON.parse(response);
|
1275
|
+
} catch (_error) {
|
1276
|
+
e = _error;
|
1277
|
+
response = "Invalid JSON response from server.";
|
1278
|
+
}
|
1279
|
+
}
|
1280
|
+
updateProgress();
|
1281
|
+
if (!((200 <= (_ref = xhr.status) && _ref < 300))) {
|
1282
|
+
return handleError();
|
1283
|
+
} else {
|
1284
|
+
return _this._finished(files, response, e);
|
1285
|
+
}
|
1286
|
+
};
|
1287
|
+
})(this);
|
1288
|
+
xhr.onerror = (function(_this) {
|
1289
|
+
return function() {
|
1290
|
+
if (files[0].status === Dropzone.CANCELED) {
|
1291
|
+
return;
|
1292
|
+
}
|
1293
|
+
return handleError();
|
1294
|
+
};
|
1295
|
+
})(this);
|
1296
|
+
progressObj = (_ref = xhr.upload) != null ? _ref : xhr;
|
1297
|
+
progressObj.onprogress = updateProgress;
|
1298
|
+
headers = {
|
1299
|
+
"Accept": "application/json",
|
1300
|
+
"Cache-Control": "no-cache",
|
1301
|
+
"X-Requested-With": "XMLHttpRequest"
|
1302
|
+
};
|
1303
|
+
if (this.options.headers) {
|
1304
|
+
extend(headers, this.options.headers);
|
1305
|
+
}
|
1306
|
+
for (headerName in headers) {
|
1307
|
+
headerValue = headers[headerName];
|
1308
|
+
xhr.setRequestHeader(headerName, headerValue);
|
1309
|
+
}
|
1310
|
+
formData = new FormData();
|
1311
|
+
if (this.options.params) {
|
1312
|
+
_ref1 = this.options.params;
|
1313
|
+
for (key in _ref1) {
|
1314
|
+
value = _ref1[key];
|
1315
|
+
formData.append(key, value);
|
1316
|
+
}
|
1317
|
+
}
|
1318
|
+
for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
|
1319
|
+
file = files[_j];
|
1320
|
+
this.emit("sending", file, xhr, formData);
|
1321
|
+
}
|
1322
|
+
if (this.options.uploadMultiple) {
|
1323
|
+
this.emit("sendingmultiple", files, xhr, formData);
|
1324
|
+
}
|
1325
|
+
if (this.element.tagName === "FORM") {
|
1326
|
+
_ref2 = this.element.querySelectorAll("input, textarea, select, button");
|
1327
|
+
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
|
1328
|
+
input = _ref2[_k];
|
1329
|
+
inputName = input.getAttribute("name");
|
1330
|
+
inputType = input.getAttribute("type");
|
1331
|
+
if (input.tagName === "SELECT" && input.hasAttribute("multiple")) {
|
1332
|
+
_ref3 = input.options;
|
1333
|
+
for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
|
1334
|
+
option = _ref3[_l];
|
1335
|
+
if (option.selected) {
|
1336
|
+
formData.append(inputName, option.value);
|
1337
|
+
}
|
1338
|
+
}
|
1339
|
+
} else if (!inputType || ((_ref4 = inputType.toLowerCase()) !== "checkbox" && _ref4 !== "radio") || input.checked) {
|
1340
|
+
formData.append(inputName, input.value);
|
1341
|
+
}
|
1342
|
+
}
|
1343
|
+
}
|
1344
|
+
for (i = _m = 0, _ref5 = files.length - 1; 0 <= _ref5 ? _m <= _ref5 : _m >= _ref5; i = 0 <= _ref5 ? ++_m : --_m) {
|
1345
|
+
formData.append(this._getParamName(i), files[i], files[i].name);
|
1346
|
+
}
|
1347
|
+
return xhr.send(formData);
|
1348
|
+
};
|
1349
|
+
|
1350
|
+
Dropzone.prototype._finished = function(files, responseText, e) {
|
1351
|
+
var file, _i, _len;
|
1352
|
+
for (_i = 0, _len = files.length; _i < _len; _i++) {
|
1353
|
+
file = files[_i];
|
1354
|
+
file.status = Dropzone.SUCCESS;
|
1355
|
+
this.emit("success", file, responseText, e);
|
1356
|
+
this.emit("complete", file);
|
1357
|
+
}
|
1358
|
+
if (this.options.uploadMultiple) {
|
1359
|
+
this.emit("successmultiple", files, responseText, e);
|
1360
|
+
this.emit("completemultiple", files);
|
1361
|
+
}
|
1362
|
+
if (this.options.autoProcessQueue) {
|
1363
|
+
return this.processQueue();
|
1364
|
+
}
|
1365
|
+
};
|
1366
|
+
|
1367
|
+
Dropzone.prototype._errorProcessing = function(files, message, xhr) {
|
1368
|
+
var file, _i, _len;
|
1369
|
+
for (_i = 0, _len = files.length; _i < _len; _i++) {
|
1370
|
+
file = files[_i];
|
1371
|
+
file.status = Dropzone.ERROR;
|
1372
|
+
this.emit("error", file, message, xhr);
|
1373
|
+
this.emit("complete", file);
|
1374
|
+
}
|
1375
|
+
if (this.options.uploadMultiple) {
|
1376
|
+
this.emit("errormultiple", files, message, xhr);
|
1377
|
+
this.emit("completemultiple", files);
|
1378
|
+
}
|
1379
|
+
if (this.options.autoProcessQueue) {
|
1380
|
+
return this.processQueue();
|
1381
|
+
}
|
1382
|
+
};
|
1383
|
+
|
1384
|
+
return Dropzone;
|
1385
|
+
|
1386
|
+
})(Emitter);
|
1387
|
+
|
1388
|
+
Dropzone.version = "4.0.1";
|
1389
|
+
|
1390
|
+
Dropzone.options = {};
|
1391
|
+
|
1392
|
+
Dropzone.optionsForElement = function(element) {
|
1393
|
+
if (element.getAttribute("id")) {
|
1394
|
+
return Dropzone.options[camelize(element.getAttribute("id"))];
|
1395
|
+
} else {
|
1396
|
+
return void 0;
|
1397
|
+
}
|
1398
|
+
};
|
1399
|
+
|
1400
|
+
Dropzone.instances = [];
|
1401
|
+
|
1402
|
+
Dropzone.forElement = function(element) {
|
1403
|
+
if (typeof element === "string") {
|
1404
|
+
element = document.querySelector(element);
|
1405
|
+
}
|
1406
|
+
if ((element != null ? element.dropzone : void 0) == null) {
|
1407
|
+
throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");
|
1408
|
+
}
|
1409
|
+
return element.dropzone;
|
1410
|
+
};
|
1411
|
+
|
1412
|
+
Dropzone.autoDiscover = true;
|
1413
|
+
|
1414
|
+
Dropzone.discover = function() {
|
1415
|
+
var checkElements, dropzone, dropzones, _i, _len, _results;
|
1416
|
+
if (document.querySelectorAll) {
|
1417
|
+
dropzones = document.querySelectorAll(".dropzone");
|
1418
|
+
} else {
|
1419
|
+
dropzones = [];
|
1420
|
+
checkElements = function(elements) {
|
1421
|
+
var el, _i, _len, _results;
|
1422
|
+
_results = [];
|
1423
|
+
for (_i = 0, _len = elements.length; _i < _len; _i++) {
|
1424
|
+
el = elements[_i];
|
1425
|
+
if (/(^| )dropzone($| )/.test(el.className)) {
|
1426
|
+
_results.push(dropzones.push(el));
|
1427
|
+
} else {
|
1428
|
+
_results.push(void 0);
|
1429
|
+
}
|
1430
|
+
}
|
1431
|
+
return _results;
|
1432
|
+
};
|
1433
|
+
checkElements(document.getElementsByTagName("div"));
|
1434
|
+
checkElements(document.getElementsByTagName("form"));
|
1435
|
+
}
|
1436
|
+
_results = [];
|
1437
|
+
for (_i = 0, _len = dropzones.length; _i < _len; _i++) {
|
1438
|
+
dropzone = dropzones[_i];
|
1439
|
+
if (Dropzone.optionsForElement(dropzone) !== false) {
|
1440
|
+
_results.push(new Dropzone(dropzone));
|
1441
|
+
} else {
|
1442
|
+
_results.push(void 0);
|
1443
|
+
}
|
1444
|
+
}
|
1445
|
+
return _results;
|
1446
|
+
};
|
1447
|
+
|
1448
|
+
Dropzone.blacklistedBrowsers = [/opera.*Macintosh.*version\/12/i];
|
1449
|
+
|
1450
|
+
Dropzone.isBrowserSupported = function() {
|
1451
|
+
var capableBrowser, regex, _i, _len, _ref;
|
1452
|
+
capableBrowser = true;
|
1453
|
+
if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) {
|
1454
|
+
if (!("classList" in document.createElement("a"))) {
|
1455
|
+
capableBrowser = false;
|
1456
|
+
} else {
|
1457
|
+
_ref = Dropzone.blacklistedBrowsers;
|
1458
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1459
|
+
regex = _ref[_i];
|
1460
|
+
if (regex.test(navigator.userAgent)) {
|
1461
|
+
capableBrowser = false;
|
1462
|
+
continue;
|
1463
|
+
}
|
1464
|
+
}
|
1465
|
+
}
|
1466
|
+
} else {
|
1467
|
+
capableBrowser = false;
|
1468
|
+
}
|
1469
|
+
return capableBrowser;
|
1470
|
+
};
|
1471
|
+
|
1472
|
+
without = function(list, rejectedItem) {
|
1473
|
+
var item, _i, _len, _results;
|
1474
|
+
_results = [];
|
1475
|
+
for (_i = 0, _len = list.length; _i < _len; _i++) {
|
1476
|
+
item = list[_i];
|
1477
|
+
if (item !== rejectedItem) {
|
1478
|
+
_results.push(item);
|
1479
|
+
}
|
1480
|
+
}
|
1481
|
+
return _results;
|
1482
|
+
};
|
1483
|
+
|
1484
|
+
camelize = function(str) {
|
1485
|
+
return str.replace(/[\-_](\w)/g, function(match) {
|
1486
|
+
return match.charAt(1).toUpperCase();
|
1487
|
+
});
|
1488
|
+
};
|
1489
|
+
|
1490
|
+
Dropzone.createElement = function(string) {
|
1491
|
+
var div;
|
1492
|
+
div = document.createElement("div");
|
1493
|
+
div.innerHTML = string;
|
1494
|
+
return div.childNodes[0];
|
1495
|
+
};
|
1496
|
+
|
1497
|
+
Dropzone.elementInside = function(element, container) {
|
1498
|
+
if (element === container) {
|
1499
|
+
return true;
|
1500
|
+
}
|
1501
|
+
while (element = element.parentNode) {
|
1502
|
+
if (element === container) {
|
1503
|
+
return true;
|
1504
|
+
}
|
1505
|
+
}
|
1506
|
+
return false;
|
1507
|
+
};
|
1508
|
+
|
1509
|
+
Dropzone.getElement = function(el, name) {
|
1510
|
+
var element;
|
1511
|
+
if (typeof el === "string") {
|
1512
|
+
element = document.querySelector(el);
|
1513
|
+
} else if (el.nodeType != null) {
|
1514
|
+
element = el;
|
1515
|
+
}
|
1516
|
+
if (element == null) {
|
1517
|
+
throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector or a plain HTML element.");
|
1518
|
+
}
|
1519
|
+
return element;
|
1520
|
+
};
|
1521
|
+
|
1522
|
+
Dropzone.getElements = function(els, name) {
|
1523
|
+
var e, el, elements, _i, _j, _len, _len1, _ref;
|
1524
|
+
if (els instanceof Array) {
|
1525
|
+
elements = [];
|
1526
|
+
try {
|
1527
|
+
for (_i = 0, _len = els.length; _i < _len; _i++) {
|
1528
|
+
el = els[_i];
|
1529
|
+
elements.push(this.getElement(el, name));
|
1530
|
+
}
|
1531
|
+
} catch (_error) {
|
1532
|
+
e = _error;
|
1533
|
+
elements = null;
|
1534
|
+
}
|
1535
|
+
} else if (typeof els === "string") {
|
1536
|
+
elements = [];
|
1537
|
+
_ref = document.querySelectorAll(els);
|
1538
|
+
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
|
1539
|
+
el = _ref[_j];
|
1540
|
+
elements.push(el);
|
1541
|
+
}
|
1542
|
+
} else if (els.nodeType != null) {
|
1543
|
+
elements = [els];
|
1544
|
+
}
|
1545
|
+
if (!((elements != null) && elements.length)) {
|
1546
|
+
throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");
|
1547
|
+
}
|
1548
|
+
return elements;
|
1549
|
+
};
|
1550
|
+
|
1551
|
+
Dropzone.confirm = function(question, accepted, rejected) {
|
1552
|
+
if (window.confirm(question)) {
|
1553
|
+
return accepted();
|
1554
|
+
} else if (rejected != null) {
|
1555
|
+
return rejected();
|
1556
|
+
}
|
1557
|
+
};
|
1558
|
+
|
1559
|
+
Dropzone.isValidFile = function(file, acceptedFiles) {
|
1560
|
+
var baseMimeType, mimeType, validType, _i, _len;
|
1561
|
+
if (!acceptedFiles) {
|
1562
|
+
return true;
|
1563
|
+
}
|
1564
|
+
acceptedFiles = acceptedFiles.split(",");
|
1565
|
+
mimeType = file.type;
|
1566
|
+
baseMimeType = mimeType.replace(/\/.*$/, "");
|
1567
|
+
for (_i = 0, _len = acceptedFiles.length; _i < _len; _i++) {
|
1568
|
+
validType = acceptedFiles[_i];
|
1569
|
+
validType = validType.trim();
|
1570
|
+
if (validType.charAt(0) === ".") {
|
1571
|
+
if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) {
|
1572
|
+
return true;
|
1573
|
+
}
|
1574
|
+
} else if (/\/\*$/.test(validType)) {
|
1575
|
+
if (baseMimeType === validType.replace(/\/.*$/, "")) {
|
1576
|
+
return true;
|
1577
|
+
}
|
1578
|
+
} else {
|
1579
|
+
if (mimeType === validType) {
|
1580
|
+
return true;
|
1581
|
+
}
|
1582
|
+
}
|
1583
|
+
}
|
1584
|
+
return false;
|
1585
|
+
};
|
1586
|
+
|
1587
|
+
if (typeof jQuery !== "undefined" && jQuery !== null) {
|
1588
|
+
jQuery.fn.dropzone = function(options) {
|
1589
|
+
return this.each(function() {
|
1590
|
+
return new Dropzone(this, options);
|
1591
|
+
});
|
1592
|
+
};
|
1593
|
+
}
|
1594
|
+
|
1595
|
+
if (typeof module !== "undefined" && module !== null) {
|
1596
|
+
module.exports = Dropzone;
|
1597
|
+
} else {
|
1598
|
+
window.Dropzone = Dropzone;
|
1599
|
+
}
|
1600
|
+
|
1601
|
+
Dropzone.ADDED = "added";
|
1602
|
+
|
1603
|
+
Dropzone.QUEUED = "queued";
|
1604
|
+
|
1605
|
+
Dropzone.ACCEPTED = Dropzone.QUEUED;
|
1606
|
+
|
1607
|
+
Dropzone.UPLOADING = "uploading";
|
1608
|
+
|
1609
|
+
Dropzone.PROCESSING = Dropzone.UPLOADING;
|
1610
|
+
|
1611
|
+
Dropzone.CANCELED = "canceled";
|
1612
|
+
|
1613
|
+
Dropzone.ERROR = "error";
|
1614
|
+
|
1615
|
+
Dropzone.SUCCESS = "success";
|
1616
|
+
|
1617
|
+
|
1618
|
+
/*
|
1619
|
+
|
1620
|
+
Bugfix for iOS 6 and 7
|
1621
|
+
Source: http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios
|
1622
|
+
based on the work of https://github.com/stomita/ios-imagefile-megapixel
|
1623
|
+
*/
|
1624
|
+
|
1625
|
+
detectVerticalSquash = function(img) {
|
1626
|
+
var alpha, canvas, ctx, data, ey, ih, iw, py, ratio, sy;
|
1627
|
+
iw = img.naturalWidth;
|
1628
|
+
ih = img.naturalHeight;
|
1629
|
+
canvas = document.createElement("canvas");
|
1630
|
+
canvas.width = 1;
|
1631
|
+
canvas.height = ih;
|
1632
|
+
ctx = canvas.getContext("2d");
|
1633
|
+
ctx.drawImage(img, 0, 0);
|
1634
|
+
data = ctx.getImageData(0, 0, 1, ih).data;
|
1635
|
+
sy = 0;
|
1636
|
+
ey = ih;
|
1637
|
+
py = ih;
|
1638
|
+
while (py > sy) {
|
1639
|
+
alpha = data[(py - 1) * 4 + 3];
|
1640
|
+
if (alpha === 0) {
|
1641
|
+
ey = py;
|
1642
|
+
} else {
|
1643
|
+
sy = py;
|
1644
|
+
}
|
1645
|
+
py = (ey + sy) >> 1;
|
1646
|
+
}
|
1647
|
+
ratio = py / ih;
|
1648
|
+
if (ratio === 0) {
|
1649
|
+
return 1;
|
1650
|
+
} else {
|
1651
|
+
return ratio;
|
1652
|
+
}
|
1653
|
+
};
|
1654
|
+
|
1655
|
+
drawImageIOSFix = function(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh) {
|
1656
|
+
var vertSquashRatio;
|
1657
|
+
vertSquashRatio = detectVerticalSquash(img);
|
1658
|
+
return ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio);
|
1659
|
+
};
|
1660
|
+
|
1661
|
+
|
1662
|
+
/*
|
1663
|
+
* contentloaded.js
|
1664
|
+
*
|
1665
|
+
* Author: Diego Perini (diego.perini at gmail.com)
|
1666
|
+
* Summary: cross-browser wrapper for DOMContentLoaded
|
1667
|
+
* Updated: 20101020
|
1668
|
+
* License: MIT
|
1669
|
+
* Version: 1.2
|
1670
|
+
*
|
1671
|
+
* URL:
|
1672
|
+
* http://javascript.nwbox.com/ContentLoaded/
|
1673
|
+
* http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE
|
1674
|
+
*/
|
1675
|
+
|
1676
|
+
contentLoaded = function(win, fn) {
|
1677
|
+
var add, doc, done, init, poll, pre, rem, root, top;
|
1678
|
+
done = false;
|
1679
|
+
top = true;
|
1680
|
+
doc = win.document;
|
1681
|
+
root = doc.documentElement;
|
1682
|
+
add = (doc.addEventListener ? "addEventListener" : "attachEvent");
|
1683
|
+
rem = (doc.addEventListener ? "removeEventListener" : "detachEvent");
|
1684
|
+
pre = (doc.addEventListener ? "" : "on");
|
1685
|
+
init = function(e) {
|
1686
|
+
if (e.type === "readystatechange" && doc.readyState !== "complete") {
|
1687
|
+
return;
|
1688
|
+
}
|
1689
|
+
(e.type === "load" ? win : doc)[rem](pre + e.type, init, false);
|
1690
|
+
if (!done && (done = true)) {
|
1691
|
+
return fn.call(win, e.type || e);
|
1692
|
+
}
|
1693
|
+
};
|
1694
|
+
poll = function() {
|
1695
|
+
var e;
|
1696
|
+
try {
|
1697
|
+
root.doScroll("left");
|
1698
|
+
} catch (_error) {
|
1699
|
+
e = _error;
|
1700
|
+
setTimeout(poll, 50);
|
1701
|
+
return;
|
1702
|
+
}
|
1703
|
+
return init("poll");
|
1704
|
+
};
|
1705
|
+
if (doc.readyState !== "complete") {
|
1706
|
+
if (doc.createEventObject && root.doScroll) {
|
1707
|
+
try {
|
1708
|
+
top = !win.frameElement;
|
1709
|
+
} catch (_error) {}
|
1710
|
+
if (top) {
|
1711
|
+
poll();
|
1712
|
+
}
|
1713
|
+
}
|
1714
|
+
doc[add](pre + "DOMContentLoaded", init, false);
|
1715
|
+
doc[add](pre + "readystatechange", init, false);
|
1716
|
+
return win[add](pre + "load", init, false);
|
1717
|
+
}
|
1718
|
+
};
|
1719
|
+
|
1720
|
+
Dropzone._autoDiscoverFunction = function() {
|
1721
|
+
if (Dropzone.autoDiscover) {
|
1722
|
+
return Dropzone.discover();
|
1723
|
+
}
|
1724
|
+
};
|
1725
|
+
|
1726
|
+
contentLoaded(window, Dropzone._autoDiscoverFunction);
|
1727
|
+
|
1728
|
+
}).call(this);
|