rails_db 1.6.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -2
  3. data/Gemfile.lock +133 -101
  4. data/app/controllers/rails_db/application_controller.rb +1 -5
  5. data/app/controllers/rails_db/sql_controller.rb +1 -5
  6. data/app/controllers/rails_db/tables_controller.rb +2 -10
  7. data/app/helpers/rails_db/tables_helper.rb +8 -3
  8. data/app/views/layouts/rails_db/application.html.erb +1 -1
  9. data/app/views/rails_db/dashboard/data_table.html.erb +1 -1
  10. data/app/views/rails_db/tables/_data.html.erb +1 -1
  11. data/app/views/rails_db/tables/_search.html.erb +1 -1
  12. data/app/views/rails_db/tables/_show.html.erb +7 -11
  13. data/lib/ext/ransack_ext.rb +0 -0
  14. data/lib/rails_db/table.rb +1 -8
  15. data/lib/rails_db/version.rb +1 -1
  16. data/rails_db.gemspec +2 -6
  17. data/test/dashboard_controller_test.rb +6 -6
  18. data/test/database_test.rb +0 -3
  19. data/test/dummy/config/application.rb +4 -1
  20. data/test/dummy/config/environments/development.rb +10 -0
  21. data/test/dummy/config/environments/production.rb +9 -1
  22. data/test/dummy/config/environments/test.rb +9 -1
  23. data/test/dummy/config/initializers/mime_types.rb +3 -0
  24. data/test/dummy/db/migrate/20151013203739_create_users.rb +7 -1
  25. data/test/dummy/db/migrate/20151013203757_create_comments.rb +1 -1
  26. data/test/dummy/db/migrate/20151013204027_populate_data.rb +1 -1
  27. data/test/dummy/db/migrate/20151014074454_create_accounts.rb +1 -1
  28. data/test/dummy/db/migrate/20151014074655_create_contacts.rb +1 -1
  29. data/test/dummy/db/migrate/20151014152932_add_bd.rb +1 -1
  30. data/test/dummy/db/migrate/20151014183823_create_projects.rb +1 -1
  31. data/test/dummy/db/migrate/20151014184243_add_long_text.rb +1 -1
  32. data/test/dummy/db/migrate/20151015145740_populate_db.rb +1 -1
  33. data/test/dummy/db/migrate/20151027192250_create_payments.rb +1 -1
  34. data/test/dummy/db/migrate/20151027223149_add_non_pk_table.rb +1 -1
  35. data/test/dummy/db/migrate/20151028191429_create_legacy_accounts.rb +1 -1
  36. data/test/dummy/db/migrate/20151121125538_add_boolean_field_to_user.rb +1 -1
  37. data/test/dummy/db/migrate/20170126124628_add_sti_model.rb +1 -1
  38. data/test/dummy/db/rails_db.sqlite3 +0 -0
  39. data/test/dummy/db/rails_db_dev.sqlite3 +0 -0
  40. data/test/dummy/db/schema.rb +72 -77
  41. data/test/rails_db_data_table_helper_test.rb +0 -4
  42. data/test/rails_db_test.rb +0 -3
  43. data/test/sql_import_test.rb +0 -4
  44. data/test/sql_query_test.rb +0 -4
  45. data/test/standalone/config/application.rb +4 -1
  46. data/test/standalone/config/environments/development.rb +10 -0
  47. data/test/standalone/config/environments/production.rb +9 -1
  48. data/test/standalone/config/environments/test.rb +9 -1
  49. data/test/standalone/config/initializers/mime_types.rb +3 -0
  50. data/test/table_test.rb +0 -1
  51. data/test/tables_helper_test.rb +0 -4
  52. data/test/test_helper.rb +1 -10
  53. metadata +7 -7
  54. data/test/standalone/config/initializers/quiet_assets.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38ee5e7a2a449a75b5dee2890bfacb34e3600a73
4
- data.tar.gz: 8cc216088bd7d1cf9b7ebff56a32fd46cebb3854
3
+ metadata.gz: d344f8033229abb378e3078dbda79b5888a56c33
4
+ data.tar.gz: e59e2ac708f3011aaada3c31e947189eb09e3d78
5
5
  SHA512:
6
- metadata.gz: fe5053a606b1f0924b48a82514eb6a21d98d69012056e3b40fe446b4ce1918dc08a4929ba63519bf6b40300da3923236e80bc445b8a4016b4efeb05e5226dfcd
7
- data.tar.gz: ad341d49365dec5f75ee722b7420784278a2262971a68aed655c202d73f6d12d7715c3a2663388cf7f80e875d5e913f524ed4088bd101ee2ac771d9e51f5cb37
6
+ metadata.gz: 320b1a28ac55849a4272ec7860a0ff285857ec36c1446884912fd308e915c734cb22ecb8484aa59a8f308763358eac78467bee7b39a2cf661fbd6d42cc58b163
7
+ data.tar.gz: c6b279415bea449da156068ef716dd9da118ae106663425b19813c88174c9b128f5f0ecd7d10e0434f4130127d8044ab76753ca5015670ed6cf16a8ff1860fb3
data/Gemfile CHANGED
@@ -2,13 +2,18 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'rails'
5
+ gem 'rails', '5.1.6'
6
6
  gem 'codemirror-rails'
7
7
  gem 'terminal-table'
8
8
  gem 'simple_form'
9
- gem 'ransack'
9
+ gem 'ransack', '1.8.8'
10
10
  gem 'kaminari', '>= 0.17.0'
11
11
 
12
+ # for Rails 5+
13
+ gem 'rubyzip', '>= 1.2.1'
14
+ gem 'axlsx', git: 'https://github.com/randym/axlsx.git', ref: 'c8ac844'
15
+ gem 'axlsx_rails'
16
+
12
17
  group :assets do
13
18
  gem 'uglifier'
14
19
  end
@@ -1,10 +1,21 @@
1
+ GIT
2
+ remote: https://github.com/randym/axlsx.git
3
+ revision: c8ac844572b25fda358cc01d2104720c4c42f450
4
+ ref: c8ac844
5
+ specs:
6
+ axlsx (2.1.0.pre)
7
+ htmlentities (~> 4.3.4)
8
+ mimemagic (~> 0.3)
9
+ nokogiri (>= 1.6.6)
10
+ rubyzip (>= 1.2.1)
11
+
1
12
  PATH
2
13
  remote: .
3
14
  specs:
4
- rails_db (1.5.0)
15
+ rails_db (2.0.0)
5
16
  codemirror-rails
6
17
  kaminari
7
- rails (>= 3.1.0)
18
+ rails (>= 5.0.0)
8
19
  ransack
9
20
  simple_form
10
21
  terminal-table
@@ -12,138 +23,158 @@ PATH
12
23
  GEM
13
24
  remote: https://rubygems.org/
14
25
  specs:
15
- actionmailer (4.2.8)
16
- actionpack (= 4.2.8)
17
- actionview (= 4.2.8)
18
- activejob (= 4.2.8)
26
+ actioncable (5.1.6)
27
+ actionpack (= 5.1.6)
28
+ nio4r (~> 2.0)
29
+ websocket-driver (~> 0.6.1)
30
+ actionmailer (5.1.6)
31
+ actionpack (= 5.1.6)
32
+ actionview (= 5.1.6)
33
+ activejob (= 5.1.6)
19
34
  mail (~> 2.5, >= 2.5.4)
20
- rails-dom-testing (~> 1.0, >= 1.0.5)
21
- actionpack (4.2.8)
22
- actionview (= 4.2.8)
23
- activesupport (= 4.2.8)
24
- rack (~> 1.6)
25
- rack-test (~> 0.6.2)
26
- rails-dom-testing (~> 1.0, >= 1.0.5)
35
+ rails-dom-testing (~> 2.0)
36
+ actionpack (5.1.6)
37
+ actionview (= 5.1.6)
38
+ activesupport (= 5.1.6)
39
+ rack (~> 2.0)
40
+ rack-test (>= 0.6.3)
41
+ rails-dom-testing (~> 2.0)
27
42
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
- actionview (4.2.8)
29
- activesupport (= 4.2.8)
43
+ actionview (5.1.6)
44
+ activesupport (= 5.1.6)
30
45
  builder (~> 3.1)
31
- erubis (~> 2.7.0)
32
- rails-dom-testing (~> 1.0, >= 1.0.5)
46
+ erubi (~> 1.4)
47
+ rails-dom-testing (~> 2.0)
33
48
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
- activejob (4.2.8)
35
- activesupport (= 4.2.8)
36
- globalid (>= 0.3.0)
37
- activemodel (4.2.8)
38
- activesupport (= 4.2.8)
39
- builder (~> 3.1)
40
- activerecord (4.2.8)
41
- activemodel (= 4.2.8)
42
- activesupport (= 4.2.8)
43
- arel (~> 6.0)
44
- activesupport (4.2.8)
45
- i18n (~> 0.7)
49
+ activejob (5.1.6)
50
+ activesupport (= 5.1.6)
51
+ globalid (>= 0.3.6)
52
+ activemodel (5.1.6)
53
+ activesupport (= 5.1.6)
54
+ activerecord (5.1.6)
55
+ activemodel (= 5.1.6)
56
+ activesupport (= 5.1.6)
57
+ arel (~> 8.0)
58
+ activesupport (5.1.6)
59
+ concurrent-ruby (~> 1.0, >= 1.0.2)
60
+ i18n (>= 0.7, < 2)
46
61
  minitest (~> 5.1)
47
- thread_safe (~> 0.3, >= 0.3.4)
48
62
  tzinfo (~> 1.1)
49
- addressable (2.4.0)
50
- arel (6.0.4)
51
- axlsx (2.0.1)
52
- htmlentities (~> 4.3.1)
53
- nokogiri (>= 1.4.1)
54
- rubyzip (~> 1.0.0)
55
- axlsx_rails (0.4.0)
63
+ addressable (2.5.2)
64
+ public_suffix (>= 2.0.2, < 4.0)
65
+ arel (8.0.0)
66
+ axlsx_rails (0.5.2)
67
+ actionpack (>= 3.1)
56
68
  axlsx (>= 2.0.1)
57
- rails (>= 3.1)
58
69
  builder (3.2.3)
59
- codemirror-rails (5.6)
60
- railties (>= 3.0, < 5)
70
+ codemirror-rails (5.16.0)
71
+ railties (>= 3.0, < 6.0)
61
72
  concurrent-ruby (1.0.5)
62
- erubis (2.7.0)
63
- execjs (2.6.0)
64
- globalid (0.4.0)
73
+ crass (1.0.4)
74
+ erubi (1.7.1)
75
+ execjs (2.7.0)
76
+ globalid (0.4.1)
65
77
  activesupport (>= 4.2.0)
66
78
  htmlentities (4.3.4)
67
- i18n (0.8.1)
68
- json (2.1.0)
69
- kaminari (0.17.0)
70
- actionpack (>= 3.0.0)
71
- activesupport (>= 3.0.0)
79
+ i18n (1.0.1)
80
+ concurrent-ruby (~> 1.0)
81
+ kaminari (1.1.1)
82
+ activesupport (>= 4.1.0)
83
+ kaminari-actionview (= 1.1.1)
84
+ kaminari-activerecord (= 1.1.1)
85
+ kaminari-core (= 1.1.1)
86
+ kaminari-actionview (1.1.1)
87
+ actionview
88
+ kaminari-core (= 1.1.1)
89
+ kaminari-activerecord (1.1.1)
90
+ activerecord
91
+ kaminari-core (= 1.1.1)
92
+ kaminari-core (1.1.1)
72
93
  launchy (2.4.3)
73
94
  addressable (~> 2.3)
74
- loofah (2.0.3)
95
+ loofah (2.2.2)
96
+ crass (~> 1.0.2)
75
97
  nokogiri (>= 1.5.9)
76
- mail (2.6.5)
77
- mime-types (>= 1.16, < 4)
98
+ mail (2.7.0)
99
+ mini_mime (>= 0.1.1)
100
+ method_source (0.9.0)
78
101
  mime-types (2.99.3)
79
- mini_portile2 (2.1.0)
80
- minitest (5.10.1)
102
+ mimemagic (0.3.2)
103
+ mini_mime (1.0.0)
104
+ mini_portile2 (2.3.0)
105
+ minitest (5.11.3)
81
106
  mysql2 (0.3.20)
82
- nokogiri (1.7.1)
83
- mini_portile2 (~> 2.1.0)
84
- pg (0.18.3)
85
- polyamorous (1.3.1)
107
+ nio4r (2.3.1)
108
+ nokogiri (1.8.2)
109
+ mini_portile2 (~> 2.3.0)
110
+ pg (1.0.0)
111
+ polyamorous (1.3.3)
86
112
  activerecord (>= 3.0)
87
- rack (1.6.5)
88
- rack-test (0.6.3)
89
- rack (>= 1.0)
90
- rails (4.2.8)
91
- actionmailer (= 4.2.8)
92
- actionpack (= 4.2.8)
93
- actionview (= 4.2.8)
94
- activejob (= 4.2.8)
95
- activemodel (= 4.2.8)
96
- activerecord (= 4.2.8)
97
- activesupport (= 4.2.8)
98
- bundler (>= 1.3.0, < 2.0)
99
- railties (= 4.2.8)
100
- sprockets-rails
101
- rails-deprecated_sanitizer (1.0.3)
102
- activesupport (>= 4.2.0.alpha)
103
- rails-dom-testing (1.0.8)
104
- activesupport (>= 4.2.0.beta, < 5.0)
105
- nokogiri (~> 1.6)
106
- rails-deprecated_sanitizer (>= 1.0.1)
107
- rails-html-sanitizer (1.0.3)
108
- loofah (~> 2.0)
109
- railties (4.2.8)
110
- actionpack (= 4.2.8)
111
- activesupport (= 4.2.8)
113
+ public_suffix (3.0.2)
114
+ rack (2.0.5)
115
+ rack-test (1.0.0)
116
+ rack (>= 1.0, < 3)
117
+ rails (5.1.6)
118
+ actioncable (= 5.1.6)
119
+ actionmailer (= 5.1.6)
120
+ actionpack (= 5.1.6)
121
+ actionview (= 5.1.6)
122
+ activejob (= 5.1.6)
123
+ activemodel (= 5.1.6)
124
+ activerecord (= 5.1.6)
125
+ activesupport (= 5.1.6)
126
+ bundler (>= 1.3.0)
127
+ railties (= 5.1.6)
128
+ sprockets-rails (>= 2.0.0)
129
+ rails-dom-testing (2.0.3)
130
+ activesupport (>= 4.2.0)
131
+ nokogiri (>= 1.6)
132
+ rails-html-sanitizer (1.0.4)
133
+ loofah (~> 2.2, >= 2.2.2)
134
+ railties (5.1.6)
135
+ actionpack (= 5.1.6)
136
+ activesupport (= 5.1.6)
137
+ method_source
112
138
  rake (>= 0.8.7)
113
139
  thor (>= 0.18.1, < 2.0)
114
- rake (12.0.0)
115
- ransack (1.8.2)
140
+ rake (12.3.1)
141
+ ransack (1.8.8)
116
142
  actionpack (>= 3.0)
117
143
  activerecord (>= 3.0)
118
144
  activesupport (>= 3.0)
119
145
  i18n
120
- polyamorous (~> 1.3)
121
- rubyzip (1.0.0)
122
- simple_form (3.2.0)
123
- actionpack (~> 4.0)
124
- activemodel (~> 4.0)
146
+ polyamorous (~> 1.3.2)
147
+ rubyzip (1.2.1)
148
+ simple_form (4.0.0)
149
+ actionpack (> 4)
150
+ activemodel (> 4)
125
151
  sprockets (3.7.1)
126
152
  concurrent-ruby (~> 1.0)
127
153
  rack (> 1, < 3)
128
- sprockets-rails (3.2.0)
154
+ sprockets-rails (3.2.1)
129
155
  actionpack (>= 4.0)
130
156
  activesupport (>= 4.0)
131
157
  sprockets (>= 3.0.0)
132
- sqlite3 (1.3.11)
133
- terminal-table (1.5.2)
134
- thor (0.19.4)
158
+ sqlite3 (1.3.13)
159
+ terminal-table (1.8.0)
160
+ unicode-display_width (~> 1.1, >= 1.1.1)
161
+ thor (0.20.0)
135
162
  thread_safe (0.3.6)
136
- tzinfo (1.2.3)
163
+ tzinfo (1.2.5)
137
164
  thread_safe (~> 0.1)
138
- uglifier (2.7.2)
139
- execjs (>= 0.3.0)
140
- json (>= 1.8.0)
141
- will_paginate (3.0.7)
165
+ uglifier (4.1.10)
166
+ execjs (>= 0.3.0, < 3)
167
+ unicode-display_width (1.3.2)
168
+ websocket-driver (0.6.5)
169
+ websocket-extensions (>= 0.1.0)
170
+ websocket-extensions (0.1.3)
171
+ will_paginate (3.0.12)
142
172
 
143
173
  PLATFORMS
144
174
  ruby
145
175
 
146
176
  DEPENDENCIES
177
+ axlsx!
147
178
  axlsx_rails
148
179
  codemirror-rails
149
180
  kaminari (>= 0.17.0)
@@ -151,9 +182,10 @@ DEPENDENCIES
151
182
  mime-types (< 3.0)
152
183
  mysql2 (<= 0.3.20)
153
184
  pg
154
- rails
185
+ rails (= 5.1.6)
155
186
  rails_db!
156
- ransack
187
+ ransack (= 1.8.8)
188
+ rubyzip (>= 1.2.1)
157
189
  simple_form
158
190
  sqlite3
159
191
  terminal-table
@@ -161,4 +193,4 @@ DEPENDENCIES
161
193
  will_paginate (~> 3.0.6)
162
194
 
163
195
  BUNDLED WITH
164
- 1.14.3
196
+ 1.16.1
@@ -3,11 +3,7 @@ module RailsDb
3
3
  helper :all
4
4
  helper_method :per_page
5
5
 
6
- if Rails::VERSION::MAJOR >= 4
7
- before_action :verify_access
8
- else
9
- before_filter :verify_access
10
- end
6
+ before_action :verify_access
11
7
 
12
8
  if RailsDb.http_basic_authentication_enabled
13
9
  http_basic_authenticate_with name: RailsDb.http_basic_authentication_user_name,
@@ -1,10 +1,6 @@
1
1
  module RailsDb
2
2
  class SqlController < RailsDb::ApplicationController
3
- if Rails::VERSION::MAJOR >= 4
4
- before_action :load_query, only: [:index, :execute, :csv, :xls]
5
- else
6
- before_filter :load_query
7
- end
3
+ before_action :load_query, only: [:index, :execute, :csv, :xls]
8
4
 
9
5
  def index
10
6
  end
@@ -2,11 +2,7 @@ module RailsDb
2
2
  class TablesController < RailsDb::ApplicationController
3
3
  LOAD_TABLE_ACTIONS = [:show, :data, :csv, :truncate, :destroy, :edit, :update, :xlsx, :search, :new, :create]
4
4
 
5
- if Rails::VERSION::MAJOR >= 4
6
- before_action :find_table, only: LOAD_TABLE_ACTIONS
7
- else
8
- before_filter :find_table, only: LOAD_TABLE_ACTIONS
9
- end
5
+ before_action :find_table, only: LOAD_TABLE_ACTIONS
10
6
 
11
7
  def index
12
8
  @tables = RailsDb::Database.accessible_tables
@@ -101,11 +97,7 @@ module RailsDb
101
97
  end
102
98
 
103
99
  def record_attributes
104
- if Rails::VERSION::MAJOR >= 4
105
- params[:record].permit!
106
- else
107
- params[:record]
108
- end
100
+ params[:record].permit!
109
101
  end
110
102
 
111
103
  def find_table
@@ -24,10 +24,11 @@ module RailsDb
24
24
  end
25
25
 
26
26
  def delete_row_path(table, record)
27
+ options = params.permit!
27
28
  table_destroy_path(table,
28
29
  pk_id: record[table.primary_key],
29
- page: params[:page],
30
- q: params[:q])
30
+ page: options[:page],
31
+ q: options[:q])
31
32
  end
32
33
 
33
34
  def table_pagination_path
@@ -48,7 +49,11 @@ module RailsDb
48
49
  end
49
50
 
50
51
  def search_form_class
51
- params[:q].present? ? '' : 'hide'
52
+ hash = params.permit!.to_hash.fetch('q', {})
53
+ keys = hash.keys
54
+ return 'hide' if keys.empty?
55
+ return 'hide' if keys == ['s']
56
+ nil
52
57
  end
53
58
 
54
59
  end
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <title><%= [yield(:title), 'Rails DB'].reject(&:blank?).join(' - ') %></title>
5
- <%= stylesheet_link_tag "//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css" %>
5
+ <%= stylesheet_link_tag "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css" %>
6
6
  <%= stylesheet_link_tag "rails_db/application", media: "all" %>
7
7
  <%= javascript_include_tag "rails_db/application" %>
8
8
  <%= csrf_meta_tags %>
@@ -16,4 +16,4 @@
16
16
 
17
17
  <br/>
18
18
 
19
- <p><%= link_to 'More Options for Data Tables ==>', 'https://github.com/igorkasyanchuk/rails_db/blob/master/app/helpers/rails_db/rails_db_data_table_helper.rb' %></p>
19
+ <p><%= link_to 'More Options for Data Tables ==>', 'https://github.com/igorkasyanchuk/rails_db/blob/master/app/helpers/rails_db/rails_db_data_table_helper.rb' %></p>
@@ -1,4 +1,4 @@
1
- <% title "'#{@table.name}'"%>
1
+ <% title "\"#{@table.name}\" Data"%>
2
2
 
3
3
  <h2 class='left'>Table: <%= @table.name %></h2>
4
4
  <div class='right'>
@@ -1,4 +1,4 @@
1
- <% title "'#{@table.name}'"%>
1
+ <% title "\"#{@table.name}\" Search"%>
2
2
 
3
3
  <h2>Table: <%= @table.name %></h2>
4
4
 
@@ -1,4 +1,4 @@
1
- <% title "'#{@table.name}' Schema" %>
1
+ <% title "\"#{@table.name}\" Schema"%>
2
2
 
3
3
  <h2>Table: <%= @table.name %></h2>
4
4
 
@@ -76,11 +76,9 @@
76
76
  <th>Columns</th>
77
77
  <th>Length</th>
78
78
  <th>Orders</th>
79
- <% if Rails::VERSION::MAJOR >= 4 %>
80
- <th>Where</th>
81
- <th>Type</th>
82
- <th>Using</th>
83
- <% end %>
79
+ <th>Where</th>
80
+ <th>Type</th>
81
+ <th>Using</th>
84
82
  </tr>
85
83
  </thead>
86
84
  <tbody>
@@ -91,11 +89,9 @@
91
89
  <td><%= index.columns %></td>
92
90
  <td><%= index.lengths %></td>
93
91
  <td><%= index.orders %></td>
94
- <% if Rails::VERSION::MAJOR >= 4 %>
95
- <td><%= index.where %></td>
96
- <td><%= index.type %></td>
97
- <td><%= index.using %></td>
98
- <% end %>
92
+ <td><%= index.where %></td>
93
+ <td><%= index.type %></td>
94
+ <td><%= index.using %></td>
99
95
  </tr>
100
96
  <% end %>
101
97
  <% if @table.indexes.none? %>