active_list 6.5.1 → 6.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_list.rb +11 -11
- data/lib/active_list/definition.rb +0 -2
- data/lib/active_list/definition/abstract_column.rb +4 -9
- data/lib/active_list/definition/action_column.rb +49 -57
- data/lib/active_list/definition/association_column.rb +26 -28
- data/lib/active_list/definition/attribute_column.rb +6 -11
- data/lib/active_list/definition/check_box_column.rb +0 -5
- data/lib/active_list/definition/data_column.rb +17 -24
- data/lib/active_list/definition/empty_column.rb +0 -4
- data/lib/active_list/definition/field_column.rb +0 -4
- data/lib/active_list/definition/status_column.rb +0 -4
- data/lib/active_list/definition/table.rb +31 -37
- data/lib/active_list/definition/text_field_column.rb +0 -4
- data/lib/active_list/exporters.rb +0 -4
- data/lib/active_list/exporters/abstract_exporter.rb +15 -19
- data/lib/active_list/exporters/csv_exporter.rb +5 -11
- data/lib/active_list/exporters/excel_csv_exporter.rb +7 -13
- data/lib/active_list/exporters/open_document_spreadsheet_exporter.rb +29 -35
- data/lib/active_list/generator.rb +27 -32
- data/lib/active_list/generator/finder.rb +35 -50
- data/lib/active_list/helpers.rb +6 -8
- data/lib/active_list/rails/engine.rb +3 -3
- data/lib/active_list/rails/integration.rb +2 -10
- data/lib/active_list/renderers.rb +0 -4
- data/lib/active_list/renderers/abstract_renderer.rb +2 -7
- data/lib/active_list/renderers/simple_renderer.rb +58 -71
- data/lib/active_list/version.rb +1 -3
- data/test/active_list_test.rb +4 -6
- data/test/code_generation_test.rb +0 -2
- data/test/dummy/Gemfile +1 -2
- data/test/dummy/app/controllers/contacts_controller.rb +10 -10
- data/test/dummy/app/controllers/people_controller.rb +10 -11
- data/test/dummy/config.ru +1 -1
- data/test/dummy/config/application.rb +2 -2
- data/test/dummy/config/boot.rb +1 -1
- data/test/dummy/config/environments/test.rb +6 -3
- data/test/dummy/config/initializers/session_store.rb +1 -1
- data/test/dummy/config/initializers/wrap_parameters.rb +1 -1
- data/test/dummy/db/seeds.rb +5 -5
- data/test/dummy/script/rails +2 -2
- data/test/people_controller_test.rb +11 -15
- data/test/table_test.rb +0 -1
- data/test/test_helper.rb +6 -7
- metadata +3 -4
data/lib/active_list/version.rb
CHANGED
data/test/active_list_test.rb
CHANGED
@@ -12,24 +12,22 @@ class ActiveListTest < ActiveSupport::TestCase
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
15
|
def test_existing_renderers
|
17
|
-
assert ActiveList.renderers.any?,
|
16
|
+
assert ActiveList.renderers.any?, 'No renderer found'
|
18
17
|
|
19
|
-
|
18
|
+
ActiveList.renderers.each do |name, renderer|
|
20
19
|
assert renderer.instance_methods.include?(:remote_update_code), "Renderer #{name} does not respond to :remote_update_code"
|
21
20
|
assert renderer.instance_methods.include?(:build_data_code), "Renderer #{name} does not respond to :build_data_code"
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
25
24
|
def test_existing_exporters
|
26
|
-
assert ActiveList.exporters.any?,
|
25
|
+
assert ActiveList.exporters.any?, 'No exporter found'
|
27
26
|
|
28
|
-
|
27
|
+
ActiveList.exporters.each do |name, exporter|
|
29
28
|
assert exporter.instance_methods.include?(:send_data_code), "Exporter #{name} does not respond to :send_data_code"
|
30
29
|
assert exporter.instance_methods.include?(:mime_type), "Exporter #{name} does not respond to :mime_type"
|
31
30
|
assert exporter.instance_methods.include?(:file_extension), "Exporter #{name} does not respond to :file_extension"
|
32
31
|
end
|
33
32
|
end
|
34
|
-
|
35
33
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class CodeGenerationTest < ActiveSupport::TestCase
|
4
|
-
|
5
4
|
def test_generate_simple_table
|
6
5
|
table = ActiveList::Definition::Table.new(:people)
|
7
6
|
assert_nothing_raised do
|
@@ -27,5 +26,4 @@ class CodeGenerationTest < ActiveSupport::TestCase
|
|
27
26
|
# table.generate_view_method_code
|
28
27
|
# end
|
29
28
|
end
|
30
|
-
|
31
29
|
end
|
data/test/dummy/Gemfile
CHANGED
@@ -8,7 +8,6 @@ gem 'rails', '3.2.17'
|
|
8
8
|
gem 'sqlite3'
|
9
9
|
gem 'active_list', path: '../..'
|
10
10
|
|
11
|
-
|
12
11
|
# Gems used only for assets and not required
|
13
12
|
# in production environments by default.
|
14
13
|
group :assets do
|
@@ -16,7 +15,7 @@ group :assets do
|
|
16
15
|
gem 'coffee-rails', '~> 3.2.1'
|
17
16
|
|
18
17
|
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
19
|
-
gem 'therubyracer', :
|
18
|
+
gem 'therubyracer', platform: :ruby
|
20
19
|
|
21
20
|
gem 'uglifier', '>= 1.0.3'
|
22
21
|
end
|
@@ -6,7 +6,7 @@ class ContactsController < ApplicationController
|
|
6
6
|
|
7
7
|
respond_to do |format|
|
8
8
|
format.html # index.html.erb
|
9
|
-
format.json { render :
|
9
|
+
format.json { render json: @contacts }
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -17,7 +17,7 @@ class ContactsController < ApplicationController
|
|
17
17
|
|
18
18
|
respond_to do |format|
|
19
19
|
format.html # show.html.erb
|
20
|
-
format.json { render :
|
20
|
+
format.json { render json: @contact }
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -28,7 +28,7 @@ class ContactsController < ApplicationController
|
|
28
28
|
|
29
29
|
respond_to do |format|
|
30
30
|
format.html # new.html.erb
|
31
|
-
format.json { render :
|
31
|
+
format.json { render json: @contact }
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -44,11 +44,11 @@ class ContactsController < ApplicationController
|
|
44
44
|
|
45
45
|
respond_to do |format|
|
46
46
|
if @contact.save
|
47
|
-
format.html { redirect_to @contact, :
|
48
|
-
format.json { render :
|
47
|
+
format.html { redirect_to @contact, notice: 'Contact was successfully created.' }
|
48
|
+
format.json { render json: @contact, status: :created, location: @contact }
|
49
49
|
else
|
50
|
-
format.html { render :
|
51
|
-
format.json { render :
|
50
|
+
format.html { render action: 'new' }
|
51
|
+
format.json { render json: @contact.errors, status: :unprocessable_entity }
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -60,11 +60,11 @@ class ContactsController < ApplicationController
|
|
60
60
|
|
61
61
|
respond_to do |format|
|
62
62
|
if @contact.update_attributes(params[:contact])
|
63
|
-
format.html { redirect_to @contact, :
|
63
|
+
format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }
|
64
64
|
format.json { head :no_content }
|
65
65
|
else
|
66
|
-
format.html { render :
|
67
|
-
format.json { render :
|
66
|
+
format.html { render action: 'edit' }
|
67
|
+
format.json { render json: @contact.errors, status: :unprocessable_entity }
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
class PeopleController < ApplicationController
|
2
|
-
|
3
2
|
list
|
4
3
|
|
5
4
|
# GET /people
|
@@ -9,7 +8,7 @@ class PeopleController < ApplicationController
|
|
9
8
|
|
10
9
|
respond_to do |format|
|
11
10
|
format.html # index.html.erb
|
12
|
-
format.json { render :
|
11
|
+
format.json { render json: @people }
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
@@ -20,7 +19,7 @@ class PeopleController < ApplicationController
|
|
20
19
|
|
21
20
|
respond_to do |format|
|
22
21
|
format.html # show.html.erb
|
23
|
-
format.json { render :
|
22
|
+
format.json { render json: @person }
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
@@ -31,7 +30,7 @@ class PeopleController < ApplicationController
|
|
31
30
|
|
32
31
|
respond_to do |format|
|
33
32
|
format.html # new.html.erb
|
34
|
-
format.json { render :
|
33
|
+
format.json { render json: @person }
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
@@ -47,11 +46,11 @@ class PeopleController < ApplicationController
|
|
47
46
|
|
48
47
|
respond_to do |format|
|
49
48
|
if @person.save
|
50
|
-
format.html { redirect_to @person, :
|
51
|
-
format.json { render :
|
49
|
+
format.html { redirect_to @person, notice: 'Person was successfully created.' }
|
50
|
+
format.json { render json: @person, status: :created, location: @person }
|
52
51
|
else
|
53
|
-
format.html { render :
|
54
|
-
format.json { render :
|
52
|
+
format.html { render action: 'new' }
|
53
|
+
format.json { render json: @person.errors, status: :unprocessable_entity }
|
55
54
|
end
|
56
55
|
end
|
57
56
|
end
|
@@ -63,11 +62,11 @@ class PeopleController < ApplicationController
|
|
63
62
|
|
64
63
|
respond_to do |format|
|
65
64
|
if @person.update_attributes(params[:person])
|
66
|
-
format.html { redirect_to @person, :
|
65
|
+
format.html { redirect_to @person, notice: 'Person was successfully updated.' }
|
67
66
|
format.json { head :no_content }
|
68
67
|
else
|
69
|
-
format.html { render :
|
70
|
-
format.json { render :
|
68
|
+
format.html { render action: 'edit' }
|
69
|
+
format.json { render json: @person.errors, status: :unprocessable_entity }
|
71
70
|
end
|
72
71
|
end
|
73
72
|
end
|
data/test/dummy/config.ru
CHANGED
@@ -4,7 +4,7 @@ require 'rails/all'
|
|
4
4
|
|
5
5
|
if defined?(Bundler)
|
6
6
|
# If you precompile assets before deploying to production, use this line
|
7
|
-
Bundler.require(*Rails.groups(:
|
7
|
+
Bundler.require(*Rails.groups(assets: %w(development test)))
|
8
8
|
# If you want your assets lazily compiled in production, use this line
|
9
9
|
# Bundler.require(:default, :assets, Rails.env)
|
10
10
|
end
|
@@ -34,7 +34,7 @@ module Dummy
|
|
34
34
|
# config.i18n.default_locale = :de
|
35
35
|
|
36
36
|
# Configure the default encoding used in templates for Ruby 1.9.
|
37
|
-
config.encoding =
|
37
|
+
config.encoding = 'utf-8'
|
38
38
|
|
39
39
|
# Configure sensitive parameters which will be filtered from the log file.
|
40
40
|
config.filter_parameters += [:password]
|
data/test/dummy/config/boot.rb
CHANGED
@@ -11,8 +11,8 @@ Dummy::Application.configure do
|
|
11
11
|
config.cache_classes = true
|
12
12
|
|
13
13
|
# Configure static asset server for tests with Cache-Control for performance
|
14
|
-
config.
|
15
|
-
config.static_cache_control =
|
14
|
+
config.serve_static_files = true
|
15
|
+
config.static_cache_control = 'public, max-age=3600'
|
16
16
|
|
17
17
|
# Log error messages when you accidentally call methods on nil
|
18
18
|
# config.whiny_nils = true
|
@@ -25,7 +25,7 @@ Dummy::Application.configure do
|
|
25
25
|
config.action_dispatch.show_exceptions = false
|
26
26
|
|
27
27
|
# Disable request forgery protection in test environment
|
28
|
-
config.action_controller.allow_forgery_protection
|
28
|
+
config.action_controller.allow_forgery_protection = false
|
29
29
|
|
30
30
|
# Tell Action Mailer not to deliver emails to the real world.
|
31
31
|
# The :test delivery method accumulates sent emails in the
|
@@ -37,4 +37,7 @@ Dummy::Application.configure do
|
|
37
37
|
|
38
38
|
# Print deprecation notices to the stderr
|
39
39
|
config.active_support.deprecation = :stderr
|
40
|
+
|
41
|
+
# Sort test
|
42
|
+
config.active_support.test_order = :random
|
40
43
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
|
-
Dummy::Application.config.session_store :cookie_store, :
|
3
|
+
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
|
4
4
|
|
5
5
|
# Use the database for sessions instead of the cookie-based default,
|
6
6
|
# which shouldn't be used to store highly confidential information
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
7
|
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters :
|
8
|
+
wrap_parameters format: [:json]
|
9
9
|
end
|
10
10
|
|
11
11
|
# Disable root element in JSON by default.
|
data/test/dummy/db/seeds.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
Person.create! name:
|
3
|
-
Person.create! name:
|
4
|
-
Person.create! name:
|
5
|
-
Person.create! name:
|
2
|
+
Person.create! name: 'Leonardo di ser Piero da Vinci', born_on: '1452-04-15'
|
3
|
+
Person.create! name: '宮崎 駿', born_on: '1941-01-05'
|
4
|
+
Person.create! name: 'عَبْدَالله مُحَمَّد بِن مُوسَى اَلْخْوَارِزْمِي', born_on: Date.new(780, 8, 7)
|
5
|
+
Person.create! name: 'Περικλῆς', born_on: Date.new(-495, 9, 4)
|
6
6
|
200.times do |index|
|
7
|
-
Person.create! name: "Human ##{index}", born_on: Date.new(1 + 11*index, 1 + index % 11, 1 + (7*index) % 27)
|
7
|
+
Person.create! name: "Human ##{index}", born_on: Date.new(1 + 11 * index, 1 + index % 11, 1 + (7 * index) % 27)
|
8
8
|
end
|
9
9
|
|
10
10
|
puts "#{Person.count} people"
|
data/test/dummy/script/rails
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
3
|
|
4
|
-
APP_PATH = File.expand_path('../../config/application',
|
5
|
-
require File.expand_path('../../config/boot',
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
6
|
require 'rails/commands'
|
@@ -1,21 +1,19 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class PeopleControllerTest < ActionController::TestCase
|
4
|
-
|
5
4
|
def test_action
|
6
5
|
get :list
|
7
6
|
assert_response :success
|
8
7
|
|
9
|
-
get :list, :
|
8
|
+
get :list, format: :csv
|
10
9
|
assert_response :success
|
11
10
|
|
12
|
-
get :list, :
|
11
|
+
get :list, format: :ods
|
13
12
|
assert_response :success
|
14
|
-
|
15
13
|
end
|
16
14
|
|
17
|
-
test
|
18
|
-
get :list,
|
15
|
+
test 'parameters' do
|
16
|
+
get :list, 'people-id' => 10
|
19
17
|
assert_response :success
|
20
18
|
|
21
19
|
get :list, page: 0
|
@@ -30,10 +28,8 @@ class PeopleControllerTest < ActionController::TestCase
|
|
30
28
|
get :list, page: 500, per_page: 25
|
31
29
|
assert_response :success
|
32
30
|
end
|
33
|
-
|
34
31
|
end
|
35
32
|
|
36
|
-
|
37
33
|
# # module WithinController
|
38
34
|
# include AppMockHelper
|
39
35
|
# # mock_app
|
@@ -45,17 +41,17 @@ end
|
|
45
41
|
|
46
42
|
# class PeopleController < ActionController::Base
|
47
43
|
# layout nil
|
48
|
-
|
44
|
+
|
49
45
|
# include ActiveList::ActionController
|
50
46
|
# list
|
51
|
-
|
47
|
+
|
52
48
|
# def index
|
53
49
|
# render :inline => "<h1></h1><%=list-%>"
|
54
50
|
# end
|
55
|
-
# end
|
56
|
-
|
51
|
+
# end
|
52
|
+
|
57
53
|
# class PeopleControllerTest < ActionController::TestCase # Test::Unit::TestCase
|
58
|
-
|
54
|
+
|
59
55
|
# def setup
|
60
56
|
# @routes = ActionDispatch::Routing::RouteSet.new
|
61
57
|
# @routes.draw do
|
@@ -65,12 +61,12 @@ end
|
|
65
61
|
# resources :contacts
|
66
62
|
# end
|
67
63
|
# end
|
68
|
-
|
64
|
+
|
69
65
|
# def test_action
|
70
66
|
# get :list
|
71
67
|
# # raise @response
|
72
68
|
# # assert _response :success
|
73
69
|
# end
|
74
|
-
|
70
|
+
|
75
71
|
# end
|
76
72
|
# # end
|
data/test/table_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -5,21 +5,21 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
5
5
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
6
|
|
7
7
|
require 'active_list'
|
8
|
-
dummy_path = Pathname.new(__FILE__).dirname.join(
|
8
|
+
dummy_path = Pathname.new(__FILE__).dirname.join('dummy')
|
9
9
|
|
10
10
|
Kernel.system("cd #{dummy_path} && bundle install && bundle exec rake db:drop db:create db:migrate db:seed RAILS_ENV=test")
|
11
11
|
|
12
12
|
# CURRENT FILE :: test/test_helper.rb
|
13
13
|
# Configure Rails Environment
|
14
|
-
ENV[
|
15
|
-
ENV[
|
14
|
+
ENV['RAILS_ENV'] = 'test'
|
15
|
+
ENV['RAILS_ROOT'] = dummy_path.to_s
|
16
16
|
|
17
|
-
require dummy_path.join(
|
18
|
-
require
|
17
|
+
require dummy_path.join('config', 'environment.rb')
|
18
|
+
require 'rails/test_help'
|
19
19
|
|
20
20
|
ActionMailer::Base.delivery_method = :test
|
21
21
|
ActionMailer::Base.perform_deliveries = true
|
22
|
-
ActionMailer::Base.default_url_options[:host] =
|
22
|
+
ActionMailer::Base.default_url_options[:host] = 'test.com'
|
23
23
|
|
24
24
|
Rails.backtrace_cleaner.remove_silencers!
|
25
25
|
|
@@ -29,6 +29,5 @@ Rails.backtrace_cleaner.remove_silencers!
|
|
29
29
|
# Load support files
|
30
30
|
# Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
31
31
|
|
32
|
-
|
33
32
|
# TODO: Adds integration test
|
34
33
|
# TODO: Adds test on list with double join on same table
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brice Texier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
228
|
version: '0'
|
229
229
|
requirements: []
|
230
230
|
rubyforge_project:
|
231
|
-
rubygems_version: 2.4.5
|
231
|
+
rubygems_version: 2.4.5.1
|
232
232
|
signing_key:
|
233
233
|
specification_version: 4
|
234
234
|
summary: Simple interactive tables for Rails app
|
@@ -293,4 +293,3 @@ test_files:
|
|
293
293
|
- test/people_controller_test.rb
|
294
294
|
- test/table_test.rb
|
295
295
|
- test/test_helper.rb
|
296
|
-
has_rdoc:
|