tramway 0.2.0 → 0.2.1.1

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: c88b945e6fe61b58431c5598687538fb9514ec49333e11bfdb4b4027ff755e94
4
- data.tar.gz: dde0abe3237e06f5aa5119e8cd28162643301fb534e949082cb930eca4a2b5dc
3
+ metadata.gz: f21d3c15fcbad670039714c4661be3546849982618662fec4de88d5fa7f46ce3
4
+ data.tar.gz: ed77adc5f2247c5db97e23b0c6706219689afcbbedd02db3597d2e31f1adde23
5
5
  SHA512:
6
- metadata.gz: 7c27968e67c7c6da3047aadb5be9e39c52eb8049d558777674c8633e34cea10f996e0bf7d3dc04d2744fdd509f9e5019d321a730c2292c55336a2a5e32575b14
7
- data.tar.gz: a5eab082d14d3c3158745135fdeedc5bf65789b59b6996523c0584e03522ceeeba63529b25b3549ab368123b6712257865e7098dd7641ec87cbb28358089f0ab
6
+ metadata.gz: 58c2ce7f3f93ae17fd399d1fff01e0abce89f0a687aba960d5431be777f2ec2ae0078d68d9f9bdffadedce5b67004a4a487a30ad29e09e7927fb1b808a83843c
7
+ data.tar.gz: 2b1ff7fa17dfb4e8eed897bdaab83b32a58f0230a12a24d2bf37f9334779d7abf180949d50444b0e75623efd9db10a9b116d231a923b16efbb6af507d218a17b
data/README.md CHANGED
@@ -91,6 +91,7 @@ This helper provides several options. Here is YAML view of `tramway_navbar` opti
91
91
 
92
92
  ```yaml
93
93
  title: String that will be added to the left side of the navbar
94
+ title_link: Link on Tramway Navbar title. Default: '/'
94
95
  background:
95
96
  color: Css-color. Supports all named CSS colors and HEX colors
96
97
  intensity: Color intensity. Range: **100..950**. Used by Tailwind. Not supported in case of using HEX color in the background.color
@@ -1,9 +1,10 @@
1
1
  %nav.py-4.px-8.flex.justify-between.items-center{ class: "bg-#{@color}" }
2
- - if @title.present? || @left_items.present?
2
+ - if @title[:text].present? || @left_items.present?
3
3
  .flex
4
- - if @title.present?
5
- .text-xl.text-white.font-bold
6
- = @title
4
+ - if @title[:text].present?
5
+ = link_to @title[:link] do
6
+ .text-xl.text-white.font-bold
7
+ = @title[:text]
7
8
  - if @left_items.present?
8
9
  %ul.flex.items-center.space-x-4
9
10
  - @left_items.each do |item|
@@ -33,7 +33,7 @@ module Tailwinds
33
33
  include Tailwinds::BackgroundHelper
34
34
 
35
35
  def initialize(**options)
36
- @title = options[:title]
36
+ @title = { text: options[:title], link: options[:title_link] || '/' }
37
37
  @left_items = options[:left_items]
38
38
  @right_items = options[:right_items]
39
39
  @color = BackgroundHelper.background(options)
@@ -22,7 +22,11 @@ module Tramway
22
22
  class << self
23
23
  def decorate(object_or_array, context)
24
24
  if Tramway::Decorators::CollectionDecorators.collection?(object_or_array)
25
- Tramway::Decorators::CollectionDecorators.decorate_collection(collection: object_or_array, context:)
25
+ Tramway::Decorators::CollectionDecorators.decorate_collection(
26
+ collection: object_or_array,
27
+ context:,
28
+ decorator: self
29
+ )
26
30
  else
27
31
  new(object_or_array, context)
28
32
  end
@@ -7,9 +7,9 @@ module Tramway
7
7
  module CollectionDecorators
8
8
  module_function
9
9
 
10
- def decorate_collection(collection:, context:)
10
+ def decorate_collection(collection:, context:, decorator:)
11
11
  collection.map do |item|
12
- Tramway::Decorators::BaseDecorator.decorate item, context
12
+ decorator.decorate item, context
13
13
  end
14
14
  end
15
15
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kalashnikovisme
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-06-30 00:00:00.000000000 Z
12
+ date: 2023-07-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml-rails