├── log └── .gitkeep ├── lib ├── tasks │ └── .gitkeep └── assets │ └── .gitkeep ├── public ├── favicon.ico ├── robots.txt ├── 500.html ├── 422.html └── 404.html ├── test ├── unit │ ├── .gitkeep │ └── node_test.rb ├── fixtures │ ├── .gitkeep │ └── nodes.yml ├── functional │ └── .gitkeep ├── integration │ └── .gitkeep ├── performance │ └── browsing_test.rb └── test_helper.rb ├── app ├── mailers │ └── .gitkeep ├── models │ ├── .gitkeep │ └── node.rb ├── views │ ├── nodes │ │ ├── children.html.erb │ │ ├── _node.html.erb │ │ └── index.html.erb │ └── layouts │ │ └── application.html.erb ├── helpers │ └── application_helper.rb ├── assets │ ├── images │ │ ├── file.png │ │ ├── expand.png │ │ ├── folder.png │ │ ├── rails.png │ │ ├── collapse.png │ │ ├── expand-light.png │ │ ├── bg-table-thead.png │ │ └── collapse-light.png │ ├── stylesheets │ │ ├── application.css │ │ ├── jquery.treetable.css │ │ ├── screen.css.scss │ │ └── jquery.treetable.theme.default.css │ └── javascripts │ │ ├── application.js │ │ ├── jquery.treetable.js │ │ └── jquery-ui.js └── controllers │ ├── application_controller.rb │ └── nodes_controller.rb ├── vendor ├── plugins │ └── .gitkeep └── assets │ ├── javascripts │ └── .gitkeep │ └── stylesheets │ └── .gitkeep ├── config.ru ├── config ├── environment.rb ├── routes.rb ├── boot.rb ├── initializers │ ├── mime_types.rb │ ├── backtrace_silencers.rb │ ├── session_store.rb │ ├── secret_token.rb │ ├── wrap_parameters.rb │ └── inflections.rb ├── locales │ └── en.yml ├── database.yml ├── application.rb └── environments │ ├── development.rb │ ├── test.rb │ └── production.rb ├── doc └── README_FOR_APP ├── Rakefile ├── script └── rails ├── db ├── migrate │ └── 20130207053519_create_nodes.rb ├── seeds.rb ├── schema.rb └── seeds.xml ├── .gitignore ├── README.md ├── MIT-LICENSE.txt ├── Gemfile ├── Gemfile.lock └── GPL-LICENSE.txt /log/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/unit/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/mailers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/plugins/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/functional/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/integration/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/views/nodes/children.html.erb: -------------------------------------------------------------------------------- 1 | <%= render @nodes %> 2 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/assets/images/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludo/jquery-treetable-ajax-example/HEAD/app/assets/images/file.png -------------------------------------------------------------------------------- /app/assets/images/expand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludo/jquery-treetable-ajax-example/HEAD/app/assets/images/expand.png -------------------------------------------------------------------------------- /app/assets/images/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludo/jquery-treetable-ajax-example/HEAD/app/assets/images/folder.png -------------------------------------------------------------------------------- /app/assets/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludo/jquery-treetable-ajax-example/HEAD/app/assets/images/rails.png -------------------------------------------------------------------------------- /app/models/node.rb: -------------------------------------------------------------------------------- 1 | class Node < ActiveRecord::Base 2 | include ActsAsTree 3 | 4 | acts_as_tree order: :name 5 | end 6 | -------------------------------------------------------------------------------- /app/assets/images/collapse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludo/jquery-treetable-ajax-example/HEAD/app/assets/images/collapse.png -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery 3 | end 4 | -------------------------------------------------------------------------------- /app/assets/images/expand-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludo/jquery-treetable-ajax-example/HEAD/app/assets/images/expand-light.png -------------------------------------------------------------------------------- /app/assets/images/bg-table-thead.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludo/jquery-treetable-ajax-example/HEAD/app/assets/images/bg-table-thead.png -------------------------------------------------------------------------------- /app/assets/images/collapse-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludo/jquery-treetable-ajax-example/HEAD/app/assets/images/collapse-light.png -------------------------------------------------------------------------------- /test/unit/node_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class NodeTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Commander::Application 5 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | Commander::Application.initialize! 6 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Commander::Application.routes.draw do 2 | resources :nodes do 3 | member do 4 | get :children 5 | end 6 | end 7 | 8 | root :to => 'nodes#index' 9 | end 10 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | # Set up gems listed in the Gemfile. 4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 5 | 6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 7 | -------------------------------------------------------------------------------- /doc/README_FOR_APP: -------------------------------------------------------------------------------- 1 | Use this README file to introduce your application and point to useful places in the API for learning more. 2 | Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-Agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Sample localization file for English. Add more files in this directory for other locales. 2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. 3 | 4 | en: 5 | hello: "Hello world" 6 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | # Add your own tasks in files placed in lib/tasks ending in .rake, 3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 4 | 5 | require File.expand_path('../config/application', __FILE__) 6 | 7 | Commander::Application.load_tasks 8 | -------------------------------------------------------------------------------- /script/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. 3 | 4 | APP_PATH = File.expand_path('../../config/application', __FILE__) 5 | require File.expand_path('../../config/boot', __FILE__) 6 | require 'rails/commands' 7 | -------------------------------------------------------------------------------- /test/fixtures/nodes.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html 2 | 3 | one: 4 | name: MyString 5 | kind: MyString 6 | size: 1 7 | modified_at: 2013-02-07 12:35:19 8 | 9 | two: 10 | name: MyString 11 | kind: MyString 12 | size: 1 13 | modified_at: 2013-02-07 12:35:19 14 | -------------------------------------------------------------------------------- /db/migrate/20130207053519_create_nodes.rb: -------------------------------------------------------------------------------- 1 | class CreateNodes < ActiveRecord::Migration 2 | def change 3 | create_table :nodes do |t| 4 | t.references :parent 5 | t.string :name 6 | t.string :kind 7 | t.integer :size 8 | t.datetime :modified_at 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/views/nodes/_node.html.erb: -------------------------------------------------------------------------------- 1 | "> 2 | 3 | <%= node.name %> 4 | 5 | <%= node.modified_at ? node.modified_at.strftime('%b %e, %Y %I:%M %p') : '-' %> 6 | <%= number_to_human_size(node.size) %> 7 | 8 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Commander 5 | <%= stylesheet_link_tag "application", :media => "all" %> 6 | <%= csrf_meta_tags %> 7 | 8 | 9 |
10 | <%= yield %> 11 |
12 | 13 | <%= javascript_include_tag "application" %> 14 | <%= yield :javascript %> 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/performance/browsing_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | require 'rails/performance_test_help' 3 | 4 | class BrowsingTest < ActionDispatch::PerformanceTest 5 | # Refer to the documentation for all available options 6 | # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory] 7 | # :output => 'tmp/performance', :formats => [:flat] } 8 | 9 | def test_homepage 10 | get '/' 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Commander::Application.config.session_store :cookie_store, key: '_commander_session' 4 | 5 | # Use the database for sessions instead of the cookie-based default, 6 | # which shouldn't be used to store highly confidential information 7 | # (create the session table with "rails generate session_migration") 8 | # Commander::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile ~/.gitignore_global 6 | 7 | # Ignore bundler config 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | 13 | # Ignore all logfiles and tempfiles. 14 | /log/*.log 15 | /tmp 16 | /.idea/* 17 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV["RAILS_ENV"] = "test" 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. 7 | # 8 | # Note: You'll currently still have to declare fixtures explicitly in integration tests 9 | # -- they do not yet inherit this setting 10 | fixtures :all 11 | 12 | # Add more helper methods to be used by all tests here... 13 | end 14 | -------------------------------------------------------------------------------- /config/initializers/secret_token.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | # Make sure the secret is at least 30 characters and all random, 6 | # no regular words or you'll be exposed to dictionary attacks. 7 | Commander::Application.config.secret_token = '2f60c75b64edd831f643ece65644112a9925d6802fd0c5ab07c921f69f928e4eb289a8133594a6910bb1eb58fc8513b6c0309eb3d5bc2d9c39631852652b4a13' 8 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # Disable root element in JSON by default. 12 | ActiveSupport.on_load(:active_record) do 13 | self.include_root_in_json = false 14 | end 15 | -------------------------------------------------------------------------------- /app/controllers/nodes_controller.rb: -------------------------------------------------------------------------------- 1 | class NodesController < ApplicationController 2 | def index 3 | @nodes = Node.roots 4 | end 5 | 6 | def children 7 | @nodes = Node.find(params[:id].to_i).children 8 | 9 | render layout: false 10 | end 11 | 12 | def update 13 | @node = Node.find(params[:id].to_i) 14 | @node.update_attributes(node_params) 15 | 16 | render text: "" 17 | end 18 | 19 | private 20 | 21 | def node_params 22 | params.require(:node).permit(:kind, :modified_at, :name, :parent, :parent_id, :size) 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format 4 | # (all these examples are active by default): 5 | # ActiveSupport::Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | # 12 | # These inflection rules are supported but not enabled by default: 13 | # ActiveSupport::Inflector.inflections do |inflect| 14 | # inflect.acronym 'RESTful' 15 | # end 16 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the top of the 9 | * compiled file, but it's generally better to create a new file per style scope. 10 | * 11 | *= require_self 12 | *= require_tree . 13 | */ 14 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | development: 7 | adapter: sqlite3 8 | database: db/development.sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | # Warning: The database defined as "test" will be erased and 13 | # re-generated from your development database when you run "rake". 14 | # Do not set this db to the same as development or production. 15 | test: 16 | adapter: sqlite3 17 | database: db/test.sqlite3 18 | pool: 5 19 | timeout: 5000 20 | 21 | production: 22 | adapter: sqlite3 23 | database: db/production.sqlite3 24 | pool: 5 25 | timeout: 5000 26 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // the compiled file. 9 | // 10 | // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD 11 | // GO AFTER THE REQUIRES BELOW. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require_tree . 16 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

We're sorry, but something went wrong.

23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /app/assets/stylesheets/jquery.treetable.css: -------------------------------------------------------------------------------- 1 | table.treetable span.indenter { 2 | display: inline-block; 3 | margin: 0; 4 | padding: 0; 5 | text-align: right; 6 | 7 | /* Disable text selection of nodes (for better D&D UX) */ 8 | user-select: none; 9 | -khtml-user-select: none; 10 | -moz-user-select: none; 11 | -o-user-select: none; 12 | -webkit-user-select: none; 13 | 14 | /* Force content-box box model for indenter (Bootstrap compatibility) */ 15 | -webkit-box-sizing: content-box; 16 | -moz-box-sizing: content-box; 17 | box-sizing: content-box; 18 | 19 | width: 19px; 20 | } 21 | 22 | table.treetable span.indenter a { 23 | background-position: left center; 24 | background-repeat: no-repeat; 25 | display: inline-block; 26 | text-decoration: none; 27 | width: 19px; 28 | } 29 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The change you wanted was rejected.

23 |

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

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The page you were looking for doesn't exist.

23 |

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

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jQuery treeTable AJAX example 2 | 3 | This example demonstrates using the jQuery treeTable plugin (http://plugins.jquery.com/treetable) for an AJAX enabled tree. It uses Ruby on Rails and SQLite for the server side. 4 | 5 | The file app/views/nodes/index.html.erb contains the interesting Javascript bits. It uses the jQuery.ajax function to download remote nodes when a node is expanded. It also uses jQuery.ajax to update the remote tree when a node is moved between branches (D&D). 6 | 7 | ## Installation 8 | 9 | This assusmes you already have Ruby and the bundler gem installed. 10 | 11 | cd jquery-treetable-ajax-example 12 | bundle install 13 | bundle exec rake db:create 14 | bundle exec rake db:migrate 15 | bundle exec rake db:seed 16 | script/rails server 17 | 18 | Now open your browser at http://localhost:3000. 19 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module Commander 10 | class Application < Rails::Application 11 | # Settings in config/environments/* take precedence over those specified here. 12 | # Application configuration should go into files in config/initializers 13 | # -- all .rb files in that directory are automatically loaded. 14 | 15 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 16 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 17 | # config.time_zone = 'Central Time (US & Canada)' 18 | 19 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 20 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 21 | # config.i18n.default_locale = :de 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | require 'pp' 2 | 3 | # seeds.xml was generated with 'tree' command (tree -XDh) 4 | tree = Hash.from_xml(File.read(Rails.root.join("db/seeds.xml")))["tree"] 5 | report = tree["report"] 6 | 7 | def create_nodes(parent, tree) 8 | ["directory", "file"].each do |kind| 9 | if tree[kind] 10 | tree[kind] = [tree[kind]] unless tree[kind].is_a?(Array) 11 | tree[kind].each do |value| 12 | node = Node.create( 13 | kind: kind, 14 | modified_at: value["time"].present? ? Time.parse(value["time"]) : nil, 15 | name: value["name"], 16 | parent: parent, 17 | size: value["size"].present? ? value["size"].to_i : nil 18 | ) 19 | 20 | create_nodes(node, value) 21 | end 22 | end 23 | end 24 | end 25 | 26 | Node.delete_all 27 | create_nodes(nil, tree["directory"]) 28 | 29 | # Checksum 30 | puts "=" * 80 31 | report.each_pair do |kind, expected_count| 32 | kind = kind.singularize 33 | actual_count = Node.where(kind: kind).count 34 | puts "Created #{actual_count}/#{expected_count} #{kind} nodes" 35 | end 36 | puts "=" * 80 37 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | # This file is auto-generated from the current state of the database. Instead 3 | # of editing this file, please use the migrations feature of Active Record to 4 | # incrementally modify your database, and then regenerate this schema definition. 5 | # 6 | # Note that this schema.rb definition is the authoritative source for your 7 | # database schema. If you need to create the application database on another 8 | # system, you should be using db:schema:load, not running all the migrations 9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 10 | # you'll amass, the slower it'll run and the greater likelihood for issues). 11 | # 12 | # It's strongly recommended that you check this file into your version control system. 13 | 14 | ActiveRecord::Schema.define(version: 20130207053519) do 15 | 16 | create_table "nodes", force: true do |t| 17 | t.integer "parent_id" 18 | t.string "name" 19 | t.string "kind" 20 | t.integer "size" 21 | t.datetime "modified_at" 22 | t.datetime "created_at" 23 | t.datetime "updated_at" 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Ludo van den Boom, http://ludo.is 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | 4 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 5 | gem 'rails', '4.1.7' 6 | # Use sqlite3 as the database for Active Record 7 | gem 'sqlite3' 8 | # Use SCSS for stylesheets 9 | gem 'sass-rails', '~> 4.0.3' 10 | # Use Uglifier as compressor for JavaScript assets 11 | gem 'uglifier', '>= 1.3.0' 12 | # Use CoffeeScript for .js.coffee assets and views 13 | gem 'coffee-rails', '~> 4.0.0' 14 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes 15 | # gem 'therubyracer', platforms: :ruby 16 | 17 | # Use jquery as the JavaScript library 18 | gem 'jquery-rails' 19 | # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 20 | gem 'turbolinks' 21 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 22 | gem 'jbuilder', '~> 2.0' 23 | # bundle exec rake doc:rails generates the API under doc/api. 24 | gem 'sdoc', '~> 0.4.0', group: :doc 25 | 26 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 27 | gem 'spring', group: :development 28 | 29 | # Use ActiveModel has_secure_password 30 | # gem 'bcrypt', '~> 3.1.7' 31 | 32 | # Use unicorn as the app server 33 | # gem 'unicorn' 34 | 35 | # Use Capistrano for deployment 36 | # gem 'capistrano-rails', group: :development 37 | 38 | # Use debugger 39 | # gem 'debugger', group: [:development, :test] 40 | 41 | gem 'acts_as_tree' 42 | -------------------------------------------------------------------------------- /app/assets/stylesheets/screen.css.scss: -------------------------------------------------------------------------------- 1 | body { 2 | background: #ddd; 3 | color: #000; 4 | font-family: Helvetica, Arial, sans-serif; 5 | line-height: 1.5; 6 | margin: 0; 7 | padding: 0; 8 | } 9 | 10 | #main { 11 | background: #fff; 12 | border-left: 20px solid #eee; 13 | border-right: 20px solid #eee; 14 | margin: 0 auto; 15 | max-width: 800px; 16 | padding: 20px; 17 | } 18 | 19 | pre.listing { 20 | background: #eee; 21 | border: 1px solid #ccc; 22 | margin: .6em 0 .3em 0; 23 | padding: .1em .3em; 24 | } 25 | 26 | pre.listing b { 27 | color: #f00; 28 | } 29 | 30 | table { 31 | border: 1px solid #888; 32 | border-collapse: collapse; 33 | font-size: .8em; 34 | line-height: 1; 35 | margin: .6em 0 1.8em 0; 36 | width: 100%; 37 | } 38 | 39 | table caption { 40 | font-size: .9em; 41 | font-weight: bold; 42 | margin-bottom: .2em; 43 | } 44 | 45 | table thead { 46 | background: #aaa image-url('bg-table-thead.png') repeat-x top left; 47 | font-size: .9em; 48 | } 49 | 50 | table thead tr th { 51 | border: 1px solid #888; 52 | font-weight: normal; 53 | padding: .3em 1em .1em 1em; 54 | text-align: left; 55 | } 56 | 57 | table tbody tr td { 58 | cursor: default; 59 | padding: .3em 1em; 60 | } 61 | 62 | table span { 63 | background-position: center left; 64 | background-repeat: no-repeat; 65 | padding: .2em 0 .2em 1.5em; 66 | } 67 | 68 | table span.file { 69 | background-image: image-url('file.png'); 70 | } 71 | 72 | table span.directory { 73 | background-image: image-url('folder.png'); 74 | } 75 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports and disable caching. 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send. 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger. 20 | config.active_support.deprecation = :log 21 | 22 | # Raise an error on page load if there are pending migrations. 23 | config.active_record.migration_error = :page_load 24 | 25 | # Debug mode disables concatenation and preprocessing of assets. 26 | # This option may cause significant delays in view rendering with a large 27 | # number of complex assets. 28 | config.assets.debug = true 29 | 30 | # Adds additional error checking when serving assets at runtime. 31 | # Checks for improperly declared sprockets dependencies. 32 | # Raises helpful error messages. 33 | config.assets.raise_runtime_errors = true 34 | 35 | # Raises error for missing translations 36 | # config.action_view.raise_on_missing_translations = true 37 | end 38 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static asset server for tests with Cache-Control for performance. 16 | config.serve_static_assets = true 17 | config.static_cache_control = 'public, max-age=3600' 18 | 19 | # Show full error reports and disable caching. 20 | config.consider_all_requests_local = true 21 | config.action_controller.perform_caching = false 22 | 23 | # Raise exceptions instead of rendering exception templates. 24 | config.action_dispatch.show_exceptions = false 25 | 26 | # Disable request forgery protection in test environment. 27 | config.action_controller.allow_forgery_protection = false 28 | 29 | # Tell Action Mailer not to deliver emails to the real world. 30 | # The :test delivery method accumulates sent emails in the 31 | # ActionMailer::Base.deliveries array. 32 | config.action_mailer.delivery_method = :test 33 | 34 | # Print deprecation notices to the stderr. 35 | config.active_support.deprecation = :stderr 36 | 37 | # Raises error for missing translations 38 | # config.action_view.raise_on_missing_translations = true 39 | end 40 | 41 | -------------------------------------------------------------------------------- /app/views/nodes/index.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :javascript do %> 2 | 86 | <% end %> 87 | 88 |

jQuery treeTable

89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | <%= render @nodes %> 100 | 101 |
NameDate modifiedSize
102 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actionmailer (4.1.7) 5 | actionpack (= 4.1.7) 6 | actionview (= 4.1.7) 7 | mail (~> 2.5, >= 2.5.4) 8 | actionpack (4.1.7) 9 | actionview (= 4.1.7) 10 | activesupport (= 4.1.7) 11 | rack (~> 1.5.2) 12 | rack-test (~> 0.6.2) 13 | actionview (4.1.7) 14 | activesupport (= 4.1.7) 15 | builder (~> 3.1) 16 | erubis (~> 2.7.0) 17 | activemodel (4.1.7) 18 | activesupport (= 4.1.7) 19 | builder (~> 3.1) 20 | activerecord (4.1.7) 21 | activemodel (= 4.1.7) 22 | activesupport (= 4.1.7) 23 | arel (~> 5.0.0) 24 | activesupport (4.1.7) 25 | i18n (~> 0.6, >= 0.6.9) 26 | json (~> 1.7, >= 1.7.7) 27 | minitest (~> 5.1) 28 | thread_safe (~> 0.1) 29 | tzinfo (~> 1.1) 30 | acts_as_tree (1.6.1) 31 | activerecord (>= 3.0.0) 32 | arel (5.0.1.20140414130214) 33 | builder (3.2.2) 34 | coffee-rails (4.0.1) 35 | coffee-script (>= 2.2.0) 36 | railties (>= 4.0.0, < 5.0) 37 | coffee-script (2.2.0) 38 | coffee-script-source 39 | execjs 40 | coffee-script-source (1.7.0) 41 | erubis (2.7.0) 42 | execjs (2.1.0) 43 | hike (1.2.3) 44 | i18n (0.6.11) 45 | jbuilder (2.0.7) 46 | activesupport (>= 3.0.0, < 5) 47 | multi_json (~> 1.2) 48 | jquery-rails (3.1.0) 49 | railties (>= 3.0, < 5.0) 50 | thor (>= 0.14, < 2.0) 51 | json (1.8.1) 52 | mail (2.6.3) 53 | mime-types (>= 1.16, < 3) 54 | mime-types (2.4.3) 55 | minitest (5.4.3) 56 | multi_json (1.10.1) 57 | rack (1.5.2) 58 | rack-test (0.6.2) 59 | rack (>= 1.0) 60 | rails (4.1.7) 61 | actionmailer (= 4.1.7) 62 | actionpack (= 4.1.7) 63 | actionview (= 4.1.7) 64 | activemodel (= 4.1.7) 65 | activerecord (= 4.1.7) 66 | activesupport (= 4.1.7) 67 | bundler (>= 1.3.0, < 2.0) 68 | railties (= 4.1.7) 69 | sprockets-rails (~> 2.0) 70 | railties (4.1.7) 71 | actionpack (= 4.1.7) 72 | activesupport (= 4.1.7) 73 | rake (>= 0.8.7) 74 | thor (>= 0.18.1, < 2.0) 75 | rake (10.3.2) 76 | rdoc (4.1.1) 77 | json (~> 1.4) 78 | sass (3.2.19) 79 | sass-rails (4.0.3) 80 | railties (>= 4.0.0, < 5.0) 81 | sass (~> 3.2.0) 82 | sprockets (~> 2.8, <= 2.11.0) 83 | sprockets-rails (~> 2.0) 84 | sdoc (0.4.0) 85 | json (~> 1.8) 86 | rdoc (~> 4.0, < 5.0) 87 | spring (1.1.3) 88 | sprockets (2.11.0) 89 | hike (~> 1.2) 90 | multi_json (~> 1.0) 91 | rack (~> 1.0) 92 | tilt (~> 1.1, != 1.3.0) 93 | sprockets-rails (2.2.0) 94 | actionpack (>= 3.0) 95 | activesupport (>= 3.0) 96 | sprockets (>= 2.8, < 4.0) 97 | sqlite3 (1.3.9) 98 | thor (0.19.1) 99 | thread_safe (0.3.4) 100 | tilt (1.4.1) 101 | turbolinks (2.2.2) 102 | coffee-rails 103 | tzinfo (1.2.2) 104 | thread_safe (~> 0.1) 105 | uglifier (2.5.0) 106 | execjs (>= 0.3.0) 107 | json (>= 1.8.0) 108 | 109 | PLATFORMS 110 | ruby 111 | 112 | DEPENDENCIES 113 | acts_as_tree 114 | coffee-rails (~> 4.0.0) 115 | jbuilder (~> 2.0) 116 | jquery-rails 117 | rails (= 4.1.7) 118 | sass-rails (~> 4.0.3) 119 | sdoc (~> 0.4.0) 120 | spring 121 | sqlite3 122 | turbolinks 123 | uglifier (>= 1.3.0) 124 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application 18 | # Add `rack-cache` to your Gemfile before enabling this. 19 | # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. 20 | # config.action_dispatch.rack_cache = true 21 | 22 | # Disable Rails's static asset server (Apache or nginx will already do this). 23 | config.serve_static_assets = false 24 | 25 | # Compress JavaScripts and CSS. 26 | config.assets.js_compressor = :uglifier 27 | # config.assets.css_compressor = :sass 28 | 29 | # Do not fallback to assets pipeline if a precompiled asset is missed. 30 | config.assets.compile = false 31 | 32 | # Generate digests for assets URLs. 33 | config.assets.digest = true 34 | 35 | # Version of your assets, change this if you want to expire all your assets. 36 | config.assets.version = '1.0' 37 | 38 | # Specifies the header that your server uses for sending files. 39 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache 40 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx 41 | 42 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 43 | # config.force_ssl = true 44 | 45 | # Set to :debug to see everything in the log. 46 | config.log_level = :info 47 | 48 | # Prepend all log lines with the following tags. 49 | # config.log_tags = [ :subdomain, :uuid ] 50 | 51 | # Use a different logger for distributed setups. 52 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 53 | 54 | # Use a different cache store in production. 55 | # config.cache_store = :mem_cache_store 56 | 57 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 58 | # config.action_controller.asset_host = "http://assets.example.com" 59 | 60 | # Precompile additional assets. 61 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 62 | # config.assets.precompile += %w( search.js ) 63 | 64 | # Ignore bad email addresses and do not raise email delivery errors. 65 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 66 | # config.action_mailer.raise_delivery_errors = false 67 | 68 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 69 | # the I18n.default_locale when a translation cannot be found). 70 | config.i18n.fallbacks = true 71 | 72 | # Send deprecation notices to registered listeners. 73 | config.active_support.deprecation = :notify 74 | 75 | # Disable automatic flushing of the log to improve performance. 76 | # config.autoflush_log = false 77 | 78 | # Use default logging formatter so that PID and timestamp are not suppressed. 79 | config.log_formatter = ::Logger::Formatter.new 80 | 81 | # Do not dump schema after migrations. 82 | config.active_record.dump_schema_after_migration = false 83 | end 84 | 85 | -------------------------------------------------------------------------------- /GPL-LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. -------------------------------------------------------------------------------- /app/assets/javascripts/jquery.treetable.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery treetable Plugin 3.1.0 3 | * http://ludo.cubicphuse.nl/jquery-treetable 4 | * 5 | * Copyright 2013, Ludo van den Boom 6 | * Dual licensed under the MIT or GPL Version 2 licenses. 7 | */ 8 | (function() { 9 | var $, Node, Tree, methods; 10 | 11 | $ = jQuery; 12 | 13 | Node = (function() { 14 | function Node(row, tree, settings) { 15 | var parentId; 16 | 17 | this.row = row; 18 | this.tree = tree; 19 | this.settings = settings; 20 | 21 | // TODO Ensure id/parentId is always a string (not int) 22 | this.id = this.row.data(this.settings.nodeIdAttr); 23 | 24 | // TODO Move this to a setParentId function? 25 | parentId = this.row.data(this.settings.parentIdAttr); 26 | if (parentId != null && parentId !== "") { 27 | this.parentId = parentId; 28 | } 29 | 30 | this.treeCell = $(this.row.children(this.settings.columnElType)[this.settings.column]); 31 | this.expander = $(this.settings.expanderTemplate); 32 | this.indenter = $(this.settings.indenterTemplate); 33 | this.children = []; 34 | this.initialized = false; 35 | this.treeCell.prepend(this.indenter); 36 | } 37 | 38 | Node.prototype.addChild = function(child) { 39 | return this.children.push(child); 40 | }; 41 | 42 | Node.prototype.ancestors = function() { 43 | var ancestors, node; 44 | node = this; 45 | ancestors = []; 46 | while (node = node.parentNode()) { 47 | ancestors.push(node); 48 | } 49 | return ancestors; 50 | }; 51 | 52 | Node.prototype.collapse = function() { 53 | if (this.collapsed()) { 54 | return this; 55 | } 56 | 57 | this.row.removeClass("expanded").addClass("collapsed"); 58 | 59 | this._hideChildren(); 60 | this.expander.attr("title", this.settings.stringExpand); 61 | 62 | if (this.initialized && this.settings.onNodeCollapse != null) { 63 | this.settings.onNodeCollapse.apply(this); 64 | } 65 | 66 | return this; 67 | }; 68 | 69 | Node.prototype.collapsed = function() { 70 | return this.row.hasClass("collapsed"); 71 | }; 72 | 73 | // TODO destroy: remove event handlers, expander, indenter, etc. 74 | 75 | Node.prototype.expand = function() { 76 | if (this.expanded()) { 77 | return this; 78 | } 79 | 80 | this.row.removeClass("collapsed").addClass("expanded"); 81 | 82 | if (this.initialized && this.settings.onNodeExpand != null) { 83 | this.settings.onNodeExpand.apply(this); 84 | } 85 | 86 | if ($(this.row).is(":visible")) { 87 | this._showChildren(); 88 | } 89 | 90 | this.expander.attr("title", this.settings.stringCollapse); 91 | 92 | return this; 93 | }; 94 | 95 | Node.prototype.expanded = function() { 96 | return this.row.hasClass("expanded"); 97 | }; 98 | 99 | Node.prototype.hide = function() { 100 | this._hideChildren(); 101 | this.row.hide(); 102 | return this; 103 | }; 104 | 105 | Node.prototype.isBranchNode = function() { 106 | if(this.children.length > 0 || this.row.data(this.settings.branchAttr) === true) { 107 | return true; 108 | } else { 109 | return false; 110 | } 111 | }; 112 | 113 | Node.prototype.updateBranchLeafClass = function(){ 114 | this.row.removeClass('branch'); 115 | this.row.removeClass('leaf'); 116 | this.row.addClass(this.isBranchNode() ? 'branch' : 'leaf'); 117 | }; 118 | 119 | Node.prototype.level = function() { 120 | return this.ancestors().length; 121 | }; 122 | 123 | Node.prototype.parentNode = function() { 124 | if (this.parentId != null) { 125 | return this.tree[this.parentId]; 126 | } else { 127 | return null; 128 | } 129 | }; 130 | 131 | Node.prototype.removeChild = function(child) { 132 | var i = $.inArray(child, this.children); 133 | return this.children.splice(i, 1) 134 | }; 135 | 136 | Node.prototype.render = function() { 137 | var handler, 138 | settings = this.settings, 139 | target; 140 | 141 | if (settings.expandable === true && this.isBranchNode()) { 142 | handler = function(e) { 143 | $(this).parents("table").treetable("node", $(this).parents("tr").data(settings.nodeIdAttr)).toggle(); 144 | return e.preventDefault(); 145 | }; 146 | 147 | this.indenter.html(this.expander); 148 | target = settings.clickableNodeNames === true ? this.treeCell : this.expander; 149 | 150 | target.off("click.treetable").on("click.treetable", handler); 151 | target.off("keydown.treetable").on("keydown.treetable", function(e) { 152 | if (e.keyCode == 13) { 153 | handler.apply(this, [e]); 154 | } 155 | }); 156 | } 157 | 158 | this.indenter[0].style.paddingLeft = "" + (this.level() * settings.indent) + "px"; 159 | 160 | return this; 161 | }; 162 | 163 | Node.prototype.reveal = function() { 164 | if (this.parentId != null) { 165 | this.parentNode().reveal(); 166 | } 167 | return this.expand(); 168 | }; 169 | 170 | Node.prototype.setParent = function(node) { 171 | if (this.parentId != null) { 172 | this.tree[this.parentId].removeChild(this); 173 | } 174 | this.parentId = node.id; 175 | this.row.data(this.settings.parentIdAttr, node.id); 176 | return node.addChild(this); 177 | }; 178 | 179 | Node.prototype.show = function() { 180 | if (!this.initialized) { 181 | this._initialize(); 182 | } 183 | this.row.show(); 184 | if (this.expanded()) { 185 | this._showChildren(); 186 | } 187 | return this; 188 | }; 189 | 190 | Node.prototype.toggle = function() { 191 | if (this.expanded()) { 192 | this.collapse(); 193 | } else { 194 | this.expand(); 195 | } 196 | return this; 197 | }; 198 | 199 | Node.prototype._hideChildren = function() { 200 | var child, _i, _len, _ref, _results; 201 | _ref = this.children; 202 | _results = []; 203 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 204 | child = _ref[_i]; 205 | _results.push(child.hide()); 206 | } 207 | return _results; 208 | }; 209 | 210 | Node.prototype._initialize = function() { 211 | var settings = this.settings; 212 | 213 | this.render(); 214 | 215 | if (settings.expandable === true && settings.initialState === "collapsed") { 216 | this.collapse(); 217 | } else { 218 | this.expand(); 219 | } 220 | 221 | if (settings.onNodeInitialized != null) { 222 | settings.onNodeInitialized.apply(this); 223 | } 224 | 225 | return this.initialized = true; 226 | }; 227 | 228 | Node.prototype._showChildren = function() { 229 | var child, _i, _len, _ref, _results; 230 | _ref = this.children; 231 | _results = []; 232 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 233 | child = _ref[_i]; 234 | _results.push(child.show()); 235 | } 236 | return _results; 237 | }; 238 | 239 | return Node; 240 | })(); 241 | 242 | Tree = (function() { 243 | function Tree(table, settings) { 244 | this.table = table; 245 | this.settings = settings; 246 | this.tree = {}; 247 | 248 | // Cache the nodes and roots in simple arrays for quick access/iteration 249 | this.nodes = []; 250 | this.roots = []; 251 | } 252 | 253 | Tree.prototype.collapseAll = function() { 254 | var node, _i, _len, _ref, _results; 255 | _ref = this.nodes; 256 | _results = []; 257 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 258 | node = _ref[_i]; 259 | _results.push(node.collapse()); 260 | } 261 | return _results; 262 | }; 263 | 264 | Tree.prototype.expandAll = function() { 265 | var node, _i, _len, _ref, _results; 266 | _ref = this.nodes; 267 | _results = []; 268 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 269 | node = _ref[_i]; 270 | _results.push(node.expand()); 271 | } 272 | return _results; 273 | }; 274 | 275 | Tree.prototype.findLastNode = function (node) { 276 | if (node.children.length > 0) { 277 | return this.findLastNode(node.children[node.children.length - 1]); 278 | } else { 279 | return node; 280 | } 281 | }; 282 | 283 | Tree.prototype.loadRows = function(rows) { 284 | var node, row, i; 285 | 286 | if (rows != null) { 287 | for (i = 0; i < rows.length; i++) { 288 | row = $(rows[i]); 289 | 290 | if (row.data(this.settings.nodeIdAttr) != null) { 291 | node = new Node(row, this.tree, this.settings); 292 | this.nodes.push(node); 293 | this.tree[node.id] = node; 294 | 295 | if (node.parentId != null) { 296 | this.tree[node.parentId].addChild(node); 297 | } else { 298 | this.roots.push(node); 299 | } 300 | } 301 | } 302 | } 303 | 304 | for (i = 0; i < this.nodes.length; i++) { 305 | node = this.nodes[i].updateBranchLeafClass(); 306 | } 307 | 308 | return this; 309 | }; 310 | 311 | Tree.prototype.move = function(node, destination) { 312 | // Conditions: 313 | // 1: +node+ should not be inserted as a child of +node+ itself. 314 | // 2: +destination+ should not be the same as +node+'s current parent (this 315 | // prevents +node+ from being moved to the same location where it already 316 | // is). 317 | // 3: +node+ should not be inserted in a location in a branch if this would 318 | // result in +node+ being an ancestor of itself. 319 | var nodeParent = node.parentNode(); 320 | if (node !== destination && destination.id !== node.parentId && $.inArray(node, destination.ancestors()) === -1) { 321 | node.setParent(destination); 322 | this._moveRows(node, destination); 323 | 324 | // Re-render parentNode if this is its first child node, and therefore 325 | // doesn't have the expander yet. 326 | if (node.parentNode().children.length === 1) { 327 | node.parentNode().render(); 328 | } 329 | } 330 | 331 | if(nodeParent){ 332 | nodeParent.updateBranchLeafClass(); 333 | } 334 | if(node.parentNode()){ 335 | node.parentNode().updateBranchLeafClass(); 336 | } 337 | node.updateBranchLeafClass(); 338 | return this; 339 | }; 340 | 341 | Tree.prototype.removeNode = function(node) { 342 | // Recursively remove all descendants of +node+ 343 | this.unloadBranch(node); 344 | 345 | // Remove node from DOM () 346 | node.row.remove(); 347 | 348 | // Clean up Tree object (so Node objects are GC-ed) 349 | delete this.tree[node.id]; 350 | this.nodes.splice($.inArray(node, this.nodes), 1); 351 | } 352 | 353 | Tree.prototype.render = function() { 354 | var root, _i, _len, _ref; 355 | _ref = this.roots; 356 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 357 | root = _ref[_i]; 358 | 359 | // Naming is confusing (show/render). I do not call render on node from 360 | // here. 361 | root.show(); 362 | } 363 | return this; 364 | }; 365 | 366 | Tree.prototype.sortBranch = function(node, sortFun) { 367 | // First sort internal array of children 368 | node.children.sort(sortFun); 369 | 370 | // Next render rows in correct order on page 371 | this._sortChildRows(node); 372 | 373 | return this; 374 | }; 375 | 376 | Tree.prototype.unloadBranch = function(node) { 377 | var children, i; 378 | 379 | for (i = 0; i < node.children.length; i++) { 380 | this.removeNode(node.children[i]); 381 | } 382 | 383 | // Reset node's collection of children 384 | node.children = []; 385 | 386 | node.updateBranchLeafClass(); 387 | 388 | return this; 389 | }; 390 | 391 | Tree.prototype._moveRows = function(node, destination) { 392 | var children = node.children, i; 393 | 394 | node.row.insertAfter(destination.row); 395 | node.render(); 396 | 397 | // Loop backwards through children to have them end up on UI in correct 398 | // order (see #112) 399 | for (i = children.length - 1; i >= 0; i--) { 400 | this._moveRows(children[i], node); 401 | } 402 | }; 403 | 404 | // Special _moveRows case, move children to itself to force sorting 405 | Tree.prototype._sortChildRows = function(parentNode) { 406 | return this._moveRows(parentNode, parentNode); 407 | }; 408 | 409 | return Tree; 410 | })(); 411 | 412 | // jQuery Plugin 413 | methods = { 414 | init: function(options, force) { 415 | var settings; 416 | 417 | settings = $.extend({ 418 | branchAttr: "ttBranch", 419 | clickableNodeNames: false, 420 | column: 0, 421 | columnElType: "td", // i.e. 'td', 'th' or 'td,th' 422 | expandable: false, 423 | expanderTemplate: " ", 424 | indent: 19, 425 | indenterTemplate: "", 426 | initialState: "collapsed", 427 | nodeIdAttr: "ttId", // maps to data-tt-id 428 | parentIdAttr: "ttParentId", // maps to data-tt-parent-id 429 | stringExpand: "Expand", 430 | stringCollapse: "Collapse", 431 | 432 | // Events 433 | onInitialized: null, 434 | onNodeCollapse: null, 435 | onNodeExpand: null, 436 | onNodeInitialized: null 437 | }, options); 438 | 439 | return this.each(function() { 440 | var el = $(this), tree; 441 | 442 | if (force || el.data("treetable") === undefined) { 443 | tree = new Tree(this, settings); 444 | tree.loadRows(this.rows).render(); 445 | 446 | el.addClass("treetable").data("treetable", tree); 447 | 448 | if (settings.onInitialized != null) { 449 | settings.onInitialized.apply(tree); 450 | } 451 | } 452 | 453 | return el; 454 | }); 455 | }, 456 | 457 | destroy: function() { 458 | return this.each(function() { 459 | return $(this).removeData("treetable").removeClass("treetable"); 460 | }); 461 | }, 462 | 463 | collapseAll: function() { 464 | this.data("treetable").collapseAll(); 465 | return this; 466 | }, 467 | 468 | collapseNode: function(id) { 469 | var node = this.data("treetable").tree[id]; 470 | 471 | if (node) { 472 | node.collapse(); 473 | } else { 474 | throw new Error("Unknown node '" + id + "'"); 475 | } 476 | 477 | return this; 478 | }, 479 | 480 | expandAll: function() { 481 | this.data("treetable").expandAll(); 482 | return this; 483 | }, 484 | 485 | expandNode: function(id) { 486 | var node = this.data("treetable").tree[id]; 487 | 488 | if (node) { 489 | if (!node.initialized) { 490 | node._initialize(); 491 | } 492 | 493 | node.expand(); 494 | } else { 495 | throw new Error("Unknown node '" + id + "'"); 496 | } 497 | 498 | return this; 499 | }, 500 | 501 | loadBranch: function(node, rows) { 502 | var settings = this.data("treetable").settings, 503 | tree = this.data("treetable").tree; 504 | 505 | // TODO Switch to $.parseHTML 506 | rows = $(rows); 507 | 508 | if (node == null) { // Inserting new root nodes 509 | this.append(rows); 510 | } else { 511 | var lastNode = this.data("treetable").findLastNode(node); 512 | rows.insertAfter(lastNode.row); 513 | } 514 | 515 | this.data("treetable").loadRows(rows); 516 | 517 | // Make sure nodes are properly initialized 518 | rows.filter("tr").each(function() { 519 | tree[$(this).data(settings.nodeIdAttr)].show(); 520 | }); 521 | 522 | if (node != null) { 523 | // Re-render parent to ensure expander icon is shown (#79) 524 | node.render().expand(); 525 | } 526 | 527 | return this; 528 | }, 529 | 530 | move: function(nodeId, destinationId) { 531 | var destination, node; 532 | 533 | node = this.data("treetable").tree[nodeId]; 534 | destination = this.data("treetable").tree[destinationId]; 535 | this.data("treetable").move(node, destination); 536 | 537 | return this; 538 | }, 539 | 540 | node: function(id) { 541 | return this.data("treetable").tree[id]; 542 | }, 543 | 544 | removeNode: function(id) { 545 | var node = this.data("treetable").tree[id]; 546 | 547 | if (node) { 548 | this.data("treetable").removeNode(node); 549 | } else { 550 | throw new Error("Unknown node '" + id + "'"); 551 | } 552 | 553 | return this; 554 | }, 555 | 556 | reveal: function(id) { 557 | var node = this.data("treetable").tree[id]; 558 | 559 | if (node) { 560 | node.reveal(); 561 | } else { 562 | throw new Error("Unknown node '" + id + "'"); 563 | } 564 | 565 | return this; 566 | }, 567 | 568 | sortBranch: function(node, columnOrFunction) { 569 | var settings = this.data("treetable").settings, 570 | prepValue, 571 | sortFun; 572 | 573 | columnOrFunction = columnOrFunction || settings.column; 574 | sortFun = columnOrFunction; 575 | 576 | if ($.isNumeric(columnOrFunction)) { 577 | sortFun = function(a, b) { 578 | var extractValue, valA, valB; 579 | 580 | extractValue = function(node) { 581 | var val = node.row.find("td:eq(" + columnOrFunction + ")").text(); 582 | // Ignore trailing/leading whitespace and use uppercase values for 583 | // case insensitive ordering 584 | return $.trim(val).toUpperCase(); 585 | } 586 | 587 | valA = extractValue(a); 588 | valB = extractValue(b); 589 | 590 | if (valA < valB) return -1; 591 | if (valA > valB) return 1; 592 | return 0; 593 | }; 594 | } 595 | 596 | this.data("treetable").sortBranch(node, sortFun); 597 | return this; 598 | }, 599 | 600 | unloadBranch: function(node) { 601 | this.data("treetable").unloadBranch(node); 602 | return this; 603 | } 604 | }; 605 | 606 | $.fn.treetable = function(method) { 607 | if (methods[method]) { 608 | return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 609 | } else if (typeof method === 'object' || !method) { 610 | return methods.init.apply(this, arguments); 611 | } else { 612 | return $.error("Method " + method + " does not exist on jQuery.treetable"); 613 | } 614 | }; 615 | 616 | // Expose classes to world 617 | this.TreeTable || (this.TreeTable = {}); 618 | this.TreeTable.Node = Node; 619 | this.TreeTable.Tree = Tree; 620 | }).call(this); 621 | -------------------------------------------------------------------------------- /db/seeds.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 114 334 | 99 335 | 336 | 337 | -------------------------------------------------------------------------------- /app/assets/stylesheets/jquery.treetable.theme.default.css: -------------------------------------------------------------------------------- 1 | table.treetable { 2 | border: 1px solid #888; 3 | border-collapse: collapse; 4 | font-size: .8em; 5 | line-height: 1; 6 | margin: .6em 0 1.8em 0; 7 | width: 100%; 8 | } 9 | 10 | table.treetable caption { 11 | font-size: .9em; 12 | font-weight: bold; 13 | margin-bottom: .2em; 14 | } 15 | 16 | table.treetable thead { 17 | background: #aaa url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAZCAYAAADwkER/AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQC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afJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAD9JREFUeNpsxzEKgDAQAMHlQEhpYWuTF+RV+X+fmLU7ItgMDGoPYAXwJPOHkWxFbd9W1Dt7oZ4BTNSCeqDGOwDlRyvLRZQgvgAAAABJRU5ErkJggg==) repeat-x top left; 18 | font-size: .9em; 19 | } 20 | 21 | table.treetable thead tr th { 22 | border: 1px solid #888; 23 | font-weight: normal; 24 | padding: .3em 1em .1em 1em; 25 | text-align: left; 26 | } 27 | 28 | table.treetable tbody tr td { 29 | cursor: default; 30 | padding: .3em 1em; 31 | } 32 | 33 | table.treetable span { 34 | background-position: center left; 35 | background-repeat: no-repeat; 36 | padding: .2em 0 .2em 1.5em; 37 | } 38 | 39 | table.treetable span.file { 40 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQC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2smkzLAHkbRBmP0/Uk26O5YnUActBp1GsAI+S5nRJJJal5K1aAMrq0d6Tm9uI6zjyf75dAe6tx/SsWeD//o2/Ab6IH3/h25pOAAAAAElFTkSuQmCC); 45 | } 46 | 47 | table.treetable tr.collapsed span.indenter a { 48 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhz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7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAHlJREFUeNrcU1sNgDAQ6wgmcAM2MICGGlg1gJnNzWQcvwQGy1j4oUl/7tH0mpwzM7SgQyO+EZAUWh2MkkzSWhJwuRAlHYsJwEwyvs1gABDuzqoJcTw5qxaIJN0bgQRgIjnlmn1heSO5PE6Y2YXe+5Cr5+h++gs12AcAS6FS+7YOsj4AAAAASUVORK5CYII=); 49 | } 50 | 51 | table.treetable tr.expanded span.indenter a { 52 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+b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P/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAHFJREFUeNpi/P//PwMlgImBQsA44C6gvhfa29v3MzAwOODRc6CystIRbxi0t7fjDJjKykpGYrwwi1hxnLHQ3t7+jIGBQRJJ6HllZaUUKYEYRYBPOB0gBShKwKGA////48VtbW3/8clTnBIH3gCKkzJgAGvBX0dDm0sCAAAAAElFTkSuQmCC); 53 | } 54 | 55 | table.treetable tr.branch { 56 | background-color: #f9f9f9; 57 | } 58 | 59 | table.treetable tr.selected { 60 | background-color: #3875d7; 61 | color: #fff; 62 | } 63 | 64 | table.treetable tr.collapsed.selected span.indenter a { 65 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkk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DOQ6gKyY4HodMA49PMCxQYABgAVYHsjyZ1x7QAAAABJRU5ErkJggg==); 66 | } 67 | 68 | table.treetable tr.expanded.selected span.indenter a { 69 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaI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6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAFtJREFUeNpi/P//PwMlgImBQsA44C6giQENDAwM//HgBmLCAF/AMBLjBUeixf///48L7/+PCvZjU4fPAAc0AxywqcMXCwegGJ1NckL6jx5wpKYDxqGXEkkCgAEAmrqBIejdgngAAAAASUVORK5CYII=); 70 | } 71 | 72 | table.treetable tr.accept { 73 | background-color: #a3bce4; 74 | color: #fff 75 | } 76 | 77 | table.treetable tr.collapsed.accept td span.indenter a { 78 | background-image: url(data:image/x-png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAiz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xYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAFpJREFUeNpi/P//PwMlgHHADWD4//8/NtyAQxwD45KAAQdKDfj//////fgMIsYAZIMw1DKREFwODAwM/4kNRKq64AADA4MjFDOQ6gKyY4HodMA49PMCxQYABgAVYHsjyZ1x7QAAAABJRU5ErkJggg==); 79 | } 80 | 81 | table.treetable tr.expanded.accept td span.indenter a { 82 | background-image: url(data:image/x-png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1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5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAFtJREFUeNpi/P//PwMlgImBQsA44C6giQENDAwM//HgBmLCAF/AMBLjBUeixf///48L7/+PCvZjU4fPAAc0AxywqcMXCwegGJ1NckL6jx5wpKYDxqGXEkkCgAEAmrqBIejdgngAAAAASUVORK5CYII=); 83 | } 84 | -------------------------------------------------------------------------------- /app/assets/javascripts/jquery-ui.js: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.10.0 - 2013-01-20 2 | * http://jqueryui.com 3 | * Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.droppable.js 4 | * Copyright (c) 2013 jQuery Foundation and other contributors Licensed MIT */ 5 | 6 | (function( $, undefined ) { 7 | 8 | var uuid = 0, 9 | runiqueId = /^ui-id-\d+$/; 10 | 11 | // prevent duplicate loading 12 | // this is only a problem because we proxy existing functions 13 | // and we don't want to double proxy them 14 | $.ui = $.ui || {}; 15 | if ( $.ui.version ) { 16 | return; 17 | } 18 | 19 | $.extend( $.ui, { 20 | version: "1.10.0", 21 | 22 | keyCode: { 23 | BACKSPACE: 8, 24 | COMMA: 188, 25 | DELETE: 46, 26 | DOWN: 40, 27 | END: 35, 28 | ENTER: 13, 29 | ESCAPE: 27, 30 | HOME: 36, 31 | LEFT: 37, 32 | NUMPAD_ADD: 107, 33 | NUMPAD_DECIMAL: 110, 34 | NUMPAD_DIVIDE: 111, 35 | NUMPAD_ENTER: 108, 36 | NUMPAD_MULTIPLY: 106, 37 | NUMPAD_SUBTRACT: 109, 38 | PAGE_DOWN: 34, 39 | PAGE_UP: 33, 40 | PERIOD: 190, 41 | RIGHT: 39, 42 | SPACE: 32, 43 | TAB: 9, 44 | UP: 38 45 | } 46 | }); 47 | 48 | // plugins 49 | $.fn.extend({ 50 | _focus: $.fn.focus, 51 | focus: function( delay, fn ) { 52 | return typeof delay === "number" ? 53 | this.each(function() { 54 | var elem = this; 55 | setTimeout(function() { 56 | $( elem ).focus(); 57 | if ( fn ) { 58 | fn.call( elem ); 59 | } 60 | }, delay ); 61 | }) : 62 | this._focus.apply( this, arguments ); 63 | }, 64 | 65 | scrollParent: function() { 66 | var scrollParent; 67 | if (($.ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) { 68 | scrollParent = this.parents().filter(function() { 69 | return (/(relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x")); 70 | }).eq(0); 71 | } else { 72 | scrollParent = this.parents().filter(function() { 73 | return (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x")); 74 | }).eq(0); 75 | } 76 | 77 | return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent; 78 | }, 79 | 80 | zIndex: function( zIndex ) { 81 | if ( zIndex !== undefined ) { 82 | return this.css( "zIndex", zIndex ); 83 | } 84 | 85 | if ( this.length ) { 86 | var elem = $( this[ 0 ] ), position, value; 87 | while ( elem.length && elem[ 0 ] !== document ) { 88 | // Ignore z-index if position is set to a value where z-index is ignored by the browser 89 | // This makes behavior of this function consistent across browsers 90 | // WebKit always returns auto if the element is positioned 91 | position = elem.css( "position" ); 92 | if ( position === "absolute" || position === "relative" || position === "fixed" ) { 93 | // IE returns 0 when zIndex is not specified 94 | // other browsers return a string 95 | // we ignore the case of nested elements with an explicit value of 0 96 | //
97 | value = parseInt( elem.css( "zIndex" ), 10 ); 98 | if ( !isNaN( value ) && value !== 0 ) { 99 | return value; 100 | } 101 | } 102 | elem = elem.parent(); 103 | } 104 | } 105 | 106 | return 0; 107 | }, 108 | 109 | uniqueId: function() { 110 | return this.each(function() { 111 | if ( !this.id ) { 112 | this.id = "ui-id-" + (++uuid); 113 | } 114 | }); 115 | }, 116 | 117 | removeUniqueId: function() { 118 | return this.each(function() { 119 | if ( runiqueId.test( this.id ) ) { 120 | $( this ).removeAttr( "id" ); 121 | } 122 | }); 123 | } 124 | }); 125 | 126 | // selectors 127 | function focusable( element, isTabIndexNotNaN ) { 128 | var map, mapName, img, 129 | nodeName = element.nodeName.toLowerCase(); 130 | if ( "area" === nodeName ) { 131 | map = element.parentNode; 132 | mapName = map.name; 133 | if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 134 | return false; 135 | } 136 | img = $( "img[usemap=#" + mapName + "]" )[0]; 137 | return !!img && visible( img ); 138 | } 139 | return ( /input|select|textarea|button|object/.test( nodeName ) ? 140 | !element.disabled : 141 | "a" === nodeName ? 142 | element.href || isTabIndexNotNaN : 143 | isTabIndexNotNaN) && 144 | // the element and all of its ancestors must be visible 145 | visible( element ); 146 | } 147 | 148 | function visible( element ) { 149 | return $.expr.filters.visible( element ) && 150 | !$( element ).parents().addBack().filter(function() { 151 | return $.css( this, "visibility" ) === "hidden"; 152 | }).length; 153 | } 154 | 155 | $.extend( $.expr[ ":" ], { 156 | data: $.expr.createPseudo ? 157 | $.expr.createPseudo(function( dataName ) { 158 | return function( elem ) { 159 | return !!$.data( elem, dataName ); 160 | }; 161 | }) : 162 | // support: jQuery <1.8 163 | function( elem, i, match ) { 164 | return !!$.data( elem, match[ 3 ] ); 165 | }, 166 | 167 | focusable: function( element ) { 168 | return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); 169 | }, 170 | 171 | tabbable: function( element ) { 172 | var tabIndex = $.attr( element, "tabindex" ), 173 | isTabIndexNaN = isNaN( tabIndex ); 174 | return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); 175 | } 176 | }); 177 | 178 | // support: jQuery <1.8 179 | if ( !$( "" ).outerWidth( 1 ).jquery ) { 180 | $.each( [ "Width", "Height" ], function( i, name ) { 181 | var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], 182 | type = name.toLowerCase(), 183 | orig = { 184 | innerWidth: $.fn.innerWidth, 185 | innerHeight: $.fn.innerHeight, 186 | outerWidth: $.fn.outerWidth, 187 | outerHeight: $.fn.outerHeight 188 | }; 189 | 190 | function reduce( elem, size, border, margin ) { 191 | $.each( side, function() { 192 | size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; 193 | if ( border ) { 194 | size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; 195 | } 196 | if ( margin ) { 197 | size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; 198 | } 199 | }); 200 | return size; 201 | } 202 | 203 | $.fn[ "inner" + name ] = function( size ) { 204 | if ( size === undefined ) { 205 | return orig[ "inner" + name ].call( this ); 206 | } 207 | 208 | return this.each(function() { 209 | $( this ).css( type, reduce( this, size ) + "px" ); 210 | }); 211 | }; 212 | 213 | $.fn[ "outer" + name] = function( size, margin ) { 214 | if ( typeof size !== "number" ) { 215 | return orig[ "outer" + name ].call( this, size ); 216 | } 217 | 218 | return this.each(function() { 219 | $( this).css( type, reduce( this, size, true, margin ) + "px" ); 220 | }); 221 | }; 222 | }); 223 | } 224 | 225 | // support: jQuery <1.8 226 | if ( !$.fn.addBack ) { 227 | $.fn.addBack = function( selector ) { 228 | return this.add( selector == null ? 229 | this.prevObject : this.prevObject.filter( selector ) 230 | ); 231 | }; 232 | } 233 | 234 | // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) 235 | if ( $( "" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { 236 | $.fn.removeData = (function( removeData ) { 237 | return function( key ) { 238 | if ( arguments.length ) { 239 | return removeData.call( this, $.camelCase( key ) ); 240 | } else { 241 | return removeData.call( this ); 242 | } 243 | }; 244 | })( $.fn.removeData ); 245 | } 246 | 247 | 248 | 249 | 250 | 251 | // deprecated 252 | $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); 253 | 254 | $.support.selectstart = "onselectstart" in document.createElement( "div" ); 255 | $.fn.extend({ 256 | disableSelection: function() { 257 | return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + 258 | ".ui-disableSelection", function( event ) { 259 | event.preventDefault(); 260 | }); 261 | }, 262 | 263 | enableSelection: function() { 264 | return this.unbind( ".ui-disableSelection" ); 265 | } 266 | }); 267 | 268 | $.extend( $.ui, { 269 | // $.ui.plugin is deprecated. Use the proxy pattern instead. 270 | plugin: { 271 | add: function( module, option, set ) { 272 | var i, 273 | proto = $.ui[ module ].prototype; 274 | for ( i in set ) { 275 | proto.plugins[ i ] = proto.plugins[ i ] || []; 276 | proto.plugins[ i ].push( [ option, set[ i ] ] ); 277 | } 278 | }, 279 | call: function( instance, name, args ) { 280 | var i, 281 | set = instance.plugins[ name ]; 282 | if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) { 283 | return; 284 | } 285 | 286 | for ( i = 0; i < set.length; i++ ) { 287 | if ( instance.options[ set[ i ][ 0 ] ] ) { 288 | set[ i ][ 1 ].apply( instance.element, args ); 289 | } 290 | } 291 | } 292 | }, 293 | 294 | // only used by resizable 295 | hasScroll: function( el, a ) { 296 | 297 | //If overflow is hidden, the element might have extra content, but the user wants to hide it 298 | if ( $( el ).css( "overflow" ) === "hidden") { 299 | return false; 300 | } 301 | 302 | var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", 303 | has = false; 304 | 305 | if ( el[ scroll ] > 0 ) { 306 | return true; 307 | } 308 | 309 | // TODO: determine which cases actually cause this to happen 310 | // if the element doesn't have the scroll set, see if it's possible to 311 | // set the scroll 312 | el[ scroll ] = 1; 313 | has = ( el[ scroll ] > 0 ); 314 | el[ scroll ] = 0; 315 | return has; 316 | } 317 | }); 318 | 319 | })( jQuery ); 320 | (function( $, undefined ) { 321 | 322 | var uuid = 0, 323 | slice = Array.prototype.slice, 324 | _cleanData = $.cleanData; 325 | $.cleanData = function( elems ) { 326 | for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { 327 | try { 328 | $( elem ).triggerHandler( "remove" ); 329 | // http://bugs.jquery.com/ticket/8235 330 | } catch( e ) {} 331 | } 332 | _cleanData( elems ); 333 | }; 334 | 335 | $.widget = function( name, base, prototype ) { 336 | var fullName, existingConstructor, constructor, basePrototype, 337 | // proxiedPrototype allows the provided prototype to remain unmodified 338 | // so that it can be used as a mixin for multiple widgets (#8876) 339 | proxiedPrototype = {}, 340 | namespace = name.split( "." )[ 0 ]; 341 | 342 | name = name.split( "." )[ 1 ]; 343 | fullName = namespace + "-" + name; 344 | 345 | if ( !prototype ) { 346 | prototype = base; 347 | base = $.Widget; 348 | } 349 | 350 | // create selector for plugin 351 | $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { 352 | return !!$.data( elem, fullName ); 353 | }; 354 | 355 | $[ namespace ] = $[ namespace ] || {}; 356 | existingConstructor = $[ namespace ][ name ]; 357 | constructor = $[ namespace ][ name ] = function( options, element ) { 358 | // allow instantiation without "new" keyword 359 | if ( !this._createWidget ) { 360 | return new constructor( options, element ); 361 | } 362 | 363 | // allow instantiation without initializing for simple inheritance 364 | // must use "new" keyword (the code above always passes args) 365 | if ( arguments.length ) { 366 | this._createWidget( options, element ); 367 | } 368 | }; 369 | // extend with the existing constructor to carry over any static properties 370 | $.extend( constructor, existingConstructor, { 371 | version: prototype.version, 372 | // copy the object used to create the prototype in case we need to 373 | // redefine the widget later 374 | _proto: $.extend( {}, prototype ), 375 | // track widgets that inherit from this widget in case this widget is 376 | // redefined after a widget inherits from it 377 | _childConstructors: [] 378 | }); 379 | 380 | basePrototype = new base(); 381 | // we need to make the options hash a property directly on the new instance 382 | // otherwise we'll modify the options hash on the prototype that we're 383 | // inheriting from 384 | basePrototype.options = $.widget.extend( {}, basePrototype.options ); 385 | $.each( prototype, function( prop, value ) { 386 | if ( !$.isFunction( value ) ) { 387 | proxiedPrototype[ prop ] = value; 388 | return; 389 | } 390 | proxiedPrototype[ prop ] = (function() { 391 | var _super = function() { 392 | return base.prototype[ prop ].apply( this, arguments ); 393 | }, 394 | _superApply = function( args ) { 395 | return base.prototype[ prop ].apply( this, args ); 396 | }; 397 | return function() { 398 | var __super = this._super, 399 | __superApply = this._superApply, 400 | returnValue; 401 | 402 | this._super = _super; 403 | this._superApply = _superApply; 404 | 405 | returnValue = value.apply( this, arguments ); 406 | 407 | this._super = __super; 408 | this._superApply = __superApply; 409 | 410 | return returnValue; 411 | }; 412 | })(); 413 | }); 414 | constructor.prototype = $.widget.extend( basePrototype, { 415 | // TODO: remove support for widgetEventPrefix 416 | // always use the name + a colon as the prefix, e.g., draggable:start 417 | // don't prefix for widgets that aren't DOM-based 418 | widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name 419 | }, proxiedPrototype, { 420 | constructor: constructor, 421 | namespace: namespace, 422 | widgetName: name, 423 | widgetFullName: fullName 424 | }); 425 | 426 | // If this widget is being redefined then we need to find all widgets that 427 | // are inheriting from it and redefine all of them so that they inherit from 428 | // the new version of this widget. We're essentially trying to replace one 429 | // level in the prototype chain. 430 | if ( existingConstructor ) { 431 | $.each( existingConstructor._childConstructors, function( i, child ) { 432 | var childPrototype = child.prototype; 433 | 434 | // redefine the child widget using the same prototype that was 435 | // originally used, but inherit from the new version of the base 436 | $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); 437 | }); 438 | // remove the list of existing child constructors from the old constructor 439 | // so the old child constructors can be garbage collected 440 | delete existingConstructor._childConstructors; 441 | } else { 442 | base._childConstructors.push( constructor ); 443 | } 444 | 445 | $.widget.bridge( name, constructor ); 446 | }; 447 | 448 | $.widget.extend = function( target ) { 449 | var input = slice.call( arguments, 1 ), 450 | inputIndex = 0, 451 | inputLength = input.length, 452 | key, 453 | value; 454 | for ( ; inputIndex < inputLength; inputIndex++ ) { 455 | for ( key in input[ inputIndex ] ) { 456 | value = input[ inputIndex ][ key ]; 457 | if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { 458 | // Clone objects 459 | if ( $.isPlainObject( value ) ) { 460 | target[ key ] = $.isPlainObject( target[ key ] ) ? 461 | $.widget.extend( {}, target[ key ], value ) : 462 | // Don't extend strings, arrays, etc. with objects 463 | $.widget.extend( {}, value ); 464 | // Copy everything else by reference 465 | } else { 466 | target[ key ] = value; 467 | } 468 | } 469 | } 470 | } 471 | return target; 472 | }; 473 | 474 | $.widget.bridge = function( name, object ) { 475 | var fullName = object.prototype.widgetFullName || name; 476 | $.fn[ name ] = function( options ) { 477 | var isMethodCall = typeof options === "string", 478 | args = slice.call( arguments, 1 ), 479 | returnValue = this; 480 | 481 | // allow multiple hashes to be passed on init 482 | options = !isMethodCall && args.length ? 483 | $.widget.extend.apply( null, [ options ].concat(args) ) : 484 | options; 485 | 486 | if ( isMethodCall ) { 487 | this.each(function() { 488 | var methodValue, 489 | instance = $.data( this, fullName ); 490 | if ( !instance ) { 491 | return $.error( "cannot call methods on " + name + " prior to initialization; " + 492 | "attempted to call method '" + options + "'" ); 493 | } 494 | if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { 495 | return $.error( "no such method '" + options + "' for " + name + " widget instance" ); 496 | } 497 | methodValue = instance[ options ].apply( instance, args ); 498 | if ( methodValue !== instance && methodValue !== undefined ) { 499 | returnValue = methodValue && methodValue.jquery ? 500 | returnValue.pushStack( methodValue.get() ) : 501 | methodValue; 502 | return false; 503 | } 504 | }); 505 | } else { 506 | this.each(function() { 507 | var instance = $.data( this, fullName ); 508 | if ( instance ) { 509 | instance.option( options || {} )._init(); 510 | } else { 511 | $.data( this, fullName, new object( options, this ) ); 512 | } 513 | }); 514 | } 515 | 516 | return returnValue; 517 | }; 518 | }; 519 | 520 | $.Widget = function( /* options, element */ ) {}; 521 | $.Widget._childConstructors = []; 522 | 523 | $.Widget.prototype = { 524 | widgetName: "widget", 525 | widgetEventPrefix: "", 526 | defaultElement: "
", 527 | options: { 528 | disabled: false, 529 | 530 | // callbacks 531 | create: null 532 | }, 533 | _createWidget: function( options, element ) { 534 | element = $( element || this.defaultElement || this )[ 0 ]; 535 | this.element = $( element ); 536 | this.uuid = uuid++; 537 | this.eventNamespace = "." + this.widgetName + this.uuid; 538 | this.options = $.widget.extend( {}, 539 | this.options, 540 | this._getCreateOptions(), 541 | options ); 542 | 543 | this.bindings = $(); 544 | this.hoverable = $(); 545 | this.focusable = $(); 546 | 547 | if ( element !== this ) { 548 | $.data( element, this.widgetFullName, this ); 549 | this._on( true, this.element, { 550 | remove: function( event ) { 551 | if ( event.target === element ) { 552 | this.destroy(); 553 | } 554 | } 555 | }); 556 | this.document = $( element.style ? 557 | // element within the document 558 | element.ownerDocument : 559 | // element is window or document 560 | element.document || element ); 561 | this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); 562 | } 563 | 564 | this._create(); 565 | this._trigger( "create", null, this._getCreateEventData() ); 566 | this._init(); 567 | }, 568 | _getCreateOptions: $.noop, 569 | _getCreateEventData: $.noop, 570 | _create: $.noop, 571 | _init: $.noop, 572 | 573 | destroy: function() { 574 | this._destroy(); 575 | // we can probably remove the unbind calls in 2.0 576 | // all event bindings should go through this._on() 577 | this.element 578 | .unbind( this.eventNamespace ) 579 | // 1.9 BC for #7810 580 | // TODO remove dual storage 581 | .removeData( this.widgetName ) 582 | .removeData( this.widgetFullName ) 583 | // support: jquery <1.6.3 584 | // http://bugs.jquery.com/ticket/9413 585 | .removeData( $.camelCase( this.widgetFullName ) ); 586 | this.widget() 587 | .unbind( this.eventNamespace ) 588 | .removeAttr( "aria-disabled" ) 589 | .removeClass( 590 | this.widgetFullName + "-disabled " + 591 | "ui-state-disabled" ); 592 | 593 | // clean up events and states 594 | this.bindings.unbind( this.eventNamespace ); 595 | this.hoverable.removeClass( "ui-state-hover" ); 596 | this.focusable.removeClass( "ui-state-focus" ); 597 | }, 598 | _destroy: $.noop, 599 | 600 | widget: function() { 601 | return this.element; 602 | }, 603 | 604 | option: function( key, value ) { 605 | var options = key, 606 | parts, 607 | curOption, 608 | i; 609 | 610 | if ( arguments.length === 0 ) { 611 | // don't return a reference to the internal hash 612 | return $.widget.extend( {}, this.options ); 613 | } 614 | 615 | if ( typeof key === "string" ) { 616 | // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 617 | options = {}; 618 | parts = key.split( "." ); 619 | key = parts.shift(); 620 | if ( parts.length ) { 621 | curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 622 | for ( i = 0; i < parts.length - 1; i++ ) { 623 | curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 624 | curOption = curOption[ parts[ i ] ]; 625 | } 626 | key = parts.pop(); 627 | if ( value === undefined ) { 628 | return curOption[ key ] === undefined ? null : curOption[ key ]; 629 | } 630 | curOption[ key ] = value; 631 | } else { 632 | if ( value === undefined ) { 633 | return this.options[ key ] === undefined ? null : this.options[ key ]; 634 | } 635 | options[ key ] = value; 636 | } 637 | } 638 | 639 | this._setOptions( options ); 640 | 641 | return this; 642 | }, 643 | _setOptions: function( options ) { 644 | var key; 645 | 646 | for ( key in options ) { 647 | this._setOption( key, options[ key ] ); 648 | } 649 | 650 | return this; 651 | }, 652 | _setOption: function( key, value ) { 653 | this.options[ key ] = value; 654 | 655 | if ( key === "disabled" ) { 656 | this.widget() 657 | .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value ) 658 | .attr( "aria-disabled", value ); 659 | this.hoverable.removeClass( "ui-state-hover" ); 660 | this.focusable.removeClass( "ui-state-focus" ); 661 | } 662 | 663 | return this; 664 | }, 665 | 666 | enable: function() { 667 | return this._setOption( "disabled", false ); 668 | }, 669 | disable: function() { 670 | return this._setOption( "disabled", true ); 671 | }, 672 | 673 | _on: function( suppressDisabledCheck, element, handlers ) { 674 | var delegateElement, 675 | instance = this; 676 | 677 | // no suppressDisabledCheck flag, shuffle arguments 678 | if ( typeof suppressDisabledCheck !== "boolean" ) { 679 | handlers = element; 680 | element = suppressDisabledCheck; 681 | suppressDisabledCheck = false; 682 | } 683 | 684 | // no element argument, shuffle and use this.element 685 | if ( !handlers ) { 686 | handlers = element; 687 | element = this.element; 688 | delegateElement = this.widget(); 689 | } else { 690 | // accept selectors, DOM elements 691 | element = delegateElement = $( element ); 692 | this.bindings = this.bindings.add( element ); 693 | } 694 | 695 | $.each( handlers, function( event, handler ) { 696 | function handlerProxy() { 697 | // allow widgets to customize the disabled handling 698 | // - disabled as an array instead of boolean 699 | // - disabled class as method for disabling individual parts 700 | if ( !suppressDisabledCheck && 701 | ( instance.options.disabled === true || 702 | $( this ).hasClass( "ui-state-disabled" ) ) ) { 703 | return; 704 | } 705 | return ( typeof handler === "string" ? instance[ handler ] : handler ) 706 | .apply( instance, arguments ); 707 | } 708 | 709 | // copy the guid so direct unbinding works 710 | if ( typeof handler !== "string" ) { 711 | handlerProxy.guid = handler.guid = 712 | handler.guid || handlerProxy.guid || $.guid++; 713 | } 714 | 715 | var match = event.match( /^(\w+)\s*(.*)$/ ), 716 | eventName = match[1] + instance.eventNamespace, 717 | selector = match[2]; 718 | if ( selector ) { 719 | delegateElement.delegate( selector, eventName, handlerProxy ); 720 | } else { 721 | element.bind( eventName, handlerProxy ); 722 | } 723 | }); 724 | }, 725 | 726 | _off: function( element, eventName ) { 727 | eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace; 728 | element.unbind( eventName ).undelegate( eventName ); 729 | }, 730 | 731 | _delay: function( handler, delay ) { 732 | function handlerProxy() { 733 | return ( typeof handler === "string" ? instance[ handler ] : handler ) 734 | .apply( instance, arguments ); 735 | } 736 | var instance = this; 737 | return setTimeout( handlerProxy, delay || 0 ); 738 | }, 739 | 740 | _hoverable: function( element ) { 741 | this.hoverable = this.hoverable.add( element ); 742 | this._on( element, { 743 | mouseenter: function( event ) { 744 | $( event.currentTarget ).addClass( "ui-state-hover" ); 745 | }, 746 | mouseleave: function( event ) { 747 | $( event.currentTarget ).removeClass( "ui-state-hover" ); 748 | } 749 | }); 750 | }, 751 | 752 | _focusable: function( element ) { 753 | this.focusable = this.focusable.add( element ); 754 | this._on( element, { 755 | focusin: function( event ) { 756 | $( event.currentTarget ).addClass( "ui-state-focus" ); 757 | }, 758 | focusout: function( event ) { 759 | $( event.currentTarget ).removeClass( "ui-state-focus" ); 760 | } 761 | }); 762 | }, 763 | 764 | _trigger: function( type, event, data ) { 765 | var prop, orig, 766 | callback = this.options[ type ]; 767 | 768 | data = data || {}; 769 | event = $.Event( event ); 770 | event.type = ( type === this.widgetEventPrefix ? 771 | type : 772 | this.widgetEventPrefix + type ).toLowerCase(); 773 | // the original event may come from any element 774 | // so we need to reset the target on the new event 775 | event.target = this.element[ 0 ]; 776 | 777 | // copy original event properties over to the new event 778 | orig = event.originalEvent; 779 | if ( orig ) { 780 | for ( prop in orig ) { 781 | if ( !( prop in event ) ) { 782 | event[ prop ] = orig[ prop ]; 783 | } 784 | } 785 | } 786 | 787 | this.element.trigger( event, data ); 788 | return !( $.isFunction( callback ) && 789 | callback.apply( this.element[0], [ event ].concat( data ) ) === false || 790 | event.isDefaultPrevented() ); 791 | } 792 | }; 793 | 794 | $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 795 | $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 796 | if ( typeof options === "string" ) { 797 | options = { effect: options }; 798 | } 799 | var hasOptions, 800 | effectName = !options ? 801 | method : 802 | options === true || typeof options === "number" ? 803 | defaultEffect : 804 | options.effect || defaultEffect; 805 | options = options || {}; 806 | if ( typeof options === "number" ) { 807 | options = { duration: options }; 808 | } 809 | hasOptions = !$.isEmptyObject( options ); 810 | options.complete = callback; 811 | if ( options.delay ) { 812 | element.delay( options.delay ); 813 | } 814 | if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 815 | element[ method ]( options ); 816 | } else if ( effectName !== method && element[ effectName ] ) { 817 | element[ effectName ]( options.duration, options.easing, callback ); 818 | } else { 819 | element.queue(function( next ) { 820 | $( this )[ method ](); 821 | if ( callback ) { 822 | callback.call( element[ 0 ] ); 823 | } 824 | next(); 825 | }); 826 | } 827 | }; 828 | }); 829 | 830 | })( jQuery ); 831 | (function( $, undefined ) { 832 | 833 | var mouseHandled = false; 834 | $( document ).mouseup( function() { 835 | mouseHandled = false; 836 | }); 837 | 838 | $.widget("ui.mouse", { 839 | version: "1.10.0", 840 | options: { 841 | cancel: "input,textarea,button,select,option", 842 | distance: 1, 843 | delay: 0 844 | }, 845 | _mouseInit: function() { 846 | var that = this; 847 | 848 | this.element 849 | .bind("mousedown."+this.widgetName, function(event) { 850 | return that._mouseDown(event); 851 | }) 852 | .bind("click."+this.widgetName, function(event) { 853 | if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { 854 | $.removeData(event.target, that.widgetName + ".preventClickEvent"); 855 | event.stopImmediatePropagation(); 856 | return false; 857 | } 858 | }); 859 | 860 | this.started = false; 861 | }, 862 | 863 | // TODO: make sure destroying one instance of mouse doesn't mess with 864 | // other instances of mouse 865 | _mouseDestroy: function() { 866 | this.element.unbind("."+this.widgetName); 867 | if ( this._mouseMoveDelegate ) { 868 | $(document) 869 | .unbind("mousemove."+this.widgetName, this._mouseMoveDelegate) 870 | .unbind("mouseup."+this.widgetName, this._mouseUpDelegate); 871 | } 872 | }, 873 | 874 | _mouseDown: function(event) { 875 | // don't let more than one widget handle mouseStart 876 | if( mouseHandled ) { return; } 877 | 878 | // we may have missed mouseup (out of window) 879 | (this._mouseStarted && this._mouseUp(event)); 880 | 881 | this._mouseDownEvent = event; 882 | 883 | var that = this, 884 | btnIsLeft = (event.which === 1), 885 | // event.target.nodeName works around a bug in IE 8 with 886 | // disabled inputs (#7620) 887 | elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); 888 | if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { 889 | return true; 890 | } 891 | 892 | this.mouseDelayMet = !this.options.delay; 893 | if (!this.mouseDelayMet) { 894 | this._mouseDelayTimer = setTimeout(function() { 895 | that.mouseDelayMet = true; 896 | }, this.options.delay); 897 | } 898 | 899 | if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 900 | this._mouseStarted = (this._mouseStart(event) !== false); 901 | if (!this._mouseStarted) { 902 | event.preventDefault(); 903 | return true; 904 | } 905 | } 906 | 907 | // Click event may never have fired (Gecko & Opera) 908 | if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { 909 | $.removeData(event.target, this.widgetName + ".preventClickEvent"); 910 | } 911 | 912 | // these delegates are required to keep context 913 | this._mouseMoveDelegate = function(event) { 914 | return that._mouseMove(event); 915 | }; 916 | this._mouseUpDelegate = function(event) { 917 | return that._mouseUp(event); 918 | }; 919 | $(document) 920 | .bind("mousemove."+this.widgetName, this._mouseMoveDelegate) 921 | .bind("mouseup."+this.widgetName, this._mouseUpDelegate); 922 | 923 | event.preventDefault(); 924 | 925 | mouseHandled = true; 926 | return true; 927 | }, 928 | 929 | _mouseMove: function(event) { 930 | // IE mouseup check - mouseup happened when mouse was out of window 931 | if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) { 932 | return this._mouseUp(event); 933 | } 934 | 935 | if (this._mouseStarted) { 936 | this._mouseDrag(event); 937 | return event.preventDefault(); 938 | } 939 | 940 | if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 941 | this._mouseStarted = 942 | (this._mouseStart(this._mouseDownEvent, event) !== false); 943 | (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); 944 | } 945 | 946 | return !this._mouseStarted; 947 | }, 948 | 949 | _mouseUp: function(event) { 950 | $(document) 951 | .unbind("mousemove."+this.widgetName, this._mouseMoveDelegate) 952 | .unbind("mouseup."+this.widgetName, this._mouseUpDelegate); 953 | 954 | if (this._mouseStarted) { 955 | this._mouseStarted = false; 956 | 957 | if (event.target === this._mouseDownEvent.target) { 958 | $.data(event.target, this.widgetName + ".preventClickEvent", true); 959 | } 960 | 961 | this._mouseStop(event); 962 | } 963 | 964 | return false; 965 | }, 966 | 967 | _mouseDistanceMet: function(event) { 968 | return (Math.max( 969 | Math.abs(this._mouseDownEvent.pageX - event.pageX), 970 | Math.abs(this._mouseDownEvent.pageY - event.pageY) 971 | ) >= this.options.distance 972 | ); 973 | }, 974 | 975 | _mouseDelayMet: function(/* event */) { 976 | return this.mouseDelayMet; 977 | }, 978 | 979 | // These are placeholder methods, to be overriden by extending plugin 980 | _mouseStart: function(/* event */) {}, 981 | _mouseDrag: function(/* event */) {}, 982 | _mouseStop: function(/* event */) {}, 983 | _mouseCapture: function(/* event */) { return true; } 984 | }); 985 | 986 | })(jQuery); 987 | (function( $, undefined ) { 988 | 989 | $.ui = $.ui || {}; 990 | 991 | var cachedScrollbarWidth, 992 | max = Math.max, 993 | abs = Math.abs, 994 | round = Math.round, 995 | rhorizontal = /left|center|right/, 996 | rvertical = /top|center|bottom/, 997 | roffset = /[\+\-]\d+%?/, 998 | rposition = /^\w+/, 999 | rpercent = /%$/, 1000 | _position = $.fn.position; 1001 | 1002 | function getOffsets( offsets, width, height ) { 1003 | return [ 1004 | parseInt( offsets[ 0 ], 10 ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), 1005 | parseInt( offsets[ 1 ], 10 ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) 1006 | ]; 1007 | } 1008 | 1009 | function parseCss( element, property ) { 1010 | return parseInt( $.css( element, property ), 10 ) || 0; 1011 | } 1012 | 1013 | function getDimensions( elem ) { 1014 | var raw = elem[0]; 1015 | if ( raw.nodeType === 9 ) { 1016 | return { 1017 | width: elem.width(), 1018 | height: elem.height(), 1019 | offset: { top: 0, left: 0 } 1020 | }; 1021 | } 1022 | if ( $.isWindow( raw ) ) { 1023 | return { 1024 | width: elem.width(), 1025 | height: elem.height(), 1026 | offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 1027 | }; 1028 | } 1029 | if ( raw.preventDefault ) { 1030 | return { 1031 | width: 0, 1032 | height: 0, 1033 | offset: { top: raw.pageY, left: raw.pageX } 1034 | }; 1035 | } 1036 | return { 1037 | width: elem.outerWidth(), 1038 | height: elem.outerHeight(), 1039 | offset: elem.offset() 1040 | }; 1041 | } 1042 | 1043 | $.position = { 1044 | scrollbarWidth: function() { 1045 | if ( cachedScrollbarWidth !== undefined ) { 1046 | return cachedScrollbarWidth; 1047 | } 1048 | var w1, w2, 1049 | div = $( "
" ), 1050 | innerDiv = div.children()[0]; 1051 | 1052 | $( "body" ).append( div ); 1053 | w1 = innerDiv.offsetWidth; 1054 | div.css( "overflow", "scroll" ); 1055 | 1056 | w2 = innerDiv.offsetWidth; 1057 | 1058 | if ( w1 === w2 ) { 1059 | w2 = div[0].clientWidth; 1060 | } 1061 | 1062 | div.remove(); 1063 | 1064 | return (cachedScrollbarWidth = w1 - w2); 1065 | }, 1066 | getScrollInfo: function( within ) { 1067 | var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ), 1068 | overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ), 1069 | hasOverflowX = overflowX === "scroll" || 1070 | ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), 1071 | hasOverflowY = overflowY === "scroll" || 1072 | ( overflowY === "auto" && within.height < within.element[0].scrollHeight ); 1073 | return { 1074 | width: hasOverflowX ? $.position.scrollbarWidth() : 0, 1075 | height: hasOverflowY ? $.position.scrollbarWidth() : 0 1076 | }; 1077 | }, 1078 | getWithinInfo: function( element ) { 1079 | var withinElement = $( element || window ), 1080 | isWindow = $.isWindow( withinElement[0] ); 1081 | return { 1082 | element: withinElement, 1083 | isWindow: isWindow, 1084 | offset: withinElement.offset() || { left: 0, top: 0 }, 1085 | scrollLeft: withinElement.scrollLeft(), 1086 | scrollTop: withinElement.scrollTop(), 1087 | width: isWindow ? withinElement.width() : withinElement.outerWidth(), 1088 | height: isWindow ? withinElement.height() : withinElement.outerHeight() 1089 | }; 1090 | } 1091 | }; 1092 | 1093 | $.fn.position = function( options ) { 1094 | if ( !options || !options.of ) { 1095 | return _position.apply( this, arguments ); 1096 | } 1097 | 1098 | // make a copy, we don't want to modify arguments 1099 | options = $.extend( {}, options ); 1100 | 1101 | var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 1102 | target = $( options.of ), 1103 | within = $.position.getWithinInfo( options.within ), 1104 | scrollInfo = $.position.getScrollInfo( within ), 1105 | collision = ( options.collision || "flip" ).split( " " ), 1106 | offsets = {}; 1107 | 1108 | dimensions = getDimensions( target ); 1109 | if ( target[0].preventDefault ) { 1110 | // force left top to allow flipping 1111 | options.at = "left top"; 1112 | } 1113 | targetWidth = dimensions.width; 1114 | targetHeight = dimensions.height; 1115 | targetOffset = dimensions.offset; 1116 | // clone to reuse original targetOffset later 1117 | basePosition = $.extend( {}, targetOffset ); 1118 | 1119 | // force my and at to have valid horizontal and vertical positions 1120 | // if a value is missing or invalid, it will be converted to center 1121 | $.each( [ "my", "at" ], function() { 1122 | var pos = ( options[ this ] || "" ).split( " " ), 1123 | horizontalOffset, 1124 | verticalOffset; 1125 | 1126 | if ( pos.length === 1) { 1127 | pos = rhorizontal.test( pos[ 0 ] ) ? 1128 | pos.concat( [ "center" ] ) : 1129 | rvertical.test( pos[ 0 ] ) ? 1130 | [ "center" ].concat( pos ) : 1131 | [ "center", "center" ]; 1132 | } 1133 | pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; 1134 | pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; 1135 | 1136 | // calculate offsets 1137 | horizontalOffset = roffset.exec( pos[ 0 ] ); 1138 | verticalOffset = roffset.exec( pos[ 1 ] ); 1139 | offsets[ this ] = [ 1140 | horizontalOffset ? horizontalOffset[ 0 ] : 0, 1141 | verticalOffset ? verticalOffset[ 0 ] : 0 1142 | ]; 1143 | 1144 | // reduce to just the positions without the offsets 1145 | options[ this ] = [ 1146 | rposition.exec( pos[ 0 ] )[ 0 ], 1147 | rposition.exec( pos[ 1 ] )[ 0 ] 1148 | ]; 1149 | }); 1150 | 1151 | // normalize collision option 1152 | if ( collision.length === 1 ) { 1153 | collision[ 1 ] = collision[ 0 ]; 1154 | } 1155 | 1156 | if ( options.at[ 0 ] === "right" ) { 1157 | basePosition.left += targetWidth; 1158 | } else if ( options.at[ 0 ] === "center" ) { 1159 | basePosition.left += targetWidth / 2; 1160 | } 1161 | 1162 | if ( options.at[ 1 ] === "bottom" ) { 1163 | basePosition.top += targetHeight; 1164 | } else if ( options.at[ 1 ] === "center" ) { 1165 | basePosition.top += targetHeight / 2; 1166 | } 1167 | 1168 | atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); 1169 | basePosition.left += atOffset[ 0 ]; 1170 | basePosition.top += atOffset[ 1 ]; 1171 | 1172 | return this.each(function() { 1173 | var collisionPosition, using, 1174 | elem = $( this ), 1175 | elemWidth = elem.outerWidth(), 1176 | elemHeight = elem.outerHeight(), 1177 | marginLeft = parseCss( this, "marginLeft" ), 1178 | marginTop = parseCss( this, "marginTop" ), 1179 | collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width, 1180 | collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height, 1181 | position = $.extend( {}, basePosition ), 1182 | myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); 1183 | 1184 | if ( options.my[ 0 ] === "right" ) { 1185 | position.left -= elemWidth; 1186 | } else if ( options.my[ 0 ] === "center" ) { 1187 | position.left -= elemWidth / 2; 1188 | } 1189 | 1190 | if ( options.my[ 1 ] === "bottom" ) { 1191 | position.top -= elemHeight; 1192 | } else if ( options.my[ 1 ] === "center" ) { 1193 | position.top -= elemHeight / 2; 1194 | } 1195 | 1196 | position.left += myOffset[ 0 ]; 1197 | position.top += myOffset[ 1 ]; 1198 | 1199 | // if the browser doesn't support fractions, then round for consistent results 1200 | if ( !$.support.offsetFractions ) { 1201 | position.left = round( position.left ); 1202 | position.top = round( position.top ); 1203 | } 1204 | 1205 | collisionPosition = { 1206 | marginLeft: marginLeft, 1207 | marginTop: marginTop 1208 | }; 1209 | 1210 | $.each( [ "left", "top" ], function( i, dir ) { 1211 | if ( $.ui.position[ collision[ i ] ] ) { 1212 | $.ui.position[ collision[ i ] ][ dir ]( position, { 1213 | targetWidth: targetWidth, 1214 | targetHeight: targetHeight, 1215 | elemWidth: elemWidth, 1216 | elemHeight: elemHeight, 1217 | collisionPosition: collisionPosition, 1218 | collisionWidth: collisionWidth, 1219 | collisionHeight: collisionHeight, 1220 | offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], 1221 | my: options.my, 1222 | at: options.at, 1223 | within: within, 1224 | elem : elem 1225 | }); 1226 | } 1227 | }); 1228 | 1229 | if ( options.using ) { 1230 | // adds feedback as second argument to using callback, if present 1231 | using = function( props ) { 1232 | var left = targetOffset.left - position.left, 1233 | right = left + targetWidth - elemWidth, 1234 | top = targetOffset.top - position.top, 1235 | bottom = top + targetHeight - elemHeight, 1236 | feedback = { 1237 | target: { 1238 | element: target, 1239 | left: targetOffset.left, 1240 | top: targetOffset.top, 1241 | width: targetWidth, 1242 | height: targetHeight 1243 | }, 1244 | element: { 1245 | element: elem, 1246 | left: position.left, 1247 | top: position.top, 1248 | width: elemWidth, 1249 | height: elemHeight 1250 | }, 1251 | horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 1252 | vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 1253 | }; 1254 | if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { 1255 | feedback.horizontal = "center"; 1256 | } 1257 | if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { 1258 | feedback.vertical = "middle"; 1259 | } 1260 | if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { 1261 | feedback.important = "horizontal"; 1262 | } else { 1263 | feedback.important = "vertical"; 1264 | } 1265 | options.using.call( this, props, feedback ); 1266 | }; 1267 | } 1268 | 1269 | elem.offset( $.extend( position, { using: using } ) ); 1270 | }); 1271 | }; 1272 | 1273 | $.ui.position = { 1274 | fit: { 1275 | left: function( position, data ) { 1276 | var within = data.within, 1277 | withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 1278 | outerWidth = within.width, 1279 | collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1280 | overLeft = withinOffset - collisionPosLeft, 1281 | overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 1282 | newOverRight; 1283 | 1284 | // element is wider than within 1285 | if ( data.collisionWidth > outerWidth ) { 1286 | // element is initially over the left side of within 1287 | if ( overLeft > 0 && overRight <= 0 ) { 1288 | newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset; 1289 | position.left += overLeft - newOverRight; 1290 | // element is initially over right side of within 1291 | } else if ( overRight > 0 && overLeft <= 0 ) { 1292 | position.left = withinOffset; 1293 | // element is initially over both left and right sides of within 1294 | } else { 1295 | if ( overLeft > overRight ) { 1296 | position.left = withinOffset + outerWidth - data.collisionWidth; 1297 | } else { 1298 | position.left = withinOffset; 1299 | } 1300 | } 1301 | // too far left -> align with left edge 1302 | } else if ( overLeft > 0 ) { 1303 | position.left += overLeft; 1304 | // too far right -> align with right edge 1305 | } else if ( overRight > 0 ) { 1306 | position.left -= overRight; 1307 | // adjust based on position and margin 1308 | } else { 1309 | position.left = max( position.left - collisionPosLeft, position.left ); 1310 | } 1311 | }, 1312 | top: function( position, data ) { 1313 | var within = data.within, 1314 | withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 1315 | outerHeight = data.within.height, 1316 | collisionPosTop = position.top - data.collisionPosition.marginTop, 1317 | overTop = withinOffset - collisionPosTop, 1318 | overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 1319 | newOverBottom; 1320 | 1321 | // element is taller than within 1322 | if ( data.collisionHeight > outerHeight ) { 1323 | // element is initially over the top of within 1324 | if ( overTop > 0 && overBottom <= 0 ) { 1325 | newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset; 1326 | position.top += overTop - newOverBottom; 1327 | // element is initially over bottom of within 1328 | } else if ( overBottom > 0 && overTop <= 0 ) { 1329 | position.top = withinOffset; 1330 | // element is initially over both top and bottom of within 1331 | } else { 1332 | if ( overTop > overBottom ) { 1333 | position.top = withinOffset + outerHeight - data.collisionHeight; 1334 | } else { 1335 | position.top = withinOffset; 1336 | } 1337 | } 1338 | // too far up -> align with top 1339 | } else if ( overTop > 0 ) { 1340 | position.top += overTop; 1341 | // too far down -> align with bottom edge 1342 | } else if ( overBottom > 0 ) { 1343 | position.top -= overBottom; 1344 | // adjust based on position and margin 1345 | } else { 1346 | position.top = max( position.top - collisionPosTop, position.top ); 1347 | } 1348 | } 1349 | }, 1350 | flip: { 1351 | left: function( position, data ) { 1352 | var within = data.within, 1353 | withinOffset = within.offset.left + within.scrollLeft, 1354 | outerWidth = within.width, 1355 | offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 1356 | collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1357 | overLeft = collisionPosLeft - offsetLeft, 1358 | overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 1359 | myOffset = data.my[ 0 ] === "left" ? 1360 | -data.elemWidth : 1361 | data.my[ 0 ] === "right" ? 1362 | data.elemWidth : 1363 | 0, 1364 | atOffset = data.at[ 0 ] === "left" ? 1365 | data.targetWidth : 1366 | data.at[ 0 ] === "right" ? 1367 | -data.targetWidth : 1368 | 0, 1369 | offset = -2 * data.offset[ 0 ], 1370 | newOverRight, 1371 | newOverLeft; 1372 | 1373 | if ( overLeft < 0 ) { 1374 | newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset; 1375 | if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { 1376 | position.left += myOffset + atOffset + offset; 1377 | } 1378 | } 1379 | else if ( overRight > 0 ) { 1380 | newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; 1381 | if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { 1382 | position.left += myOffset + atOffset + offset; 1383 | } 1384 | } 1385 | }, 1386 | top: function( position, data ) { 1387 | var within = data.within, 1388 | withinOffset = within.offset.top + within.scrollTop, 1389 | outerHeight = within.height, 1390 | offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 1391 | collisionPosTop = position.top - data.collisionPosition.marginTop, 1392 | overTop = collisionPosTop - offsetTop, 1393 | overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 1394 | top = data.my[ 1 ] === "top", 1395 | myOffset = top ? 1396 | -data.elemHeight : 1397 | data.my[ 1 ] === "bottom" ? 1398 | data.elemHeight : 1399 | 0, 1400 | atOffset = data.at[ 1 ] === "top" ? 1401 | data.targetHeight : 1402 | data.at[ 1 ] === "bottom" ? 1403 | -data.targetHeight : 1404 | 0, 1405 | offset = -2 * data.offset[ 1 ], 1406 | newOverTop, 1407 | newOverBottom; 1408 | if ( overTop < 0 ) { 1409 | newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; 1410 | if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) { 1411 | position.top += myOffset + atOffset + offset; 1412 | } 1413 | } 1414 | else if ( overBottom > 0 ) { 1415 | newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; 1416 | if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) { 1417 | position.top += myOffset + atOffset + offset; 1418 | } 1419 | } 1420 | } 1421 | }, 1422 | flipfit: { 1423 | left: function() { 1424 | $.ui.position.flip.left.apply( this, arguments ); 1425 | $.ui.position.fit.left.apply( this, arguments ); 1426 | }, 1427 | top: function() { 1428 | $.ui.position.flip.top.apply( this, arguments ); 1429 | $.ui.position.fit.top.apply( this, arguments ); 1430 | } 1431 | } 1432 | }; 1433 | 1434 | // fraction support test 1435 | (function () { 1436 | var testElement, testElementParent, testElementStyle, offsetLeft, i, 1437 | body = document.getElementsByTagName( "body" )[ 0 ], 1438 | div = document.createElement( "div" ); 1439 | 1440 | //Create a "fake body" for testing based on method used in jQuery.support 1441 | testElement = document.createElement( body ? "div" : "body" ); 1442 | testElementStyle = { 1443 | visibility: "hidden", 1444 | width: 0, 1445 | height: 0, 1446 | border: 0, 1447 | margin: 0, 1448 | background: "none" 1449 | }; 1450 | if ( body ) { 1451 | $.extend( testElementStyle, { 1452 | position: "absolute", 1453 | left: "-1000px", 1454 | top: "-1000px" 1455 | }); 1456 | } 1457 | for ( i in testElementStyle ) { 1458 | testElement.style[ i ] = testElementStyle[ i ]; 1459 | } 1460 | testElement.appendChild( div ); 1461 | testElementParent = body || document.documentElement; 1462 | testElementParent.insertBefore( testElement, testElementParent.firstChild ); 1463 | 1464 | div.style.cssText = "position: absolute; left: 10.7432222px;"; 1465 | 1466 | offsetLeft = $( div ).offset().left; 1467 | $.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11; 1468 | 1469 | testElement.innerHTML = ""; 1470 | testElementParent.removeChild( testElement ); 1471 | })(); 1472 | 1473 | }( jQuery ) ); 1474 | (function( $, undefined ) { 1475 | 1476 | $.widget("ui.draggable", $.ui.mouse, { 1477 | version: "1.10.0", 1478 | widgetEventPrefix: "drag", 1479 | options: { 1480 | addClasses: true, 1481 | appendTo: "parent", 1482 | axis: false, 1483 | connectToSortable: false, 1484 | containment: false, 1485 | cursor: "auto", 1486 | cursorAt: false, 1487 | grid: false, 1488 | handle: false, 1489 | helper: "original", 1490 | iframeFix: false, 1491 | opacity: false, 1492 | refreshPositions: false, 1493 | revert: false, 1494 | revertDuration: 500, 1495 | scope: "default", 1496 | scroll: true, 1497 | scrollSensitivity: 20, 1498 | scrollSpeed: 20, 1499 | snap: false, 1500 | snapMode: "both", 1501 | snapTolerance: 20, 1502 | stack: false, 1503 | zIndex: false, 1504 | 1505 | // callbacks 1506 | drag: null, 1507 | start: null, 1508 | stop: null 1509 | }, 1510 | _create: function() { 1511 | 1512 | if (this.options.helper === "original" && !(/^(?:r|a|f)/).test(this.element.css("position"))) { 1513 | this.element[0].style.position = "relative"; 1514 | } 1515 | if (this.options.addClasses){ 1516 | this.element.addClass("ui-draggable"); 1517 | } 1518 | if (this.options.disabled){ 1519 | this.element.addClass("ui-draggable-disabled"); 1520 | } 1521 | 1522 | this._mouseInit(); 1523 | 1524 | }, 1525 | 1526 | _destroy: function() { 1527 | this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ); 1528 | this._mouseDestroy(); 1529 | }, 1530 | 1531 | _mouseCapture: function(event) { 1532 | 1533 | var o = this.options; 1534 | 1535 | // among others, prevent a drag on a resizable-handle 1536 | if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) { 1537 | return false; 1538 | } 1539 | 1540 | //Quit if we're not on a valid handle 1541 | this.handle = this._getHandle(event); 1542 | if (!this.handle) { 1543 | return false; 1544 | } 1545 | 1546 | $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { 1547 | $("
") 1548 | .css({ 1549 | width: this.offsetWidth+"px", height: this.offsetHeight+"px", 1550 | position: "absolute", opacity: "0.001", zIndex: 1000 1551 | }) 1552 | .css($(this).offset()) 1553 | .appendTo("body"); 1554 | }); 1555 | 1556 | return true; 1557 | 1558 | }, 1559 | 1560 | _mouseStart: function(event) { 1561 | 1562 | var o = this.options; 1563 | 1564 | //Create and append the visible helper 1565 | this.helper = this._createHelper(event); 1566 | 1567 | this.helper.addClass("ui-draggable-dragging"); 1568 | 1569 | //Cache the helper size 1570 | this._cacheHelperProportions(); 1571 | 1572 | //If ddmanager is used for droppables, set the global draggable 1573 | if($.ui.ddmanager) { 1574 | $.ui.ddmanager.current = this; 1575 | } 1576 | 1577 | /* 1578 | * - Position generation - 1579 | * This block generates everything position related - it's the core of draggables. 1580 | */ 1581 | 1582 | //Cache the margins of the original element 1583 | this._cacheMargins(); 1584 | 1585 | //Store the helper's css position 1586 | this.cssPosition = this.helper.css("position"); 1587 | this.scrollParent = this.helper.scrollParent(); 1588 | 1589 | //The element's absolute position on the page minus margins 1590 | this.offset = this.positionAbs = this.element.offset(); 1591 | this.offset = { 1592 | top: this.offset.top - this.margins.top, 1593 | left: this.offset.left - this.margins.left 1594 | }; 1595 | 1596 | $.extend(this.offset, { 1597 | click: { //Where the click happened, relative to the element 1598 | left: event.pageX - this.offset.left, 1599 | top: event.pageY - this.offset.top 1600 | }, 1601 | parent: this._getParentOffset(), 1602 | relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper 1603 | }); 1604 | 1605 | //Generate the original position 1606 | this.originalPosition = this.position = this._generatePosition(event); 1607 | this.originalPageX = event.pageX; 1608 | this.originalPageY = event.pageY; 1609 | 1610 | //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 1611 | (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); 1612 | 1613 | //Set a containment if given in the options 1614 | if(o.containment) { 1615 | this._setContainment(); 1616 | } 1617 | 1618 | //Trigger event + callbacks 1619 | if(this._trigger("start", event) === false) { 1620 | this._clear(); 1621 | return false; 1622 | } 1623 | 1624 | //Recache the helper size 1625 | this._cacheHelperProportions(); 1626 | 1627 | //Prepare the droppable offsets 1628 | if ($.ui.ddmanager && !o.dropBehaviour) { 1629 | $.ui.ddmanager.prepareOffsets(this, event); 1630 | } 1631 | 1632 | 1633 | this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position 1634 | 1635 | //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) 1636 | if ( $.ui.ddmanager ) { 1637 | $.ui.ddmanager.dragStart(this, event); 1638 | } 1639 | 1640 | return true; 1641 | }, 1642 | 1643 | _mouseDrag: function(event, noPropagation) { 1644 | 1645 | //Compute the helpers position 1646 | this.position = this._generatePosition(event); 1647 | this.positionAbs = this._convertPositionTo("absolute"); 1648 | 1649 | //Call plugins and callbacks and use the resulting position if something is returned 1650 | if (!noPropagation) { 1651 | var ui = this._uiHash(); 1652 | if(this._trigger("drag", event, ui) === false) { 1653 | this._mouseUp({}); 1654 | return false; 1655 | } 1656 | this.position = ui.position; 1657 | } 1658 | 1659 | if(!this.options.axis || this.options.axis !== "y") { 1660 | this.helper[0].style.left = this.position.left+"px"; 1661 | } 1662 | if(!this.options.axis || this.options.axis !== "x") { 1663 | this.helper[0].style.top = this.position.top+"px"; 1664 | } 1665 | if($.ui.ddmanager) { 1666 | $.ui.ddmanager.drag(this, event); 1667 | } 1668 | 1669 | return false; 1670 | }, 1671 | 1672 | _mouseStop: function(event) { 1673 | 1674 | //If we are using droppables, inform the manager about the drop 1675 | var element, 1676 | that = this, 1677 | elementInDom = false, 1678 | dropped = false; 1679 | if ($.ui.ddmanager && !this.options.dropBehaviour) { 1680 | dropped = $.ui.ddmanager.drop(this, event); 1681 | } 1682 | 1683 | //if a drop comes from outside (a sortable) 1684 | if(this.dropped) { 1685 | dropped = this.dropped; 1686 | this.dropped = false; 1687 | } 1688 | 1689 | //if the original element is no longer in the DOM don't bother to continue (see #8269) 1690 | element = this.element[0]; 1691 | while ( element && (element = element.parentNode) ) { 1692 | if (element === document ) { 1693 | elementInDom = true; 1694 | } 1695 | } 1696 | if ( !elementInDom && this.options.helper === "original" ) { 1697 | return false; 1698 | } 1699 | 1700 | if((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { 1701 | $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { 1702 | if(that._trigger("stop", event) !== false) { 1703 | that._clear(); 1704 | } 1705 | }); 1706 | } else { 1707 | if(this._trigger("stop", event) !== false) { 1708 | this._clear(); 1709 | } 1710 | } 1711 | 1712 | return false; 1713 | }, 1714 | 1715 | _mouseUp: function(event) { 1716 | //Remove frame helpers 1717 | $("div.ui-draggable-iframeFix").each(function() { 1718 | this.parentNode.removeChild(this); 1719 | }); 1720 | 1721 | //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) 1722 | if( $.ui.ddmanager ) { 1723 | $.ui.ddmanager.dragStop(this, event); 1724 | } 1725 | 1726 | return $.ui.mouse.prototype._mouseUp.call(this, event); 1727 | }, 1728 | 1729 | cancel: function() { 1730 | 1731 | if(this.helper.is(".ui-draggable-dragging")) { 1732 | this._mouseUp({}); 1733 | } else { 1734 | this._clear(); 1735 | } 1736 | 1737 | return this; 1738 | 1739 | }, 1740 | 1741 | _getHandle: function(event) { 1742 | 1743 | var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false; 1744 | $(this.options.handle, this.element) 1745 | .find("*") 1746 | .addBack() 1747 | .each(function() { 1748 | if(this === event.target) { 1749 | handle = true; 1750 | } 1751 | }); 1752 | 1753 | return handle; 1754 | 1755 | }, 1756 | 1757 | _createHelper: function(event) { 1758 | 1759 | var o = this.options, 1760 | helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element); 1761 | 1762 | if(!helper.parents("body").length) { 1763 | helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo)); 1764 | } 1765 | 1766 | if(helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) { 1767 | helper.css("position", "absolute"); 1768 | } 1769 | 1770 | return helper; 1771 | 1772 | }, 1773 | 1774 | _adjustOffsetFromHelper: function(obj) { 1775 | if (typeof obj === "string") { 1776 | obj = obj.split(" "); 1777 | } 1778 | if ($.isArray(obj)) { 1779 | obj = {left: +obj[0], top: +obj[1] || 0}; 1780 | } 1781 | if ("left" in obj) { 1782 | this.offset.click.left = obj.left + this.margins.left; 1783 | } 1784 | if ("right" in obj) { 1785 | this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 1786 | } 1787 | if ("top" in obj) { 1788 | this.offset.click.top = obj.top + this.margins.top; 1789 | } 1790 | if ("bottom" in obj) { 1791 | this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 1792 | } 1793 | }, 1794 | 1795 | _getParentOffset: function() { 1796 | 1797 | //Get the offsetParent and cache its position 1798 | this.offsetParent = this.helper.offsetParent(); 1799 | var po = this.offsetParent.offset(); 1800 | 1801 | // This is a special case where we need to modify a offset calculated on start, since the following happened: 1802 | // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent 1803 | // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that 1804 | // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag 1805 | if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) { 1806 | po.left += this.scrollParent.scrollLeft(); 1807 | po.top += this.scrollParent.scrollTop(); 1808 | } 1809 | 1810 | //This needs to be actually done for all browsers, since pageX/pageY includes this information 1811 | //Ugly IE fix 1812 | if((this.offsetParent[0] === document.body) || 1813 | (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { 1814 | po = { top: 0, left: 0 }; 1815 | } 1816 | 1817 | return { 1818 | top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), 1819 | left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) 1820 | }; 1821 | 1822 | }, 1823 | 1824 | _getRelativeOffset: function() { 1825 | 1826 | if(this.cssPosition === "relative") { 1827 | var p = this.element.position(); 1828 | return { 1829 | top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), 1830 | left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() 1831 | }; 1832 | } else { 1833 | return { top: 0, left: 0 }; 1834 | } 1835 | 1836 | }, 1837 | 1838 | _cacheMargins: function() { 1839 | this.margins = { 1840 | left: (parseInt(this.element.css("marginLeft"),10) || 0), 1841 | top: (parseInt(this.element.css("marginTop"),10) || 0), 1842 | right: (parseInt(this.element.css("marginRight"),10) || 0), 1843 | bottom: (parseInt(this.element.css("marginBottom"),10) || 0) 1844 | }; 1845 | }, 1846 | 1847 | _cacheHelperProportions: function() { 1848 | this.helperProportions = { 1849 | width: this.helper.outerWidth(), 1850 | height: this.helper.outerHeight() 1851 | }; 1852 | }, 1853 | 1854 | _setContainment: function() { 1855 | 1856 | var over, c, ce, 1857 | o = this.options; 1858 | 1859 | if(o.containment === "parent") { 1860 | o.containment = this.helper[0].parentNode; 1861 | } 1862 | if(o.containment === "document" || o.containment === "window") { 1863 | this.containment = [ 1864 | o.containment === "document" ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 1865 | o.containment === "document" ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, 1866 | (o.containment === "document" ? 0 : $(window).scrollLeft()) + $(o.containment === "document" ? document : window).width() - this.helperProportions.width - this.margins.left, 1867 | (o.containment === "document" ? 0 : $(window).scrollTop()) + ($(o.containment === "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top 1868 | ]; 1869 | } 1870 | 1871 | if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor !== Array) { 1872 | c = $(o.containment); 1873 | ce = c[0]; 1874 | 1875 | if(!ce) { 1876 | return; 1877 | } 1878 | 1879 | over = ($(ce).css("overflow") !== "hidden"); 1880 | 1881 | this.containment = [ 1882 | (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0), 1883 | (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0), 1884 | (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right, 1885 | (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom 1886 | ]; 1887 | this.relative_container = c; 1888 | 1889 | } else if(o.containment.constructor === Array) { 1890 | this.containment = o.containment; 1891 | } 1892 | 1893 | }, 1894 | 1895 | _convertPositionTo: function(d, pos) { 1896 | 1897 | if(!pos) { 1898 | pos = this.position; 1899 | } 1900 | 1901 | var mod = d === "absolute" ? 1 : -1, 1902 | scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 1903 | 1904 | return { 1905 | top: ( 1906 | pos.top + // The absolute mouse position 1907 | this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent 1908 | this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border) 1909 | ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) 1910 | ), 1911 | left: ( 1912 | pos.left + // The absolute mouse position 1913 | this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent 1914 | this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border) 1915 | ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) 1916 | ) 1917 | }; 1918 | 1919 | }, 1920 | 1921 | _generatePosition: function(event) { 1922 | 1923 | var containment, co, top, left, 1924 | o = this.options, 1925 | scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, 1926 | scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName), 1927 | pageX = event.pageX, 1928 | pageY = event.pageY; 1929 | 1930 | /* 1931 | * - Position constraining - 1932 | * Constrain the position to a mix of grid, containment. 1933 | */ 1934 | 1935 | if(this.originalPosition) { //If we are not dragging yet, we won't check for options 1936 | if(this.containment) { 1937 | if (this.relative_container){ 1938 | co = this.relative_container.offset(); 1939 | containment = [ this.containment[0] + co.left, 1940 | this.containment[1] + co.top, 1941 | this.containment[2] + co.left, 1942 | this.containment[3] + co.top ]; 1943 | } 1944 | else { 1945 | containment = this.containment; 1946 | } 1947 | 1948 | if(event.pageX - this.offset.click.left < containment[0]) { 1949 | pageX = containment[0] + this.offset.click.left; 1950 | } 1951 | if(event.pageY - this.offset.click.top < containment[1]) { 1952 | pageY = containment[1] + this.offset.click.top; 1953 | } 1954 | if(event.pageX - this.offset.click.left > containment[2]) { 1955 | pageX = containment[2] + this.offset.click.left; 1956 | } 1957 | if(event.pageY - this.offset.click.top > containment[3]) { 1958 | pageY = containment[3] + this.offset.click.top; 1959 | } 1960 | } 1961 | 1962 | if(o.grid) { 1963 | //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950) 1964 | top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; 1965 | pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; 1966 | 1967 | left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; 1968 | pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; 1969 | } 1970 | 1971 | } 1972 | 1973 | return { 1974 | top: ( 1975 | pageY - // The absolute mouse position 1976 | this.offset.click.top - // Click offset (relative to the element) 1977 | this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent 1978 | this.offset.parent.top + // The offsetParent's offset without borders (offset + border) 1979 | ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) 1980 | ), 1981 | left: ( 1982 | pageX - // The absolute mouse position 1983 | this.offset.click.left - // Click offset (relative to the element) 1984 | this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent 1985 | this.offset.parent.left + // The offsetParent's offset without borders (offset + border) 1986 | ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) 1987 | ) 1988 | }; 1989 | 1990 | }, 1991 | 1992 | _clear: function() { 1993 | this.helper.removeClass("ui-draggable-dragging"); 1994 | if(this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { 1995 | this.helper.remove(); 1996 | } 1997 | this.helper = null; 1998 | this.cancelHelperRemoval = false; 1999 | }, 2000 | 2001 | // From now on bulk stuff - mainly helpers 2002 | 2003 | _trigger: function(type, event, ui) { 2004 | ui = ui || this._uiHash(); 2005 | $.ui.plugin.call(this, type, [event, ui]); 2006 | //The absolute position has to be recalculated after plugins 2007 | if(type === "drag") { 2008 | this.positionAbs = this._convertPositionTo("absolute"); 2009 | } 2010 | return $.Widget.prototype._trigger.call(this, type, event, ui); 2011 | }, 2012 | 2013 | plugins: {}, 2014 | 2015 | _uiHash: function() { 2016 | return { 2017 | helper: this.helper, 2018 | position: this.position, 2019 | originalPosition: this.originalPosition, 2020 | offset: this.positionAbs 2021 | }; 2022 | } 2023 | 2024 | }); 2025 | 2026 | $.ui.plugin.add("draggable", "connectToSortable", { 2027 | start: function(event, ui) { 2028 | 2029 | var inst = $(this).data("ui-draggable"), o = inst.options, 2030 | uiSortable = $.extend({}, ui, { item: inst.element }); 2031 | inst.sortables = []; 2032 | $(o.connectToSortable).each(function() { 2033 | var sortable = $.data(this, "ui-sortable"); 2034 | if (sortable && !sortable.options.disabled) { 2035 | inst.sortables.push({ 2036 | instance: sortable, 2037 | shouldRevert: sortable.options.revert 2038 | }); 2039 | sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page). 2040 | sortable._trigger("activate", event, uiSortable); 2041 | } 2042 | }); 2043 | 2044 | }, 2045 | stop: function(event, ui) { 2046 | 2047 | //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper 2048 | var inst = $(this).data("ui-draggable"), 2049 | uiSortable = $.extend({}, ui, { item: inst.element }); 2050 | 2051 | $.each(inst.sortables, function() { 2052 | if(this.instance.isOver) { 2053 | 2054 | this.instance.isOver = 0; 2055 | 2056 | inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance 2057 | this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) 2058 | 2059 | //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: "valid/invalid" 2060 | if(this.shouldRevert) { 2061 | this.instance.options.revert = true; 2062 | } 2063 | 2064 | //Trigger the stop of the sortable 2065 | this.instance._mouseStop(event); 2066 | 2067 | this.instance.options.helper = this.instance.options._helper; 2068 | 2069 | //If the helper has been the original item, restore properties in the sortable 2070 | if(inst.options.helper === "original") { 2071 | this.instance.currentItem.css({ top: "auto", left: "auto" }); 2072 | } 2073 | 2074 | } else { 2075 | this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance 2076 | this.instance._trigger("deactivate", event, uiSortable); 2077 | } 2078 | 2079 | }); 2080 | 2081 | }, 2082 | drag: function(event, ui) { 2083 | 2084 | var inst = $(this).data("ui-draggable"), that = this; 2085 | 2086 | $.each(inst.sortables, function() { 2087 | 2088 | var innermostIntersecting = false, 2089 | thisSortable = this; 2090 | 2091 | //Copy over some variables to allow calling the sortable's native _intersectsWith 2092 | this.instance.positionAbs = inst.positionAbs; 2093 | this.instance.helperProportions = inst.helperProportions; 2094 | this.instance.offset.click = inst.offset.click; 2095 | 2096 | if(this.instance._intersectsWith(this.instance.containerCache)) { 2097 | innermostIntersecting = true; 2098 | $.each(inst.sortables, function () { 2099 | this.instance.positionAbs = inst.positionAbs; 2100 | this.instance.helperProportions = inst.helperProportions; 2101 | this.instance.offset.click = inst.offset.click; 2102 | if (this !== thisSortable && 2103 | this.instance._intersectsWith(this.instance.containerCache) && 2104 | $.ui.contains(thisSortable.instance.element[0], this.instance.element[0]) 2105 | ) { 2106 | innermostIntersecting = false; 2107 | } 2108 | return innermostIntersecting; 2109 | }); 2110 | } 2111 | 2112 | 2113 | if(innermostIntersecting) { 2114 | //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once 2115 | if(!this.instance.isOver) { 2116 | 2117 | this.instance.isOver = 1; 2118 | //Now we fake the start of dragging for the sortable instance, 2119 | //by cloning the list group item, appending it to the sortable and using it as inst.currentItem 2120 | //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one) 2121 | this.instance.currentItem = $(that).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item", true); 2122 | this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it 2123 | this.instance.options.helper = function() { return ui.helper[0]; }; 2124 | 2125 | event.target = this.instance.currentItem[0]; 2126 | this.instance._mouseCapture(event, true); 2127 | this.instance._mouseStart(event, true, true); 2128 | 2129 | //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes 2130 | this.instance.offset.click.top = inst.offset.click.top; 2131 | this.instance.offset.click.left = inst.offset.click.left; 2132 | this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; 2133 | this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; 2134 | 2135 | inst._trigger("toSortable", event); 2136 | inst.dropped = this.instance.element; //draggable revert needs that 2137 | //hack so receive/update callbacks work (mostly) 2138 | inst.currentItem = inst.element; 2139 | this.instance.fromOutside = inst; 2140 | 2141 | } 2142 | 2143 | //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable 2144 | if(this.instance.currentItem) { 2145 | this.instance._mouseDrag(event); 2146 | } 2147 | 2148 | } else { 2149 | 2150 | //If it doesn't intersect with the sortable, and it intersected before, 2151 | //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval 2152 | if(this.instance.isOver) { 2153 | 2154 | this.instance.isOver = 0; 2155 | this.instance.cancelHelperRemoval = true; 2156 | 2157 | //Prevent reverting on this forced stop 2158 | this.instance.options.revert = false; 2159 | 2160 | // The out event needs to be triggered independently 2161 | this.instance._trigger("out", event, this.instance._uiHash(this.instance)); 2162 | 2163 | this.instance._mouseStop(event, true); 2164 | this.instance.options.helper = this.instance.options._helper; 2165 | 2166 | //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size 2167 | this.instance.currentItem.remove(); 2168 | if(this.instance.placeholder) { 2169 | this.instance.placeholder.remove(); 2170 | } 2171 | 2172 | inst._trigger("fromSortable", event); 2173 | inst.dropped = false; //draggable revert needs that 2174 | } 2175 | 2176 | } 2177 | 2178 | }); 2179 | 2180 | } 2181 | }); 2182 | 2183 | $.ui.plugin.add("draggable", "cursor", { 2184 | start: function() { 2185 | var t = $("body"), o = $(this).data("ui-draggable").options; 2186 | if (t.css("cursor")) { 2187 | o._cursor = t.css("cursor"); 2188 | } 2189 | t.css("cursor", o.cursor); 2190 | }, 2191 | stop: function() { 2192 | var o = $(this).data("ui-draggable").options; 2193 | if (o._cursor) { 2194 | $("body").css("cursor", o._cursor); 2195 | } 2196 | } 2197 | }); 2198 | 2199 | $.ui.plugin.add("draggable", "opacity", { 2200 | start: function(event, ui) { 2201 | var t = $(ui.helper), o = $(this).data("ui-draggable").options; 2202 | if(t.css("opacity")) { 2203 | o._opacity = t.css("opacity"); 2204 | } 2205 | t.css("opacity", o.opacity); 2206 | }, 2207 | stop: function(event, ui) { 2208 | var o = $(this).data("ui-draggable").options; 2209 | if(o._opacity) { 2210 | $(ui.helper).css("opacity", o._opacity); 2211 | } 2212 | } 2213 | }); 2214 | 2215 | $.ui.plugin.add("draggable", "scroll", { 2216 | start: function() { 2217 | var i = $(this).data("ui-draggable"); 2218 | if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") { 2219 | i.overflowOffset = i.scrollParent.offset(); 2220 | } 2221 | }, 2222 | drag: function( event ) { 2223 | 2224 | var i = $(this).data("ui-draggable"), o = i.options, scrolled = false; 2225 | 2226 | if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") { 2227 | 2228 | if(!o.axis || o.axis !== "x") { 2229 | if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) { 2230 | i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; 2231 | } else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) { 2232 | i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; 2233 | } 2234 | } 2235 | 2236 | if(!o.axis || o.axis !== "y") { 2237 | if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) { 2238 | i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; 2239 | } else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) { 2240 | i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; 2241 | } 2242 | } 2243 | 2244 | } else { 2245 | 2246 | if(!o.axis || o.axis !== "x") { 2247 | if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) { 2248 | scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 2249 | } else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) { 2250 | scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 2251 | } 2252 | } 2253 | 2254 | if(!o.axis || o.axis !== "y") { 2255 | if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { 2256 | scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); 2257 | } else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) { 2258 | scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); 2259 | } 2260 | } 2261 | 2262 | } 2263 | 2264 | if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { 2265 | $.ui.ddmanager.prepareOffsets(i, event); 2266 | } 2267 | 2268 | } 2269 | }); 2270 | 2271 | $.ui.plugin.add("draggable", "snap", { 2272 | start: function() { 2273 | 2274 | var i = $(this).data("ui-draggable"), 2275 | o = i.options; 2276 | 2277 | i.snapElements = []; 2278 | 2279 | $(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() { 2280 | var $t = $(this), 2281 | $o = $t.offset(); 2282 | if(this !== i.element[0]) { 2283 | i.snapElements.push({ 2284 | item: this, 2285 | width: $t.outerWidth(), height: $t.outerHeight(), 2286 | top: $o.top, left: $o.left 2287 | }); 2288 | } 2289 | }); 2290 | 2291 | }, 2292 | drag: function(event, ui) { 2293 | 2294 | var ts, bs, ls, rs, l, r, t, b, i, first, 2295 | inst = $(this).data("ui-draggable"), 2296 | o = inst.options, 2297 | d = o.snapTolerance, 2298 | x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 2299 | y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 2300 | 2301 | for (i = inst.snapElements.length - 1; i >= 0; i--){ 2302 | 2303 | l = inst.snapElements[i].left; 2304 | r = l + inst.snapElements[i].width; 2305 | t = inst.snapElements[i].top; 2306 | b = t + inst.snapElements[i].height; 2307 | 2308 | //Yes, I know, this is insane ;) 2309 | if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) { 2310 | if(inst.snapElements[i].snapping) { 2311 | (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); 2312 | } 2313 | inst.snapElements[i].snapping = false; 2314 | continue; 2315 | } 2316 | 2317 | if(o.snapMode !== "inner") { 2318 | ts = Math.abs(t - y2) <= d; 2319 | bs = Math.abs(b - y1) <= d; 2320 | ls = Math.abs(l - x2) <= d; 2321 | rs = Math.abs(r - x1) <= d; 2322 | if(ts) { 2323 | ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; 2324 | } 2325 | if(bs) { 2326 | ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; 2327 | } 2328 | if(ls) { 2329 | ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; 2330 | } 2331 | if(rs) { 2332 | ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; 2333 | } 2334 | } 2335 | 2336 | first = (ts || bs || ls || rs); 2337 | 2338 | if(o.snapMode !== "outer") { 2339 | ts = Math.abs(t - y1) <= d; 2340 | bs = Math.abs(b - y2) <= d; 2341 | ls = Math.abs(l - x1) <= d; 2342 | rs = Math.abs(r - x2) <= d; 2343 | if(ts) { 2344 | ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; 2345 | } 2346 | if(bs) { 2347 | ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; 2348 | } 2349 | if(ls) { 2350 | ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; 2351 | } 2352 | if(rs) { 2353 | ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; 2354 | } 2355 | } 2356 | 2357 | if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { 2358 | (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); 2359 | } 2360 | inst.snapElements[i].snapping = (ts || bs || ls || rs || first); 2361 | 2362 | } 2363 | 2364 | } 2365 | }); 2366 | 2367 | $.ui.plugin.add("draggable", "stack", { 2368 | start: function() { 2369 | 2370 | var min, 2371 | o = $(this).data("ui-draggable").options, 2372 | group = $.makeArray($(o.stack)).sort(function(a,b) { 2373 | return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); 2374 | }); 2375 | 2376 | if (!group.length) { return; } 2377 | 2378 | min = parseInt(group[0].style.zIndex, 10) || 0; 2379 | $(group).each(function(i) { 2380 | this.style.zIndex = min + i; 2381 | }); 2382 | 2383 | this[0].style.zIndex = min + group.length; 2384 | 2385 | } 2386 | }); 2387 | 2388 | $.ui.plugin.add("draggable", "zIndex", { 2389 | start: function(event, ui) { 2390 | var t = $(ui.helper), o = $(this).data("ui-draggable").options; 2391 | if(t.css("zIndex")) { 2392 | o._zIndex = t.css("zIndex"); 2393 | } 2394 | t.css("zIndex", o.zIndex); 2395 | }, 2396 | stop: function(event, ui) { 2397 | var o = $(this).data("ui-draggable").options; 2398 | if(o._zIndex) { 2399 | $(ui.helper).css("zIndex", o._zIndex); 2400 | } 2401 | } 2402 | }); 2403 | 2404 | })(jQuery); 2405 | (function( $, undefined ) { 2406 | 2407 | function isOverAxis( x, reference, size ) { 2408 | return ( x > reference ) && ( x < ( reference + size ) ); 2409 | } 2410 | 2411 | $.widget("ui.droppable", { 2412 | version: "1.10.0", 2413 | widgetEventPrefix: "drop", 2414 | options: { 2415 | accept: "*", 2416 | activeClass: false, 2417 | addClasses: true, 2418 | greedy: false, 2419 | hoverClass: false, 2420 | scope: "default", 2421 | tolerance: "intersect", 2422 | 2423 | // callbacks 2424 | activate: null, 2425 | deactivate: null, 2426 | drop: null, 2427 | out: null, 2428 | over: null 2429 | }, 2430 | _create: function() { 2431 | 2432 | var o = this.options, 2433 | accept = o.accept; 2434 | 2435 | this.isover = false; 2436 | this.isout = true; 2437 | 2438 | this.accept = $.isFunction(accept) ? accept : function(d) { 2439 | return d.is(accept); 2440 | }; 2441 | 2442 | //Store the droppable's proportions 2443 | this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; 2444 | 2445 | // Add the reference and positions to the manager 2446 | $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || []; 2447 | $.ui.ddmanager.droppables[o.scope].push(this); 2448 | 2449 | (o.addClasses && this.element.addClass("ui-droppable")); 2450 | 2451 | }, 2452 | 2453 | _destroy: function() { 2454 | var i = 0, 2455 | drop = $.ui.ddmanager.droppables[this.options.scope]; 2456 | 2457 | for ( ; i < drop.length; i++ ) { 2458 | if ( drop[i] === this ) { 2459 | drop.splice(i, 1); 2460 | } 2461 | } 2462 | 2463 | this.element.removeClass("ui-droppable ui-droppable-disabled"); 2464 | }, 2465 | 2466 | _setOption: function(key, value) { 2467 | 2468 | if(key === "accept") { 2469 | this.accept = $.isFunction(value) ? value : function(d) { 2470 | return d.is(value); 2471 | }; 2472 | } 2473 | $.Widget.prototype._setOption.apply(this, arguments); 2474 | }, 2475 | 2476 | _activate: function(event) { 2477 | var draggable = $.ui.ddmanager.current; 2478 | if(this.options.activeClass) { 2479 | this.element.addClass(this.options.activeClass); 2480 | } 2481 | if(draggable){ 2482 | this._trigger("activate", event, this.ui(draggable)); 2483 | } 2484 | }, 2485 | 2486 | _deactivate: function(event) { 2487 | var draggable = $.ui.ddmanager.current; 2488 | if(this.options.activeClass) { 2489 | this.element.removeClass(this.options.activeClass); 2490 | } 2491 | if(draggable){ 2492 | this._trigger("deactivate", event, this.ui(draggable)); 2493 | } 2494 | }, 2495 | 2496 | _over: function(event) { 2497 | 2498 | var draggable = $.ui.ddmanager.current; 2499 | 2500 | // Bail if draggable and droppable are same element 2501 | if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { 2502 | return; 2503 | } 2504 | 2505 | if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { 2506 | if(this.options.hoverClass) { 2507 | this.element.addClass(this.options.hoverClass); 2508 | } 2509 | this._trigger("over", event, this.ui(draggable)); 2510 | } 2511 | 2512 | }, 2513 | 2514 | _out: function(event) { 2515 | 2516 | var draggable = $.ui.ddmanager.current; 2517 | 2518 | // Bail if draggable and droppable are same element 2519 | if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { 2520 | return; 2521 | } 2522 | 2523 | if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { 2524 | if(this.options.hoverClass) { 2525 | this.element.removeClass(this.options.hoverClass); 2526 | } 2527 | this._trigger("out", event, this.ui(draggable)); 2528 | } 2529 | 2530 | }, 2531 | 2532 | _drop: function(event,custom) { 2533 | 2534 | var draggable = custom || $.ui.ddmanager.current, 2535 | childrenIntersection = false; 2536 | 2537 | // Bail if draggable and droppable are same element 2538 | if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { 2539 | return false; 2540 | } 2541 | 2542 | this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() { 2543 | var inst = $.data(this, "ui-droppable"); 2544 | if( 2545 | inst.options.greedy && 2546 | !inst.options.disabled && 2547 | inst.options.scope === draggable.options.scope && 2548 | inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) && 2549 | $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance) 2550 | ) { childrenIntersection = true; return false; } 2551 | }); 2552 | if(childrenIntersection) { 2553 | return false; 2554 | } 2555 | 2556 | if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { 2557 | if(this.options.activeClass) { 2558 | this.element.removeClass(this.options.activeClass); 2559 | } 2560 | if(this.options.hoverClass) { 2561 | this.element.removeClass(this.options.hoverClass); 2562 | } 2563 | this._trigger("drop", event, this.ui(draggable)); 2564 | return this.element; 2565 | } 2566 | 2567 | return false; 2568 | 2569 | }, 2570 | 2571 | ui: function(c) { 2572 | return { 2573 | draggable: (c.currentItem || c.element), 2574 | helper: c.helper, 2575 | position: c.position, 2576 | offset: c.positionAbs 2577 | }; 2578 | } 2579 | 2580 | }); 2581 | 2582 | $.ui.intersect = function(draggable, droppable, toleranceMode) { 2583 | 2584 | if (!droppable.offset) { 2585 | return false; 2586 | } 2587 | 2588 | var draggableLeft, draggableTop, 2589 | x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width, 2590 | y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height, 2591 | l = droppable.offset.left, r = l + droppable.proportions.width, 2592 | t = droppable.offset.top, b = t + droppable.proportions.height; 2593 | 2594 | switch (toleranceMode) { 2595 | case "fit": 2596 | return (l <= x1 && x2 <= r && t <= y1 && y2 <= b); 2597 | case "intersect": 2598 | return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half 2599 | x2 - (draggable.helperProportions.width / 2) < r && // Left Half 2600 | t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half 2601 | y2 - (draggable.helperProportions.height / 2) < b ); // Top Half 2602 | case "pointer": 2603 | draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left); 2604 | draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top); 2605 | return isOverAxis( draggableTop, t, droppable.proportions.height ) && isOverAxis( draggableLeft, l, droppable.proportions.width ); 2606 | case "touch": 2607 | return ( 2608 | (y1 >= t && y1 <= b) || // Top edge touching 2609 | (y2 >= t && y2 <= b) || // Bottom edge touching 2610 | (y1 < t && y2 > b) // Surrounded vertically 2611 | ) && ( 2612 | (x1 >= l && x1 <= r) || // Left edge touching 2613 | (x2 >= l && x2 <= r) || // Right edge touching 2614 | (x1 < l && x2 > r) // Surrounded horizontally 2615 | ); 2616 | default: 2617 | return false; 2618 | } 2619 | 2620 | }; 2621 | 2622 | /* 2623 | This manager tracks offsets of draggables and droppables 2624 | */ 2625 | $.ui.ddmanager = { 2626 | current: null, 2627 | droppables: { "default": [] }, 2628 | prepareOffsets: function(t, event) { 2629 | 2630 | var i, j, 2631 | m = $.ui.ddmanager.droppables[t.options.scope] || [], 2632 | type = event ? event.type : null, // workaround for #2317 2633 | list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack(); 2634 | 2635 | droppablesLoop: for (i = 0; i < m.length; i++) { 2636 | 2637 | //No disabled and non-accepted 2638 | if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) { 2639 | continue; 2640 | } 2641 | 2642 | // Filter out elements in the current dragged item 2643 | for (j=0; j < list.length; j++) { 2644 | if(list[j] === m[i].element[0]) { 2645 | m[i].proportions.height = 0; 2646 | continue droppablesLoop; 2647 | } 2648 | } 2649 | 2650 | m[i].visible = m[i].element.css("display") !== "none"; 2651 | if(!m[i].visible) { 2652 | continue; 2653 | } 2654 | 2655 | //Activate the droppable if used directly from draggables 2656 | if(type === "mousedown") { 2657 | m[i]._activate.call(m[i], event); 2658 | } 2659 | 2660 | m[i].offset = m[i].element.offset(); 2661 | m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; 2662 | 2663 | } 2664 | 2665 | }, 2666 | drop: function(draggable, event) { 2667 | 2668 | var dropped = false; 2669 | $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { 2670 | 2671 | if(!this.options) { 2672 | return; 2673 | } 2674 | if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) { 2675 | dropped = this._drop.call(this, event) || dropped; 2676 | } 2677 | 2678 | if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { 2679 | this.isout = true; 2680 | this.isover = false; 2681 | this._deactivate.call(this, event); 2682 | } 2683 | 2684 | }); 2685 | return dropped; 2686 | 2687 | }, 2688 | dragStart: function( draggable, event ) { 2689 | //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003) 2690 | draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() { 2691 | if( !draggable.options.refreshPositions ) { 2692 | $.ui.ddmanager.prepareOffsets( draggable, event ); 2693 | } 2694 | }); 2695 | }, 2696 | drag: function(draggable, event) { 2697 | 2698 | //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. 2699 | if(draggable.options.refreshPositions) { 2700 | $.ui.ddmanager.prepareOffsets(draggable, event); 2701 | } 2702 | 2703 | //Run through all droppables and check their positions based on specific tolerance options 2704 | $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { 2705 | 2706 | if(this.options.disabled || this.greedyChild || !this.visible) { 2707 | return; 2708 | } 2709 | 2710 | var parentInstance, scope, parent, 2711 | intersects = $.ui.intersect(draggable, this, this.options.tolerance), 2712 | c = !intersects && this.isover ? "isout" : (intersects && !this.isover ? "isover" : null); 2713 | if(!c) { 2714 | return; 2715 | } 2716 | 2717 | if (this.options.greedy) { 2718 | // find droppable parents with same scope 2719 | scope = this.options.scope; 2720 | parent = this.element.parents(":data(ui-droppable)").filter(function () { 2721 | return $.data(this, "ui-droppable").options.scope === scope; 2722 | }); 2723 | 2724 | if (parent.length) { 2725 | parentInstance = $.data(parent[0], "ui-droppable"); 2726 | parentInstance.greedyChild = (c === "isover"); 2727 | } 2728 | } 2729 | 2730 | // we just moved into a greedy child 2731 | if (parentInstance && c === "isover") { 2732 | parentInstance.isover = false; 2733 | parentInstance.isout = true; 2734 | parentInstance._out.call(parentInstance, event); 2735 | } 2736 | 2737 | this[c] = true; 2738 | this[c === "isout" ? "isover" : "isout"] = false; 2739 | this[c === "isover" ? "_over" : "_out"].call(this, event); 2740 | 2741 | // we just moved out of a greedy child 2742 | if (parentInstance && c === "isout") { 2743 | parentInstance.isout = false; 2744 | parentInstance.isover = true; 2745 | parentInstance._over.call(parentInstance, event); 2746 | } 2747 | }); 2748 | 2749 | }, 2750 | dragStop: function( draggable, event ) { 2751 | draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" ); 2752 | //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003) 2753 | if( !draggable.options.refreshPositions ) { 2754 | $.ui.ddmanager.prepareOffsets( draggable, event ); 2755 | } 2756 | } 2757 | }; 2758 | 2759 | })(jQuery); 2760 | --------------------------------------------------------------------------------