king_views 1.1.6 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/Gemfile +19 -0
  4. data/Rakefile +5 -28
  5. data/king_form/lib/king_form/builder/base.rb +23 -9
  6. data/king_form/lib/king_form/builder/definition_list.rb +8 -4
  7. data/king_form/lib/king_form/builder/form_fields.rb +3 -2
  8. data/king_form/lib/king_form/builder/form_fields_overrides.rb +5 -5
  9. data/king_form/lib/king_form/builder/labeled.rb +3 -3
  10. data/king_form/lib/king_form/helper.rb +21 -4
  11. data/king_form/lib/king_form/nested_form_helper.rb +9 -9
  12. data/king_form/lib/king_form/overrides.rb +13 -13
  13. data/king_format/lib/helpers/formatting_helper.rb +21 -16
  14. data/king_format/lib/helpers/money_helper.rb +6 -6
  15. data/king_format/lib/king_format.rb +2 -0
  16. data/king_format/lib/model_mixins/has_date_fields.rb +6 -2
  17. data/king_format/lib/model_mixins/has_money_fields.rb +6 -2
  18. data/king_format/lib/model_mixins/has_percent_fields.rb +5 -1
  19. data/king_list/Rakefile +2 -13
  20. data/king_list/lib/king_list/builder/show.rb +9 -6
  21. data/king_list/lib/king_list/builder/table.rb +29 -72
  22. data/king_list/lib/king_list/list_helper.rb +60 -63
  23. data/king_views.gemspec +24 -71
  24. data/spec/king_list_spec.rb +19 -0
  25. data/spec/rails_app/Rakefile +7 -0
  26. data/spec/rails_app/app/controllers/application_controller.rb +4 -0
  27. data/spec/rails_app/app/controllers/posts_controller.rb +6 -0
  28. data/spec/rails_app/app/helpers/application_helper.rb +2 -0
  29. data/spec/rails_app/app/models/comment.rb +3 -0
  30. data/spec/rails_app/app/models/person.rb +3 -0
  31. data/spec/rails_app/app/models/post.rb +4 -0
  32. data/spec/rails_app/app/views/layouts/application.html.erb +14 -0
  33. data/spec/rails_app/app/views/posts/index.haml +23 -0
  34. data/spec/rails_app/config.ru +4 -0
  35. data/spec/rails_app/config/application.rb +44 -0
  36. data/spec/rails_app/config/boot.rb +10 -0
  37. data/spec/rails_app/config/database.yml +22 -0
  38. data/spec/rails_app/config/environment.rb +5 -0
  39. data/spec/rails_app/config/environments/development.rb +26 -0
  40. data/spec/rails_app/config/environments/production.rb +49 -0
  41. data/spec/rails_app/config/environments/test.rb +35 -0
  42. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  43. data/spec/rails_app/config/initializers/inflections.rb +10 -0
  44. data/spec/rails_app/config/initializers/mime_types.rb +5 -0
  45. data/spec/rails_app/config/initializers/secret_token.rb +7 -0
  46. data/spec/rails_app/config/initializers/session_store.rb +8 -0
  47. data/spec/rails_app/config/locales/en.yml +5 -0
  48. data/spec/rails_app/config/routes.rb +60 -0
  49. data/spec/rails_app/db/migrate/20110306212208_create_posts.rb +14 -0
  50. data/spec/rails_app/db/migrate/20110306212250_create_comments.rb +15 -0
  51. data/spec/rails_app/db/migrate/20110420222224_create_people.rb +15 -0
  52. data/spec/rails_app/db/schema.rb +30 -0
  53. data/spec/rails_app/public/404.html +26 -0
  54. data/spec/rails_app/public/422.html +26 -0
  55. data/spec/rails_app/public/500.html +26 -0
  56. data/spec/rails_app/public/favicon.ico +0 -0
  57. data/spec/rails_app/script/rails +6 -0
  58. data/spec/spec_helper.rb +65 -0
  59. metadata +238 -47
  60. data/king_list/test/king_list_test.rb +0 -9
  61. data/king_list/test/test_helper.rb +0 -3
@@ -1,78 +1,31 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
5
2
 
6
3
  Gem::Specification.new do |s|
7
- s.name = %q{king_views}
8
- s.version = "1.1.6"
4
+ s.name = "king_views"
5
+ s.version = "1.2.0"
6
+ s.authors = ["Georg Leciejewski"]
7
+ s.description = "Clean up your Forms using king_form for dl or labeled forms. Use king_list for an easy markup of tables in your lists and dl-enabled listings in your detail views. "
8
+ s.email = "gl@salesking.eu"
9
+ s.license = 'MIT'
9
10
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Georg Leciejewski}]
12
- s.date = %q{2012-01-16}
13
- s.description = %q{Clean up your Forms using king_form for dl or labeled forms. Use king_list for an easy markup of tables in your lists and dl-enabled listings in your detail views. }
14
- s.email = %q{gl@salesking.eu}
15
- s.extra_rdoc_files = [
16
- "README.rdoc"
17
- ]
18
- s.files = [
19
- "CHANGELOG.rdoc",
20
- "MIT-LICENSE",
21
- "README.rdoc",
22
- "Rakefile",
23
- "VERSION",
24
- "king_form/MIT-LICENSE",
25
- "king_form/README.rdoc",
26
- "king_form/Rakefile",
27
- "king_form/lib/king_form.rb",
28
- "king_form/lib/king_form/builder/base.rb",
29
- "king_form/lib/king_form/builder/definition_list.rb",
30
- "king_form/lib/king_form/builder/form_fields.rb",
31
- "king_form/lib/king_form/builder/form_fields_overrides.rb",
32
- "king_form/lib/king_form/builder/labeled.rb",
33
- "king_form/lib/king_form/helper.rb",
34
- "king_form/lib/king_form/nested_form_helper.rb",
35
- "king_form/lib/king_form/overrides.rb",
36
- "king_form/test/king_forms_test.rb",
37
- "king_form/test/test_helper.rb",
38
- "king_format/MIT-LICENSE",
39
- "king_format/README.rdoc",
40
- "king_format/Rakefile",
41
- "king_format/lib/helpers/date_helper.rb",
42
- "king_format/lib/helpers/formatting_helper.rb",
43
- "king_format/lib/helpers/money_helper.rb",
44
- "king_format/lib/king_format.rb",
45
- "king_format/lib/model_mixins/has_date_fields.rb",
46
- "king_format/lib/model_mixins/has_money_fields.rb",
47
- "king_format/lib/model_mixins/has_percent_fields.rb",
48
- "king_format/test/king_format_test.rb",
49
- "king_format/test/test_helper.rb",
50
- "king_list/MIT-LICENSE",
51
- "king_list/README.rdoc",
52
- "king_list/Rakefile",
53
- "king_list/lib/king_list.rb",
54
- "king_list/lib/king_list/app_helper.rb",
55
- "king_list/lib/king_list/builder/show.rb",
56
- "king_list/lib/king_list/builder/table.rb",
57
- "king_list/lib/king_list/list_helper.rb",
58
- "king_list/lib/king_list/overrides.rb",
59
- "king_list/test/king_list_test.rb",
60
- "king_list/test/test_helper.rb",
61
- "king_views.gemspec",
62
- "lib/king_views.rb"
63
- ]
64
- s.homepage = %q{http://github.com/salesking/king_views}
65
- s.require_paths = [%q{lib}]
66
- s.rubygems_version = %q{1.8.6}
67
- s.summary = %q{Ultraclean haml views with list and forms helpers for rails}
11
+ s.files = `git ls-files -z`.split("\x0").reject{|i| i[/^docs\//] }
12
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
13
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
14
+ s.homepage = "http://github.com/salesking/king_views"
15
+ s.require_paths = ["lib"]
16
+ s.rubygems_version = "1.8.15"
17
+ s.summary = "Ultraclean haml views with list and forms helpers for rails"
68
18
 
69
- if s.respond_to? :specification_version then
70
- s.specification_version = 3
71
19
 
72
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
73
- else
74
- end
75
- else
76
- end
77
- end
20
+ s.add_development_dependency 'bundler', '~> 1.5'
21
+ s.add_development_dependency 'rspec'
22
+ s.add_development_dependency 'haml'
23
+ s.add_development_dependency 'sqlite3'
24
+ s.add_development_dependency 'json_schema_tools', '>=0.6.1'
25
+ s.add_development_dependency 'activemodel' # required by above
26
+ s.add_development_dependency 'rake'
27
+ s.add_development_dependency 'tzinfo'
28
+ s.add_development_dependency 'rails'
29
+ s.add_development_dependency 'rspec-rails'
78
30
 
31
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe PostsController, :type => :controller do
4
+ render_views
5
+ describe "index" do
6
+ it "shows list" do
7
+ 100.times do |i|
8
+ Post.create( :title=> "hello world #{i}")
9
+ end
10
+ get :index
11
+
12
+ #expect do
13
+ # end.to take_less_than(1).seconds
14
+
15
+ response.body.should_not be_nil
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,4 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ helper :all
4
+ end
@@ -0,0 +1,6 @@
1
+ class PostsController < ActionController::Base
2
+
3
+ def index
4
+ @posts = Post.find :all
5
+ end
6
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,3 @@
1
+ class Comment < ActiveRecord::Base
2
+ belongs_to :post
3
+ end
@@ -0,0 +1,3 @@
1
+ class Person < ActiveRecord::Base
2
+ belongs_to :post
3
+ end
@@ -0,0 +1,4 @@
1
+ class Post < ActiveRecord::Base
2
+ has_many :comments
3
+ has_many :people
4
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,23 @@
1
+ - t = Benchmark.bm(3) do |x|
2
+ =x.report('haml') do
3
+ %table
4
+ %thead
5
+ %tr
6
+ %th Title
7
+ %th Created at
8
+ %th Updated at
9
+ %tbody
10
+ - @posts.each do |p|
11
+ %tr
12
+ %td=p.title
13
+ %td=p.created_at
14
+ %td.someclass=p.updated_at
15
+
16
+ - t = Benchmark.bm(3) do |x|
17
+ =x.report('table_for') do
18
+ - table_for(@posts) do |t, post|
19
+ = t.column :title
20
+ = t.column :created_at
21
+ = t.column :updated_at, :td_options => {:class=>'xy'}
22
+
23
+
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,44 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "active_model/railtie"
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_view/railtie"
7
+ require "action_mailer/railtie"
8
+ Bundler.require
9
+ require 'haml'
10
+
11
+ module Dummy
12
+ class Application < Rails::Application
13
+ # Settings in config/environments/* take precedence over those specified here.
14
+ # Application configuration should go into files in config/initializers
15
+ # -- all .rb files in that directory are automatically loaded.
16
+
17
+ # Custom directories with classes and modules you want to be autoloadable.
18
+ # config.autoload_paths += %W(#{config.root}/extras)
19
+
20
+ # Only load the plugins named here, in the order given (default is alphabetical).
21
+ # :all can be used as a placeholder for all plugins not explicitly named.
22
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
23
+
24
+ # Activate observers that should always be running.
25
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
26
+
27
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
28
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
29
+ # config.time_zone = 'Central Time (US & Canada)'
30
+
31
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
32
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
33
+ # config.i18n.default_locale = :de
34
+
35
+ # JavaScript files you want as :defaults (application.js is always included).
36
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
37
+
38
+ # Configure the default encoding used in templates for Ruby 1.9.
39
+ config.encoding = "utf-8"
40
+
41
+ # Configure sensitive parameters which will be filtered from the log file.
42
+ config.filter_parameters += [:password]
43
+ end
44
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,26 @@
1
+ Dummy::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 webserver when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_view.debug_rjs = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Don't care if the mailer can't send
18
+ config.action_mailer.raise_delivery_errors = false
19
+
20
+ # Print deprecation notices to the Rails logger
21
+ config.active_support.deprecation = :log
22
+
23
+ # Only use best-standards-support built into browsers
24
+ config.action_dispatch.best_standards_support = :builtin
25
+ end
26
+
@@ -0,0 +1,49 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The production environment is meant for finished, "live" apps.
5
+ # Code is not reloaded between requests
6
+ config.cache_classes = true
7
+
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
+
12
+ # Specifies the header that your server uses for sending files
13
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
14
+
15
+ # For nginx:
16
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
+
18
+ # If you have no front-end server that supports something like X-Sendfile,
19
+ # just comment this out and Rails will serve the files
20
+
21
+ # See everything in the log (default is :info)
22
+ # config.log_level = :debug
23
+
24
+ # Use a different logger for distributed setups
25
+ # config.logger = SyslogLogger.new
26
+
27
+ # Use a different cache store in production
28
+ # config.cache_store = :mem_cache_store
29
+
30
+ # Disable Rails's static asset server
31
+ # In production, Apache or nginx will already do this
32
+ config.serve_static_assets = false
33
+
34
+ # Enable serving of images, stylesheets, and javascripts from an asset server
35
+ # config.action_controller.asset_host = "http://assets.example.com"
36
+
37
+ # Disable delivery errors, bad email addresses will be ignored
38
+ # config.action_mailer.raise_delivery_errors = false
39
+
40
+ # Enable threaded mode
41
+ # config.threadsafe!
42
+
43
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
+ # the I18n.default_locale when a translation can not be found)
45
+ config.i18n.fallbacks = true
46
+
47
+ # Send deprecation notices to registered listeners
48
+ config.active_support.deprecation = :notify
49
+ end
@@ -0,0 +1,35 @@
1
+ Dummy::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
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+ end
@@ -0,0 +1,7 @@
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!
@@ -0,0 +1,10 @@
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
@@ -0,0 +1,5 @@
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
@@ -0,0 +1,7 @@
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
+ Dummy::Application.config.secret_token = '58698a8f83e3ccc8e503d18280e17a23008a8f08a6813472dca7873ad0b497428dc00f62ee2225f94bce0d8e04c4befa922e4372772a2e1de89cebaa98a18c0a'