Permalink
Browse files

Proof of concept.

  • Loading branch information...
0 parents commit e25550f6799fdc5c177dcf49b37301773383db81 @AlphaHydrae committed Oct 9, 2012
Showing with 10,722 additions and 0 deletions.
  1. +7 −0 .gitignore
  2. +2 −0 .rspec
  3. +52 −0 .rvmrc
  4. +9 −0 .screenrc
  5. +33 −0 Gemfile
  6. +186 −0 Gemfile.lock
  7. +20 −0 LICENSE.txt
  8. +8 −0 README.md
  9. +19 −0 Rakefile
  10. +1 −0 VERSION
  11. +6 −0 lib/tableling-rails.rb
  12. +27 −0 lib/tableling-rails/activerecord.rb
  13. +5 −0 lib/tableling-rails/engine.rb
  14. +43 −0 lib/tableling-rails/field.rb
  15. +67 −0 lib/tableling-rails/model.rb
  16. +3 −0 lib/tableling-rails/version.rb
  17. +261 −0 spec/dummy/README.rdoc
  18. +7 −0 spec/dummy/Rakefile
  19. +23 −0 spec/dummy/app/assets/javascripts/application.js
  20. +47 −0 spec/dummy/app/assets/javascripts/books.js
  21. +2,027 −0 spec/dummy/app/assets/javascripts/bootstrap.js
  22. +12 −0 spec/dummy/app/assets/javascripts/init.js
  23. +17 −0 spec/dummy/app/assets/stylesheets/application.css.sass
  24. +19 −0 spec/dummy/app/assets/stylesheets/books.css.sass
  25. +1,058 −0 spec/dummy/app/assets/stylesheets/bootstrap/css/bootstrap-responsive.css
  26. +5,774 −0 spec/dummy/app/assets/stylesheets/bootstrap/css/bootstrap.css
  27. BIN spec/dummy/app/assets/stylesheets/bootstrap/img/glyphicons-halflings-white.png
  28. BIN spec/dummy/app/assets/stylesheets/bootstrap/img/glyphicons-halflings.png
  29. +4 −0 spec/dummy/app/assets/stylesheets/bootstrap/index.css
  30. BIN spec/dummy/app/assets/stylesheets/img/sort_asc.png
  31. BIN spec/dummy/app/assets/stylesheets/img/sort_asc_disabled.png
  32. BIN spec/dummy/app/assets/stylesheets/img/sort_both.png
  33. BIN spec/dummy/app/assets/stylesheets/img/sort_desc.png
  34. BIN spec/dummy/app/assets/stylesheets/img/sort_desc_disabled.png
  35. +1 −0 spec/dummy/app/assets/templates/booksTableEmptyRow.hamlc
  36. +2 −0 spec/dummy/app/assets/templates/booksTableRow.hamlc
  37. +3 −0 spec/dummy/app/controllers/application_controller.rb
  38. +6 −0 spec/dummy/app/controllers/books_controller.rb
  39. +2 −0 spec/dummy/app/helpers/application_helper.rb
  40. +2 −0 spec/dummy/app/helpers/books_helper.rb
  41. 0 spec/dummy/app/mailers/.gitkeep
  42. 0 spec/dummy/app/models/.gitkeep
  43. +13 −0 spec/dummy/app/models/book.rb
  44. +32 −0 spec/dummy/app/views/books/index.html.haml
  45. +16 −0 spec/dummy/app/views/layouts/application.html.haml
  46. +4 −0 spec/dummy/config.ru
  47. +59 −0 spec/dummy/config/application.rb
  48. +10 −0 spec/dummy/config/boot.rb
  49. +25 −0 spec/dummy/config/database.yml
  50. +5 −0 spec/dummy/config/environment.rb
  51. +37 −0 spec/dummy/config/environments/development.rb
  52. +67 −0 spec/dummy/config/environments/production.rb
  53. +37 −0 spec/dummy/config/environments/test.rb
  54. +7 −0 spec/dummy/config/initializers/backtrace_silencers.rb
  55. +15 −0 spec/dummy/config/initializers/inflections.rb
  56. +5 −0 spec/dummy/config/initializers/mime_types.rb
  57. +7 −0 spec/dummy/config/initializers/secret_token.rb
  58. +8 −0 spec/dummy/config/initializers/session_store.rb
  59. +14 −0 spec/dummy/config/initializers/wrap_parameters.rb
  60. +5 −0 spec/dummy/config/locales/en.yml
  61. +66 −0 spec/dummy/config/routes.rb
  62. +12 −0 spec/dummy/db/migrate/20121008115302_create_books.rb
  63. +26 −0 spec/dummy/db/schema.rb
  64. +73 −0 spec/dummy/db/seeds.rb
  65. 0 spec/dummy/lib/assets/.gitkeep
  66. 0 spec/dummy/log/.gitkeep
  67. +26 −0 spec/dummy/public/404.html
  68. +26 −0 spec/dummy/public/422.html
  69. +25 −0 spec/dummy/public/500.html
  70. 0 spec/dummy/public/favicon.ico
  71. +6 −0 spec/dummy/script/rails
  72. +7 −0 spec/models/book_spec.rb
  73. +94 −0 spec/spec_helper.rb
  74. +8 −0 spec/version_spec.rb
  75. +22 −0 tableling-rails.gemspec
  76. +2 −0 vendor/assets/javascripts/tableling-rails.js
  77. +210 −0 vendor/assets/javascripts/tableling.js
@@ -0,0 +1,7 @@
+.bundle/
+log/*.log
+pkg/
+spec/dummy/db/*.sqlite3
+spec/dummy/log/*.log
+spec/dummy/tmp/
+spec/dummy/.sass-cache
2 .rspec
@@ -0,0 +1,2 @@
+--color
+--format doc
52 .rvmrc
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+
+# This is an RVM Project .rvmrc file, used to automatically load the ruby
+# development environment upon cd'ing into the directory
+
+# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
+# Only full ruby name is supported here, for short names use:
+# echo "rvm use 1.9.3" > .rvmrc
+environment_id="ruby-1.9.3@tableling-rails"
+
+# Uncomment the following lines if you want to verify rvm version per project
+# rvmrc_rvm_version="1.15.5 (stable)" # 1.10.1 seams as a safe start
+# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
+# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
+# return 1
+# }
+
+# First we attempt to load the desired environment directly from the environment
+# file. This is very fast and efficient compared to running through the entire
+# CLI and selector. If you want feedback on which environment was used then
+# insert the word 'use' after --create as this triggers verbose mode.
+if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
+then
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
+ if [[ $- == *i* ]] # check for interactive shells
+ then echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
+ else echo "Using: $GEM_HOME" # don't use colors in non-interactive shells
+ fi
+else
+ # If the environment file has not yet been created, use the RVM CLI to select.
+ rvm --create use "$environment_id" || {
+ echo "Failed to create RVM environment '${environment_id}'."
+ return 1
+ }
+fi
+
+# If you use bundler, this might be useful to you:
+# if [[ -s Gemfile ]] && {
+# ! builtin command -v bundle >/dev/null ||
+# builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
+# }
+# then
+# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
+# gem install bundler
+# fi
+# if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
+# then
+# bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
+# fi
@@ -0,0 +1,9 @@
+source $HOME/.screenrc
+
+screen -t vim 0 $EDITOR -c GG
+screen -t zsh 1
+screen -t spec 2
+stuff "rake"
+screen -t dummy 3
+stuff "cd spec/dummy\012"
+select vim
33 Gemfile
@@ -0,0 +1,33 @@
+source "http://rubygems.org"
+
+# Declare your gem's dependencies in tableling-rails.gemspec.
+# Bundler will treat runtime dependencies like base dependencies, and
+# development dependencies will be added by default to the :development group.
+gemspec
+
+# jquery-rails is used by the dummy application
+gem 'quiet_assets'
+gem 'sqlite3'
+gem 'test-unit'
+gem 'rspec-rails'
+gem 'capybara'
+gem 'database_cleaner'
+gem 'factory_girl'
+gem 'thin'
+gem 'rake-version'
+
+gem 'haml'
+gem 'sass'
+gem 'jquery-rails'
+gem 'backbone-on-rails'
+gem 'marionette-rails'
+gem 'haml_coffee_assets'
+gem 'execjs'
+
+# Declare any dependencies that are still in development here instead of in
+# your gemspec. These might include edge Rails or gems from your path or
+# Git. Remember to move these dependencies to your gemspec before releasing
+# your gem to rubygems.org.
+
+# To use debugger
+# gem 'debugger'
@@ -0,0 +1,186 @@
+PATH
+ remote: .
+ specs:
+ tableling-rails (0.0.1)
+ rails (~> 3.2.8)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.2.8)
+ actionpack (= 3.2.8)
+ mail (~> 2.4.4)
+ actionpack (3.2.8)
+ activemodel (= 3.2.8)
+ activesupport (= 3.2.8)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.4)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.3)
+ activemodel (3.2.8)
+ activesupport (= 3.2.8)
+ builder (~> 3.0.0)
+ activerecord (3.2.8)
+ activemodel (= 3.2.8)
+ activesupport (= 3.2.8)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.8)
+ activemodel (= 3.2.8)
+ activesupport (= 3.2.8)
+ activesupport (3.2.8)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ addressable (2.3.2)
+ arel (3.0.2)
+ backbone-on-rails (0.9.2.1)
+ eco (~> 1.0.0)
+ ejs (~> 1.0.0)
+ jquery-rails
+ railties (>= 3.1)
+ builder (3.0.3)
+ capybara (1.1.2)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (~> 2.0)
+ xpath (~> 0.1.4)
+ childprocess (0.3.5)
+ ffi (~> 1.0, >= 1.0.6)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.3.3)
+ daemons (1.1.9)
+ database_cleaner (0.8.0)
+ diff-lcs (1.1.3)
+ eco (1.0.0)
+ coffee-script
+ eco-source
+ execjs
+ eco-source (1.1.0.rc.1)
+ ejs (1.0.0)
+ erubis (2.7.0)
+ eventmachine (1.0.0)
+ execjs (1.4.0)
+ multi_json (~> 1.0)
+ factory_girl (4.1.0)
+ activesupport (>= 3.0.0)
+ ffi (1.1.5)
+ haml (3.1.7)
+ haml_coffee_assets (1.5.1)
+ coffee-script (>= 1.0.0)
+ sprockets (>= 2.0.3)
+ tilt (>= 1.3.3)
+ hike (1.2.1)
+ i18n (0.6.1)
+ journey (1.0.4)
+ jquery-rails (2.1.3)
+ railties (>= 3.1.0, < 5.0)
+ thor (~> 0.14)
+ json (1.7.5)
+ libwebsocket (0.1.5)
+ addressable
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ marionette-rails (0.10.2)
+ rails (>= 3.1.0)
+ mime-types (1.19)
+ multi_json (1.3.6)
+ nokogiri (1.5.5)
+ polyglot (0.3.3)
+ quiet_assets (1.0.1)
+ railties (~> 3.1)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.2)
+ rack (>= 1.0)
+ rails (3.2.8)
+ actionmailer (= 3.2.8)
+ actionpack (= 3.2.8)
+ activerecord (= 3.2.8)
+ activeresource (= 3.2.8)
+ activesupport (= 3.2.8)
+ bundler (~> 1.0)
+ railties (= 3.2.8)
+ railties (3.2.8)
+ actionpack (= 3.2.8)
+ activesupport (= 3.2.8)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (>= 0.14.6, < 2.0)
+ rake (0.9.2.2)
+ rake-version (0.3.0)
+ rake (~> 0.9.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ rspec (2.11.0)
+ rspec-core (~> 2.11.0)
+ rspec-expectations (~> 2.11.0)
+ rspec-mocks (~> 2.11.0)
+ rspec-core (2.11.1)
+ rspec-expectations (2.11.3)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.11.3)
+ rspec-rails (2.11.0)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.11.0)
+ rubyzip (0.9.9)
+ sass (3.2.1)
+ selenium-webdriver (2.25.0)
+ childprocess (>= 0.2.5)
+ libwebsocket (~> 0.1.3)
+ multi_json (~> 1.0)
+ rubyzip
+ sprockets (2.1.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.6)
+ test-unit (2.5.2)
+ thin (1.5.0)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+ thor (0.16.0)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.33)
+ xpath (0.1.4)
+ nokogiri (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ backbone-on-rails
+ capybara
+ database_cleaner
+ execjs
+ factory_girl
+ haml
+ haml_coffee_assets
+ jquery-rails
+ marionette-rails
+ quiet_assets
+ rake-version
+ rspec-rails
+ sass
+ sqlite3
+ tableling-rails!
+ test-unit
+ thin
@@ -0,0 +1,20 @@
+Copyright (c) 2011 Simon Oulevay
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,8 @@
+# tableling-rails
+
+Async table plugin based on Backbone Marionette.
+
+## Meta
+
+* **Author:** Simon Oulevay a.k.a. Alpha Hydrae
+* **License:** MIT (see `LICENSE.txt`)
@@ -0,0 +1,19 @@
+#!/usr/bin/env rake
+begin
+ require 'bundler/setup'
+rescue LoadError
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
+end
+
+Bundler::GemHelper.install_tasks
+
+require File.expand_path('../spec/dummy/config/application', __FILE__)
+require 'rspec-rails'
+Dummy::Application.load_tasks
+
+require 'rake-version'
+RakeVersion::Tasks.new do |v|
+ v.copy 'lib/tableling/version.rb'
+end
+
+task :default => :spec
@@ -0,0 +1 @@
+0.0.1
@@ -0,0 +1,6 @@
+module Tableling
+end
+
+[ :engine, :model, :field, :version, :activerecord ].each do |lib|
+ require File.expand_path("../tableling-rails/#{lib}", __FILE__)
+end
@@ -0,0 +1,27 @@
+
+module Tableling
+
+ module ActiveRecordModel
+
+ def initialize_model options = {}
+ @model = options[:model]
+ @field_options[:model] = @model
+ end
+
+ def base_query
+ @model
+ end
+ end
+
+ module ActiveRecordExt
+ extend ActiveSupport::Concern
+
+ module ClassMethods
+ def tableling options = {}, &block
+ @model ||= Model.new(:modules => ActiveRecordModel, :model => self, &block)
+ end
+ end
+ end
+end
+
+ActiveRecord::Base.send :include, Tableling::ActiveRecordExt
@@ -0,0 +1,5 @@
+
+module Tableling
+ class Engine < Rails::Engine
+ end
+end
Oops, something went wrong.

0 comments on commit e25550f

Please sign in to comment.