rails_admin_mydash 0.1.0 → 0.1.2

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: 8b80695c22eabd86345a42ea0e130d8a35ea8229
4
- data.tar.gz: d33f858d6af0c8644cd47c3f8e1106966129091d
3
+ metadata.gz: d816fa52e0c3107c71641c2b20e10375a6f3226a
4
+ data.tar.gz: 0a10768f139fba74cee1f68bcfdcc90220cbd35a
5
5
  SHA512:
6
- metadata.gz: 6da0af2be9493626eb6c032bc00989104b9c3427183d9d8bd55b689e52f1d8727d8c3729287b492aa53809f5960d1474b2fe7666eccc176034046d29f4b0087d
7
- data.tar.gz: 4f180ab2b8b46d270ae3dd980312e7ec28a0588cc990c17a0255a02ae4416db2949a956e7ce361c22125b33d9b77ce83b8d34c1782a7382826949227ac4c4e97
6
+ metadata.gz: adfc73bb5bb8c64aa3db8967a78bf8a9bbac29398a492e0b8e8f8bb65acdff746263c4169cf3cc534803dce79f67873e7a2b703bba8e6695457b9c7545f3cd12
7
+ data.tar.gz: a1846340a15bdba7a574045afb806c3bd0ef3cccb4d2c93dffc92b1f7e574a44884da83fbfc9cd04ea0d1594ec66b2594f377787398bbd124379c7cf71ed31f9
data/README.md CHANGED
@@ -1,8 +1,14 @@
1
- # RailsAdminMydash
1
+ # RailsAdminMydash [![Gem Version](https://badge.fury.io/rb/rails_admin_mydash.svg)](https://badge.fury.io/rb/rails_admin_mydash)
2
2
 
3
3
  A rails_admin alternative dashboard.
4
4
 
5
- Show the last 3 records for each model instead of the standard progress bar animation count.
5
+ Features:
6
+
7
+ - show the last 3 records for each model (useful to reach the last items easily)
8
+
9
+ - show optionally admin notices (to show informations to the users)
10
+
11
+ - disabled default progress bars with statistics (minor performance improvement)
6
12
 
7
13
  ## Installation
8
14
 
@@ -10,6 +16,33 @@ Show the last 3 records for each model instead of the standard progress bar anim
10
16
 
11
17
  - Execute `bundle`
12
18
 
19
+ ## Admin notices
20
+
21
+ - Create and apply a migration:
22
+
23
+ `rails g migration CreateAdminNotices message:string published:boolean`
24
+
25
+ - Create a model AdminNotice
26
+
27
+ - Enable the option in rails_admin config:
28
+
29
+ ```ruby
30
+ # In config.actions block:
31
+ dashboard do
32
+ admin_notices 'AdminNotice'
33
+ end
34
+ ```
35
+
36
+ - Add some messages: `AdminNotice.new( message: 'Just a test', published: true ).save`
37
+
38
+ ## Notes
39
+
40
+ - For each record to show a *name* field or method is used
41
+
42
+ ## Preview
43
+
44
+ ![preview](preview.jpg)
45
+
13
46
  ## Contributors
14
47
 
15
48
  - [Mattia Roccoberton](http://blocknot.es) - creator, maintainer
@@ -1,6 +1,15 @@
1
- / TODO: show admin notes ?
2
1
  / TODO: show audit ?
3
2
 
3
+ - if @admin_notices
4
+ %div.panel.panel-info
5
+ %div.panel-heading
6
+ %h3.panel-title= t 'admin.dashboard.notices'
7
+ / %div.panel-body
8
+ %table.table
9
+ - @admin_notices.each do |notice|
10
+ %tr
11
+ %td= notice.message
12
+
4
13
  - if @abstract_models
5
14
  %table.table.table-condensed.table-striped.dashboard-table
6
15
  %thead
@@ -20,6 +20,7 @@ RailsAdmin::Config::Actions::Dashboard.class_eval do
20
20
  @count[t.model.name] = t.count({}, scope)
21
21
  @last_rows[t.model.name] = t.all({ limit: 3, sort: t.model.primary_key, sort_reverse: false }, scope)
22
22
  end
23
+ @admin_notices = @action.admin_notices.constantize.where( published: true ).order( id: :desc ).limit( 10 ) if @action.admin_notices
23
24
  render @action.template_name, status: @status_code || :ok
24
25
  end
25
26
  end
@@ -36,62 +37,7 @@ RailsAdmin::Config::Actions::Dashboard.class_eval do
36
37
  true
37
38
  end
38
39
 
39
- ## Static
40
- # class << self
41
- # end
40
+ register_instance_option :admin_notices do
41
+ false
42
+ end
42
43
  end
43
-
44
- ## Original action:
45
- #
46
- # module RailsAdmin
47
- # module Config
48
- # module Actions
49
- # class Dashboard < RailsAdmin::Config::Actions::Base
50
- # RailsAdmin::Config::Actions.register(self)
51
-
52
- # register_instance_option :root? do
53
- # true
54
- # end
55
-
56
- # register_instance_option :breadcrumb_parent do
57
- # nil
58
- # end
59
-
60
- # register_instance_option :controller do
61
- # proc do
62
- # puts ">>>>>>>>>>>>>>>>>>>>>"
63
- # @history = @auditing_adapter && @auditing_adapter.latest || []
64
- # if @action.statistics?
65
- # @abstract_models = RailsAdmin::Config.visible_models(controller: self).collect(&:abstract_model)
66
-
67
- # @most_recent_created = {}
68
- # @count = {}
69
- # @max = 0
70
- # @abstract_models.each do |t|
71
- # scope = @authorization_adapter && @authorization_adapter.query(:index, t)
72
- # current_count = t.count({}, scope)
73
- # @max = current_count > @max ? current_count : @max
74
- # @count[t.model.name] = current_count
75
- # next unless t.properties.detect { |c| c.name == :created_at }
76
- # @most_recent_created[t.model.name] = t.model.last.try(:created_at)
77
- # end
78
- # end
79
- # render @action.template_name, status: @status_code || :ok
80
- # end
81
- # end
82
-
83
- # register_instance_option :route_fragment do
84
- # ''
85
- # end
86
-
87
- # register_instance_option :link_icon do
88
- # 'icon-home'
89
- # end
90
-
91
- # register_instance_option :statistics? do
92
- # true
93
- # end
94
- # end
95
- # end
96
- # end
97
- # end
@@ -1,3 +1,3 @@
1
1
  module RailsAdminMydash
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_mydash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattia Roccoberton
@@ -10,7 +10,7 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2017-01-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Custom Dashboard for RailsAdmin
13
+ description: An alternative dashboard for rails_admin
14
14
  email:
15
15
  - mat@blocknot.es
16
16
  executables: []
@@ -25,7 +25,7 @@ files:
25
25
  - lib/rails_admin_mydash/config/actions/dashboard.rb
26
26
  - lib/rails_admin_mydash/engine.rb
27
27
  - lib/rails_admin_mydash/version.rb
28
- homepage: http://blocknot.es/blocknotes/rails_admin_mydash
28
+ homepage: https://github.com/blocknotes/rails_admin_mydash
29
29
  licenses:
30
30
  - MIT
31
31
  metadata: {}
@@ -48,5 +48,5 @@ rubyforge_project:
48
48
  rubygems_version: 2.6.8
49
49
  signing_key:
50
50
  specification_version: 4
51
- summary: RailsAdmin Mydash
51
+ summary: Rails Admin Mydash
52
52
  test_files: []