bulma-phlex-rails 0.1.0 → 0.2.0
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/lib/bulma-phlex-rails.rb +1 -5
- data/lib/bulma_phlex/rails/engine.rb +18 -0
- data/lib/bulma_phlex/rails/helpers/card_helper.rb +37 -0
- data/lib/bulma_phlex/rails/helpers/table_helper.rb +24 -0
- data/lib/bulma_phlex/rails/version.rb +7 -0
- data/lib/bulma_phlex/rails.rb +23 -0
- metadata +64 -5
- data/lib/bulma_phlex_rails/engine.rb +0 -6
- data/lib/bulma_phlex_rails/version.rb +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ad0e3e804dc9faff6ac9cbdf36b8b037584553ed9abfbcf3419e71d59a303b27
|
|
4
|
+
data.tar.gz: c2a35b63fe132af025e3560e4e020e0fcd9659f45befdf93d2d4ece1cc13120c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4aa3c95dd7418630d1095174a9c856c68389f4497e7c771321915739e91c4760c9676e524b5151f1ec12b827ef44a73ea54a374ff22f870dc2f851ba4c78db5c
|
|
7
|
+
data.tar.gz: f1a842f1c1c6af94222373b104d507578263eecb0d61f5770244f9bb2649a76b8f5fe28df7e93971eac88cca1a988afc709694558dfddc9a77692cfaa257d8c0
|
data/lib/bulma-phlex-rails.rb
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails/engine"
|
|
4
|
+
|
|
5
|
+
module BulmaPhlex
|
|
6
|
+
module Rails
|
|
7
|
+
# Rails Engine for BulmaPhlex
|
|
8
|
+
class Engine < ::Rails::Engine
|
|
9
|
+
initializer "bulma_phlex.rails.importmap", before: "importmap" do |app|
|
|
10
|
+
app.config.importmap.paths << Engine.root.join("config/importmap.rb")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
initializer "bulma_phlex.rails.assets" do |app|
|
|
14
|
+
app.config.assets.paths << root.join("app/javascript")
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module BulmaPhlex
|
|
4
|
+
module Rails
|
|
5
|
+
# # Card Helper
|
|
6
|
+
#
|
|
7
|
+
# This module provides method `turbo_frame_content` to create a card with a turbo frame as its content.
|
|
8
|
+
module CardHelper
|
|
9
|
+
extend ActiveSupport::Concern
|
|
10
|
+
|
|
11
|
+
included do
|
|
12
|
+
include Phlex::Rails::Helpers::TurboFrameTag
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Renders a Bulma-styled card with a Turbo Frame as its content. This uses the same signatures as
|
|
16
|
+
# `turbo_frame_tag`, with the addition of two optional attributes: `pending_message` and `pending_icon`.
|
|
17
|
+
#
|
|
18
|
+
# The two pending attributes have the following defaults:
|
|
19
|
+
# - pending_message: "Loading..."
|
|
20
|
+
# - pending_icon: "fas fa-spinner fa-pulse"
|
|
21
|
+
def turbo_frame_content(*ids, src: nil, target: nil, **attributes)
|
|
22
|
+
pending_message = attributes.delete(:pending_message) || "Loading..."
|
|
23
|
+
pending_icon = attributes.delete(:pending_icon) || "fas fa-spinner fa-pulse"
|
|
24
|
+
|
|
25
|
+
content do
|
|
26
|
+
turbo_frame_tag ids, src: src, target: target, **attributes do
|
|
27
|
+
span(class: "icon") { i class: pending_icon }
|
|
28
|
+
span { plain pending_message }
|
|
29
|
+
end
|
|
30
|
+
# rescue StandardError => e
|
|
31
|
+
# puts "Error in turbo_frame_content: #{e.message}"
|
|
32
|
+
# puts e.args
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module BulmaPhlex
|
|
4
|
+
module Rails
|
|
5
|
+
# # Table Helper
|
|
6
|
+
#
|
|
7
|
+
# This module provides method `amount_column` to create an amount column in a table.
|
|
8
|
+
module TableHelper
|
|
9
|
+
extend ActiveSupport::Concern
|
|
10
|
+
|
|
11
|
+
included do
|
|
12
|
+
include Phlex::Rails::Helpers::NumberToCurrency
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def amount_column(header, currency: {}, **html_attributes, &content)
|
|
16
|
+
html_attributes[:class] = [html_attributes[:class], "has-text-right"].compact.join(" ")
|
|
17
|
+
|
|
18
|
+
column(header, **html_attributes) do |row|
|
|
19
|
+
number_to_currency(content.call(row), **currency)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "action_view"
|
|
4
|
+
require "bulma-phlex"
|
|
5
|
+
require "phlex-rails"
|
|
6
|
+
require "zeitwerk"
|
|
7
|
+
|
|
8
|
+
module BulmaPhlex
|
|
9
|
+
# The Rails namespace provides Bulma Phlex components and helpers for integration with Ruby on Rails applications.
|
|
10
|
+
module Rails
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
loader = Zeitwerk::Loader.for_gem_extension(BulmaPhlex)
|
|
15
|
+
loader.collapse("#{__dir__}/rails/components")
|
|
16
|
+
loader.collapse("#{__dir__}/rails/helpers")
|
|
17
|
+
loader.setup
|
|
18
|
+
|
|
19
|
+
require "bulma_phlex/rails/engine"
|
|
20
|
+
|
|
21
|
+
# Rails-specific extensions to BulmaPhlex components
|
|
22
|
+
BulmaPhlex::Card.include(BulmaPhlex::Rails::CardHelper) if defined?(Turbo)
|
|
23
|
+
BulmaPhlex::Table.include(BulmaPhlex::Rails::TableHelper)
|
metadata
CHANGED
|
@@ -1,14 +1,70 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bulma-phlex-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Todd Kummer
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
-
dependencies:
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: actionpack
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '7.2'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '7.2'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: bulma-phlex
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 0.8.0
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: 0.8.0
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: phlex-rails
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '2.3'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '2.3'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: railties
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '7.2'
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '7.2'
|
|
12
68
|
description: Create forms with Bulma CSS framework styles using Phlex components in
|
|
13
69
|
your Rails applications.
|
|
14
70
|
email:
|
|
@@ -18,8 +74,11 @@ extensions: []
|
|
|
18
74
|
extra_rdoc_files: []
|
|
19
75
|
files:
|
|
20
76
|
- lib/bulma-phlex-rails.rb
|
|
21
|
-
- lib/
|
|
22
|
-
- lib/
|
|
77
|
+
- lib/bulma_phlex/rails.rb
|
|
78
|
+
- lib/bulma_phlex/rails/engine.rb
|
|
79
|
+
- lib/bulma_phlex/rails/helpers/card_helper.rb
|
|
80
|
+
- lib/bulma_phlex/rails/helpers/table_helper.rb
|
|
81
|
+
- lib/bulma_phlex/rails/version.rb
|
|
23
82
|
homepage: https://github.com/RockSolt/bulma-phlex-rails
|
|
24
83
|
licenses:
|
|
25
84
|
- MIT
|
|
@@ -33,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
33
92
|
requirements:
|
|
34
93
|
- - ">="
|
|
35
94
|
- !ruby/object:Gem::Version
|
|
36
|
-
version: 3.
|
|
95
|
+
version: '3.4'
|
|
37
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
97
|
requirements:
|
|
39
98
|
- - ">="
|