jav_madmin 2.6.2 → 2.6.3

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: 5d92b6e04ea290f8ea0692b83ed2a324fc76d51cb1c63a35435a34552cdeecba
4
- data.tar.gz: 24f2b178256dc83dd6c5dd9ed6d276be5b174b9ea34bc2fb4c99549d618488f9
3
+ metadata.gz: 46f9769147caeaaf6919b01e3f3b1e2c98b7718c11cb2983b530660f2d347123
4
+ data.tar.gz: 1e9a42b10c6c8305f1ffc66164a6d86ddf2daab6e2df6647b2087a07152cdc72
5
5
  SHA512:
6
- metadata.gz: 384f3b0526579449b6dc3e58f3e633ca7d5bb193070a17b052d6d38863f671fc9a84b054b1349912f71d479743b5b7f69f2518e67b693ea7941deb95a55d4b6e
7
- data.tar.gz: '0293d9d07f98036e8ff5895753aa87549b81345e5356fa8b171fe9bd5fbd3578842669a5c6682fa92efd84683b009eeb997a13dcc095b0e2f71ccab000468f81'
6
+ metadata.gz: b9500a465ed21b4d0dc10844bcdf674910ec1d688f75e7ec0a4cddde9aae3a432077f30b563828f6899e5b81532186b8a123e2f84890b79fceed745d121642ed
7
+ data.tar.gz: c2882294026d7074cd5bb812801e05390a1f0ff1d5093480a32e4848f505d92381793d2330a71edacf2fee740d960d921a387b93bee324e0957e76eab8be5cc7
@@ -28,7 +28,12 @@ module Madmin::NavHelper
28
28
  link_to name, url, html_options
29
29
  end
30
30
 
31
+ # label default is model i18n_key, is a Symbol
31
32
  def menu_label(label)
32
- I18n.t("activerecord.models.#{label}", default: [:"madmin.navigation.#{label}", label.titleize])
33
+ if label.is_a?(Symbol)
34
+ I18n.t("activerecord.models.#{label}", default: [:"madmin.navigation.#{label}", label.to_s.pluralize(I18n.locale).titleize])
35
+ else
36
+ label
37
+ end
33
38
  end
34
39
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  <header class="header">
4
4
  <h1>
5
- <%= link_to resource.friendly_name.pluralize(I18n.locale), resource.index_path %>
5
+ <%= link_to resource.friendly_name(count: 2, default: resource.model_name.pluralize(I18n.locale)), resource.index_path %>
6
6
  /
7
7
  <strong><%= t("madmin.actions.edit") %> <%= link_to resource.display_name(@record), resource.show_path(@record) %></strong>
8
8
  </h1>
@@ -1,7 +1,7 @@
1
- <%= content_for :title, resource.friendly_name.pluralize(I18n.locale) %>
1
+ <%= content_for :title, resource.friendly_name(count: 2, default: resource.model_name.pluralize(I18n.locale)) %>
2
2
 
3
3
  <header class="header">
4
- <h1><%= resource.friendly_name.pluralize(I18n.locale) %></h1>
4
+ <h1><%= resource.friendly_name(count: 2, default: resource.model_name.pluralize(I18n.locale)) %></h1>
5
5
 
6
6
  <div class="actions">
7
7
  <form class="search">
@@ -2,7 +2,7 @@
2
2
 
3
3
  <header class="header">
4
4
  <h1>
5
- <%= link_to resource.friendly_name.pluralize(I18n.locale), resource.index_path %>
5
+ <%= link_to resource.friendly_name(count: 2, default: resource.model_name.pluralize(I18n.locale)) , resource.index_path %>
6
6
  /
7
7
  <strong><%= t("madmin.titles.new", name: resource.friendly_name) %></strong>
8
8
  </h1>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <header class="header">
4
4
  <h1>
5
- <%= link_to resource.friendly_name.pluralize(I18n.locale), resource.index_path %>
5
+ <%= link_to resource.friendly_name(count: 2, default: resource.model_name.pluralize(I18n.locale)), resource.index_path %>
6
6
  /
7
7
  <%= resource.display_name(@record) %>
8
8
  </h1>
data/lib/madmin/menu.rb CHANGED
@@ -44,7 +44,7 @@ module Madmin
44
44
  def items
45
45
  @children.values.sort do |a, b|
46
46
  result = a.position <=> b.position
47
- result = a.label <=> b.label if result == 0 # sort alphabetically for the same position
47
+ result = a.label.to_s <=> b.label.to_s if result == 0 # sort alphabetically for the same position
48
48
  result
49
49
  end
50
50
  end
@@ -83,8 +83,8 @@ module Madmin
83
83
 
84
84
  # Returns singular name
85
85
  # For example: "Forum::Post" -> "Post"
86
- def friendly_name
87
- model.model_name.human
86
+ def friendly_name(count: 1, default: nil)
87
+ model.model_name.human(count: count, default: default)
88
88
  end
89
89
 
90
90
  # Support for isolated namespaces
@@ -286,7 +286,7 @@ module Madmin
286
286
  def menu_options
287
287
  return false if @menu_options == false
288
288
  @menu_options ||= {}
289
- @menu_options.with_defaults(label: model.model_name.i18n_key.to_s, url: index_path)
289
+ @menu_options.with_defaults(label: model.model_name.i18n_key, url: index_path)
290
290
  end
291
291
  end
292
292
 
@@ -1,3 +1,3 @@
1
1
  module Madmin
2
- VERSION = "2.6.2"
2
+ VERSION = "2.6.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jav_madmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.2
4
+ version: 2.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver