rails_app_generator 0.3.4 → 0.3.6
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 +4 -4
- data/CHANGELOG.md +14 -0
- data/after_templates/addons/view_component/_.rb +4 -2
- data/after_templates/addons/view_component/app/components/price_card_component.html.erb +2 -3
- data/after_templates/addons/view_component/app/components/price_card_component.rb +5 -0
- data/after_templates/addons/view_component/app/components/price_chart_component.rb +9 -2
- data/after_templates/addons/view_component/app/controllers/home_controller.rb +10 -5
- data/after_templates/addons/view_component/app/helpers/price_chart_helper.rb +5 -0
- data/after_templates/addons/view_component/app/views/home/component.html.erb +5 -1
- data/after_templates/addons/view_component/app/views/home/partial.html.erb +20 -1
- data/docs/last_run/app_generator_data.json +1 -1
- data/docs/last_run/rails_options_data.json +1 -1
- data/lib/rails_app_generator/version.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- data/profiles/addons/view_component.json +2 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2db7a0850cb6996121db353e0cd6a1cbd0960e1be4c3249a1b155f6c2f6b77f2
|
4
|
+
data.tar.gz: 81a48d9647584fee13d7f916c1034d565401e0926aa872dd8d2e115ab0d87ab8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99ad7530e704caba5bda6e6792d8b473854c96eecacc4dd5962b95c83c83c3361163a92702e3749356fcc2add74cc2f97e7ea49f89a0781501308959e3aa591d
|
7
|
+
data.tar.gz: ab84dfed5e50f4fbd1dfa0bc762911dea7ea73708ed2fbd1a84ef9d621de17abc602e100c1f8530abc0efb594f8c3f46a6840865b535ba87f5213933f452be36
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## [0.3.5](https://github.com/klueless-io/rails_app_generator/compare/v0.3.4...v0.3.5) (2022-10-17)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* update view_component profile ([fb94210](https://github.com/klueless-io/rails_app_generator/commit/fb94210aa704f0b24341529ab4b792a4d0bbd91a))
|
7
|
+
|
8
|
+
## [0.3.4](https://github.com/klueless-io/rails_app_generator/compare/v0.3.3...v0.3.4) (2022-10-06)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* update view_component profile ([218126a](https://github.com/klueless-io/rails_app_generator/commit/218126af5df49d1c2b4b05ad99ee8e8c97ee6fb1))
|
14
|
+
|
1
15
|
## [0.3.3](https://github.com/klueless-io/rails_app_generator/compare/v0.3.2...v0.3.3) (2022-10-05)
|
2
16
|
|
3
17
|
|
@@ -27,10 +27,12 @@ def setup_customizations
|
|
27
27
|
route("root 'home#index'")
|
28
28
|
|
29
29
|
force_copy
|
30
|
-
|
30
|
+
|
31
31
|
add_controller('home', 'index', 'partial', 'component')
|
32
|
-
|
32
|
+
|
33
|
+
directory "app/components"
|
33
34
|
directory "app/controllers"
|
35
|
+
directory "app/helpers"
|
34
36
|
directory "app/models"
|
35
37
|
directory "app/views"
|
36
38
|
template 'app/views/layouts/application.html.erb' , 'app/views/layouts/application.html.erb'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div class="
|
1
|
+
<div class="<%= card_class %>">
|
2
2
|
<div class="p-6">
|
3
3
|
<h2 class="text-lg font-medium leading-6 text-gray-900"><%= card.heading %></h2>
|
4
4
|
<p class="mt-4 text-sm text-gray-500"><%= card.description %></p>
|
@@ -11,9 +11,8 @@
|
|
11
11
|
<div class="px-6 pt-6 pb-8">
|
12
12
|
<h3 class="text-sm font-medium text-gray-900">What's included</h3>
|
13
13
|
<ul role="list" class="mt-6 space-y-4">
|
14
|
-
<%# Loop through items %>
|
15
14
|
<% card.items.each do |item| %>
|
16
|
-
<li class="flex space-x-3">
|
15
|
+
<li class="<flex space-x-3>">
|
17
16
|
<svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
18
17
|
<path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
|
19
18
|
</svg>
|
@@ -5,4 +5,9 @@ class PriceCardComponent < ViewComponent::Base
|
|
5
5
|
@card = card
|
6
6
|
super
|
7
7
|
end
|
8
|
+
|
9
|
+
def card_class
|
10
|
+
highlight = card.highlight == true ? 'border-7 border-red-500' : 'border-gray-200'
|
11
|
+
"divide-y divide-gray-200 rounded-lg border border-7 shadow-sm#{highlight}"
|
12
|
+
end
|
8
13
|
end
|
@@ -1,4 +1,9 @@
|
|
1
1
|
class PriceChartComponent < ViewComponent::Base
|
2
|
+
|
3
|
+
CARDS_TWO = 'mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-1 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl lg:max-w-none lg:grid-cols-2'
|
4
|
+
CARDS_ODD = 'mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-1 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl lg:max-w-none lg:grid-cols-3 xl:mx-0 xl:max-w-none xl:grid-cols-3'
|
5
|
+
CARDS_EVEN = 'mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-1 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl lg:max-w-none lg:grid-cols-2 xl:mx-0 xl:max-w-none xl:grid-cols-4'
|
6
|
+
|
2
7
|
def initialize(chart)
|
3
8
|
@chart = chart
|
4
9
|
|
@@ -7,7 +12,9 @@ class PriceChartComponent < ViewComponent::Base
|
|
7
12
|
end
|
8
13
|
|
9
14
|
def card_list_class
|
10
|
-
@chart.cards.length
|
11
|
-
|
15
|
+
return CARDS_TWO if @chart.cards.length == 2
|
16
|
+
return CARDS_ODD if @chart.cards.length.odd?
|
17
|
+
|
18
|
+
CARDS_EVEN
|
12
19
|
end
|
13
20
|
end
|
@@ -4,17 +4,22 @@ class HomeController < ApplicationController
|
|
4
4
|
|
5
5
|
def component
|
6
6
|
@pricing_data1 = pricing_data_poro
|
7
|
-
@pricing_data1.title = nil
|
7
|
+
@pricing_data1.title = nil # let the component set a default title
|
8
8
|
|
9
|
-
@pricing_data2 = pricing_data_poro
|
10
|
-
@pricing_data2.cards.
|
9
|
+
@pricing_data2 = pricing_data_poro(3)
|
10
|
+
@pricing_data2.cards[1].highlight = true # highlight the second card
|
11
|
+
|
12
|
+
@pricing_data3 = pricing_data_poro(2)
|
13
|
+
@pricing_data3.title = 'Only 2 Plans'
|
11
14
|
end
|
12
15
|
|
13
16
|
private
|
14
17
|
|
15
|
-
def pricing_data_poro
|
18
|
+
def pricing_data_poro(take_cards = nil)
|
19
|
+
data = pricing_data
|
20
|
+
data[:cards] = data[:cards].take(take_cards) if take_cards
|
16
21
|
# OpenStruct is not a good practice: But this makes the HASH and feel like a PORO model
|
17
|
-
JSON.parse(
|
22
|
+
JSON.parse(data.to_json, object_class: OpenStruct)
|
18
23
|
end
|
19
24
|
|
20
25
|
def pricing_data
|
@@ -3,4 +3,23 @@
|
|
3
3
|
<p class="mt-2 max-w-4xl text-sm text-gray-500">Use Rails Partials to hold the HTML</p>
|
4
4
|
</div>
|
5
5
|
|
6
|
-
<%= render 'price_container' %>
|
6
|
+
<%= render 'price_container' %>
|
7
|
+
|
8
|
+
<%#
|
9
|
+
NOTE: These classes are here so that tailwind pipeline sees that they are being used
|
10
|
+
|
11
|
+
If you put tailwind css into .rb files, they are not being seen by the transpiler
|
12
|
+
I need to investigate why this is?
|
13
|
+
%>
|
14
|
+
|
15
|
+
<div class='mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-1 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl lg:max-w-none lg:grid-cols-3 xl:mx-0 xl:max-w-none xl:grid-cols-3'>
|
16
|
+
</div>
|
17
|
+
<div class='mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-1 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl lg:max-w-none lg:grid-cols-3 xl:mx-0 xl:max-w-none xl:grid-cols-3'>
|
18
|
+
</div>
|
19
|
+
<div class='mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-1 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl lg:max-w-none lg:grid-cols-2 xl:mx-0 xl:max-w-none xl:grid-cols-4'>
|
20
|
+
</div>
|
21
|
+
<div class='border-2 lg:border-4 border-solid md:border-dashed lg:border-double xl:border-dotted 2xl:border-dashed border-red-500'>
|
22
|
+
</div>
|
23
|
+
<div class='divide-y divide-gray-200 rounded-lg border border-gray-200 border-7 shadow-sm border-2 border-red-500'>
|
24
|
+
</div>
|
25
|
+
<div class='border-7'>
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "rails_app_generator",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.6",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "rails_app_generator",
|
9
|
-
"version": "0.3.
|
9
|
+
"version": "0.3.6",
|
10
10
|
"dependencies": {
|
11
11
|
"daisyui": "^2.20.0"
|
12
12
|
},
|
data/package.json
CHANGED
@@ -2,11 +2,10 @@
|
|
2
2
|
"args": {
|
3
3
|
"app_path": "r7_view_component",
|
4
4
|
"destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/addons",
|
5
|
-
"when_folder_exist": "
|
5
|
+
"when_folder_exist": "keep_git"
|
6
6
|
},
|
7
7
|
"opts": {
|
8
|
-
"
|
9
|
-
"skip_test": true,
|
8
|
+
"skip_test": false,
|
10
9
|
"template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/view_component/_.rb",
|
11
10
|
"add_view_component": true,
|
12
11
|
"css": "tailwind",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_app_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootsnap
|
@@ -529,6 +529,7 @@ files:
|
|
529
529
|
- after_templates/addons/view_component/app/components/price_chart_component.html.erb
|
530
530
|
- after_templates/addons/view_component/app/components/price_chart_component.rb
|
531
531
|
- after_templates/addons/view_component/app/controllers/home_controller.rb
|
532
|
+
- after_templates/addons/view_component/app/helpers/price_chart_helper.rb
|
532
533
|
- after_templates/addons/view_component/app/services/seed_service.rb
|
533
534
|
- after_templates/addons/view_component/app/views/home/_price_card.html.erb
|
534
535
|
- after_templates/addons/view_component/app/views/home/_price_container.html.erb
|