tiny_admin 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10d229ad7389d1fe4392d6f96ec993550470ba67d1b4e140df21b9d247ae3657
4
- data.tar.gz: 3f625daa624cdff4e7fe4f13618ac753cce120995daa9140dac17e55d79ef1ba
3
+ metadata.gz: aa8eb3987f51f28c4f9a55c62fddfd521accf075aac9be4d0b4fab7e88145770
4
+ data.tar.gz: 98e2f4af557280ca167816fa325f824d5eda99cde96d35407d472ab1e37b370d
5
5
  SHA512:
6
- metadata.gz: 7078779b3478f2e28f5864b43839a69ee918a452a97c0851b3be45a75802fd01600f2df6d771f093032e021f98c408b40fcaffac0b4ba5fca61e5e92693bfe86
7
- data.tar.gz: c120746d7363cbda9dd39f9de6910181645da4d63bf8325c0e4d8619b2892b008c882a32e4e8b50f63ec9fc6486837843e920f4e4c917424390346fb5af67877
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
- The main features are:
8
- - a Rack app that can be mounted in any Rack-enabled framework, it can even work standalone;
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, which is small and performant;
11
- - views are Phlex components, so plain Ruby objects for views and no assets are needed.
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.1'`
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
- - Configure the dashboard using `TinyAdmin.configure` and/or `TinyAdmin.configure_from_file` (see [configuration](#configuration) below)
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) + 1
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!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TinyAdmin
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
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.0
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-10 00:00:00.000000000 Z
11
+ date: 2023-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phlex