bullet_train-themes-tailwind_css 1.4.4 → 1.4.5

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: a4916f4b8cc6676ec9d3b930ae4115819272a4457d5331c50efb80da59f9fe3b
4
- data.tar.gz: ebef2fd18041a167af4b3817b851b7986bd9d416cb3d4e9ff050ab8b89b64295
3
+ metadata.gz: 340403c7112e4ffdedd92f4be18dd9230412bba7c48517d2e5ec47e656f417d4
4
+ data.tar.gz: 745e312dbf9c37fa14fac9ec0cc67e26f0c58853b4a221eed38e706b72f8cb35
5
5
  SHA512:
6
- metadata.gz: bd5f98d68a2f07ab0789a25c1862121d7d3c72a84e23224a5583ca079c770c220bdd2831e40ff880137a369ce5cbc4a5a45fb7aefd5a272dc867c57c324bcfe9
7
- data.tar.gz: 30ea2e1c778b9027bda76812fd21fb1f78bf515d36e90026043a87347d3c20214daefcee070ef32cbe28e17e30fb1b343ab12189b4b703eaed36fbba3c316314
6
+ metadata.gz: 52ba142143b309c9d777b0c1bf09178fba09daa1e77a948c59eb9363cc7a53ec4afc36cfd04a50e7dcf760a389a7c680f249d1f19330a36007053f332aed065e
7
+ data.tar.gz: 1200eaaed7c457b31b165f3ca29f6bf4d025454ded4a63922e99fe036aad59146039794c69661cc5ede0fd188c19795b927f3835876b3ee069153f22e9e1f9fb
@@ -0,0 +1,56 @@
1
+ <%# TODO: This is mostly just copy pasta from the field_field partial.
2
+ # Should we just try to make that partial aware of images?
3
+ # If not, should we make a new dedicated stimulus controler for this partial,
4
+ # instead of hijacking the "fields--file-field" controller?
5
+ %>
6
+ <%
7
+ form ||= current_fields_form
8
+ options ||= {}
9
+ other_options ||= {}
10
+ multiple ||= false
11
+ persisted_files = multiple ? form.object.send(method) : [form.object.send(method)]
12
+
13
+ options[:width] ||= 100
14
+ options[:height] ||= 100
15
+
16
+ # options[:resize_to_limit] ||= [options[:width], options[:height]]
17
+ %>
18
+
19
+ <%= render 'shared/fields/field', form: form, method: method, helper: :file_field, options: options, other_options: other_options do %>
20
+ <% content_for :field do %>
21
+ <div class="file-field" data-controller="fields--file-field">
22
+ <%= form.file_field method, class: 'file-upload hidden', multiple: multiple, direct_upload: true, data: {'fields--file-field-target': 'fileField', action: 'change->fields--file-field#handleFileSelected'} %>
23
+ <div>
24
+ <% if form.object.send(method).attached? %>
25
+ <div class="divide-y-2 divide-dashed">
26
+ <% persisted_files.each do |file| %>
27
+ <div data-controller="fields--file-item" data-fields--file-item-id-value="<%= file.id %>">
28
+ <%= form.hidden_field "#{method}_removal".to_sym, multiple: multiple, value: nil, data: {'fields--file-item-target': 'removeFileFlag'} %>
29
+ <%= image_tag photo_url_for_active_storage_attachment(file, options), class: 'mb-1.5', data: {'fields--file-item-target': "fileName"} %>
30
+
31
+ <%= link_to url_for(file), class: 'button download-file mr-3', data: {'fields--file-item-target': 'downloadFileButton'} do %>
32
+ <i class="leading-none mr-2 text-base ti ti-download"></i>
33
+ <span><%= t('fields.download_image') %></span>
34
+ <% end %>
35
+ <div class="button-alternative cursor-pointer mr-3" data-action="click->fields--file-item#removeFile" data-fields--file-item-target="removeFileButton">
36
+ <i class="leading-none mr-2 text-base ti ti-trash"></i>
37
+ <span><%= t('fields.remove_image') %></span>
38
+ </div>
39
+ </div>
40
+ <% end %>
41
+ </div>
42
+ <% end %>
43
+ </div>
44
+ <div class="mt-2">
45
+ <div class="button-alternative cursor-pointer" data-action="click->fields--file-field#uploadFile" data-fields--file-field-target="selectFileButton">
46
+ <i class="leading-none mr-2 text-base ti ti-upload dark:text-white"></i>
47
+ <span class="dark:text-white"><%= t('fields.upload_image') %></span>
48
+ </div>
49
+ <div class="mt-2 hidden overflow-hidden text-xs rounded bg-slate-100 shadow-inner relative">
50
+ <div data-fields--file-field-target="progressBar" aria-valuemax="100" aria-valuemin="0" aria-valuenow="0" class="absolute top-0 left-0 whitespace-nowrap overflow-hidden animate-pulse bg-primary-500 dark:bg-slate-800 rounded" role="progressbar" style="width: 0%;">&nbsp;</div>
51
+ <div class="text-black text-center" data-fields--file-field-target="progressLabel">0%</div>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ <% end %>
56
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <%
2
+ form ||= current_fields_form
3
+ options ||= {}
4
+ other_options ||= {}
5
+ multiple ||= false
6
+ #persisted_files = multiple ? form.object.send(method) : [form.object.send(method)]
7
+ %>
8
+
9
+ <% if cloudinary_enabled? %>
10
+ <%= render 'shared/fields/cloudinary_image', method: method, form: form, options: options, other_options: other_options %>
11
+ <% else %>
12
+ <%= render 'shared/fields/active_storage_image', method: method, form: form, options: options, other_options: other_options %>
13
+ <% end %>
@@ -3,3 +3,6 @@ en:
3
3
  download_document: Download Current Document
4
4
  upload_document: Upload New Document
5
5
  remove_document: Remove Current Document
6
+ download_image: Download Current Image
7
+ upload_image: Upload New Image
8
+ remove_image: Remove Current Image
@@ -1,7 +1,7 @@
1
1
  module BulletTrain
2
2
  module Themes
3
3
  module TailwindCss
4
- VERSION = "1.4.4"
4
+ VERSION = "1.4.5"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-themes-tailwind_css
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-19 00:00:00.000000000 Z
11
+ date: 2023-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -82,6 +82,7 @@ files:
82
82
  - app/views/themes/tailwind_css/attributes/_code.html.erb
83
83
  - app/views/themes/tailwind_css/attributes/_file.erb
84
84
  - app/views/themes/tailwind_css/attributes/_files.erb
85
+ - app/views/themes/tailwind_css/fields/_active_storage_image.html.erb
85
86
  - app/views/themes/tailwind_css/fields/_address_field.html.erb
86
87
  - app/views/themes/tailwind_css/fields/_buttons.html.erb
87
88
  - app/views/themes/tailwind_css/fields/_cloudinary_image.html.erb
@@ -90,6 +91,7 @@ files:
90
91
  - app/views/themes/tailwind_css/fields/_date_field.html.erb
91
92
  - app/views/themes/tailwind_css/fields/_field.html.erb
92
93
  - app/views/themes/tailwind_css/fields/_file_field.html.erb
94
+ - app/views/themes/tailwind_css/fields/_image.html.erb
93
95
  - app/views/themes/tailwind_css/fields/_option.html.erb
94
96
  - app/views/themes/tailwind_css/fields/_options.html.erb
95
97
  - app/views/themes/tailwind_css/limits/_form.html.erb