scaffold-bootstrap3 0.0.1

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,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MzY3YzcyYjgzYjg3Mzg1YWIyY2JhODM1MjI1ODRhMGE0Zjg2ODQ1Zg==
5
+ data.tar.gz: !binary |-
6
+ Y2U3OWIxZDAxZGI1NTYwNzlmOGMyMWUyNzQ2NTQ0MDYxMmM2ZGU3NA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NjIzMzdkZjQxOTQ4NzdlNWVlNDQzZGRkMDFiZjY0YjkxNDQ2NmQ4ZDk0NjI1
10
+ MWI3ZWY2Yjc3NDFhMzhkNzU1ODY3MjMzYzJjOTk1MmFmYzRiMzg5OGJmOTFi
11
+ NzM5ZTIxNzViNjNhZmU0YTgxN2U1ZmE2YzEzNDE5MDk5MmFmM2I=
12
+ data.tar.gz: !binary |-
13
+ NzQ5YjVjYTFlYTUyYmRmZTAwNjdjMDZiMjRhNDBlZThjZjYwNzI5ZDYzZjMy
14
+ ZjBjNWIwMzFmNDMyY2M2NmFmMjg5YWNmNWZmZmI4OTUyYjZjZDg3YjA3MmQx
15
+ OTA2M2NkYmMzZjE1NWM1MjA3NDg1MDhjYzVhN2RhYzY4Mzg0YTg=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in scaffold-bootstrap3.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Paul Sutcliffe
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Scaffold::Bootstrap3
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'scaffold-bootstrap3'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install scaffold-bootstrap3
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'scaffold/bootstrap3'
@@ -0,0 +1,16 @@
1
+ require 'rails/generators/erb/controller/controller_generator'
2
+
3
+ module Haml
4
+ module Generators
5
+ class ControllerGenerator < Erb::Generators::ControllerGenerator
6
+ source_root File.expand_path("../templates", __FILE__)
7
+
8
+ protected
9
+
10
+ def handler
11
+ :haml
12
+ end
13
+
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ #region-<%= class_name %>.container
2
+ .region
3
+ .region-title
4
+ %h1= page_title!('<%= @action %>')
5
+
6
+ .region
7
+ %p Aquí va el contenido...
@@ -0,0 +1,16 @@
1
+ require 'generators/haml/controller/controller_generator'
2
+
3
+ module Haml
4
+ module Generators
5
+ class MailerGenerator < ControllerGenerator
6
+ source_root File.expand_path("../templates", __FILE__)
7
+
8
+ protected
9
+
10
+ def format
11
+ :text
12
+ end
13
+
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ <%= class_name %>#<%= @action %>
2
+
3
+ = @greeting + ", find me in <%= @path %>"
@@ -0,0 +1,36 @@
1
+ require 'rails/generators/erb/scaffold/scaffold_generator'
2
+
3
+ module Haml
4
+ module Generators
5
+ class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
6
+ source_root File.expand_path("../templates", __FILE__)
7
+
8
+ def copy_view_files
9
+ available_views.each do |view|
10
+ filename = filename_with_extensions(view)
11
+ template "#{view}.html.haml", File.join("app/views", controller_file_path, filename)
12
+ end
13
+ end
14
+
15
+ hook_for :form_builder, :as => :scaffold
16
+
17
+ def copy_form_file
18
+ if options[:form_builder].nil?
19
+ filename = filename_with_extensions("_form")
20
+ template "_form.html.haml", File.join("app/views", controller_file_path, filename)
21
+ end
22
+ end
23
+
24
+ protected
25
+
26
+ def available_views
27
+ %w(index edit show new)
28
+ end
29
+
30
+ def handler
31
+ :haml
32
+ end
33
+
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,16 @@
1
+ = form_for @<%= singular_table_name %>, :html => { class: 'form-horizontal', role: 'fordb/migrate/20131119172026_create_diseños.rbm' } do |f|
2
+ - if @<%= singular_table_name %>.errors.any?
3
+ #error_explanation
4
+ %h2= "#{pluralize(@<%= singular_table_name %>.errors.count, "error")}"
5
+ %ul
6
+ - @<%= singular_table_name %>.errors.full_messages.each do |msg|
7
+ %li= msg
8
+
9
+ <% for attribute in attributes -%>
10
+ .form-group
11
+ = f.label :<%= attribute.name %>, class: 'col-sm-2 control-label'
12
+ .col-sm-10
13
+ = f.<%= attribute.field_type %> :<%= attribute.name %>, class: 'form-control'
14
+ <% end -%>
15
+ .actions
16
+ = f.submit 'Guardar', class: 'btn btn-default'
@@ -0,0 +1,18 @@
1
+ - page_title!('Editando <%= singular_table_name %>')
2
+
3
+ #region-<%= plural_table_name %>.container
4
+
5
+ .region
6
+ .region-title
7
+ %h1
8
+ Editando
9
+ %b
10
+ <%= singular_table_name %>
11
+
12
+ .region
13
+ = render 'form'
14
+
15
+ .region
16
+ .admin-controls
17
+ = link_to 'Ver', @<%= singular_table_name %>, class: 'btn btn-info'
18
+ = link_to 'Regresar', 'javascript:history.back(-1)', class: 'btn btn-warning'
@@ -0,0 +1,30 @@
1
+ #region-<%= plural_table_name %>.container
2
+
3
+ .region
4
+ .region-title
5
+ %h1= page_title!('Listando <%= plural_table_name %>')
6
+
7
+ .region
8
+ - if current_admin
9
+ .admin-control
10
+ = link_to 'Crear <%= human_name %>', new_<%= singular_table_name %>_path, class: 'btn btn-primary'
11
+
12
+ .table-responsive
13
+ %table.table
14
+ %tr
15
+ <% for attribute in attributes -%>
16
+ %th <%= attribute.human_name %>
17
+ <% end -%>
18
+ %th
19
+ %th
20
+ %th
21
+
22
+ - @<%= plural_table_name %>.each do |<%= singular_table_name %>|
23
+ %tr
24
+ <% for attribute in attributes -%>
25
+ %td= <%= singular_table_name %>.<%= attribute.name %>
26
+ <% end -%>
27
+ %td= link_to 'Ver', <%= singular_table_name %>, class: 'btn btn-info'
28
+ - if current_admin
29
+ %td= link_to 'Editar', edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'btn btn-success'
30
+ %td= link_to 'Eliminar', <%= singular_table_name %>, :method => :delete, :data => { :confirm => '¿Estás Seguro?' }, class: 'btn btn-danger'
@@ -0,0 +1,17 @@
1
+ - page_title!('Editando <%= singular_table_name %>')
2
+
3
+ #region-<%= plural_table_name %>.container
4
+
5
+ .region
6
+ .region-title
7
+ %h1
8
+ Creando
9
+ %b
10
+ <%= singular_table_name %>
11
+
12
+ .region
13
+ = render 'form'
14
+
15
+ .region
16
+ .admin-controls
17
+ = link_to 'Regresar', 'javascript:history.back(-1)', class: 'btn btn-warning'
@@ -0,0 +1,17 @@
1
+ #region-<%= plural_table_name %>.container
2
+ .region
3
+ .region-title
4
+ %h1= page_title!('<%= singular_table_name %>')
5
+
6
+ .region
7
+ <% for attribute in attributes -%>
8
+ %p
9
+ %b <%= attribute.human_name %>:
10
+ = @<%= singular_table_name %>.<%= attribute.name %>
11
+ <% end -%>
12
+
13
+ .region
14
+ - if current_admin
15
+ .admin-controls
16
+ = link_to 'Editar', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: 'btn btn-success'
17
+ = link_to 'Regresar', <%= index_helper %>_path, class: 'btn btn-warning'
@@ -0,0 +1,5 @@
1
+ module Scaffold
2
+ module Bootstrap3
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,64 @@
1
+ require 'haml'
2
+ require 'rails'
3
+ require "scaffold/bootstrap3/version"
4
+
5
+ module Scaffold
6
+ module Bootstrap3
7
+ class Railtie < ::Rails::Railtie
8
+ if ::Rails.version.to_s >= "3.1"
9
+ config.app_generators.template_engine :haml
10
+ else
11
+ config.generators.template_engine :haml
12
+ end
13
+
14
+ config.before_initialize do
15
+ Haml.init_rails(binding)
16
+ Haml::Template.options[:format] = :html5
17
+ end
18
+
19
+ initializer 'haml_rails.configure_template_digestor' do
20
+ # Configure cache digests to parse haml view templates
21
+ # when calculating cache keys for view fragments
22
+
23
+ ActiveSupport.on_load(:action_view) do
24
+ ActiveSupport.on_load(:after_initialize) do
25
+ begin
26
+ if defined?(CacheDigests::DependencyTracker)
27
+ # 'cache_digests' gem being used (overrides Rails 4 implementation)
28
+ CacheDigests::DependencyTracker.register_tracker :haml, CacheDigests::DependencyTracker::ERBTracker
29
+
30
+ if ::Rails.env.development?
31
+ # recalculate cache digest keys for each request
32
+ CacheDigests::TemplateDigestor.cache = ActiveSupport::Cache::NullStore.new
33
+ end
34
+ else
35
+ # will only apply if Rails 4, which includes 'action_view/dependency_tracker'
36
+ require 'action_view/dependency_tracker'
37
+ ActionView::DependencyTracker.register_tracker :haml, ActionView::DependencyTracker::ERBTracker
38
+
39
+ if ::Rails.env.development?
40
+ # recalculate cache digest keys for each request
41
+
42
+ # using blackhole cache until code is released to allow us to get this behavior
43
+ # by simply setting `config.action_view.cache_template_loading` false in development.rb
44
+ # https://github.com/rails/rails/pull/10791
45
+ class BlackHole < Hash
46
+ def []=(*); end
47
+ end
48
+ module ::ActionView
49
+ class Digestor
50
+ @@cache = BlackHole.new
51
+ end
52
+ end
53
+ end
54
+ end
55
+ rescue
56
+ # likely this version of Rails doesn't support dependency tracking
57
+ # so, we can't parse haml templates without 'cache_digests' gem anyway :)
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'scaffold/bootstrap3/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "scaffold-bootstrap3"
8
+ spec.version = Scaffold::Bootstrap3::VERSION
9
+ spec.authors = ["Paul Sutcliffe"]
10
+ spec.email = ["paul@kosmyka.com"]
11
+ spec.description = "Scaffold Bootstrap3 takes the advantage of bootstrap3 to generate your scaffolds and controllers with a basic bootstrap classes, for a minimun effort development."
12
+ spec.summary = "Generate yout scaffolds with bootstrap3 classes for minimum effort"
13
+ spec.homepage = "http://github.com/paulsutcliffe/scaffold-bootstrap3"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_dependency "haml", [">= 3.1", "< 4.1"]
25
+ spec.add_dependency "activesupport", [">= 3.1", "< 4.1"]
26
+ spec.add_dependency "actionpack", [">= 3.1", "< 4.1"]
27
+ spec.add_dependency "railties", [">= 3.1", "< 4.1"]
28
+
29
+ spec.add_development_dependency "rails", [">= 3.1", "< 4.1"]
30
+ end
metadata ADDED
@@ -0,0 +1,193 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scaffold-bootstrap3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Paul Sutcliffe
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: haml
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ - - <
49
+ - !ruby/object:Gem::Version
50
+ version: '4.1'
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '3.1'
58
+ - - <
59
+ - !ruby/object:Gem::Version
60
+ version: '4.1'
61
+ - !ruby/object:Gem::Dependency
62
+ name: activesupport
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '3.1'
68
+ - - <
69
+ - !ruby/object:Gem::Version
70
+ version: '4.1'
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '3.1'
78
+ - - <
79
+ - !ruby/object:Gem::Version
80
+ version: '4.1'
81
+ - !ruby/object:Gem::Dependency
82
+ name: actionpack
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '3.1'
88
+ - - <
89
+ - !ruby/object:Gem::Version
90
+ version: '4.1'
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '3.1'
98
+ - - <
99
+ - !ruby/object:Gem::Version
100
+ version: '4.1'
101
+ - !ruby/object:Gem::Dependency
102
+ name: railties
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '3.1'
108
+ - - <
109
+ - !ruby/object:Gem::Version
110
+ version: '4.1'
111
+ type: :runtime
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '3.1'
118
+ - - <
119
+ - !ruby/object:Gem::Version
120
+ version: '4.1'
121
+ - !ruby/object:Gem::Dependency
122
+ name: rails
123
+ requirement: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ! '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '3.1'
128
+ - - <
129
+ - !ruby/object:Gem::Version
130
+ version: '4.1'
131
+ type: :development
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ! '>='
136
+ - !ruby/object:Gem::Version
137
+ version: '3.1'
138
+ - - <
139
+ - !ruby/object:Gem::Version
140
+ version: '4.1'
141
+ description: Scaffold Bootstrap3 takes the advantage of bootstrap3 to generate your
142
+ scaffolds and controllers with a basic bootstrap classes, for a minimun effort development.
143
+ email:
144
+ - paul@kosmyka.com
145
+ executables:
146
+ - scaffold-bootstrap3
147
+ extensions: []
148
+ extra_rdoc_files: []
149
+ files:
150
+ - .gitignore
151
+ - Gemfile
152
+ - LICENSE.txt
153
+ - README.md
154
+ - Rakefile
155
+ - bin/scaffold-bootstrap3
156
+ - lib/generators/haml/controller/controller_generator.rb
157
+ - lib/generators/haml/controller/templates/view.html.haml
158
+ - lib/generators/haml/mailer/mailer_generator.rb
159
+ - lib/generators/haml/mailer/templates/view.text.haml
160
+ - lib/generators/haml/scaffold/scaffold_generator.rb
161
+ - lib/generators/haml/scaffold/templates/_form.html.haml
162
+ - lib/generators/haml/scaffold/templates/edit.html.haml
163
+ - lib/generators/haml/scaffold/templates/index.html.haml
164
+ - lib/generators/haml/scaffold/templates/new.html.haml
165
+ - lib/generators/haml/scaffold/templates/show.html.haml
166
+ - lib/scaffold/bootstrap3.rb
167
+ - lib/scaffold/bootstrap3/version.rb
168
+ - scaffold-bootstrap3.gemspec
169
+ homepage: http://github.com/paulsutcliffe/scaffold-bootstrap3
170
+ licenses:
171
+ - MIT
172
+ metadata: {}
173
+ post_install_message:
174
+ rdoc_options: []
175
+ require_paths:
176
+ - lib
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ required_rubygems_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ! '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ requirements: []
188
+ rubyforge_project:
189
+ rubygems_version: 2.1.8
190
+ signing_key:
191
+ specification_version: 4
192
+ summary: Generate yout scaffolds with bootstrap3 classes for minimum effort
193
+ test_files: []