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.
- checksums.yaml +4 -4
- data/Gemfile +7 -2
- data/Gemfile.lock +133 -101
- data/app/controllers/rails_db/application_controller.rb +1 -5
- data/app/controllers/rails_db/sql_controller.rb +1 -5
- data/app/controllers/rails_db/tables_controller.rb +2 -10
- data/app/helpers/rails_db/tables_helper.rb +8 -3
- data/app/views/layouts/rails_db/application.html.erb +1 -1
- data/app/views/rails_db/dashboard/data_table.html.erb +1 -1
- data/app/views/rails_db/tables/_data.html.erb +1 -1
- data/app/views/rails_db/tables/_search.html.erb +1 -1
- data/app/views/rails_db/tables/_show.html.erb +7 -11
- data/lib/ext/ransack_ext.rb +0 -0
- data/lib/rails_db/table.rb +1 -8
- data/lib/rails_db/version.rb +1 -1
- data/rails_db.gemspec +2 -6
- data/test/dashboard_controller_test.rb +6 -6
- data/test/database_test.rb +0 -3
- data/test/dummy/config/application.rb +4 -1
- data/test/dummy/config/environments/development.rb +10 -0
- data/test/dummy/config/environments/production.rb +9 -1
- data/test/dummy/config/environments/test.rb +9 -1
- data/test/dummy/config/initializers/mime_types.rb +3 -0
- data/test/dummy/db/migrate/20151013203739_create_users.rb +7 -1
- data/test/dummy/db/migrate/20151013203757_create_comments.rb +1 -1
- data/test/dummy/db/migrate/20151013204027_populate_data.rb +1 -1
- data/test/dummy/db/migrate/20151014074454_create_accounts.rb +1 -1
- data/test/dummy/db/migrate/20151014074655_create_contacts.rb +1 -1
- data/test/dummy/db/migrate/20151014152932_add_bd.rb +1 -1
- data/test/dummy/db/migrate/20151014183823_create_projects.rb +1 -1
- data/test/dummy/db/migrate/20151014184243_add_long_text.rb +1 -1
- data/test/dummy/db/migrate/20151015145740_populate_db.rb +1 -1
- data/test/dummy/db/migrate/20151027192250_create_payments.rb +1 -1
- data/test/dummy/db/migrate/20151027223149_add_non_pk_table.rb +1 -1
- data/test/dummy/db/migrate/20151028191429_create_legacy_accounts.rb +1 -1
- data/test/dummy/db/migrate/20151121125538_add_boolean_field_to_user.rb +1 -1
- data/test/dummy/db/migrate/20170126124628_add_sti_model.rb +1 -1
- data/test/dummy/db/rails_db.sqlite3 +0 -0
- data/test/dummy/db/rails_db_dev.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +72 -77
- data/test/rails_db_data_table_helper_test.rb +0 -4
- data/test/rails_db_test.rb +0 -3
- data/test/sql_import_test.rb +0 -4
- data/test/sql_query_test.rb +0 -4
- data/test/standalone/config/application.rb +4 -1
- data/test/standalone/config/environments/development.rb +10 -0
- data/test/standalone/config/environments/production.rb +9 -1
- data/test/standalone/config/environments/test.rb +9 -1
- data/test/standalone/config/initializers/mime_types.rb +3 -0
- data/test/table_test.rb +0 -1
- data/test/tables_helper_test.rb +0 -4
- data/test/test_helper.rb +1 -10
- metadata +7 -7
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d344f8033229abb378e3078dbda79b5888a56c33
|
4
|
+
data.tar.gz: e59e2ac708f3011aaada3c31e947189eb09e3d78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/Gemfile.lock
CHANGED
@@ -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 (
|
15
|
+
rails_db (2.0.0)
|
5
16
|
codemirror-rails
|
6
17
|
kaminari
|
7
|
-
rails (>=
|
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
|
-
|
16
|
-
actionpack (=
|
17
|
-
|
18
|
-
|
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 (~>
|
21
|
-
actionpack (
|
22
|
-
actionview (=
|
23
|
-
activesupport (=
|
24
|
-
rack (~>
|
25
|
-
rack-test (
|
26
|
-
rails-dom-testing (~>
|
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 (
|
29
|
-
activesupport (=
|
43
|
+
actionview (5.1.6)
|
44
|
+
activesupport (= 5.1.6)
|
30
45
|
builder (~> 3.1)
|
31
|
-
|
32
|
-
rails-dom-testing (~>
|
46
|
+
erubi (~> 1.4)
|
47
|
+
rails-dom-testing (~> 2.0)
|
33
48
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
-
activejob (
|
35
|
-
activesupport (=
|
36
|
-
globalid (>= 0.3.
|
37
|
-
activemodel (
|
38
|
-
activesupport (=
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
i18n (
|
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.
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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.
|
60
|
-
railties (>= 3.0, <
|
70
|
+
codemirror-rails (5.16.0)
|
71
|
+
railties (>= 3.0, < 6.0)
|
61
72
|
concurrent-ruby (1.0.5)
|
62
|
-
|
63
|
-
|
64
|
-
|
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.
|
68
|
-
|
69
|
-
kaminari (
|
70
|
-
|
71
|
-
|
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.
|
95
|
+
loofah (2.2.2)
|
96
|
+
crass (~> 1.0.2)
|
75
97
|
nokogiri (>= 1.5.9)
|
76
|
-
mail (2.
|
77
|
-
|
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
|
-
|
80
|
-
|
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
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
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
|
-
|
88
|
-
rack
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
rails-dom-testing (
|
104
|
-
activesupport (>= 4.2.0
|
105
|
-
nokogiri (
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
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.
|
115
|
-
ransack (1.8.
|
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.
|
122
|
-
simple_form (
|
123
|
-
actionpack (
|
124
|
-
activemodel (
|
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.
|
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.
|
133
|
-
terminal-table (1.
|
134
|
-
|
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.
|
163
|
+
tzinfo (1.2.5)
|
137
164
|
thread_safe (~> 0.1)
|
138
|
-
uglifier (
|
139
|
-
execjs (>= 0.3.0)
|
140
|
-
|
141
|
-
|
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.
|
196
|
+
1.16.1
|
@@ -3,11 +3,7 @@ module RailsDb
|
|
3
3
|
helper :all
|
4
4
|
helper_method :per_page
|
5
5
|
|
6
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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:
|
30
|
-
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
|
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 "
|
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 "
|
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
|
-
|
80
|
-
|
81
|
-
|
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
|
-
|
95
|
-
|
96
|
-
|
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? %>
|