bootswatch_rails 3.1.1.17 → 3.1.1.18

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
  SHA1:
3
- metadata.gz: 2d04615087e70ce8743038a4d74cb754d42a182e
4
- data.tar.gz: 2c88428f3bf5e07f4ad5db66e22baa29ad1a4866
3
+ metadata.gz: f3a9c23f41bdd82e2508421007ed2ff4c68e56c2
4
+ data.tar.gz: 459bb3beb51df32b7bd60ce0a3a722e537f8a25c
5
5
  SHA512:
6
- metadata.gz: 9cb8e2689a7e9aad47b43a9e8ebddb97036935e3544549160b299650ea744848743b5bf6b555385148c616c923eca49d8d1e245189c3c395682ed5ffa03531f7
7
- data.tar.gz: 5991a9c692c1b95b298d9f2851864dd0c928f18ef0aeb15b5e467b83eaaf87590d82a35f17d57c841af2a01a15e0acd90eaa4d8b6c453885284d3428b7fb6ca8
6
+ metadata.gz: 0ad3cf4e38f92147619b1c669dbed058426268282b07e57a66de3acbdbcb30385496a95510bc4e2e48bffc039d9ad55420bcc99e909979ce39833a7121dc842a
7
+ data.tar.gz: f98b4e619d82c612724bd2556154c60e3f944d9f44d8ae0bd33c0ef7ab53902c304a2e1f4b7472c2df7edf6807f21f23e6795e45f171326ddc3034d7a27616e3
@@ -1,5 +1,5 @@
1
1
  module BootswatchRails
2
- VERSION = "3.1.1.17"
2
+ VERSION = "3.1.1.18"
3
3
  THEMES = [:amelia, :cerulean, :cosmo, :custom, :cyborg, :darkly, :flatly, :journal, :lumen, :readable, :simplex, :slate, :spacelab, :superhero, :united, :yeti]
4
4
  DEFAULT = 1
5
5
  end
@@ -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.17
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