kadmin 0.2.3 → 0.2.6

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
  SHA1:
3
- metadata.gz: b93f665bacdbc2c0a768cfda4c575cc8fd22e285
4
- data.tar.gz: 2cae0cf0381bfc451dff4f32101da5571a36493d
3
+ metadata.gz: a39b7907819cab2d4460a0adacda8c2d436a4e8c
4
+ data.tar.gz: 0364eda91f770f22ae8d11ceb789e728b44e1242
5
5
  SHA512:
6
- metadata.gz: d7bc685b2ae780f63ed879dbff8e13c1796c7995bfdacce8fe7ebcdc59daa55627b595d258a878692f4fc93a6909cc2288d58277752c29431ca9745f077b304a
7
- data.tar.gz: 561fe7ece08f9fd708d446bff09a8227041d87e8baa2b779f69d1493dbb397ca3f3f987155b889b78fd4c5a3f4d20d17f763bd20f8b0ffc8f78b44567d680808
6
+ metadata.gz: c356d2258ff6225309275b4335774ef742f815e866462c41feed77e7ad297f7fb57c663b3d2df626db0f6b3d4b21a30139b1d1a6a0fc22909e330f4b22913382
7
+ data.tar.gz: 7919d7485bb1bc24b256b6ddabe4a4daae62bc127bc7a9221685e5c5d2da52b0b2a414b1af09ad4c730387b3b7d57b3245217b0006acd59dc476512b173bbb32
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Kadmin
2
2
 
3
- [![GitHub release](https://img.shields.io/badge/release-0.2.3-blue.png)](https://github.com/barcoo/kadmin/releases/tag/0.2.3)
3
+ [![GitHub release](https://img.shields.io/badge/release-0.2.6-blue.png)](https://github.com/barcoo/kadmin/releases/tag/0.2.6)
4
4
 
5
5
  Collection of utility, configuration, etc., for admin areas in different projects.
6
6
 
@@ -9,15 +9,18 @@ module Kadmin
9
9
  @finder = finder
10
10
  end
11
11
 
12
+ # @return [Boolean] true if no results, false otherwise
13
+ def empty?
14
+ return finder.results.count.zero?
15
+ end
16
+
17
+ # @return [String] how many resources are being displayed (along with indices)
12
18
  def currently_showing
13
19
  resource = resource_name.downcase
14
- currently_showing_phrase = if finder.results.count.positive?
15
- phrase = "#{pager.displayed_items} #{resource}"
16
- phrase = "#{phrase} (#{pager.page_start} - #{pager.page_end})" if finder.results.count > 1
17
- phrase
18
- else
19
- "no #{resource}"
20
- end
20
+ displayed = empty? ? 0 : pager.displayed_items
21
+
22
+ currently_showing_phrase = "#{displayed} #{resource}"
23
+ currently_showing_phrase = "#{currently_showing_phrase} (#{pager.page_start} - #{pager.page_end})" if finder.results.count > 1
21
24
 
22
25
  return currently_showing_phrase
23
26
  end
@@ -1,10 +1,10 @@
1
1
  <%= form_tag(request.path, method: 'get', class: 'form-inline') do %>
2
2
  <div class='form-group'>
3
- <%= link_to('Create', url_for(action: :new), class: 'btn btn-primary') %>
3
+ <%= link_to(t('kadmin.components.finder.create'), url_for(action: :new), class: 'btn btn-primary') %>
4
4
  <% finder.filters.each do |name, filter| %>
5
5
  <%= text_field_tag("filter_#{name}", filter&.value, class: 'form-control', placeholder: "Filter by #{name}...") %>
6
6
  <% end %>
7
- <%= submit_tag('Filter', class: 'btn btn-default form-control') %>
8
- <%= link_to('Clear', request.path, class: 'btn btn-danger form-control') %>
7
+ <%= submit_tag(t('kadmin.components.finder.filter'), class: 'btn btn-default form-control') %>
8
+ <%= link_to(t('kadmin.components.finder.clear'), request.path, class: 'btn btn-danger form-control') %>
9
9
  </div>
10
10
  <% end %>
@@ -1,8 +1,11 @@
1
1
  <div class="page-header">
2
2
  <h2>
3
- Showing <%= finder.currently_showing %>
4
- <% if finder.results.count.positive? %>
5
- <small>out of <%= finder.pager.total %> <%= finder.applied_filters %></small>
3
+ <%= finder.currently_showing %>
4
+ <% unless finder.empty? %>
5
+ <small>
6
+ <%= t('kadmin.components.finder.out_of', total: finder.pager.total) %>
7
+ <%= finder.applied_filters %>
8
+ </small>
6
9
  <% end %>
7
10
  </h2>
8
11
  </div>
@@ -8,7 +8,11 @@ de:
8
8
  unauthorized_message: Sie haben für die gewünschte Seite leider keine Zugriffsrechte; falls Sie haben sollten, bitte das Apps & Services Team kontaktieren
9
9
  components:
10
10
  finder:
11
+ clear: Löschen
12
+ create: Anlegen
11
13
  empty: Nichts zu zeigen
14
+ filter: Suchen
15
+ out_of: von %{total}
12
16
  dash_message: Schaue Dir mal die Bereiche in der Navigationsleiste oben. Wenn es irgenwelche Probleme gibt, oder es fehlt Dir Zugriffsrechte, bitte das Apps & Services Team kontaktieren.
13
17
  error: Fehler
14
18
  errors:
@@ -8,7 +8,11 @@ en:
8
8
  unauthorized_message: You are not authorized to access this resource; if you think you should be, contact the Apps & Services team
9
9
  components:
10
10
  finder:
11
+ clear: Clear
12
+ create: Create
11
13
  empty: Nothing to show
14
+ filter: Filter
15
+ out_of: out of %{total}
12
16
  dash_message: See the top navigation bar for the different admin sections. If you are missing authorizations, or if there is any issue at all, contact the Apps & Services team!
13
17
  error: Error
14
18
  errors:
@@ -1,3 +1,3 @@
1
1
  module Kadmin
2
- VERSION = '0.2.3'.freeze
2
+ VERSION = '0.2.6'.freeze
3
3
  end
@@ -1,26 +1,20 @@
1
1
  module Dummy
2
2
  class User < Kadmin::Auth::User
3
- def initialize(email, resources: [])
4
- super(email)
5
- @resources = resources
6
- end
7
-
8
3
  def authorized?(_request)
9
4
  return true
10
5
  end
11
6
  end
12
7
 
13
8
  class UserStore < Kadmin::Auth::UserStore
14
- def initialize
15
- super
16
-
17
- set('admin@test.com', Dummy::User.new('admin@test.com', resources: [:posts]))
9
+ def get(email)
10
+ set(email, Dummy::User.new(email)) unless exists?(email)
11
+ return @store[email.downcase]
18
12
  end
19
13
  end
20
14
  end
21
15
 
22
16
  Kadmin.config.logger = Rails.logger
23
- Kadmin.config.mount_path = '/kadmin'
17
+ Kadmin.config.mount_path = '/admin'
24
18
 
25
19
  Kadmin::Auth.config.user_class = Dummy::User
26
20
  Kadmin::Auth.config.user_store_class = Dummy::UserStore
@@ -22637,3 +22637,113 @@ Processing by Admin::PeopleController#edit as HTML
22637
22637
  Rendered admin/people/edit.html.erb within layouts/kadmin/application (33.6ms)
22638
22638
  Rendered /Users/npepinpe/work/github/barcoo/kadmin/app/views/kadmin/helpers/_alerts.html.erb (0.1ms)
22639
22639
  Completed 200 OK in 90ms (Views: 59.9ms | ActiveRecord: 0.4ms)
22640
+
22641
+
22642
+ Started GET "/admin/people/" for 127.0.0.1 at 2016-10-11 11:21:56 +0200
22643
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
22644
+ Processing by Admin::PeopleController#index as HTML
22645
+ Redirected to http://0.0.0.0:3000/kadmin/auth/login?origin=%2Fadmin%2Fpeople
22646
+ Filter chain halted as :authorize rendered or redirected
22647
+ Completed 302 Found in 24ms (ActiveRecord: 0.0ms)
22648
+
22649
+
22650
+ Started GET "/kadmin/auth/login?origin=%2Fadmin%2Fpeople" for 127.0.0.1 at 2016-10-11 11:21:57 +0200
22651
+ Processing by Kadmin::AuthController#login as HTML
22652
+ Parameters: {"origin"=>"/admin/people"}
22653
+ Rendered /Users/npepinpe/work/github/barcoo/kadmin/app/views/kadmin/auth/login.html.erb within layouts/kadmin/application (7.1ms)
22654
+ Rendered /Users/npepinpe/work/github/barcoo/kadmin/app/views/kadmin/helpers/_alerts.html.erb (0.6ms)
22655
+ Completed 200 OK in 227ms (Views: 227.1ms | ActiveRecord: 0.0ms)
22656
+
22657
+
22658
+ Started GET "/kadmin/auth/developer?origin=%2Fadmin%2Fpeople" for 127.0.0.1 at 2016-10-11 11:21:58 +0200
22659
+ (developer) Request phase initiated.
22660
+
22661
+
22662
+ Started POST "/kadmin/auth/developer/callback" for 127.0.0.1 at 2016-10-11 11:22:01 +0200
22663
+ (developer) Callback phase initiated.
22664
+ Processing by Kadmin::AuthController#save as HTML
22665
+ Parameters: {"email"=>"nicolas.pepin-perreault@offerista.com", "provider"=>"developer"}
22666
+ Redirected to http://0.0.0.0:3000/kadmin/auth/login
22667
+ Completed 302 Found in 1ms (ActiveRecord: 0.0ms)
22668
+
22669
+
22670
+ Started GET "/kadmin/auth/login" for 127.0.0.1 at 2016-10-11 11:22:01 +0200
22671
+ Processing by Kadmin::AuthController#login as HTML
22672
+ Rendered /Users/npepinpe/work/github/barcoo/kadmin/app/views/kadmin/auth/login.html.erb within layouts/kadmin/application (0.5ms)
22673
+ Rendered /Users/npepinpe/work/github/barcoo/kadmin/app/views/kadmin/helpers/_alerts.html.erb (0.3ms)
22674
+ Completed 200 OK in 19ms (Views: 19.3ms | ActiveRecord: 0.0ms)
22675
+
22676
+
22677
+ Started GET "/kadmin/auth/developer" for 127.0.0.1 at 2016-10-11 11:22:02 +0200
22678
+ (developer) Request phase initiated.
22679
+
22680
+
22681
+ Started POST "/kadmin/auth/developer/callback" for 127.0.0.1 at 2016-10-11 11:22:05 +0200
22682
+ (developer) Callback phase initiated.
22683
+ Processing by Kadmin::AuthController#save as HTML
22684
+ Parameters: {"email"=>"admin@test.com", "provider"=>"developer"}
22685
+ Redirected to http://0.0.0.0:3000/kadmin
22686
+ Completed 302 Found in 0ms (ActiveRecord: 0.0ms)
22687
+
22688
+
22689
+ Started GET "/kadmin" for 127.0.0.1 at 2016-10-11 11:22:05 +0200
22690
+ Processing by Kadmin::DashController#index as HTML
22691
+ Rendered /Users/npepinpe/work/github/barcoo/kadmin/app/views/kadmin/dash/index.html.erb within layouts/kadmin/application (1.1ms)
22692
+ Rendered /Users/npepinpe/work/github/barcoo/kadmin/app/views/kadmin/helpers/_alerts.html.erb (0.1ms)
22693
+ Completed 200 OK in 32ms (Views: 31.2ms | ActiveRecord: 0.0ms)
22694
+
22695
+
22696
+ Started GET "/admin/test" for 127.0.0.1 at 2016-10-11 11:22:07 +0200
22697
+
22698
+ ActionController::RoutingError (No route matches [GET] "/admin/test"):
22699
+ actionpack (4.2.7.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
22700
+ actionpack (4.2.7.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
22701
+ railties (4.2.7.1) lib/rails/rack/logger.rb:38:in `call_app'
22702
+ railties (4.2.7.1) lib/rails/rack/logger.rb:20:in `block in call'
22703
+ activesupport (4.2.7.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
22704
+ activesupport (4.2.7.1) lib/active_support/tagged_logging.rb:26:in `tagged'
22705
+ activesupport (4.2.7.1) lib/active_support/tagged_logging.rb:68:in `tagged'
22706
+ railties (4.2.7.1) lib/rails/rack/logger.rb:20:in `call'
22707
+ quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets'
22708
+ actionpack (4.2.7.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
22709
+ rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
22710
+ rack (1.6.4) lib/rack/runtime.rb:18:in `call'
22711
+ activesupport (4.2.7.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
22712
+ rack (1.6.4) lib/rack/lock.rb:17:in `call'
22713
+ actionpack (4.2.7.1) lib/action_dispatch/middleware/static.rb:120:in `call'
22714
+ rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
22715
+ railties (4.2.7.1) lib/rails/engine.rb:518:in `call'
22716
+ railties (4.2.7.1) lib/rails/application.rb:165:in `call'
22717
+ rack (1.6.4) lib/rack/content_length.rb:15:in `call'
22718
+ puma (3.6.0) lib/puma/configuration.rb:225:in `call'
22719
+ puma (3.6.0) lib/puma/server.rb:578:in `handle_request'
22720
+ puma (3.6.0) lib/puma/server.rb:415:in `process_client'
22721
+ puma (3.6.0) lib/puma/server.rb:275:in `block in run'
22722
+ puma (3.6.0) lib/puma/thread_pool.rb:116:in `block in spawn_thread'
22723
+
22724
+
22725
+ Rendered /Users/npepinpe/.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.0ms)
22726
+ Rendered /Users/npepinpe/.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/templates/routes/_route.html.erb (1.3ms)
22727
+ Rendered /Users/npepinpe/.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/templates/routes/_route.html.erb (0.3ms)
22728
+ Rendered /Users/npepinpe/.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/templates/routes/_table.html.erb (16.1ms)
22729
+ Rendered /Users/npepinpe/.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (18.5ms)
22730
+ Rendered /Users/npepinpe/.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (88.2ms)
22731
+
22732
+
22733
+ Started GET "/admin/people" for 127.0.0.1 at 2016-10-11 11:22:13 +0200
22734
+ Processing by Admin::PeopleController#index as HTML
22735
+  (0.1ms) SELECT COUNT(*) FROM "people"
22736
+  (0.2ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "people" LIMIT 15 OFFSET 0) subquery_for_count
22737
+ CACHE (0.0ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "people" LIMIT 15 OFFSET 0) subquery_for_count
22738
+ CACHE (0.0ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "people" LIMIT 15 OFFSET 0) subquery_for_count
22739
+ Rendered /Users/npepinpe/work/github/barcoo/kadmin/app/views/kadmin/components/finder/_header.html.erb (7.5ms)
22740
+ Rendered /Users/npepinpe/work/github/barcoo/kadmin/app/views/kadmin/components/finder/_form.erb (1.5ms)
22741
+ CACHE (0.0ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "people" LIMIT 15 OFFSET 0) subquery_for_count
22742
+ Person Load (0.2ms) SELECT "people".* FROM "people" ORDER BY "people"."created_at" DESC LIMIT 15 OFFSET 0
22743
+ GroupPerson Load (0.1ms) SELECT "group_people".* FROM "group_people" WHERE "group_people"."person_id" IN (2, 1)
22744
+ Group Load (0.2ms) SELECT "groups".* FROM "groups" WHERE "groups"."owner_id" IN (2, 1)
22745
+ Rendered admin/people/_table.html.erb (63.8ms)
22746
+ Rendered /Users/npepinpe/work/github/barcoo/kadmin/app/views/kadmin/components/_finder.html.erb (104.5ms)
22747
+ Rendered admin/people/index.html.erb within layouts/kadmin/application (106.3ms)
22748
+ Rendered /Users/npepinpe/work/github/barcoo/kadmin/app/views/kadmin/helpers/_alerts.html.erb (0.1ms)
22749
+ Completed 200 OK in 149ms (Views: 137.1ms | ActiveRecord: 1.3ms)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Pepin-Perreault
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-10-10 00:00:00.000000000 Z
13
+ date: 2016-10-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -193,8 +193,8 @@ files:
193
193
  - test/dummy/config/initializers/cookies_serializer.rb
194
194
  - test/dummy/config/initializers/filter_parameter_logging.rb
195
195
  - test/dummy/config/initializers/inflections.rb
196
+ - test/dummy/config/initializers/kadmin.rb
196
197
  - test/dummy/config/initializers/mime_types.rb
197
- - test/dummy/config/initializers/rails_admin.rb
198
198
  - test/dummy/config/initializers/session_store.rb
199
199
  - test/dummy/config/initializers/wrap_parameters.rb
200
200
  - test/dummy/config/locales/en.yml
@@ -631,7 +631,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
631
631
  version: '0'
632
632
  requirements: []
633
633
  rubyforge_project:
634
- rubygems_version: 2.6.6
634
+ rubygems_version: 2.6.7
635
635
  signing_key:
636
636
  specification_version: 4
637
637
  summary: Collection of utility, configuration, etc., for admin areas
@@ -673,8 +673,8 @@ test_files:
673
673
  - test/dummy/config/initializers/cookies_serializer.rb
674
674
  - test/dummy/config/initializers/filter_parameter_logging.rb
675
675
  - test/dummy/config/initializers/inflections.rb
676
+ - test/dummy/config/initializers/kadmin.rb
676
677
  - test/dummy/config/initializers/mime_types.rb
677
- - test/dummy/config/initializers/rails_admin.rb
678
678
  - test/dummy/config/initializers/session_store.rb
679
679
  - test/dummy/config/initializers/wrap_parameters.rb
680
680
  - test/dummy/config/locales/en.yml