diff --git a/CHANGELOG.md b/CHANGELOG.md index b4a58de..2a22557 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 4.0.0 / unreleased + +* Rewrite the plugin to work with TinyMCE 4. TinyMCE 3.x is supported in the + tinymce3-branch. + # 3.5.8.5 / 2013-05-09 * Initial release \ No newline at end of file diff --git a/README.md b/README.md index 0419073..506adb3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +# IMPORTANT NOTE: +This version is being rewritten to work with TinyMCE 4.x, and is currently not very tested. Use at your own risk, feedback welcome. For the stable version targetting TinyMCE 3, see the [tinymce3 branch](https://github.com/florentmorin/tinymce-rails-documentupload/tree/tinymce3) + # tinymce-rails-documentupload Simple plugin for TinyMCE that allows uploading documents and inserting. @@ -6,22 +9,28 @@ This plugin is adapted from work done by [Christian Bechström Viken for TinyMCE Rails Image Upload plugin](https://github.com/PerfectlyNormal/tinymce-rails-imageupload). The icon used for the button comes from the icon set [Silk by famfamfam](http://www.famfamfam.com/lab/icons/silk/) and the spinner image from [ajaxload.info](http://ajaxload.info/). + + Support for TinyMCE 3 is currently available in the [tinymce3 branch](https://github.com/florentmorin/tinymce-rails-documentupload/tree/tinymce3). The master branch is targetting TinyMCE 4.x. ## Requirements * Rails >= 3.1 - * TinyMCE using the advanced theme + * TinyMCE4 using the advanced theme ## Setup ### Add the gem to your Gemfile - gem 'tinymce-rails-documentupload', '~> 3.5.8.7' + gem 'tinymce-rails-documentupload', '~> 4.0.0.beta' + + # or use git + + gem 'tinymce-rails-documentupload', github: 'florentmorin/tinymce-rails-documentupload' ### Set up TinyMCE as you would normally, but in the call to `.tinymce()`, add plugins: "uploaddocument" - # theme_advanced_buttonsX must include "uploaddocument" somewhere to have the button appear + # toolbar option must include "uploaddocument" somewhere to have the button appear and the rest should happen automatically. @@ -50,7 +59,7 @@ document: { url: view_context.document_url(image) } - }, content_type: "text/html" + }, layout: false, content_type: "text/html" end end @@ -73,37 +82,23 @@ Example response: ## Internationalization -I18n is taken care of by `tinymce-rails`. This gem includes strings for english and french. -To add your own language, create the files `.js` and `_dlg.js` in `vendor/assets/javascripts/tinymce/plugins/uploaddocument/langs` in your application, -or fork the gem and add your own translations there. - -To get your custom language precompiled, you have to add it to the list of files manually. -If you have a fork, just add it to the list in `lib/tinymce-rails-documentupload/rails.rb`, but if you have the translations in the application, -you can add it like this in `config/application.rb`: - - config.assets.precompile += %w(tinymce/plugins/uploaddocument/langs/fr.js tinymce/plugins/uploaddocument/langs/fr_dlg.js) - -The available strings are listed below: - -### en.js - - tinyMCE.addI18n('en.uploaddocument', { - desc: 'Insert a document from your computer' - }); - -### en_dlg.js - - tinyMCE.addI18n('en.uploaddocument_dlg', { - title: 'Insert document', - header: "Insert document", - input: "Choose a document", - uploading: "Uploading…", - blank_input: "Must choose a file", - bad_response: "Got a bad response from the server", - blank_response: "Didn't get a response from the server", - insert: "Insert", - cancel: "Cancel", - alt_text: "Document description" +I18n is taken care of by `tinymce-rails`. This gem includes strings for `en` and `fr`. To add your own language, create the files `.js` in `app/assets/javascripts/tinymce/plugins/uploaddocument/langs` in your application, or fork the gem and add your own translations there. + +The format and available strings are listed below: + +### fr.js + + tinyMCE.addI18n('fr', { + 'Insert a document from your computer': 'Insérer un document depuis votre ordinateur', + 'Insert document': "Insérer un document", + 'Choose a document': "Choisir un document", + 'You must choose a file': "Vous devez choisir un fichier", + 'Got a bad response from the server': "Mauvaise réponse du serveur", + "Didn't get a response from the server": "Aucune réponse du serveur", + 'Insert': "Insérer", + 'Cancel': "Annuler", + 'Document description': "Description du document", + 'Click to download' : "Cliquer pour télécharger", }); ## Versioning diff --git a/vendor/assets/javascripts/tinymce/plugins/uploaddocument/img/spinner.gif b/app/assets/javascripts/tinymce/plugins/uploaddocument/img/spinner.gif similarity index 100% rename from vendor/assets/javascripts/tinymce/plugins/uploaddocument/img/spinner.gif rename to app/assets/javascripts/tinymce/plugins/uploaddocument/img/spinner.gif diff --git a/vendor/assets/javascripts/tinymce/plugins/uploaddocument/img/uploaddocument.png b/app/assets/javascripts/tinymce/plugins/uploaddocument/img/uploaddocument.png similarity index 100% rename from vendor/assets/javascripts/tinymce/plugins/uploaddocument/img/uploaddocument.png rename to app/assets/javascripts/tinymce/plugins/uploaddocument/img/uploaddocument.png diff --git a/app/assets/javascripts/tinymce/plugins/uploaddocument/langs/en.js b/app/assets/javascripts/tinymce/plugins/uploaddocument/langs/en.js new file mode 100644 index 0000000..466af7d --- /dev/null +++ b/app/assets/javascripts/tinymce/plugins/uploaddocument/langs/en.js @@ -0,0 +1,12 @@ +tinyMCE.addI18n('en', { + 'Insert a document from your computer': 'Insert a document from your computer', + 'Insert document': "Insert document", + 'Choose a document': "Choose a document", + 'You must choose a file': "You must choose a file", + 'Got a bad response from the server': "Got a bad response from the server", + "Didn't get a response from the server": "Didn't get a response from the server", + 'Insert': "Insert", + 'Cancel': "Cancel", + 'Document description': "Document description", + 'Click to download': "Click to download", +}); diff --git a/app/assets/javascripts/tinymce/plugins/uploaddocument/langs/fr.js b/app/assets/javascripts/tinymce/plugins/uploaddocument/langs/fr.js new file mode 100644 index 0000000..546d0a1 --- /dev/null +++ b/app/assets/javascripts/tinymce/plugins/uploaddocument/langs/fr.js @@ -0,0 +1,12 @@ +tinyMCE.addI18n('fr', { + 'Insert a document from your computer': "Envoyer un document depuis votre ordinateur", + 'Insert document': "Insérer un document", + 'Choose a document': "Choisir un document", + 'You must choose a file': "Vous devez sélectionner un fichier", + 'Got a bad response from the server': "Le serveur a envoyé une réponse erronée", + "Didn't get a response from the server": "Le serveur n'a pas renvoyé de réponse", + 'Insert': "Insérer", + 'Cancel': "Annuler", + 'Document description': "Description du document", + 'Click to download': "Cliquer pour télécharger", +}); \ No newline at end of file diff --git a/app/assets/javascripts/tinymce/plugins/uploaddocument/langs/fr_FR.js b/app/assets/javascripts/tinymce/plugins/uploaddocument/langs/fr_FR.js new file mode 100644 index 0000000..dc20919 --- /dev/null +++ b/app/assets/javascripts/tinymce/plugins/uploaddocument/langs/fr_FR.js @@ -0,0 +1,12 @@ +tinyMCE.addI18n('fr_FR', { + 'Insert a document from your computer': "Envoyer un document depuis votre ordinateur", + 'Insert document': "Insérer un document", + 'Choose a document': "Choisir un document", + 'You must choose a file': "Vous devez sélectionner un fichier", + 'Got a bad response from the server': "Le serveur a envoyé une réponse erronée", + "Didn't get a response from the server": "Le serveur n'a pas renvoyé de réponse", + 'Insert': "Insérer", + 'Cancel': "Annuler", + 'Document description': "Description du document", + 'Click to download': "Cliquer pour télécharger", +}); \ No newline at end of file diff --git a/app/assets/javascripts/tinymce/plugins/uploaddocument/plugin.js b/app/assets/javascripts/tinymce/plugins/uploaddocument/plugin.js new file mode 100644 index 0000000..acd7988 --- /dev/null +++ b/app/assets/javascripts/tinymce/plugins/uploaddocument/plugin.js @@ -0,0 +1,259 @@ +(function() { + tinymce.PluginManager.requireLangPack('uploaddocument'); + + tinymce.create('tinymce.plugins.UploadDocument', { + UploadDocument: function(ed, url) { + var form, + iframe, + win, + throbber, + editor = ed; + + function showDialog() { + win = editor.windowManager.open({ + title: ed.translate('Insert a document from your computer'), + width: 500 + parseInt(editor.getLang('uploaddocument.delta_width', 0), 10), + height: 180 + parseInt(editor.getLang('uploaddocument.delta_height', 0), 10), + body: [ + {type: 'iframe', url: 'javascript:void(0)'}, + {type: 'textbox', name: 'file', label: ed.translate('Choose a document'), subtype: 'file'}, + {type: 'textbox', name: 'alt', label: ed.translate('Document description')}, + {type: 'container', classes: 'error', html: "

 

"}, + + // Trick TinyMCE to add a empty div that "preloads" the throbber image + {type: 'container', classes: 'throbber'}, + ], + buttons: [ + { + text: ed.translate('Insert'), + onclick: insertImage, + subtype: 'primary' + }, + { + text: ed.translate('Cancel'), + onclick: ed.windowManager.close + } + ], + }, { + plugin_url: url + }); + + // TinyMCE likes pointless submit handlers + win.off('submit'); + win.on('submit', insertImage); + + /* WHY DO YOU HATE
, TINYMCE!? */ + iframe = win.find("iframe")[0]; + form = createElement('form', { + action: ed.getParam("uploaddocument_form_url", "/tinymce_documents"), + target: iframe._id, + method: "POST", + enctype: 'multipart/form-data', + accept_charset: "UTF-8", + }); + + // Might have several instances on the same page, + // so we TinyMCE create unique IDs and use those. + iframe.getEl().name = iframe._id; + + // Create some needed hidden inputs + form.appendChild(createElement('input', {type: "hidden", name: "utf8", value: "✓"})); + form.appendChild(createElement('input', {type: 'hidden', name: 'authenticity_token', value: getMetaContents('csrf-token')})); + form.appendChild(createElement('input', {type: 'hidden', name: 'hint', value: ed.getParam("uploaddocument_hint", "")})); + + var el = win.getEl(); + var body = document.getElementById(el.id + "-body"); + + // Copy everything TinyMCE made into our form + var containers = body.getElementsByClassName('mce-container'); + for(var i = 0; i < containers.length; i++) { + form.appendChild(containers[i]); + } + + // Fix inputs, since TinyMCE hates HTML and forms + var inputs = form.getElementsByTagName('input'); + for(var i = 0; i < inputs.length; i++) { + var ctrl = inputs[i]; + + if(ctrl.tagName.toLowerCase() == 'input' && ctrl.type != "hidden") { + if(ctrl.type == "file") { + ctrl.name = "file"; + + // Hack styles + tinymce.DOM.setStyles(ctrl, { + 'border': 0, + 'boxShadow': 'none', + 'webkitBoxShadow': 'none', + }); + } else { + ctrl.name = "alt"; + } + } + } + + body.appendChild(form); + } + + function insertImage() { + if(getInputValue("file") == "") { + return handleError('You must choose a file'); + } + + throbber = new top.tinymce.ui.Throbber(win.getEl()); + throbber.show(); + + clearErrors(); + + /* Add event listeners. + * We remove the existing to avoid them being called twice in case + * of errors and re-submitting afterwards. + */ + var target = iframe.getEl(); + if(target.attachEvent) { + target.detachEvent('onload', uploadDone); + target.attachEvent('onload', uploadDone); + } else { + target.removeEventListener('load', uploadDone); + target.addEventListener('load', uploadDone, false); + } + + form.submit(); + } + + function uploadDone() { + if(throbber) { + throbber.hide(); + } + + var target = iframe.getEl(); + if(target.document || target.contentDocument) { + var doc = target.contentDocument || target.contentWindow.document; + handleResponse(doc.getElementsByTagName("body")[0].innerHTML); + } else { + handleError("Didn't get a response from the server"); + } + } + + function handleResponse(ret) { + try { + var json = tinymce.util.JSON.parse(ret); + + if(json["error"]) { + handleError(json["error"]["message"]); + } else { + var str = buildHTML(json); + if (ed.execCommand('mceInsertContent', false, str)) { + console.log(str); + } else { + console.log("Error"); + } + + ed.windowManager.close(); + } + } catch(e) { + console.log(e); + handleError('Got a bad response from the server'); + } + } + + function clearErrors() { + var message = win.find(".error")[0].getEl(); + + if(message) + message.getElementsByTagName("p")[0].innerHTML = " "; + } + + function handleError(error) { + var message = win.find(".error")[0].getEl(); + + if(message) + message.getElementsByTagName("p")[0].innerHTML = ed.translate(error); + } + + function createElement(element, attributes) { + var el = document.createElement(element); + for(var property in attributes) { + if (!(attributes[property] instanceof Function)) { + el[property] = attributes[property]; + } + } + + return el; + } + + function buildHTML(json, default_text) { + var default_class = ed.getParam("uploaddocument_default_img_class", ""); + var alt_text = getInputValue("alt"); + + var docstr = ""; + } else if (alt_text == "") { + docstr += ed.translate('Click to download'); + } else { + docstr += alt_text; + } + + docstr += ""; + + return docstr; + } + + function getInputValue(name) { + var inputs = form.getElementsByTagName("input"); + + for(var i in inputs) + if(inputs[i].name == name) + return inputs[i].value; + + return ""; + } + + function getMetaContents(mn) { + var m = document.getElementsByTagName('meta'); + + for(var i in m) + if(m[i].name == mn) + return m[i].content; + + return null; + } + + // Add a button that opens a window + editor.addButton('uploaddocument', { + tooltip: ed.translate('Insert a document from your computer'), + icon : 'newdocument', + onclick: showDialog + }); + + // Adds a menu item to the tools menu + editor.addMenuItem('uploaddocument', { + text: ed.translate('Insert a document from your computer'), + icon : 'newdocument', + context: 'insert', + onclick: showDialog + }); + } + }); + + tinymce.PluginManager.add('uploaddocument', tinymce.plugins.UploadDocument); +})(); diff --git a/lib/tasks/tinymce-uploaddocument-assets.rake b/lib/tasks/tinymce-uploaddocument-assets.rake index d575407..94ddec6 100644 --- a/lib/tasks/tinymce-uploaddocument-assets.rake +++ b/lib/tasks/tinymce-uploaddocument-assets.rake @@ -8,7 +8,7 @@ Rake::Task[assets_task].enhance do manifest = config.assets.manifest assets = Pathname.new(File.expand_path(File.join(File.dirname(__FILE__), - "../../vendor/assets/javascripts/tinymce/plugins/uploaddocument"))) - TinyMCE::Rails::AssetInstaller::ASSETS = assets + "../../app/assets/javascripts/tinymce/plugins/uploaddocument"))) + TinyMCE::Rails::AssetInstaller.new(target, manifest).install end \ No newline at end of file diff --git a/lib/tinymce-rails-documentupload/version.rb b/lib/tinymce-rails-documentupload/version.rb index dad9e0a..d143b5a 100644 --- a/lib/tinymce-rails-documentupload/version.rb +++ b/lib/tinymce-rails-documentupload/version.rb @@ -1,7 +1,7 @@ module Tinymce module Rails module Documentupload - VERSION = "3.5.8.7" + VERSION = "4.0.16.beta" end end end \ No newline at end of file diff --git a/test/dummy/.gitignore b/test/dummy/.gitignore new file mode 100644 index 0000000..6a502e9 --- /dev/null +++ b/test/dummy/.gitignore @@ -0,0 +1,16 @@ +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' + +# Ignore bundler config. +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 +/db/*.sqlite3-journal + +# Ignore all logfiles and tempfiles. +/log/*.log +/tmp diff --git a/test/dummy/Gemfile b/test/dummy/Gemfile new file mode 100644 index 0000000..ec284b3 --- /dev/null +++ b/test/dummy/Gemfile @@ -0,0 +1,51 @@ +source 'https://rubygems.org' + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '4.0.2' + +# Use sqlite3 as the database for Active Record +gem 'sqlite3' + +# Use SCSS for stylesheets +gem 'sass-rails', '~> 4.0.0' + +# Use Uglifier as compressor for JavaScript assets +gem 'uglifier', '>= 1.3.0' + +# Use CoffeeScript for .js.coffee assets and views +gem 'coffee-rails', '~> 4.0.0' + + +gem 'tinymce-rails-langs', github: 'spohlenz/tinymce-rails-langs', branch: 'tinymce-4' + +# See https://github.com/sstephenson/execjs#readme for more supported runtimes +# gem 'therubyracer', platforms: :ruby + +# Use jquery as the JavaScript library +gem 'jquery-rails' + +# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks +gem 'turbolinks' + +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +gem 'jbuilder', '~> 1.2' + +group :doc do + # bundle exec rake doc:rails generates the API under doc/api. + gem 'sdoc', require: false +end + +# Use ActiveModel has_secure_password +# gem 'bcrypt-ruby', '~> 3.1.2' + +# Use unicorn as the app server +# gem 'unicorn' + +# Use Capistrano for deployment +# gem 'capistrano', group: :development + +# Use debugger +# gem 'debugger', group: [:development, :test] + +gem 'tinymce-rails-documentupload', path: '../../' +gem 'paperclip' \ No newline at end of file diff --git a/test/dummy/README.rdoc b/test/dummy/README.rdoc new file mode 100644 index 0000000..dd4e97e --- /dev/null +++ b/test/dummy/README.rdoc @@ -0,0 +1,28 @@ +== README + +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... + + +Please feel free to use a different markup language if you do not plan to run +rake doc:app. diff --git a/test/dummy/Rakefile b/test/dummy/Rakefile new file mode 100644 index 0000000..4135d7a --- /dev/null +++ b/test/dummy/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Dummy::Application.load_tasks diff --git a/test/dummy/app/assets/images/.keep b/test/dummy/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/app/assets/javascripts/application.js b/test/dummy/app/assets/javascripts/application.js new file mode 100644 index 0000000..6299abe --- /dev/null +++ b/test/dummy/app/assets/javascripts/application.js @@ -0,0 +1,18 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. +// +// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require jquery +//= require jquery_ujs +//= require tinymce-jquery +//= require turbolinks +//= require tinymce-jquery +//= require_self \ No newline at end of file diff --git a/test/dummy/app/assets/stylesheets/application.css b/test/dummy/app/assets/stylesheets/application.css new file mode 100644 index 0000000..3192ec8 --- /dev/null +++ b/test/dummy/app/assets/stylesheets/application.css @@ -0,0 +1,13 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the top of the + * compiled file, but it's generally better to create a new file per style scope. + * + *= require_self + *= require_tree . + */ diff --git a/test/dummy/app/controllers/application_controller.rb b/test/dummy/app/controllers/application_controller.rb new file mode 100644 index 0000000..d679131 --- /dev/null +++ b/test/dummy/app/controllers/application_controller.rb @@ -0,0 +1,8 @@ +class ApplicationController < ActionController::Base + # Prevent CSRF attacks by raising an exception. + # For APIs, you may want to use :null_session instead. + protect_from_forgery with: :exception + + def editor + end +end diff --git a/test/dummy/app/controllers/concerns/.keep b/test/dummy/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/app/controllers/tinymce_documents_controller.rb b/test/dummy/app/controllers/tinymce_documents_controller.rb new file mode 100644 index 0000000..1750b84 --- /dev/null +++ b/test/dummy/app/controllers/tinymce_documents_controller.rb @@ -0,0 +1,15 @@ +class TinymceDocumentsController < ApplicationController + respond_to :json + + def create + document = Document.create params.permit(:file) + + url = "#{request.protocol}#{request.host_with_port}#{document.file.url}" + + render json: { + document: { + url: url + } + }, layout: false, content_type: "text/html" + end +end diff --git a/test/dummy/app/helpers/application_helper.rb b/test/dummy/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/test/dummy/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/test/dummy/app/mailers/.keep b/test/dummy/app/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/app/models/.keep b/test/dummy/app/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/app/models/concerns/.keep b/test/dummy/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/app/models/document.rb b/test/dummy/app/models/document.rb new file mode 100644 index 0000000..b0d47d7 --- /dev/null +++ b/test/dummy/app/models/document.rb @@ -0,0 +1,4 @@ +class Document < ActiveRecord::Base + has_attached_file :file + do_not_validate_attachment_file_type :file +end \ No newline at end of file diff --git a/test/dummy/app/views/application/editor.html.erb b/test/dummy/app/views/application/editor.html.erb new file mode 100644 index 0000000..a9b5679 --- /dev/null +++ b/test/dummy/app/views/application/editor.html.erb @@ -0,0 +1,3 @@ +<%= text_area_tag :content, "", :class => "tinymce", :rows => 40, :cols => 120 %> + +<%= tinymce %> \ No newline at end of file diff --git a/test/dummy/app/views/layouts/application.html.erb b/test/dummy/app/views/layouts/application.html.erb new file mode 100644 index 0000000..670d187 --- /dev/null +++ b/test/dummy/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + Dummy + <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> + <%= javascript_include_tag "application", "data-turbolinks-track" => true %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/test/dummy/bin/bundle b/test/dummy/bin/bundle new file mode 100755 index 0000000..66e9889 --- /dev/null +++ b/test/dummy/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/test/dummy/bin/rails b/test/dummy/bin/rails new file mode 100755 index 0000000..728cd85 --- /dev/null +++ b/test/dummy/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/test/dummy/bin/rake b/test/dummy/bin/rake new file mode 100755 index 0000000..1724048 --- /dev/null +++ b/test/dummy/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/test/dummy/config.ru b/test/dummy/config.ru new file mode 100644 index 0000000..5bc2a61 --- /dev/null +++ b/test/dummy/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Rails.application diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb new file mode 100644 index 0000000..4cd6683 --- /dev/null +++ b/test/dummy/config/application.rb @@ -0,0 +1,23 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(:default, Rails.env) + +module Dummy + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + end +end diff --git a/test/dummy/config/boot.rb b/test/dummy/config/boot.rb new file mode 100644 index 0000000..3596736 --- /dev/null +++ b/test/dummy/config/boot.rb @@ -0,0 +1,4 @@ +# Set up gems listed in the Gemfile. +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/test/dummy/config/database.yml b/test/dummy/config/database.yml new file mode 100644 index 0000000..51a4dd4 --- /dev/null +++ b/test/dummy/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +development: + adapter: sqlite3 + database: db/development.sqlite3 + pool: 5 + timeout: 5000 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: sqlite3 + database: db/test.sqlite3 + pool: 5 + timeout: 5000 + +production: + adapter: sqlite3 + database: db/production.sqlite3 + pool: 5 + timeout: 5000 diff --git a/test/dummy/config/environment.rb b/test/dummy/config/environment.rb new file mode 100644 index 0000000..10e0cad --- /dev/null +++ b/test/dummy/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require File.expand_path('../application', __FILE__) + +# Initialize the Rails application. +Dummy::Application.initialize! diff --git a/test/dummy/config/environments/development.rb b/test/dummy/config/environments/development.rb new file mode 100644 index 0000000..9d26e12 --- /dev/null +++ b/test/dummy/config/environments/development.rb @@ -0,0 +1,29 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations + config.active_record.migration_error = :page_load + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true +end diff --git a/test/dummy/config/environments/production.rb b/test/dummy/config/environments/production.rb new file mode 100644 index 0000000..b690b1c --- /dev/null +++ b/test/dummy/config/environments/production.rb @@ -0,0 +1,80 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both thread web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. + # config.action_dispatch.rack_cache = true + + # Disable Rails's static asset server (Apache or nginx will already do this). + config.serve_static_assets = false + + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false + + # Generate digests for assets URLs. + config.assets.digest = true + + # Version of your assets, change this if you want to expire all your assets. + config.assets.version = '1.0' + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Set to :debug to see everything in the log. + config.log_level = :info + + # Prepend all log lines with the following tags. + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups. + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets. + # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. + # config.assets.precompile += %w( search.js ) + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Disable automatic flushing of the log to improve performance. + # config.autoflush_log = false + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new +end diff --git a/test/dummy/config/environments/test.rb b/test/dummy/config/environments/test.rb new file mode 100644 index 0000000..afbc0ae --- /dev/null +++ b/test/dummy/config/environments/test.rb @@ -0,0 +1,36 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure static asset server for tests with Cache-Control for performance. + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr +end diff --git a/test/dummy/config/initializers/backtrace_silencers.rb b/test/dummy/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/test/dummy/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/test/dummy/config/initializers/filter_parameter_logging.rb b/test/dummy/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..4a994e1 --- /dev/null +++ b/test/dummy/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/test/dummy/config/initializers/inflections.rb b/test/dummy/config/initializers/inflections.rb new file mode 100644 index 0000000..ac033bf --- /dev/null +++ b/test/dummy/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/test/dummy/config/initializers/mime_types.rb b/test/dummy/config/initializers/mime_types.rb new file mode 100644 index 0000000..72aca7e --- /dev/null +++ b/test/dummy/config/initializers/mime_types.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone diff --git a/test/dummy/config/initializers/secret_token.rb b/test/dummy/config/initializers/secret_token.rb new file mode 100644 index 0000000..cb1f895 --- /dev/null +++ b/test/dummy/config/initializers/secret_token.rb @@ -0,0 +1,12 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure your secret_key_base is kept private +# if you're sharing your code publicly. +Dummy::Application.config.secret_key_base = '86469c58f09ff72d35a198e6d57fe5982732ac56d3717b26157804cf0f8d4d90f3c905ffb979e824841a4cd5b247e640b037cd4981e44788b04fc7b26f5fe6a1' diff --git a/test/dummy/config/initializers/session_store.rb b/test/dummy/config/initializers/session_store.rb new file mode 100644 index 0000000..155f7b0 --- /dev/null +++ b/test/dummy/config/initializers/session_store.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Dummy::Application.config.session_store :cookie_store, key: '_dummy_session' diff --git a/test/dummy/config/initializers/wrap_parameters.rb b/test/dummy/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..33725e9 --- /dev/null +++ b/test/dummy/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] if respond_to?(:wrap_parameters) +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff --git a/test/dummy/config/locales/en.yml b/test/dummy/config/locales/en.yml new file mode 100644 index 0000000..0653957 --- /dev/null +++ b/test/dummy/config/locales/en.yml @@ -0,0 +1,23 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/test/dummy/config/routes.rb b/test/dummy/config/routes.rb new file mode 100644 index 0000000..b8839f9 --- /dev/null +++ b/test/dummy/config/routes.rb @@ -0,0 +1,5 @@ +Dummy::Application.routes.draw do + post '/tinymce_documents' => 'tinymce_documents#create' + + root to: 'application#editor' +end diff --git a/test/dummy/config/tinymce.yml b/test/dummy/config/tinymce.yml new file mode 100644 index 0000000..d014272 --- /dev/null +++ b/test/dummy/config/tinymce.yml @@ -0,0 +1,7 @@ +toolbar: + - styleselect | bold italic | link image | undo redo + - table | fullscreen | uploaddocument +plugins: + - table + - fullscreen + - uploaddocument \ No newline at end of file diff --git a/test/dummy/db/migrate/20140220155401_create_documents.rb b/test/dummy/db/migrate/20140220155401_create_documents.rb new file mode 100644 index 0000000..b4fd5e8 --- /dev/null +++ b/test/dummy/db/migrate/20140220155401_create_documents.rb @@ -0,0 +1,10 @@ +class CreateDocuments < ActiveRecord::Migration + def change + create_table :documents do |t| + t.string :alt, default: "" + t.string :hint, default: "" + t.attachment :file + t.timestamps + end + end +end \ No newline at end of file diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb new file mode 100644 index 0000000..824e37b --- /dev/null +++ b/test/dummy/db/schema.rb @@ -0,0 +1,27 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20140220155401) do + + create_table "documents", force: true do |t| + t.string "alt", default: "" + t.string "hint", default: "" + t.string "file_file_name" + t.string "file_content_type" + t.integer "file_file_size" + t.datetime "file_updated_at" + t.datetime "created_at" + t.datetime "updated_at" + end + +end diff --git a/test/dummy/db/seeds.rb b/test/dummy/db/seeds.rb new file mode 100644 index 0000000..4edb1e8 --- /dev/null +++ b/test/dummy/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) diff --git a/test/dummy/lib/assets/.keep b/test/dummy/lib/assets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/lib/tasks/.keep b/test/dummy/lib/tasks/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/log/.keep b/test/dummy/log/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/public/404.html b/test/dummy/public/404.html new file mode 100644 index 0000000..a0daa0c --- /dev/null +++ b/test/dummy/public/404.html @@ -0,0 +1,58 @@ + + + + The page you were looking for doesn't exist (404) + + + + + +
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

+ + diff --git a/test/dummy/public/422.html b/test/dummy/public/422.html new file mode 100644 index 0000000..fbb4b84 --- /dev/null +++ b/test/dummy/public/422.html @@ -0,0 +1,58 @@ + + + + The change you wanted was rejected (422) + + + + + +
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

+ + diff --git a/test/dummy/public/500.html b/test/dummy/public/500.html new file mode 100644 index 0000000..e9052d3 --- /dev/null +++ b/test/dummy/public/500.html @@ -0,0 +1,57 @@ + + + + We're sorry, but something went wrong (500) + + + + + +
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

+ + diff --git a/test/dummy/public/favicon.ico b/test/dummy/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/public/robots.txt b/test/dummy/public/robots.txt new file mode 100644 index 0000000..1a3a5e4 --- /dev/null +++ b/test/dummy/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: / diff --git a/test/dummy/public/system/documents/files/000/000/001/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/001/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/001/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/002/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/002/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/002/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/003/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/003/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/003/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/004/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/004/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/004/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/005/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/005/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/005/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/006/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/006/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/006/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/007/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/007/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/007/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/008/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/008/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/008/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/009/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/009/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/009/original/19-connexion.pdf differ diff --git "a/test/dummy/public/system/documents/files/000/000/016/original/Re\314\201unions_a\314\200_distance.png" "b/test/dummy/public/system/documents/files/000/000/016/original/Re\314\201unions_a\314\200_distance.png" new file mode 100644 index 0000000..8e4cc7d Binary files /dev/null and "b/test/dummy/public/system/documents/files/000/000/016/original/Re\314\201unions_a\314\200_distance.png" differ diff --git a/test/dummy/public/system/documents/files/000/000/017/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/017/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/017/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/018/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/018/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/018/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/019/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/019/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/019/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/020/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/020/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/020/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/021/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/021/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/021/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/022/original/20-inscription.pdf b/test/dummy/public/system/documents/files/000/000/022/original/20-inscription.pdf new file mode 100644 index 0000000..5314e41 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/022/original/20-inscription.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/023/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/023/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/023/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/024/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/024/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/024/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/025/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/025/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/025/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/026/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/026/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/026/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/027/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/027/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/027/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/028/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/028/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/028/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/029/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/029/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/029/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/030/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/030/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/030/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/031/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/031/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/031/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/032/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/032/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/032/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/033/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/033/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/033/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/034/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/034/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/034/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/035/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/035/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/035/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/036/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/036/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/036/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/037/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/037/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/037/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/038/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/038/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/038/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/039/original/1.jpg b/test/dummy/public/system/documents/files/000/000/039/original/1.jpg new file mode 100644 index 0000000..b442479 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/039/original/1.jpg differ diff --git a/test/dummy/public/system/documents/files/000/000/040/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/040/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/040/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/041/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/041/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/041/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/042/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/042/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/042/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/043/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/043/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/043/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/044/original/19-connexion_(1).pdf b/test/dummy/public/system/documents/files/000/000/044/original/19-connexion_(1).pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/044/original/19-connexion_(1).pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/045/original/19-connexion_(1).pdf b/test/dummy/public/system/documents/files/000/000/045/original/19-connexion_(1).pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/045/original/19-connexion_(1).pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/046/original/19-connexion_(1).pdf b/test/dummy/public/system/documents/files/000/000/046/original/19-connexion_(1).pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/046/original/19-connexion_(1).pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/047/original/19-connexion_(1).pdf b/test/dummy/public/system/documents/files/000/000/047/original/19-connexion_(1).pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/047/original/19-connexion_(1).pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/048/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/048/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/048/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/049/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/049/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/049/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/050/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/050/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/050/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/051/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/051/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/051/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/052/original/19-connexion_(1).pdf b/test/dummy/public/system/documents/files/000/000/052/original/19-connexion_(1).pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/052/original/19-connexion_(1).pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/053/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/053/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/053/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/054/original/19-connexion_(1).pdf b/test/dummy/public/system/documents/files/000/000/054/original/19-connexion_(1).pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/054/original/19-connexion_(1).pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/055/original/19-connexion.pdf b/test/dummy/public/system/documents/files/000/000/055/original/19-connexion.pdf new file mode 100644 index 0000000..9a87b44 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/055/original/19-connexion.pdf differ diff --git a/test/dummy/public/system/documents/files/000/000/056/original/20-inscription.pdf b/test/dummy/public/system/documents/files/000/000/056/original/20-inscription.pdf new file mode 100644 index 0000000..5314e41 Binary files /dev/null and b/test/dummy/public/system/documents/files/000/000/056/original/20-inscription.pdf differ diff --git a/test/dummy/test/controllers/.keep b/test/dummy/test/controllers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/test/fixtures/.keep b/test/dummy/test/fixtures/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/test/helpers/.keep b/test/dummy/test/helpers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/test/integration/.keep b/test/dummy/test/integration/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/test/mailers/.keep b/test/dummy/test/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/test/models/.keep b/test/dummy/test/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/test/test_helper.rb b/test/dummy/test/test_helper.rb new file mode 100644 index 0000000..bc7e05d --- /dev/null +++ b/test/dummy/test/test_helper.rb @@ -0,0 +1,15 @@ +ENV["RAILS_ENV"] ||= "test" +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + ActiveRecord::Migration.check_pending! + + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + # + # Note: You'll currently still have to declare fixtures explicitly in integration tests + # -- they do not yet inherit this setting + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/test/dummy/vendor/assets/javascripts/.keep b/test/dummy/vendor/assets/javascripts/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/vendor/assets/stylesheets/.keep b/test/dummy/vendor/assets/stylesheets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/tinymce-rails-documentupload.gemspec b/tinymce-rails-documentupload.gemspec index 142226e..db43af5 100644 --- a/tinymce-rails-documentupload.gemspec +++ b/tinymce-rails-documentupload.gemspec @@ -2,22 +2,27 @@ $:.push File.expand_path("../lib", __FILE__) require "tinymce-rails-documentupload/version" -# Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "tinymce-rails-documentupload" s.version = Tinymce::Rails::Documentupload::VERSION s.authors = ["Florent Morin"] s.email = ["morinflorent@gmail.com"] s.homepage = "https://github.com/florentmorin/tinymce-rails-documentupload" - s.summary = %q{TinyMCE plugin for taking documents uploads in Rails >= 3.1} - s.description = %q{TinyMCE plugin for taking documents uploads in Rails >= 3.1} + s.summary = %q{TinyMCE plugin for taking documents uploads in Rails >= 3.2} + s.description = %q{TinyMCE plugin for taking documents uploads in Rails >= 3.2} - s.files = `git ls-files`.split("\n") - s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + s.files = [Dir["app/assets/javascripts/tinymce/plugins/uploaddocument/**/*.js"], + Dir["lib/**/*.rb"], + "lib/tasks/tinymce-uploaddocument-assets.rake", + "CHANGELOG.md", + "LICENSE", + "README.md", + ].flatten + s.test_files = [] s.require_paths = ["lib"] - s.add_runtime_dependency "railties", ">= 3.1" - s.add_runtime_dependency "tinymce-rails", "~> 3.5.8.1" + s.add_runtime_dependency "railties", ">= 3.2", "< 5" + s.add_runtime_dependency "tinymce-rails", "~> 4.0" s.add_development_dependency "bundler", "~> 1.0" s.add_development_dependency "rails", ">= 3.1" end diff --git a/vendor/assets/javascripts/tinymce/plugins/uploaddocument/dialog.html b/vendor/assets/javascripts/tinymce/plugins/uploaddocument/dialog.html deleted file mode 100644 index ed8cb1b..0000000 --- a/vendor/assets/javascripts/tinymce/plugins/uploaddocument/dialog.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - {#uploaddocument_dlg.title} - - - - - -

{#uploaddocument_dlg.header}

- - - - - - - - - -

- - - -
- - #{uploaddocument_dlg.uploading} - -
-
- - \ No newline at end of file diff --git a/vendor/assets/javascripts/tinymce/plugins/uploaddocument/editor_plugin.js b/vendor/assets/javascripts/tinymce/plugins/uploaddocument/editor_plugin.js deleted file mode 100644 index 12cf534..0000000 --- a/vendor/assets/javascripts/tinymce/plugins/uploaddocument/editor_plugin.js +++ /dev/null @@ -1,38 +0,0 @@ -(function() { - tinymce.PluginManager.requireLangPack('uploaddocument'); - tinymce.create('tinymce.plugins.UploadDocumentPlugin', { - init: function(ed, url) { - ed.addCommand('mceUploadDocument', function() { - return ed.windowManager.open({ - file: url + '/dialog.html', - width: 350 + parseInt(ed.getLang('uploaddocument.delta_width', 0)), - height: 180 + parseInt(ed.getLang('uploaddocument.delta_height', 0)), - inline: 1 - }, { - plugin_url: url - }); - }); - ed.addButton('uploaddocument', { - title: 'uploaddocument.desc', - cmd: 'mceUploadDocument', - image: url + '/img/uploaddocument.png' - }); - return ed.onNodeChange.add(function(ed, cm, n) { - return cm.setActive('uploaddocument', n.nodeName === 'IMG'); - }); - }, - createControl: function(n, cm) { - return null; - }, - getInfo: function() { - return { - longname: 'UploadDocument plugin', - author: 'Per Florent Morin (based on work done by Christian B. Viken for image upload plugin)', - authorurl: 'https://github.com/florentmorin', - infourl: 'https://github.com/florentmorin/tinymce-rails-documentupload', - version: '1.0' - }; - } - }); - return tinymce.PluginManager.add('uploaddocument', tinymce.plugins.UploadDocumentPlugin); -})(); \ No newline at end of file diff --git a/vendor/assets/javascripts/tinymce/plugins/uploaddocument/langs/en.js b/vendor/assets/javascripts/tinymce/plugins/uploaddocument/langs/en.js deleted file mode 100644 index a6eae5b..0000000 --- a/vendor/assets/javascripts/tinymce/plugins/uploaddocument/langs/en.js +++ /dev/null @@ -1,3 +0,0 @@ -tinyMCE.addI18n('en.uploaddocument', { - desc: 'Insert a document from your computer' -}); \ No newline at end of file diff --git a/vendor/assets/javascripts/tinymce/plugins/uploaddocument/langs/en_dlg.js b/vendor/assets/javascripts/tinymce/plugins/uploaddocument/langs/en_dlg.js deleted file mode 100644 index 6ec9419..0000000 --- a/vendor/assets/javascripts/tinymce/plugins/uploaddocument/langs/en_dlg.js +++ /dev/null @@ -1,12 +0,0 @@ -tinyMCE.addI18n('en.uploaddocument_dlg', { - title: 'Insert document', - header: "Insert document", - input: "Choose a document", - uploading: "Uploading…", - blank_input: "Must choose a file", - bad_response: "Got a bad response from the server", - blank_response: "Didn't get a response from the server", - insert: "Insert", - cancel: "Cancel", - alt_text: "Document description" -}); \ No newline at end of file diff --git a/vendor/assets/javascripts/tinymce/plugins/uploaddocument/langs/fr.js b/vendor/assets/javascripts/tinymce/plugins/uploaddocument/langs/fr.js deleted file mode 100644 index 75a798b..0000000 --- a/vendor/assets/javascripts/tinymce/plugins/uploaddocument/langs/fr.js +++ /dev/null @@ -1,3 +0,0 @@ -tinyMCE.addI18n('fr.uploaddocument', { - desc: "Envoyer un document de votre ordinateur" -}); \ No newline at end of file diff --git a/vendor/assets/javascripts/tinymce/plugins/uploaddocument/langs/fr_dlg.js b/vendor/assets/javascripts/tinymce/plugins/uploaddocument/langs/fr_dlg.js deleted file mode 100644 index ad703ca..0000000 --- a/vendor/assets/javascripts/tinymce/plugins/uploaddocument/langs/fr_dlg.js +++ /dev/null @@ -1,12 +0,0 @@ -tinyMCE.addI18n('fr.uploaddocument_dlg', { - title: "Insérer un document", - header: "Insérer un document", - input: "Choisissez un document", - uploading: "Transfert en cours ...", - blank_input: "Vous devez sélectionner un fichier", - bad_response: "Le serveur a envoyé une réponse erronée", - blank_response: "Le serveur n'a pas renvoyé de réponse", - insert: "Insérer", - cancel: "Annuler", - alt_text: "Description du document" -}); \ No newline at end of file