tybo 0.2.0 → 0.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: 22d6c0fae60eed0eb777ab4adeffa5556470941180567062546ab55613ca50ba
4
- data.tar.gz: c93f5582d498f8a941dbff97d72907ac9b5de9d15d7f51221503ebb7a72d0ed9
3
+ metadata.gz: 99b6c52df41ad55c9a50c8f5e76dbcdf18972f4a417360ac5902f3cb203842ad
4
+ data.tar.gz: f4f9ef0ee8f3029e925b5158714b44776ac4d7ff6234fcf9328652640c137e04
5
5
  SHA512:
6
- metadata.gz: e6f65e79c9fff3d70cff9f097799dbcfb72e980577a991080197ac4279f4b0dd6ae867e283f371c83f3bc0ba7269cfe32b21c6d8a049d0bb58f8e357462d65d2
7
- data.tar.gz: 8d1584568c6f3df187741547e83bc54c68abe08db27cf9109c8bb1a74db65af71e63cb918b66c0e906ba0987659bdf5300764ab89ca8ab540fc3fe61fa679cfa
6
+ metadata.gz: 42012ad58801a47d31b21905d1036b55dee575ca37f4540cb34dfb8080b004499b5da05d096ab72e5b685c3db847f3dc068991a26a23dd06bd098a045badbdcc
7
+ data.tar.gz: c163a4ddb426ffcc1f886289222a78990f08adb3b2db512b35385a2c58c9b8cb73faf3a69fc478e8e14b730a5b469182c143073f06a4083622626ae81e2b9fe4
@@ -0,0 +1,6 @@
1
+ <div class="my-5">
2
+ <label class="block text-sm font-medium text-gray-700 string required text-sm font-medium text-gray-600">
3
+ <%= @label %>
4
+ </label>
5
+ <%= @form.datetime_field @field, class: "mt-1 block border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-tybo-500 focus:border-tybo-500 sm:text-sm string required" %>
6
+ </div>
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Input
4
+ class DatetimeComponent < ViewComponent::Base
5
+ def initialize(item:, field:, form:)
6
+ @item = item
7
+ @field = field
8
+ @form = form
9
+ @label = label
10
+ end
11
+
12
+ def label
13
+ I18n.t("bo.#{@item.class.name.underscore}.attributes.#{@field}")
14
+ end
15
+ end
16
+ end
@@ -13,7 +13,7 @@ module Input
13
13
  end
14
14
 
15
15
  def label
16
- I18n.t("bo.#{@item.class.name.downcase}.attributes.#{@field}")
16
+ I18n.t("bo.#{@item.class.name.underscore}.attributes.#{@field}")
17
17
  end
18
18
 
19
19
  def picture
@@ -1,8 +1,12 @@
1
1
  <%%= simple_form_for [:<%= options[:namespace] %>, <%= class_name.underscore %>], html: { class: "<%= class_name.underscore %> form" } do |f| %>
2
2
  <!-- Model columns -->
3
- <%- bo_model.column_names.each do |column| -%>
4
- <%- next if excluded_columns.include?(column.to_sym) || bo_model.reflect_on_all_associations.map(&:foreign_key).include?(column) -%>
5
- <%%= f.input :<%= column %>,label: I18n.t('bo.<%= class_name.underscore %>.attributes.<%= column %>') %>
3
+ <%- bo_model.columns.each do |column| -%>
4
+ <%- next if excluded_columns.include?(column.name.to_sym) || bo_model.reflect_on_all_associations.map(&:foreign_key).include?(column.name) -%>
5
+ <%- if column.type == :datetime -%>
6
+ <%%= render(Input::DatetimeComponent.new(item: <%= class_name.underscore %>, field: '<%= column.name %>', form: f)) %>
7
+ <%- else -%>
8
+ <%%= f.input :<%= column.name %>,label: I18n.t('bo.<%= class_name.underscore %>.attributes.<%= column.name %>') %>
9
+ <%- end -%>
6
10
  <%- end -%>
7
11
  <!-- belongs_to Associations -->
8
12
  <%- belongs_to_assoc.each do |association| -%>
@@ -10,7 +10,7 @@
10
10
  <!-- Search Bar -->
11
11
  <%%= render('search_bar') %>
12
12
  <!-- Table -->
13
- <%%= turbo_frame_tag "<%= class_name.underscore.pluralize %>", class: "shadow overflow-hidden rounded border-b border-gray-200" do %>
13
+ <%%= turbo_frame_tag "<%= class_name.underscore.pluralize %>", target: '_top', class: "shadow overflow-hidden rounded border-b border-gray-200" do %>
14
14
  <%%= render('table') %>
15
15
  <div class="py-2">
16
16
  <%%== render partial: 'shared/pagination', locals: { pagy: @pagy } %>
@@ -8,7 +8,7 @@ module.exports = {
8
8
  './app/helpers/**/*.rb',
9
9
  './app/javascript/**/*.js',
10
10
  './app/views/**/*.{erb,haml,html,slim}',
11
- './app/components/**/*.html.erb',
11
+ './app/components/**/*.{erb,haml,html,rb}',
12
12
  output.trim() + '/app/**/*.{erb,haml,html,rb}'
13
13
  ],
14
14
  theme: {
data/lib/tybo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tybo
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tybo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Delpierre
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-05-24 00:00:00.000000000 Z
12
+ date: 2023-06-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -189,6 +189,8 @@ files:
189
189
  - app/components/index_header_component.rb
190
190
  - app/components/index_header_export_component.html.erb
191
191
  - app/components/index_header_export_component.rb
192
+ - app/components/input/datetime_component.html.erb
193
+ - app/components/input/datetime_component.rb
192
194
  - app/components/input/file_component.html.erb
193
195
  - app/components/input/file_component.rb
194
196
  - app/components/sidebar_component.html.erb