bamboo_legals 0.0.5 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb287870d4b55b1a46bafbd56ce0cc6451346a6e
4
- data.tar.gz: da17ea582e17f956b30c4a2b542b3dc6e793502c
3
+ metadata.gz: 928113bb4a58d8824f2148c11de321a9d082a448
4
+ data.tar.gz: 497357ac00a05c577aaacaef87bf68b5e25d33e5
5
5
  SHA512:
6
- metadata.gz: 8204a3e38cc1a6ab5d6b60121ff54e6238f3250a0e5bfe53efe14c4842f68cf25be3941649e366fe2fba4229adba5ef17b9927eda941666871876264aadf2d25
7
- data.tar.gz: cd0425a810878258b70ed22657eb0a01a8bcf7bed17ddb744f64cf473c79b3848ffb7c1f981a803f7d62305d5ec346f4fa8a6db6e6f7e449a72fd614bf80a063
6
+ metadata.gz: a8c9cab594bacc8b84a46a69be08c77becd15fc9011de37e796a37e826ccbed3eb6b69e55a3ef078be64d1246a0f15ffe600711c67811cdb91f59480f8d46d2c
7
+ data.tar.gz: fd7f450405a6ecbbed3a853bf9f794265bd4f8f19d9cfe3e015fd914a7f5d9620e1f72e7d839b349115683a8b0ffd89fd4d357c3cbdf3236ae38ce728b084c15
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bamboo_legals
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mislav Kvesić
@@ -17,12 +17,6 @@ executables:
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - bamboo_legals_lib/generators/controller.rb
21
- - bamboo_legals_lib/generators/manual.rb
22
- - bamboo_legals_lib/generators/migration.rb
23
- - bamboo_legals_lib/generators/model.rb
24
- - bamboo_legals_lib/generators/routes.rb
25
- - bamboo_legals_lib/generators/views.rb
26
20
  - bin/add_bamboo_legals
27
21
  homepage: https://rubygems.org/gems/bamboo_legals
28
22
  licenses:
@@ -1,21 +0,0 @@
1
- def create_admin_controller(type)
2
- # find the legal controller
3
- controller_path = "app/controllers/admin/legals_controller.rb"
4
- template_controller_path = "bamboo_legals/bamboo_legals_lib/templates/#{type}/admin_legals_controller.txt"
5
-
6
- new_controller_text = File.open(template_controller_path).read
7
- File.write(controller_path, new_controller_text)
8
-
9
- puts "++ Created -> #{controller_path}"
10
- end
11
-
12
- def create_controller(type)
13
- # find the legal controller
14
- controller_path = "app/controllers/legals_controller.rb"
15
- template_controller_path = "bamboo_legals/bamboo_legals_lib/templates/#{type}/legals_controller.txt"
16
-
17
- new_controller_text = File.open(template_controller_path).read
18
- File.write(controller_path, new_controller_text)
19
-
20
- puts "++ Created -> #{controller_path}"
21
- end
@@ -1,47 +0,0 @@
1
- def print_manual(type)
2
- puts ""
3
- puts "++ Add locales"
4
- puts """
5
- admin_nav:
6
- legals: \"Legal Pages\"
7
-
8
- activerecord:
9
- attributes:
10
- legal:
11
- is_visible: \"Page is visible?\"
12
- title: \"Title\"
13
- content: \"Content\"
14
- created_at: \"Created at\"
15
- errors:
16
- models:
17
- legal:
18
- attributes:
19
- title:
20
- blank: \"Title can't be blank!\"
21
- content:
22
- blank: \"Content can't be blank!\"
23
- """
24
- puts ""
25
- puts "++ Add to app/views/layouts/admin/_navigation.html.erb"
26
- puts """
27
- <% if current_admin.permitted?(:legals) %>
28
- <%= active_link_to admin_legals_path, class: 'sidebar__link', active: :inclusive, class_active: 'active-link' do %>
29
- <%= inline_svg \"icons/nav/court.svg\", class: 'sidebar__icon', width: 16, height: 16 %>
30
- <%= t(\"admin_nav.legals\") %>
31
- <% end %>
32
- <% end %>
33
- """
34
- if type == "multilingual"
35
- puts ""
36
- puts "++ Maybe you are missing some helpers..."
37
- puts """
38
- look here: https://gitlab.com/bamboolab/b4b/-/blob/master/app/helpers/admin/language_helper.rb
39
- """
40
- end
41
-
42
- puts ""
43
- puts "++ Run"
44
- puts """
45
- rake db:migrate
46
- """
47
- end
@@ -1,21 +0,0 @@
1
- def overwrite_migration
2
- # find the legal migration
3
- migrations_path = "db/migrate/"
4
- migration_path = "#{migrations_path}#{Dir.entries(migrations_path).grep(/_create_legals.rb$/).first}"
5
-
6
- new_migration_text = ""
7
- migration = File.open(migration_path).read
8
- migration.each_line do |line|
9
- # add detault: true to migration
10
- if line.include?("t.boolean :is_visible")
11
- new_migration_text += " t.boolean :is_visible, default: true \n"
12
- else
13
- new_migration_text += line
14
- end
15
- end
16
-
17
- # rewrite the migration file
18
- File.write(migration_path, new_migration_text)
19
-
20
- puts "++ Changed -> #{migration_path}"
21
- end
@@ -1,20 +0,0 @@
1
- def overwrite_model(type)
2
- # find the legal model
3
- model_path = "app/models/legal.rb"
4
- template_model_path = "bamboo_legals/bamboo_legals_lib/templates/#{type}/legal.txt"
5
-
6
- new_model_text = File.open(template_model_path).read
7
- File.write(model_path, new_model_text)
8
-
9
- puts "++ Changed -> #{model_path}"
10
-
11
- if type == "multilingual"
12
- model_translation_path = "app/models/legal_translation.rb"
13
- template_model_translation_path = "bamboo_legals/bamboo_legals_lib/templates/#{type}/legal_translation.txt"
14
-
15
- new_model_translation_text = File.open(template_model_translation_path).read
16
- File.write(model_translation_path, new_model_translation_text)
17
-
18
- puts "++ Changed -> #{model_translation_path}"
19
- end
20
- end
@@ -1,28 +0,0 @@
1
- def overwrite_routes
2
- # find the routes
3
- route_path = "config/routes.rb"
4
-
5
- # text that will overwrite namespace :admin do
6
- to_add = """ resources :legals, only: [:show]
7
- namespace :admin do
8
- resources :legals, except: [:show] do
9
- collection { patch :sort }
10
- end
11
- """
12
-
13
- new_routes_text = ""
14
- routes = File.open(route_path).read
15
- routes.each_line do |line|
16
- # add routes for legal
17
- if line.include?("namespace :admin do")
18
- new_routes_text += to_add
19
- else
20
- new_routes_text += line
21
- end
22
- end
23
-
24
- # rewrite the routes file
25
- File.write(route_path, new_routes_text)
26
-
27
- puts "++ Changed -> #{route_path}"
28
- end
@@ -1,37 +0,0 @@
1
- def create_admin_views(type)
2
- admin_view_dir_path = 'app/views/admin/legals/'
3
-
4
- # create directory for legal views in admin
5
- Dir.mkdir admin_view_dir_path
6
-
7
- # find all template views
8
- template_views_path = "bamboo_legals/bamboo_legals_lib/templates/#{type}/admin_views/"
9
- Dir.entries(template_views_path).each do |template|
10
- next if template == "." or template == ".."
11
-
12
- new_text = File.open("#{template_views_path}#{template}").read
13
- new_file_name = "#{admin_view_dir_path}#{template.split(".")[0]}.html.erb"
14
- File.write(new_file_name, new_text)
15
-
16
- puts "++ Created -> #{new_file_name}"
17
- end
18
- end
19
-
20
- def create_views(type)
21
- view_dir_path = 'app/views/legals/'
22
-
23
- # create directory for legal views
24
- Dir.mkdir view_dir_path
25
-
26
- # find all template views
27
- template_views_path = "bamboo_legals/bamboo_legals_lib/templates/#{type}/views/"
28
- Dir.entries(template_views_path).each do |template|
29
- next if template == "." or template == ".."
30
-
31
- new_text = File.open("#{template_views_path}#{template}").read
32
- new_file_name = "#{view_dir_path}#{template.split(".")[0]}.html.erb"
33
- File.write(new_file_name, new_text)
34
-
35
- puts "++ Created -> #{new_file_name}"
36
- end
37
- end