solid_litequeen 0.2.0 → 0.3.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3f132c6c4e18960f12438f05fdf54e948a4070e2ecf5091a4f7c7c62cbe44f1
4
- data.tar.gz: 5c89920649215ddd684425458de125ba9e33a0c840ae23d7bd6b249cc952ba8b
3
+ metadata.gz: cb48a82364fe67c2dcc78b33801516c60214494c6712edf938f461c1c930e2a1
4
+ data.tar.gz: 7c2d8bf503637adf820837f47d03a6144ba071a8a19802fc20befd57c5c9e70d
5
5
  SHA512:
6
- metadata.gz: ff1073234828dce4b242d52ec7c5701379267e4d9ae1a3745c13945c070a222f8a6ff427318071f611675d3ea1639941071aaa693070ac9b808d1a96a87b3cf6
7
- data.tar.gz: fcb094570ed7b10dfe4dc7a79a9abd22c53805698966fd300115903929eb96a0e5e9adc54281c38baa188c96611231a2a4ff572c6d95890ed35cece436e7e7b2
6
+ metadata.gz: f11dc97ed41282856c2abe8a62e616e0e93702db170ef812ce174412ec21f715779b1974a541cc7c4d9caa1ff37f985d06639ea9a8399396339423a72ea1b7b6
7
+ data.tar.gz: 4209767503b6dd23ae3c10d7f6943ad3db6ab6c1807f5e2f300769af59744d69983cf7367cb0d79e35a2a4b1d518eba1a210ad045db6950ed9acca0cb53b9a40
data/README.md CHANGED
@@ -21,6 +21,20 @@ Or install it yourself as:
21
21
  $ gem install solid_litequeen
22
22
  ```
23
23
 
24
+ After we need to mount in `routes.rb`:
25
+ ```ruby
26
+ mount SolidLitequeen::Engine => "/solid_litequeen"
27
+ ```
28
+
29
+ You can now navigate to `/solid_litequeen` to access the application
30
+
31
+
32
+
33
+ ## Authentication
34
+
35
+ The application inherits from your `ApplicationController` and with it the authentication system you have in your application.
36
+
37
+
24
38
  ## Contributing
25
39
  Contribution directions go here.
26
40
 
@@ -11,12 +11,12 @@ module SolidLitequeen
11
11
  end
12
12
 
13
13
  def show
14
- db_id = params.expect(:id)
15
- database_location = Base64.urlsafe_decode64(db_id)
14
+ @database_id = params.expect(:id)
15
+ @database_location = Base64.urlsafe_decode64(@database_id)
16
16
 
17
17
  DynamicDatabase.establish_connection(
18
18
  adapter: "sqlite3",
19
- database: database_location
19
+ database: @database_location
20
20
  )
21
21
 
22
22
  tables = DynamicDatabase.connection.tables
@@ -27,5 +27,19 @@ module SolidLitequeen
27
27
  { name: table, row_count: row_count }
28
28
  end
29
29
  end
30
+
31
+ def table_rows
32
+ database_id = params.expect(:database_id)
33
+ @table_name = params.expect(:table)
34
+
35
+ @database_location = Base64.urlsafe_decode64(database_id)
36
+
37
+ DynamicDatabase.establish_connection(
38
+ adapter: "sqlite3",
39
+ database: @database_location
40
+ )
41
+
42
+ @data = DynamicDatabase.connection.select_all("SELECT * FROM #{@table_name} LIMIT 100")
43
+ end
30
44
  end
31
45
  end
@@ -1,6 +1,5 @@
1
1
  <div>
2
2
 
3
- <%= console %>
4
3
  <h1>Solid Lite Queen</h1>
5
4
 
6
5
 
@@ -1,12 +1,16 @@
1
- <%= console %>
1
+
2
2
  <div>
3
- hello <%= params[:id] %>
3
+ hello <%= @database_location %>
4
4
 
5
5
 
6
6
  <p>Tables</p>
7
7
  <ul>
8
8
  <% @tables.each do |table| %>
9
- <li><%= table.dig(:name) %> - <%= pluralize(table.dig(:row_count), "Row") %></li>
9
+ <li>
10
+ <%= link_to database_table_rows_path(@database_id, table[:name]) do %>
11
+ <%= table.dig(:name) %> - <%= pluralize(table.dig(:row_count), "Row") %>
12
+ <% end %>
13
+ </li>
10
14
  <% end %>
11
15
  </ul>
12
16
 
@@ -0,0 +1,23 @@
1
+
2
+ <div>
3
+ <h1><%= @database_location %> - <%= @table_name %></h1>
4
+
5
+ <table>
6
+ <thead>
7
+ <tr>
8
+ <% @data.columns.each do |column| %>
9
+ <th><%= column %></th>
10
+ <% end %>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <% @data.rows.each do |row| %>
15
+ <tr>
16
+ <% row.each do |item| %>
17
+ <td><%= item %></td>
18
+ <% end %>
19
+ </tr>
20
+ <% end %>
21
+ </tbody>
22
+ </table>
23
+ </div>
data/config/routes.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  SolidLitequeen::Engine.routes.draw do
2
- resources :databases, only: [ :index, :show ]
2
+ resources :databases, only: [ :index, :show ] do
3
+ get ":table", to: "databases#table_rows", as: :table_rows
4
+ end
3
5
  root to: "databases#index"
4
6
  end
@@ -1,3 +1,3 @@
1
1
  module SolidLitequeen
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_litequeen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vik Borges
@@ -60,6 +60,7 @@ files:
60
60
  - app/views/layouts/solid_litequeen/application.html.erb
61
61
  - app/views/solid_litequeen/databases/index.html.erb
62
62
  - app/views/solid_litequeen/databases/show.html.erb
63
+ - app/views/solid_litequeen/databases/table_rows.html.erb
63
64
  - config/routes.rb
64
65
  - lib/solid_litequeen.rb
65
66
  - lib/solid_litequeen/engine.rb