simple_form-theme 0.1.2 → 0.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: 6d934b32592b1a73bb0bc657301447d61a96ec793002ee096e700b176000120d
4
- data.tar.gz: 3a7dcde3dea07205f7f4542d68061fca65f696ebe41c17eab3c059fb1029b8e6
3
+ metadata.gz: e618469f92118637344e4871ff50df80758d5a247539340e717ea5b1d30b8e81
4
+ data.tar.gz: 755fe9c11a533e154b42a6fbbb400bb36fe17a3000531043c7d01a9cb9e16d78
5
5
  SHA512:
6
- metadata.gz: 4cfd8957eb26b23fa26fd3d981c28d08f21c3c9b7955feac799380f1a2f9421d8b9723c160e124544fa88f5902eb52eb237ffa91a8a0e98a476530a825c76d4c
7
- data.tar.gz: b49bffcde5d65de881e966d0c36da9fc953ac0c09b451d517151a05fe40d7f9a23b48b7b0bc7488382395f8ec4b0899bab5742ac54ba393c123d15bef256d8b8
6
+ metadata.gz: 7bd168b55e09f8b9fab8397c6a058098bca5f401eee8ad98d97016202e7c834d9df8fd4cb6894df4d5adb01f7ded2fe3d470f96ffb4b4fcf923cfccf0be65234
7
+ data.tar.gz: b7828d89e6aac779b28a3dd8a33f0b08b0ba4ba12c7b4a82252beab4a0232f88435532dd04cb583122f49a95e76eae94e20f60bfb7525b5aaf7818354110176f
data/README.md CHANGED
@@ -36,13 +36,31 @@ However, if you install the gem, you will get the latest updates and improvement
36
36
 
37
37
  ## Usage
38
38
 
39
- ### Install Tailwind CSS initializer
39
+ ### Install Tailwind CSS files
40
40
 
41
41
  ```bash
42
42
  bin/rails generate simple_form:theme:tailwind install
43
43
  ```
44
44
 
45
- ### Install Bulma CSS initializer
45
+ After running this generator, you will see the `config/initializers/simple_form_tailwindcss.rb` file.
46
+ This file adds the Tailwind CSS styles to your application.
47
+ Additionally, the `config/locales/simple_form_tailwind.en.yml` file will add the "required" mark to the required fields.
48
+ However, you need to communicate Tailwind to "watch" those files by adding the following configuration:
49
+
50
+ ```js
51
+ # tailwind.config.js
52
+
53
+ module.exports = {
54
+ ...
55
+ content: [
56
+ './config/initializers/simple_form_tailwindcss.rb',
57
+ './config/locales/simple_form*.yml',
58
+ ...
59
+ ],
60
+ }
61
+ ```
62
+
63
+ ### Install Bulma CSS files
46
64
 
47
65
  ```bash
48
66
  bin/rails generate simple_form:theme:bulma install
@@ -108,6 +108,17 @@ SimpleForm.setup do |config|
108
108
  b.use :hint, wrap_with: { tag: 'small', class: 'help' }
109
109
  end
110
110
 
111
+ # bulma vertical textarea field
112
+ config.wrappers :vertical_text_form, tag: 'div', class: 'field' do |b|
113
+ b.use :html5
114
+ b.use :placeholder
115
+ b.optional :readonly
116
+ b.use :label, class: 'label'
117
+ b.use :input, class: 'textarea', wrap_with: { tag: 'div', class: 'control' }, error_class: 'is-danger', valid_class: 'is-success'
118
+ b.use :full_error, wrap_with: { tag: 'div', class: 'help is-danger' }
119
+ b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
120
+ end
121
+
111
122
  # The default wrapper to be used by the FormBuilder.
112
123
  config.default_wrapper = :vertical_form
113
124
 
@@ -121,6 +132,7 @@ SimpleForm.setup do |config|
121
132
  file: :vertical_file,
122
133
  radio_buttons: :vertical_collection,
123
134
  range: :vertical_range,
124
- time: :vertical_multi_select
135
+ time: :vertical_multi_select,
136
+ text: :vertical_text_form
125
137
  }
126
138
  end
@@ -1,8 +1,6 @@
1
- Description:
2
- Install the simple form tailwindcss config file in your app.
3
-
4
- Example:
1
+ Install Command:
5
2
  bin/rails generate simple_form:theme:tailwind install
6
3
 
7
4
  This will create:
8
5
  config/initializers/simple_form_tailwindcss.rb
6
+ config/locales/
@@ -3,8 +3,27 @@
3
3
  class SimpleForm::Theme::TailwindGenerator < Rails::Generators::NamedBase
4
4
  source_root File.expand_path('templates', __dir__)
5
5
 
6
- desc 'Copy the tailwindcss initializer file for simple_form'
7
- def copy_initializer_file
6
+ desc 'Copy the tailwindcss files for simple_form'
7
+ def generate
8
+ install if install?
9
+ end
10
+
11
+ private
12
+
13
+ def install
14
+ copy_initializers
15
+ copy_locales
16
+ end
17
+
18
+ def install?
19
+ name == 'install'
20
+ end
21
+
22
+ def copy_initializers
8
23
  template 'config/initializers/simple_form_tailwindcss.rb', 'config/initializers/simple_form_tailwindcss.rb'
9
24
  end
25
+
26
+ def copy_locales
27
+ directory 'config/locales'
28
+ end
10
29
  end
@@ -0,0 +1,6 @@
1
+ en:
2
+ simple_form:
3
+ required:
4
+ text: 'required'
5
+ mark: '*'
6
+ html: '<abbr class="text-red-500 no-underline" title="required">*</abbr>'
@@ -1,5 +1,5 @@
1
1
  module SimpleForm
2
2
  module Theme
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,35 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Vasquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-06 00:00:00.000000000 Z
11
+ date: 2024-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 6.1.7
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
- version: 6.1.7.8
19
+ version: '6.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '7.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: 6.1.7
30
27
  - - ">="
31
28
  - !ruby/object:Gem::Version
32
- version: 6.1.7.8
29
+ version: '6.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '7.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: simple_form
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -70,6 +70,7 @@ files:
70
70
  - lib/generators/simple_form/theme/tailwind/USAGE
71
71
  - lib/generators/simple_form/theme/tailwind/tailwind_generator.rb
72
72
  - lib/generators/simple_form/theme/tailwind/templates/config/initializers/simple_form_tailwindcss.rb
73
+ - lib/generators/simple_form/theme/tailwind/templates/config/locales/simple_form_tailwind.en.yml
73
74
  - lib/simple_form/theme.rb
74
75
  - lib/simple_form/theme/engine.rb
75
76
  - lib/simple_form/theme/version.rb
@@ -90,6 +91,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
91
  - - ">="
91
92
  - !ruby/object:Gem::Version
92
93
  version: 2.6.0
94
+ - - "<"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.1'
93
97
  required_rubygems_version: !ruby/object:Gem::Requirement
94
98
  requirements:
95
99
  - - ">="