avo 2.15.2.pre.1 → 2.15.3.pre.1.data.attrs.to.sidebar.items

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of avo might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1ab7eb43d1f112ff5307e96837c8d4a7198864b5f27730fb798fc3f35b4f3df
4
- data.tar.gz: edbe08766003e670fe83553e5eb11300cb61985e7826b11f7eb96552d5c68bec
3
+ metadata.gz: 64729fc8e5570fcc659daa51c57938d6b75690ab2952fa054149e7208c064e5a
4
+ data.tar.gz: 373621511d2f61b098add0594a1cfdfb687f1587ac7a6e3c1f1c388b663146fd
5
5
  SHA512:
6
- metadata.gz: f194547e6652e8f1d3aefa09ccadb769ee3fdce46aaeb2c75ec25b6e45671293bb405e93be8b18cf7850537182a934b32c607266e7c25a04453c2029e4fd18fb
7
- data.tar.gz: 10faeb4cc74ae9cc025aad81fac3e1b0d6364fd609c5169e4ed91dbec20b99946fd360a75cf13a520ef97611fdf9c4963993581ee6b80b13ffbd964009106310
6
+ metadata.gz: 36b5950de108a20d8fa2dd24e68022d7eee35d16bb9cd07e926748c887e3bc42d42fb6ef36d3932e60c31fbbf2860a1aee6af035287515393e20619be4c59f62
7
+ data.tar.gz: e047c958831467741cb77c330b8fe62df5349b40fee2f5de42e2965e11587dc193d2266883c217d1d9b529536264101aa76fb41d884008e9ca8d192b0d33928d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.15.2.pre.1)
4
+ avo (2.15.3.pre.1.data.attrs.to.sidebar.items)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
@@ -1,11 +1,11 @@
1
1
  <% if item.is_a? Avo::Menu::Link %>
2
- <%= render Avo::Sidebar::LinkComponent.new label: item.name, path: item.path, target: item.target %>
2
+ <%= render Avo::Sidebar::LinkComponent.new label: item.name, path: item.path, target: item.target, data: item.data %>
3
3
  <% end %>
4
4
  <% if item.is_a? Avo::Menu::Resource %>
5
- <%= render Avo::Sidebar::LinkComponent.new label: item.navigation_label, path: helpers.resources_path(resource: resource) %>
5
+ <%= render Avo::Sidebar::LinkComponent.new label: item.navigation_label, path: helpers.resources_path(resource: resource), data: item.data %>
6
6
  <% end %>
7
7
  <% if item.is_a? Avo::Menu::Dashboard %>
8
- <%= render Avo::Sidebar::LinkComponent.new label: item.navigation_label, path: dashboard.navigation_path %>
8
+ <%= render Avo::Sidebar::LinkComponent.new label: item.navigation_label, path: dashboard.navigation_path, data: item.data %>
9
9
  <% end %>
10
10
  <% if item.is_a? Avo::Menu::Section %>
11
11
  <%= render Avo::Sidebar::SectionComponent.new item: item %>
@@ -1,12 +1,12 @@
1
1
  <% if path.present? %>
2
- <%= send link_method, path, class: classes, active: active, target: target do %>
2
+ <%= send link_method, path, class: classes, active: active, target: target, data: data do %>
3
3
  <%= label %>
4
4
  <% if target == :_blank %>
5
5
  <%= helpers.svg('heroicons/outline/external-link', class: 'self-center ml-auto h-3 mr-2') %>
6
6
  <% end %>
7
7
  <% end %>
8
8
  <% else %>
9
- <%= content_tag :div, class: classes, active: active, target: target do %>
9
+ <%= content_tag :div, class: classes, active: active, target: target, data: data do %>
10
10
  <%= label %>
11
11
  <% end %>
12
12
  <% end %>
@@ -5,12 +5,14 @@ class Avo::Sidebar::LinkComponent < ViewComponent::Base
5
5
  attr_reader :target
6
6
  attr_reader :label
7
7
  attr_reader :path
8
+ attr_reader :data
8
9
 
9
- def initialize(label: nil, path: nil, active: :inclusive, target: nil)
10
+ def initialize(label: nil, path: nil, active: :inclusive, target: nil, data: {})
10
11
  @label = label
11
12
  @path = path
12
13
  @active = active
13
14
  @target = target
15
+ @data = data
14
16
  end
15
17
 
16
18
  def is_external?
@@ -9,6 +9,7 @@ class Avo::Menu::BaseItem
9
9
  option :items, default: proc { [] }
10
10
  option :name, default: proc { "" }
11
11
  option :visible, default: proc { true }
12
+ option :data, default: proc { {} }
12
13
 
13
14
  def visible?
14
15
  return visible if visible.in? [true, false]
@@ -22,9 +22,11 @@ class Avo::Menu::Builder
22
22
  end
23
23
 
24
24
  # Adds a link
25
- def link(name, **args)
26
- @menu.items << Avo::Menu::Link.new(name: name, **args)
25
+ def link(name, path = nil, **args)
26
+ path ||= args[:path]
27
+ @menu.items << Avo::Menu::Link.new(name: name, path: path, **args)
27
28
  end
29
+ alias_method :link_to, :link
28
30
 
29
31
  # Validates and adds a resource
30
32
  def resource(name, **args)
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.15.2.pre.1" unless const_defined?(:VERSION)
2
+ VERSION = "2.15.3.pre.1.data.attrs.to.sidebar.items" unless const_defined?(:VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.2.pre.1
4
+ version: 2.15.3.pre.1.data.attrs.to.sidebar.items
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin