tybo 0.2.0 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22d6c0fae60eed0eb777ab4adeffa5556470941180567062546ab55613ca50ba
4
- data.tar.gz: c93f5582d498f8a941dbff97d72907ac9b5de9d15d7f51221503ebb7a72d0ed9
3
+ metadata.gz: 44038010e0e9d54bf36dd444aa448f4d8896971d3063007fd6ae9f7f07e3d13c
4
+ data.tar.gz: 2a4b09953926cf89540b0f5c73bce9e7c9d9abc461deb42e2a41785e0dc07666
5
5
  SHA512:
6
- metadata.gz: e6f65e79c9fff3d70cff9f097799dbcfb72e980577a991080197ac4279f4b0dd6ae867e283f371c83f3bc0ba7269cfe32b21c6d8a049d0bb58f8e357462d65d2
7
- data.tar.gz: 8d1584568c6f3df187741547e83bc54c68abe08db27cf9109c8bb1a74db65af71e63cb918b66c0e906ba0987659bdf5300764ab89ca8ab540fc3fe61fa679cfa
6
+ metadata.gz: ad7c27eafab3934de5b3dba9869eb9b47627cc66754dc3cf57cd78ced19e641d4fb805e66599141796d5e379c18d6480c8cf5f4a8461a83a38dff2ea1dadbe52
7
+ data.tar.gz: 44cf9f73f175fd796c8809b9dd6c640f5d6e4394251ee2b889a93912d6a0ff25e6b6d95e9a428f78ba6bef9b8f0c68900a679aa3f4b37caf4d80de4012c7a022
@@ -29,7 +29,7 @@
29
29
  </div>
30
30
  <% end %>
31
31
 
32
- <div class="px-4 py-5 bg-white space-y-6 sm:p-6 shadow sm:rounded-md">
32
+ <div class="px-4 bg-white sm:p-6 shadow sm:rounded-md">
33
33
  <%= content %>
34
34
  </div>
35
35
  </div>
@@ -1,9 +1,9 @@
1
- <div class="space-y-6 sm:space-y-5">
1
+ <div class="py-3 space-y-1 sm:space-y-2">
2
2
  <div>
3
3
  <h3 class="text-lg font-medium leading-6 text-gray-900"><%= @title %></h3>
4
4
  </div>
5
- <div class="space-y-6 sm:space-y-5">
6
- <div class="sm:items-start sm:gap-4 sm:border-t sm:border-gray-200 sm:pt-5">
5
+ <div>
6
+ <div class="sm:items-start sm:gap-4 sm:border-t sm:border-gray-200">
7
7
  <%= content %>
8
8
  </div>
9
9
  </div>
@@ -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 } %>
@@ -10,7 +10,6 @@
10
10
  { label: I18n.t('bo.<%= class_name.underscore %>.others').capitalize, path: <%= "#{options[:namespace]}_#{class_name.pluralize.underscore}_path"%> },
11
11
  current_page
12
12
  ]) %>
13
- <br>
14
13
  <%%= render "form", <%= class_name.underscore %>: @<%= class_name.underscore %> %>
15
14
  <%% end %>
16
15
  <%% end %>
@@ -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.3'
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.3
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-08-18 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
@@ -300,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
300
302
  - !ruby/object:Gem::Version
301
303
  version: '0'
302
304
  requirements: []
303
- rubygems_version: 3.0.3.1
305
+ rubygems_version: 3.4.10
304
306
  signing_key:
305
307
  specification_version: 4
306
308
  summary: A tailwind custom admin engine for Ruby on Rails