bootswatch_rails 3.1.1.17 → 3.1.1.18
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3a9c23f41bdd82e2508421007ed2ff4c68e56c2
|
4
|
+
data.tar.gz: 459bb3beb51df32b7bd60ce0a3a722e537f8a25c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ad3cf4e38f92147619b1c669dbed058426268282b07e57a66de3acbdbcb30385496a95510bc4e2e48bffc039d9ad55420bcc99e909979ce39833a7121dc842a
|
7
|
+
data.tar.gz: f98b4e619d82c612724bd2556154c60e3f944d9f44d8ae0bd33c0ef7ab53902c304a2e1f4b7472c2df7edf6807f21f23e6795e45f171326ddc3034d7a27616e3
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
module BootswatchRails
|
4
|
+
module Generators
|
5
|
+
class BootsyGenerator < ActiveRecord::Generators::Base
|
6
|
+
desc "Turn text_area(s) into bootsy_area(s)"
|
7
|
+
argument :name, type: :string,
|
8
|
+
desc: "The resource that will have bootsy_areas"
|
9
|
+
argument :columns, type: :array, banner: "COLUMN [...]",
|
10
|
+
desc: "The names of the text attributes to be converted"
|
11
|
+
class_option :before, type: :boolean, default: false,
|
12
|
+
desc: 'Add a line before generated text in model'
|
13
|
+
class_option :after, type: :boolean, default: false,
|
14
|
+
desc: 'Add a line after generated text in model'
|
15
|
+
class_option :permit, type: :boolean, default: true,
|
16
|
+
desc: 'Allow mass assignment for bootsy_image_gallery_id'
|
17
|
+
|
18
|
+
def add_to_model
|
19
|
+
inject_into_class "app/models/#{name}.rb", class_name do
|
20
|
+
text = options.before? ? "\n" : ""
|
21
|
+
text << " include Bootsy::Container\n"
|
22
|
+
text << "\n" if options.after?
|
23
|
+
text
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def add_to_permit
|
28
|
+
return unless options.permit?
|
29
|
+
text = ":bootsy_image_gallery_id"
|
30
|
+
file = "app/controllers/#{table_name}_controller.rb"
|
31
|
+
gsub_file file, /(permit\(.*)\)/, "\\1, #{text})"
|
32
|
+
# Special case: no previous permit
|
33
|
+
gsub_file file, /^(\s*params)\[:#{name}\]$/, "\\1.require(:#{name}).permit(#{text})"
|
34
|
+
end
|
35
|
+
|
36
|
+
def add_to_view
|
37
|
+
file = "app/views/#{table_name}/_form.html.erb"
|
38
|
+
columns.each do |column|
|
39
|
+
gsub_file file, /(input :#{column}) /, "\\1, as: :bootsy, rows: 12 "
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootswatch_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.1.
|
4
|
+
version: 3.1.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Volker Wiegand
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/bootswatch_rails.rb
|
86
86
|
- lib/bootswatch_rails/engine.rb
|
87
87
|
- lib/bootswatch_rails/version.rb
|
88
|
+
- lib/generators/bootswatch_rails/bootsy/bootsy_generator.rb
|
88
89
|
- lib/generators/bootswatch_rails/carrierwave/carrierwave_generator.rb
|
89
90
|
- lib/generators/bootswatch_rails/carrierwave/templates/carrierwave_migration.rb
|
90
91
|
- lib/generators/bootswatch_rails/carrierwave/templates/document_uploader.rb
|