countries_regions_and_cities_by_peterconsuegra 0.2.0 → 0.2.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a95c8003c1bbb397d3ed8ae71a0678c951ebe14538d2528b155cefc4b85a28a1
|
4
|
+
data.tar.gz: 214b0e0d0daf9f1305075d4c74c3f39e4aeb9983ac85707a516181e0d3cd1aab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8c93452f55c5fe3aca838ffc5c0d340fec69fdffad5605b82f10b4203870158c4c23e403779b3661cb0e3607289180f079119ab7ac983f86f894abb38013e15
|
7
|
+
data.tar.gz: 61962df939c85c792fec18d8951cc13bc380a046c49da3e6f622503fa2718dd1e730a41f1af1e07d3e3b75a28bdc10797acb19ba4d9e0ec926479d317a471186
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# Countries Regions And Cities By Peter Consuegra
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
An agile way to implement Countries, Regions and Cities in your project, without the need to create additional tables
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -16,23 +14,46 @@ And then execute:
|
|
16
14
|
|
17
15
|
$ bundle install
|
18
16
|
|
19
|
-
|
17
|
+
Run the rake command to generate the necessary files:
|
18
|
+
|
19
|
+
$ bundle exec rake 'install_countries_regions_and_cities_to_model[your_model_name]'
|
20
|
+
|
21
|
+
|
22
|
+
Rails
|
23
|
+
===============
|
24
|
+
|
25
|
+
Add this code to the _form.html.erb partial of your_model_name form
|
26
|
+
|
27
|
+
```
|
28
|
+
|
29
|
+
<div class="field" id="country_field">
|
30
|
+
<%= render partial: 'shared/peterconsuegra_country_select', locals: {model: form.object.class.name.downcase, label: "Country", selected: form.object.country} %>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<div class="field" id="region_field">
|
34
|
+
<%= render partial: 'shared/peterconsuegra_region_select', locals: {model: form.object.class.name.downcase, label: "Region / State", selected_country: form.object.country, selected: form.object.region} %>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div class="field" id="city_field">
|
38
|
+
<%= render partial: 'shared/peterconsuegra_city_select', locals: {model: form.object.class.name.downcase, label: "City", selected_region: form.object.region, selected_country: form.object.country, selected: form.object.city} %>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
|
42
|
+
```
|
20
43
|
|
21
|
-
|
44
|
+
Video Tutorial
|
45
|
+
===============
|
22
46
|
|
23
|
-
|
47
|
+
Watch this video to see how it works
|
24
48
|
|
25
|
-
|
49
|
+
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg)](https://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)
|
26
50
|
|
27
|
-
## Development
|
28
51
|
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
52
|
|
31
|
-
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).
|
32
53
|
|
33
54
|
## Contributing
|
34
55
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
56
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/peterconsuegra/countries_regions_and_cities. 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]/countries_regions_and_cities_by_peterconsuegra/blob/master/CODE_OF_CONDUCT.md).
|
36
57
|
|
37
58
|
## Code of Conduct
|
38
59
|
|
@@ -4,6 +4,7 @@ module PeterConsuegraRecipes
|
|
4
4
|
|
5
5
|
def self.move_templates(src_folder,dest_folder,files)
|
6
6
|
files.each do |file_name|
|
7
|
+
puts "src_folder: #{src_folder} dest_folder: #{dest_folder}".blue
|
7
8
|
FileUtils.cp(src_folder+file_name,dest_folder+file_name)
|
8
9
|
puts "file copied to: #{dest_folder+file_name}".green
|
9
10
|
end
|
@@ -8,6 +8,9 @@ task :install_countries_regions_and_cities_to_model, [:model] do |t, args|
|
|
8
8
|
rails_app_folder = Dir.pwd
|
9
9
|
gem_folder = File.expand_path('../../../.', __FILE__)
|
10
10
|
|
11
|
+
puts "rails_app_folder: #{rails_app_folder}"
|
12
|
+
puts "gem_folder: #{gem_folder}"
|
13
|
+
|
11
14
|
#adding partials
|
12
15
|
dest_folder="#{rails_app_folder}/app/views/shared/"
|
13
16
|
src_folder="#{gem_folder}/templates/"
|
@@ -25,7 +28,6 @@ task :install_countries_regions_and_cities_to_model, [:model] do |t, args|
|
|
25
28
|
PeterConsuegraRecipes::append_before_last_appearance_of("end",'get "get_cities", to: "peterconsuegra_countries_regions_and_cities#get_cities"',file)
|
26
29
|
|
27
30
|
#adding migration to model
|
28
|
-
puts "table name:"
|
29
31
|
model = args[:model]
|
30
32
|
model = model.capitalize
|
31
33
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: countries_regions_and_cities_by_peterconsuegra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Consuegra
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carmen
|