tiny_admin 0.2.0 → 0.2.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 +4 -4
- data/README.md +16 -6
- data/lib/tiny_admin/actions/index.rb +1 -1
- data/lib/tiny_admin/plugins/simple_auth.rb +1 -1
- data/lib/tiny_admin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa8eb3987f51f28c4f9a55c62fddfd521accf075aac9be4d0b4fab7e88145770
|
4
|
+
data.tar.gz: 98e2f4af557280ca167816fa325f824d5eda99cde96d35407d472ab1e37b370d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 501e766d535a08b80597c7e5e9c5c40c075a74d1ddf347ad6d0858600c37fb945e39616a7d3b62d91a9486484a6a7d5edbd59fdfaca7e373fa099ecb8092edef
|
7
|
+
data.tar.gz: cfd95059d66a9f5d83b60086b5b59d01840fc654e929546778d02457605d6bca1b22cf3f587a92db93575464281ef0f1cd7993a2082bd234ef91c124e84b5ad7
|
data/README.md
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
|
5
5
|
A compact and composable dashboard component for Ruby.
|
6
6
|
|
7
|
-
|
8
|
-
- a Rack app that can be mounted in any Rack-enabled framework
|
7
|
+
Main features:
|
8
|
+
- a Rack app that can be mounted in any Rack-enabled framework or used standalone;
|
9
9
|
- structured with plugins also for main components that can be replaced with little effort;
|
10
|
-
- routing is provided by Roda
|
11
|
-
- views are Phlex components, so plain Ruby objects for views
|
10
|
+
- routing is provided by Roda which is small and performant;
|
11
|
+
- views are Phlex components, so plain Ruby objects for views, no assets are needed.
|
12
12
|
|
13
13
|
Please ⭐ if you like it.
|
14
14
|
|
@@ -16,9 +16,19 @@ Please ⭐ if you like it.
|
|
16
16
|
|
17
17
|
## Install
|
18
18
|
|
19
|
-
- Add to your Gemfile: `gem 'tiny_admin', '~> 0.
|
19
|
+
- Add to your Gemfile: `gem 'tiny_admin', '~> 0.2'`
|
20
20
|
- Mount the app in a route (check some examples with: Hanami, Rails, Roda and standalone in [extra](extra))
|
21
|
-
|
21
|
+
+ in Rails, update _config/routes.rb_: `mount TinyAdmin::Router => '/admin'`
|
22
|
+
- Configure the dashboard using `TinyAdmin.configure` and/or `TinyAdmin.configure_from_file` (see [configuration](#configuration) below):
|
23
|
+
|
24
|
+
```rb
|
25
|
+
TinyAdmin.configure do |settings|
|
26
|
+
settings.root = {
|
27
|
+
title: 'Home',
|
28
|
+
page: Admin::PageRoot
|
29
|
+
}
|
30
|
+
end
|
31
|
+
```
|
22
32
|
|
23
33
|
## Plugins and components
|
24
34
|
|
@@ -12,7 +12,7 @@ module TinyAdmin
|
|
12
12
|
records, total_count = repository.list(page: current_page, limit: pagination, filters: filters, sort: sort)
|
13
13
|
prepare_record = ->(record) { repository.index_record_attrs(record, fields: fields_options) }
|
14
14
|
title = repository.index_title
|
15
|
-
pages = (total_count / pagination)
|
15
|
+
pages = (total_count / pagination.to_f).ceil
|
16
16
|
|
17
17
|
prepare_page(Views::Actions::Index, context: context) do |page|
|
18
18
|
page.setup_pagination(current_page: current_page, pages: pages > 1 ? pages : false)
|
@@ -8,7 +8,7 @@ module TinyAdmin
|
|
8
8
|
class << self
|
9
9
|
def configure(app, opts = {})
|
10
10
|
@@opts = opts || {} # rubocop:disable Style/ClassVars
|
11
|
-
@@opts[:password] ||= ENV.fetch('ADMIN_PASSWORD_HASH') # NOTE: fallback value
|
11
|
+
@@opts[:password] ||= ENV.fetch('ADMIN_PASSWORD_HASH', nil) # NOTE: fallback value
|
12
12
|
|
13
13
|
Warden::Strategies.add(:secret) do
|
14
14
|
def authenticate!
|
data/lib/tiny_admin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiny_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattia Roccoberton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: phlex
|