hotwire_datepicker 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 924d33b9fd84023bc6f22ba3a53dd9b160c85d5e542102d3f674628d7bc2c95a
4
+ data.tar.gz: a571e6434eae6b66c22cf706367b616ce6dfd240d76e3d48a8dfeb9ff15673d3
5
+ SHA512:
6
+ metadata.gz: daaa80ae5b59bb1f7a08360290e3b1e2fae3000f5b61ab16410af8bd9b87d0aeadc1ebac32c5e725ccdc6fb9ba7d231b7d7ac1812eb31634550f2df5f09b3ca7
7
+ data.tar.gz: 436d1cafdbff909246cea2f21d7ee59450e7b79d499a96b1d740818e38fe187a60915073fa29487e790ae0a78fca177b96af847c81778d92c0ba9a6c16484b57
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # HotwireDatepicker
2
+
3
+ This project is HEAVILY, - at first, influenced by [HotwireCombobox](https://github.com/josefarias/hotwire_combobox).
4
+
5
+ TODO: Delete this and the text below, and describe your gem
6
+
7
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/hotwire_datepicker`. To experiment with that code, run `bin/console` for an interactive prompt.
8
+
9
+ ## Installation
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ $ bundle add hotwire_datepicker
14
+
15
+ If bundler is not being used to manage dependencies, install the gem by executing:
16
+
17
+ $ gem install hotwire_datepicker
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Development
24
+
25
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
+
27
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/RickHPotter/hotwire_datepicker. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/hotwire_datepicker/blob/master/CODE_OF_CONDUCT.md).
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
36
+
37
+ ## Code of Conduct
38
+
39
+ Everyone interacting in the HotwireDatepicker project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/RickHPotter/hotwire_datepicker/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[test rubocop]
@@ -0,0 +1,2 @@
1
+ //= link_directory ../stylesheets .css
2
+ //= link_tree ../javascripts .js
File without changes
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ pin_all_from File.expand_path("../app/assets/javascripts", __dir__)
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HotwireDatepicker
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace HotwireDatepicker
6
+
7
+ initializer "hotwire_datepicker.view_helpers" do
8
+ ActiveSupport.on_load :action_view do
9
+ require "hotwire_datepicker/helper"
10
+ ActionView::Base.include HotwireDatepicker::Helper
11
+
12
+ unless HotwireDatepicker.bypass_convenience_methods?
13
+ module FormBuilderExtensions
14
+ def datepicker(*args, **kwargs, &block)
15
+ @template.hw_datepicker_tag(*args, **kwargs.merge(form: self), &block)
16
+ end
17
+ end
18
+
19
+ ActionView::Helpers::FormBuilder.include FormBuilderExtensions
20
+ end
21
+ end
22
+ end
23
+
24
+ initializer "hotwire_datepicker.importmap", before: "importmap" do |app|
25
+ if Rails.application.respond_to?(:importmap)
26
+ app.config.importmap.paths << Engine.root.join("config/hw_importmap.rb")
27
+ end
28
+ end
29
+
30
+ initializer "hotwire_datepicker.assets.precompile" do |app|
31
+ app.config.assets.precompile << "hw_datepicker_manifest.js" if Rails.application.config.respond_to?(:assets)
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HotwireDatepicker
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HotwireDatepicker
4
+ module ViewHelpers
5
+ class << self
6
+ delegate :bypass_convenience_methods?, to: :HotwireDatepicker
7
+
8
+ def hw_alias(method_name)
9
+ unless bypass_convenience_methods?
10
+ alias_method method_name.to_s.sub(/^hw_/, ""), method_name
11
+ end
12
+ end
13
+ end
14
+
15
+ def datepicker_tag(name, value = nil, **options, &block)
16
+ options[:html][:class] ||= ""
17
+ options[:html][:class] += " datepicker"
18
+ text_field_tag(name, value, options, &block)
19
+ end
20
+
21
+ def hw_datepicker_style_tag(*args, **kwargs)
22
+ stylesheet_link_tag HotwireDatepicker.stylesheet_path, *args, **kwargs
23
+ end
24
+
25
+ hw_alias :hw_datepicker_style_tag
26
+ hw_alias :hw_datepicker_tag
27
+ end
28
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "hotwire_datepicker/version"
4
+ require_relative "hotwire_datepicker/engine"
5
+
6
+ module HotwireDatepicker
7
+ mattr_accessor :bypass_convenience_methods
8
+ @@bypass_convenience_methods = false
9
+
10
+ class << self
11
+ def setup
12
+ yield self
13
+ end
14
+
15
+ def bypass_convenience_methods?
16
+ bypass_convenience_methods
17
+ end
18
+
19
+ def stylesheet_path
20
+ "hotwire_datepicker"
21
+ end
22
+ end
23
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hotwire_datepicker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Rick Potter
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-05-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '7.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '7.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: stimulus-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: turbo-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ description: A datecpicker exclusively for Rails apps with Hotwire and Stimulus.
56
+ email:
57
+ - luisfla55@hotmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - README.md
63
+ - Rakefile
64
+ - app/assets/config/hw_datepicker_manifest.js
65
+ - app/assets/stylesheets/hotwire_datepicker.css
66
+ - config/hw_importmap.rb
67
+ - lib/hotwire_datepicker.rb
68
+ - lib/hotwire_datepicker/engine.rb
69
+ - lib/hotwire_datepicker/version.rb
70
+ - lib/hotwire_datepicker/view_helpers.rb
71
+ homepage: https://github.com/RickHPotter/hotwire_datepicker
72
+ licenses:
73
+ - MIT
74
+ metadata:
75
+ homepage_uri: https://github.com/RickHPotter/hotwire_datepicker
76
+ source_code_uri: https://github.com/RickHPotter/hotwire_datepicker
77
+ changelog_uri: https://github.com/RickHPotter/hotwire_datepicker/releases
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 3.0.0
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubygems_version: 3.4.1
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Multi-purpose datepicker for Rails apps
97
+ test_files: []