tramway 2.3.1.2 → 2.3.1.4

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: afb266e8ff0e57296500fc2181b623ef4abffbe184be90bbb3a6a61431cfcbc8
4
- data.tar.gz: 7e23e932ff24c6f5c93bbc3a3cd2365c2f66e7b121a690f9c56e51cfe5c3ac60
3
+ metadata.gz: 20f2a11f56484a9763bbb712c8bbf2c09558d9ad098b886849ee87429e379a19
4
+ data.tar.gz: b5b9a13a2e084cd82fd09c9d4451c8cb2d59a4dd08198968eb8165d34a7dcfc0
5
5
  SHA512:
6
- metadata.gz: 48eca5f7a2a9c24681f73f164b997e59b21e75efd761fd99f8f765752ed16b226d8823ee124c60fca08c2944c49b91b38d2e8b4808faf424fc804dfb0b8aec40
7
- data.tar.gz: 11835fac94f5d47052e64a8a6de159eb53385b1ee9dc78f1a0500c8a7b4329eb1f0f607ff8e84c078a66becd1387f0403d78f3b9fe6e43dd6c905ab695c3b50b
6
+ metadata.gz: c0a2569b1767b5e8c7e65b88f03124c67e845ce2db8999574255e1353135770f06dfe932d3b4d3601ad9bd3bfd0573dc4f217b7e211c502a67414a0e757b3239
7
+ data.tar.gz: d6d354cef03905530fc1f959a5768e2682008b14a10a9b34d03a0065c7f07ed343eb3dac7e06c2a5d3a1136f3c149e8f81a62c360ace8c8a4bf7c5615b46b184
data/README.md CHANGED
@@ -51,7 +51,7 @@ bundle install
51
51
  bin/rails g tramway:install
52
52
  ```
53
53
 
54
- The install generator adds the required gems (`haml-rails`, `kaminari`, `view_component`, and `dry-initializer`) to your
54
+ The install generator adds the required gems (`haml-rails`, `kaminari`, `view_component`, `dry-initializer`, and `dry-monads`) to your
55
55
  application's Gemfile—if they are not present—and appends the Tailwind safelist configuration Tramway ships with.
56
56
 
57
57
  ## Getting Started
data/docs/AGENTS.md CHANGED
@@ -103,6 +103,8 @@ Tramway.configure do |config|
103
103
  end
104
104
  ```
105
105
 
106
+ If admin panel requested to be implemented from scratch, do the same with `namespace: :admin`
107
+
106
108
  ### Rule 2
107
109
  Normalize input with `normalizes` (from Tramway) for attributes like email, phone, etc. Don't use `normalizes` in model unless it requested explicitly.
108
110
 
@@ -115,11 +117,18 @@ Use Tramway Navbar for navigation
115
117
  ### Rule 4
116
118
  Use Tramway Flash for user notifications.
117
119
 
120
+ ```
121
+ = tramway_flash text: flash[:notice], type: :hope
122
+ = tramway_flash text: 'Double check your data', type: :greed, class: 'mt-2', data: { turbo: 'false' }
123
+ ```
124
+
125
+ `type:` argument supports lantern colors.
126
+
118
127
  ### Rule 5
119
128
  Use Tramway Table for tabular data display.
120
129
 
121
130
  ### Rule 6
122
- Use Tramway Button for buttons.
131
+ Use Tramway Button for buttons. Always add a color of the button via `color:` or `type:` argument. `color:` argument support directs colors only: red, yellow, blue, etc. `type:` argument supports only lantern colors: will, hope, rage, etc.
123
132
 
124
133
  ### Rule 7
125
134
  Use `tramway_form_for` instead `form_with`, `form_for`
@@ -356,7 +365,12 @@ In case you need something that looks like enumerize but it's a process state, u
356
365
  Use model scopes instead of creating private methods for object collections.
357
366
 
358
367
  ### Rule 23
359
- Use `tramway_title` for the main title on pages
368
+ Use `tramway_title` for the main title on pages. `tramway_title text: 'Title'` OR
369
+
370
+ ```
371
+ tramway_title do
372
+ More complicated title with HTML tags
373
+ ```
360
374
 
361
375
  Example
362
376
  *app/models/user.rb*
@@ -458,7 +472,7 @@ In case, you need to make a one link in tramway_table on each row. Use `tramway_
458
472
  Always use tramway decorated objects in views.
459
473
 
460
474
  ### Rule 30
461
- For Tailwind classes with `/`, `[`, `]` characters use `{ class: 'here is the complicated class' }` in HAML.
475
+ For Tailwind classes with arbitrary values (with `/`, `[`, `]` characters) use `{ class: 'here is the complicated class' }` in HAML.
462
476
 
463
477
  ### Rule 31
464
478
  Always `tramway_decorate` and `tramway_form` for creating these types of objects. Don't use decorator and form classes for this.
@@ -466,6 +480,9 @@ Always `tramway_decorate` and `tramway_form` for creating these types of objects
466
480
  ### Rule 32
467
481
  In Tramway Decorators, use `delegate_attributes` method instead of `delegate :something, to: :object`
468
482
 
483
+ ### Rule 33
484
+ In case you want to use container on the page, use `tramway_container` helper instead of creating a component for that or using a plain div with Tailwind classes.
485
+
469
486
  ## Controller Patterns
470
487
 
471
488
  - Keep actions short and explicit with guard clauses.
@@ -16,7 +16,8 @@ module Tramway
16
16
  { name: 'haml-rails', declaration: 'gem "haml-rails"' },
17
17
  { name: 'kaminari', declaration: 'gem "kaminari"' },
18
18
  { name: 'view_component', declaration: 'gem "view_component"' },
19
- { name: 'dry-initializer', declaration: "gem 'dry-initializer'" }
19
+ { name: 'dry-initializer', declaration: "gem 'dry-initializer'" },
20
+ { name: 'dry-monads', declaration: "gem 'dry-monads'" }
20
21
  ]
21
22
  end
22
23
 
@@ -70,7 +71,19 @@ module Tramway
70
71
  response = Net::HTTP.get_response(uri)
71
72
  body = response.body.to_s
72
73
  body = body.dup.force_encoding(Encoding::UTF_8)
73
- @agents_template_body = body.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: '')
74
+ @agents_template_body = sanitize_agents_template_body(
75
+ body.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: '')
76
+ )
77
+ end
78
+
79
+ def sanitize_agents_template_body(content)
80
+ stripped_content = content.strip
81
+ section_pattern = /\A#{Regexp.escape(agents_section_start)}\s*\n?(.*?)\n?#{Regexp.escape(agents_section_end)}\s*\z/m # rubocop:disable Layout/LineLength
82
+ match = stripped_content.match(section_pattern)
83
+
84
+ return stripped_content unless match
85
+
86
+ match[1].to_s.strip
74
87
  end
75
88
 
76
89
  def agents_section_start
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '2.3.1.2'
4
+ VERSION = '2.3.1.4'
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: 2.3.1.2
4
+ version: 2.3.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - kalashnikovisme