active_list 6.0.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 (103) hide show
  1. data/LICENSE.txt +20 -0
  2. data/README.rdoc +46 -0
  3. data/app/assets/images/active_list.png +0 -0
  4. data/app/assets/images/active_list.svg +415 -0
  5. data/app/assets/javascripts/active_list.jquery.js +136 -0
  6. data/app/assets/stylesheets/active_list.css.scss +7 -0
  7. data/app/assets/stylesheets/active_list/background.scss +39 -0
  8. data/app/assets/stylesheets/active_list/minimal.scss +87 -0
  9. data/app/assets/stylesheets/active_list/theme.scss +189 -0
  10. data/lib/active_list.rb +61 -0
  11. data/lib/active_list/action_pack.rb +46 -0
  12. data/lib/active_list/definition.rb +17 -0
  13. data/lib/active_list/definition/abstract_column.rb +54 -0
  14. data/lib/active_list/definition/action_column.rb +76 -0
  15. data/lib/active_list/definition/association_column.rb +80 -0
  16. data/lib/active_list/definition/attribute_column.rb +58 -0
  17. data/lib/active_list/definition/check_box_column.rb +17 -0
  18. data/lib/active_list/definition/data_column.rb +88 -0
  19. data/lib/active_list/definition/empty_column.rb +10 -0
  20. data/lib/active_list/definition/field_column.rb +20 -0
  21. data/lib/active_list/definition/status_column.rb +10 -0
  22. data/lib/active_list/definition/table.rb +159 -0
  23. data/lib/active_list/definition/text_field_column.rb +10 -0
  24. data/lib/active_list/exporters.rb +17 -0
  25. data/lib/active_list/exporters/abstract_exporter.rb +55 -0
  26. data/lib/active_list/exporters/csv_exporter.rb +32 -0
  27. data/lib/active_list/exporters/excel_csv_exporter.rb +38 -0
  28. data/lib/active_list/exporters/open_document_spreadsheet_exporter.rb +82 -0
  29. data/lib/active_list/generator.rb +122 -0
  30. data/lib/active_list/generator/finder.rb +150 -0
  31. data/lib/active_list/helpers.rb +33 -0
  32. data/lib/active_list/rails/engine.rb +13 -0
  33. data/lib/active_list/renderers.rb +16 -0
  34. data/lib/active_list/renderers/abstract_renderer.rb +29 -0
  35. data/lib/active_list/renderers/simple_renderer.rb +356 -0
  36. data/lib/active_list/version.rb +5 -0
  37. data/locales/eng.yml +25 -0
  38. data/locales/fra.yml +25 -0
  39. data/test/active_list_test.rb +35 -0
  40. data/test/code_generation_test.rb +31 -0
  41. data/test/dummy/.gitignore +15 -0
  42. data/test/dummy/Gemfile +39 -0
  43. data/test/dummy/Gemfile.lock +132 -0
  44. data/test/dummy/Rakefile +7 -0
  45. data/test/dummy/app/assets/images/rails.png +0 -0
  46. data/test/dummy/app/assets/javascripts/application.js +16 -0
  47. data/test/dummy/app/assets/javascripts/contacts.js.coffee +3 -0
  48. data/test/dummy/app/assets/javascripts/people.js.coffee +3 -0
  49. data/test/dummy/app/assets/stylesheets/application.css +14 -0
  50. data/test/dummy/app/assets/stylesheets/contacts.css.scss +3 -0
  51. data/test/dummy/app/assets/stylesheets/people.css.scss +3 -0
  52. data/test/dummy/app/assets/stylesheets/scaffolds.css.scss +56 -0
  53. data/test/dummy/app/controllers/application_controller.rb +3 -0
  54. data/test/dummy/app/controllers/contacts_controller.rb +83 -0
  55. data/test/dummy/app/controllers/people_controller.rb +86 -0
  56. data/test/dummy/app/helpers/application_helper.rb +2 -0
  57. data/test/dummy/app/helpers/contacts_helper.rb +2 -0
  58. data/test/dummy/app/helpers/people_helper.rb +2 -0
  59. data/test/dummy/app/mailers/.gitkeep +0 -0
  60. data/test/dummy/app/models/.gitkeep +0 -0
  61. data/test/dummy/app/models/contact.rb +3 -0
  62. data/test/dummy/app/models/person.rb +3 -0
  63. data/test/dummy/app/views/contacts/_form.html.erb +37 -0
  64. data/test/dummy/app/views/contacts/edit.html.erb +6 -0
  65. data/test/dummy/app/views/contacts/index.html.erb +31 -0
  66. data/test/dummy/app/views/contacts/new.html.erb +5 -0
  67. data/test/dummy/app/views/contacts/show.html.erb +30 -0
  68. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  69. data/test/dummy/app/views/people/_form.html.erb +29 -0
  70. data/test/dummy/app/views/people/edit.html.erb +6 -0
  71. data/test/dummy/app/views/people/index.html.erb +30 -0
  72. data/test/dummy/app/views/people/new.html.erb +5 -0
  73. data/test/dummy/app/views/people/show.html.erb +20 -0
  74. data/test/dummy/config.ru +4 -0
  75. data/test/dummy/config/application.rb +59 -0
  76. data/test/dummy/config/boot.rb +6 -0
  77. data/test/dummy/config/database.yml +25 -0
  78. data/test/dummy/config/environment.rb +5 -0
  79. data/test/dummy/config/environments/development.rb +37 -0
  80. data/test/dummy/config/environments/production.rb +67 -0
  81. data/test/dummy/config/environments/test.rb +40 -0
  82. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  83. data/test/dummy/config/initializers/inflections.rb +15 -0
  84. data/test/dummy/config/initializers/mime_types.rb +5 -0
  85. data/test/dummy/config/initializers/secret_token.rb +8 -0
  86. data/test/dummy/config/initializers/session_store.rb +8 -0
  87. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  88. data/test/dummy/config/locales/en.yml +5 -0
  89. data/test/dummy/config/routes.rb +66 -0
  90. data/test/dummy/db/migrate/20120510131331_create_people.rb +11 -0
  91. data/test/dummy/db/migrate/20120510134500_create_contacts.rb +13 -0
  92. data/test/dummy/db/schema.rb +34 -0
  93. data/test/dummy/log/.gitkeep +0 -0
  94. data/test/dummy/public/404.html +26 -0
  95. data/test/dummy/public/422.html +26 -0
  96. data/test/dummy/public/500.html +25 -0
  97. data/test/dummy/public/favicon.ico +0 -0
  98. data/test/dummy/public/robots.txt +5 -0
  99. data/test/dummy/script/rails +6 -0
  100. data/test/people_controller_test.rb +55 -0
  101. data/test/table_test.rb +15 -0
  102. data/test/test_helper.rb +30 -0
  103. metadata +313 -0
@@ -0,0 +1,5 @@
1
+ module ActiveList
2
+
3
+ VERSION = "6.0.0"
4
+
5
+ end
data/locales/eng.yml ADDED
@@ -0,0 +1,25 @@
1
+ eng: &eng
2
+ list:
3
+ columns: "Columns"
4
+ export:
5
+ false_value: "FALSE"
6
+ formats:
7
+ csv: "CSV"
8
+ ods: "Spreadsheet ODF"
9
+ xcsv: "Excel CSV"
10
+ title: "Export"
11
+ true_value: "TRUE"
12
+ export_as: "Export as %{exported}..."
13
+ items_per_page: "Items per page"
14
+ menu: "Menu"
15
+ no_records: "No records"
16
+ pagination:
17
+ first: "First page"
18
+ last: "Last page"
19
+ next: "Next page"
20
+ previous: "Previous page"
21
+ showing_x_to_y_of_total: "Showing %{x} to %{y} of %{total}"
22
+ x_per_page:
23
+ one: "%{count} per page"
24
+ other: "%{count} per page"
25
+ en: *eng
data/locales/fra.yml ADDED
@@ -0,0 +1,25 @@
1
+ fra: &fra
2
+ list:
3
+ columns: "Colonnes"
4
+ export:
5
+ false_value: "FAUX"
6
+ formats:
7
+ csv: "CSV"
8
+ ods: "Classeur ODF"
9
+ xcsv: "CSV Excel"
10
+ title: "Exporter"
11
+ true_value: "VRAI"
12
+ export_as: "Exporter en %{exported}"
13
+ items_per_page: "Éléments par page"
14
+ menu: "Menu"
15
+ no_records: "Aucun enregistrement"
16
+ pagination:
17
+ first: "Début"
18
+ last: "Fin"
19
+ next: "Suivant"
20
+ previous: "Précédent"
21
+ showing_x_to_y_of_total: "Enregistrements %{x} à %{y} sur %{total}"
22
+ x_per_page:
23
+ one: "%{count} par page"
24
+ other: "%{count} par page"
25
+ fr: *fra
@@ -0,0 +1,35 @@
1
+ require 'test_helper'
2
+
3
+ class InvalidRenderer
4
+ end
5
+
6
+ class ActiveListTest < ActiveSupport::TestCase
7
+ # include AppMockHelper
8
+
9
+ def test_add_renderer
10
+ assert_raise ArgumentError do
11
+ ActiveList.register_renderer(InvalidRenderer)
12
+ end
13
+ end
14
+
15
+
16
+ def test_existing_renderers
17
+ assert ActiveList.renderers.any?, "No renderer found"
18
+
19
+ for name, renderer in ActiveList.renderers
20
+ assert renderer.instance_methods.include?(:remote_update_code), "Renderer #{name} does not respond to :remote_update_code"
21
+ assert renderer.instance_methods.include?(:build_data_code), "Renderer #{name} does not respond to :build_data_code"
22
+ end
23
+ end
24
+
25
+ def test_existing_exporters
26
+ assert ActiveList.exporters.any?, "No exporter found"
27
+
28
+ for name, exporter in ActiveList.exporters
29
+ assert exporter.instance_methods.include?(:send_data_code), "Exporter #{name} does not respond to :send_data_code"
30
+ assert exporter.instance_methods.include?(:mime_type), "Exporter #{name} does not respond to :mime_type"
31
+ assert exporter.instance_methods.include?(:file_extension), "Exporter #{name} does not respond to :file_extension"
32
+ end
33
+ end
34
+
35
+ end
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+
3
+ class CodeGenerationTest < ActiveSupport::TestCase
4
+
5
+ def test_generate_simple_table
6
+ table = ActiveList::Definition::Table.new(:people)
7
+ assert_nothing_raised do
8
+ table.load_default_columns
9
+ end
10
+ # assert_nothing_raised do
11
+ # table.generate_controller_method_code
12
+ # end
13
+ # assert_nothing_raised do
14
+ # table.generate_view_method_code
15
+ # end
16
+ end
17
+
18
+ def test_generate_table_with_reflection
19
+ table = ActiveList::Definition::Table.new(:contact)
20
+ assert_nothing_raised do
21
+ table.load_default_columns
22
+ end
23
+ # assert_nothing_raised do
24
+ # table.generate_controller_method_code
25
+ # end
26
+ # assert_nothing_raised do
27
+ # table.generate_view_method_code
28
+ # end
29
+ end
30
+
31
+ end
@@ -0,0 +1,15 @@
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
@@ -0,0 +1,39 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '3.2.17'
4
+
5
+ # Bundle edge Rails instead:
6
+ # gem 'rails', :git => 'git://github.com/rails/rails.git'
7
+
8
+ gem 'sqlite3'
9
+ gem 'active_list', path: '../..'
10
+
11
+
12
+ # Gems used only for assets and not required
13
+ # in production environments by default.
14
+ group :assets do
15
+ gem 'sass-rails', '~> 3.2.3'
16
+ gem 'coffee-rails', '~> 3.2.1'
17
+
18
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
19
+ # gem 'therubyracer', :platform => :ruby
20
+
21
+ gem 'uglifier', '>= 1.0.3'
22
+ end
23
+
24
+ gem 'jquery-rails'
25
+
26
+ # To use ActiveModel has_secure_password
27
+ # gem 'bcrypt-ruby', '~> 3.0.0'
28
+
29
+ # To use Jbuilder templates for JSON
30
+ # gem 'jbuilder'
31
+
32
+ # Use unicorn as the app server
33
+ # gem 'unicorn'
34
+
35
+ # Deploy with Capistrano
36
+ # gem 'capistrano'
37
+
38
+ # To use debugger
39
+ # gem 'ruby-debug19', :require => 'ruby-debug'
@@ -0,0 +1,132 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ active-list (4.0.0)
5
+ compass-rails (>= 1)
6
+ fastercsv (>= 1.5)
7
+ i18n-complements
8
+ rails (>= 3.1)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ actionmailer (3.2.3)
14
+ actionpack (= 3.2.3)
15
+ mail (~> 2.4.4)
16
+ actionpack (3.2.3)
17
+ activemodel (= 3.2.3)
18
+ activesupport (= 3.2.3)
19
+ builder (~> 3.0.0)
20
+ erubis (~> 2.7.0)
21
+ journey (~> 1.0.1)
22
+ rack (~> 1.4.0)
23
+ rack-cache (~> 1.2)
24
+ rack-test (~> 0.6.1)
25
+ sprockets (~> 2.1.2)
26
+ activemodel (3.2.3)
27
+ activesupport (= 3.2.3)
28
+ builder (~> 3.0.0)
29
+ activerecord (3.2.3)
30
+ activemodel (= 3.2.3)
31
+ activesupport (= 3.2.3)
32
+ arel (~> 3.0.2)
33
+ tzinfo (~> 0.3.29)
34
+ activeresource (3.2.3)
35
+ activemodel (= 3.2.3)
36
+ activesupport (= 3.2.3)
37
+ activesupport (3.2.3)
38
+ i18n (~> 0.6)
39
+ multi_json (~> 1.0)
40
+ arel (3.0.2)
41
+ builder (3.0.0)
42
+ chunky_png (1.2.5)
43
+ coffee-rails (3.2.2)
44
+ coffee-script (>= 2.2.0)
45
+ railties (~> 3.2.0)
46
+ coffee-script (2.2.0)
47
+ coffee-script-source
48
+ execjs
49
+ coffee-script-source (1.3.1)
50
+ compass (0.12.1)
51
+ chunky_png (~> 1.2)
52
+ fssm (>= 0.2.7)
53
+ sass (~> 3.1)
54
+ compass-rails (1.0.1)
55
+ compass (~> 0.12.0)
56
+ erubis (2.7.0)
57
+ execjs (1.3.2)
58
+ multi_json (~> 1.0)
59
+ fastercsv (1.5.4)
60
+ fssm (0.2.9)
61
+ hike (1.2.1)
62
+ i18n (0.6.0)
63
+ i18n-complements (0.0.1)
64
+ i18n (>= 0.6)
65
+ journey (1.0.3)
66
+ jquery-rails (2.0.2)
67
+ railties (>= 3.2.0, < 5.0)
68
+ thor (~> 0.14)
69
+ json (1.7.1)
70
+ mail (2.4.4)
71
+ i18n (>= 0.4.0)
72
+ mime-types (~> 1.16)
73
+ treetop (~> 1.4.8)
74
+ mime-types (1.18)
75
+ multi_json (1.3.4)
76
+ polyglot (0.3.3)
77
+ rack (1.4.1)
78
+ rack-cache (1.2)
79
+ rack (>= 0.4)
80
+ rack-ssl (1.3.2)
81
+ rack
82
+ rack-test (0.6.1)
83
+ rack (>= 1.0)
84
+ rails (3.2.3)
85
+ actionmailer (= 3.2.3)
86
+ actionpack (= 3.2.3)
87
+ activerecord (= 3.2.3)
88
+ activeresource (= 3.2.3)
89
+ activesupport (= 3.2.3)
90
+ bundler (~> 1.0)
91
+ railties (= 3.2.3)
92
+ railties (3.2.3)
93
+ actionpack (= 3.2.3)
94
+ activesupport (= 3.2.3)
95
+ rack-ssl (~> 1.3.2)
96
+ rake (>= 0.8.7)
97
+ rdoc (~> 3.4)
98
+ thor (~> 0.14.6)
99
+ rake (0.9.2.2)
100
+ rdoc (3.12)
101
+ json (~> 1.4)
102
+ sass (3.1.17)
103
+ sass-rails (3.2.5)
104
+ railties (~> 3.2.0)
105
+ sass (>= 3.1.10)
106
+ tilt (~> 1.3)
107
+ sprockets (2.1.3)
108
+ hike (~> 1.2)
109
+ rack (~> 1.0)
110
+ tilt (~> 1.1, != 1.3.0)
111
+ sqlite3 (1.3.6)
112
+ thor (0.14.6)
113
+ tilt (1.3.3)
114
+ treetop (1.4.10)
115
+ polyglot
116
+ polyglot (>= 0.3.1)
117
+ tzinfo (0.3.33)
118
+ uglifier (1.2.4)
119
+ execjs (>= 0.3.0)
120
+ multi_json (>= 1.0.2)
121
+
122
+ PLATFORMS
123
+ ruby
124
+
125
+ DEPENDENCIES
126
+ active-list!
127
+ coffee-rails (~> 3.2.1)
128
+ jquery-rails
129
+ rails (= 3.2.3)
130
+ sass-rails (~> 3.2.3)
131
+ sqlite3
132
+ uglifier (>= 1.0.3)
@@ -0,0 +1,7 @@
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
+ Dummy::Application.load_tasks
@@ -0,0 +1,16 @@
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 active_list.jquery
16
+ //= require jquery_ujs
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,14 @@
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 active_list
12
+ *= require_self
13
+ *= require_tree .
14
+ */
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the contacts controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the people controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,56 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px; }
7
+
8
+ p, ol, ul, td {
9
+ font-family: verdana, arial, helvetica, sans-serif;
10
+ font-size: 13px;
11
+ line-height: 18px; }
12
+
13
+ pre {
14
+ background-color: #eee;
15
+ padding: 10px;
16
+ font-size: 11px; }
17
+
18
+ a {
19
+ color: #000;
20
+ &:visited {
21
+ color: #666; }
22
+ &:hover {
23
+ color: #fff;
24
+ background-color: #000; } }
25
+
26
+ div {
27
+ &.field, &.actions {
28
+ margin-bottom: 10px; } }
29
+
30
+ #notice {
31
+ color: green; }
32
+
33
+ .field_with_errors {
34
+ padding: 2px;
35
+ background-color: red;
36
+ display: table; }
37
+
38
+ #error_explanation {
39
+ width: 450px;
40
+ border: 2px solid red;
41
+ padding: 7px;
42
+ padding-bottom: 0;
43
+ margin-bottom: 20px;
44
+ background-color: #f0f0f0;
45
+ h2 {
46
+ text-align: left;
47
+ font-weight: bold;
48
+ padding: 5px 5px 5px 15px;
49
+ font-size: 12px;
50
+ margin: -7px;
51
+ margin-bottom: 0px;
52
+ background-color: #c00;
53
+ color: #fff; }
54
+ ul li {
55
+ font-size: 12px;
56
+ list-style: square; } }
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end