tramway 3.1.2 → 3.1.2.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
  SHA256:
3
- metadata.gz: b60bf123066d7c59336dba45b1dae5ab6a90b36fd54063c73f04d4fcac17ba21
4
- data.tar.gz: d1512dee19a6f92b27791ad9b6b40582e0b0e90b7ef2a6304e7d1846d7d05930
3
+ metadata.gz: b808bd77758d7995826c1f69fb90dbac277d9b31ad2008caddf938bbe14e81cc
4
+ data.tar.gz: 12b47f9c4880fcfeec5b64e1c5cc9aaf87e72ed2e618c08b01300977e58c9025
5
5
  SHA512:
6
- metadata.gz: fbe4b415c8fc353f3be1453064072dc34864181f795f92c631ff2776af7fa060f0c0ab893149b8e3fb1702365b9f56c286b038424bff034b6ec3a1a6c13156b8
7
- data.tar.gz: 4a403cd5695f25bf309feceed280afdf9cc489eff25dd1d37bf766b2714aff4fd22cf6d0fbf460659b115258bd9b89f6b10bb5c419c228a077d97272921222c8
6
+ metadata.gz: be0192fd85de34e28c48ac47c3799b185e69282c37c3921fc778012ab87465ed0ddc53c363552e57f174fc2aebf6ae0745ca1d6abef0ddecd39e5af16103cbd8
7
+ data.tar.gz: d28e20eaef6fe9cb8c2ecf042fe719c76b054a70d52619bb79c94fce6ecd595be2d187b2ec000bc4273af7fae2c5b30a5ba2c2cd15a9a32a0c54f3c2b8a92a0f
data/README.md CHANGED
@@ -921,6 +921,8 @@ choose when it appears. Supported events are `:hover` and `:onclick`; hover is t
921
921
  `tramway_chat` renders the chat experience bundled with Tramway. Provide a chat ID, a list of message hashes, and the URL
922
922
  that receives new messages. Each message must include an `:id` and a `:type` (either `:sent` or `:received`). Additional
923
923
  message fields like `text`, `data`, or `sent_at` are forwarded to `tramway/chats/message_component`.
924
+ Message text preserves normal word wrapping and only breaks oversized words or links when needed to keep content inside the
925
+ message bubble.
924
926
 
925
927
  Use `send_messages_enabled:` to control whether users can send new messages from the rendered form. It defaults to `true`.
926
928
  When set to `false`, the text field is disabled and the waiting placeholder is shown.
@@ -1215,6 +1217,7 @@ will render [this](https://play.tailwindcss.com/xho3LfjKkK)
1215
1217
 
1216
1218
  Use `size:` to control the input sizing (`:small`, `:medium`, or `:large`). The default is `:medium`, and supported inputs
1217
1219
  rendered within the form will use the same size value.
1220
+ Date and datetime fields open the browser's native picker when clicking anywhere in the input, not only the picker icon.
1218
1221
 
1219
1222
  ```erb
1220
1223
  <%= tramway_form_for @user, size: :large do |f| %>
@@ -3,4 +3,4 @@
3
3
  = component('tramway/form/label', for: @for, class: 'mb-0') do
4
4
  = @label
5
5
  - classes = "#{size_class(:text_input)} #{text_input_base_classes}"
6
- = @input.call @attribute, **@options.merge(class: classes), value: @value
6
+ = @input.call @attribute, **picker_options(classes), value: @value
@@ -4,6 +4,13 @@ module Tramway
4
4
  module Form
5
5
  # Tailwind-styled date field
6
6
  class DateFieldComponent < TailwindComponent
7
+ PICKER_ONCLICK = 'try { this.showPicker && this.showPicker() } catch (error) {}'
8
+
9
+ private
10
+
11
+ def picker_options(classes)
12
+ @options.merge(class: classes, onclick: [@options[:onclick], PICKER_ONCLICK].compact.join('; '))
13
+ end
7
14
  end
8
15
  end
9
16
  end
@@ -3,4 +3,4 @@
3
3
  = component('tramway/form/label', for: @for, class: 'mb-0') do
4
4
  = @label
5
5
  - classes = "#{size_class(:text_input)} #{text_input_base_classes}"
6
- = @input.call @attribute, **@options.merge(class: classes), value: @value
6
+ = @input.call @attribute, **picker_options(classes), value: @value
@@ -4,6 +4,13 @@ module Tramway
4
4
  module Form
5
5
  # Tailwind-styled datetime field
6
6
  class DatetimeFieldComponent < TailwindComponent
7
+ PICKER_ONCLICK = 'try { this.showPicker && this.showPicker() } catch (error) {}'
8
+
9
+ private
10
+
11
+ def picker_options(classes)
12
+ @options.merge(class: classes, onclick: [@options[:onclick], PICKER_ONCLICK].compact.join('; '))
13
+ end
7
14
  end
8
15
  end
9
16
  end
@@ -1,2 +1,2 @@
1
- %div.max-w-full.min-w-0.break-all
1
+ %div.max-w-full.min-w-0.break-words
2
2
  = rendered_html
@@ -48,7 +48,8 @@ module Tramway
48
48
  @record = tramway_form model_class.new, namespace: entity.namespace
49
49
 
50
50
  if @record.submit params[model_class.model_name.param_key]
51
- redirect_to public_send(entity.show_helper_method, @record.id), notice: t('tramway.notices.created')
51
+ redirect_to Tramway::Engine.routes.url_helpers.public_send(entity.show_helper_method, @record.id),
52
+ notice: t('tramway.notices.created')
52
53
  else
53
54
  render :new
54
55
  end
@@ -58,7 +59,8 @@ module Tramway
58
59
  @record = tramway_form model_class.find(params[:id]), namespace: entity.namespace
59
60
 
60
61
  if @record.submit params[model_class.model_name.param_key]
61
- redirect_to public_send(entity.show_helper_method, @record.id), notice: t('tramway.notices.updated')
62
+ redirect_to Tramway::Engine.routes.url_helpers.public_send(entity.show_helper_method, @record.id),
63
+ notice: t('tramway.notices.updated')
62
64
  else
63
65
  render :edit
64
66
  end
@@ -70,7 +72,8 @@ module Tramway
70
72
 
71
73
  @record.destroy
72
74
 
73
- redirect_to public_send(entity.index_helper_method), notice: t('tramway.notices.deleted')
75
+ redirect_to Tramway::Engine.routes.url_helpers.public_send(entity.index_helper_method),
76
+ notice: t('tramway.notices.deleted')
74
77
  end
75
78
 
76
79
  private
@@ -148,7 +148,7 @@ module.exports = {
148
148
  'text-blue-100/90',
149
149
  'text-red-200',
150
150
  'underline',
151
- 'break-all',
151
+ 'break-words',
152
152
  'animate-spin',
153
153
  'placeholder:text-gray-400',
154
154
  'focus:outline-none',
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '3.1.2'
4
+ VERSION = '3.1.2.2'
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: 3.1.2
4
+ version: 3.1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kalashnikovisme