prefab 1.0.0 → 1.0.3.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 +4 -4
- data/Gemfile +4 -4
- data/README.md +10 -26
- data/lib/generators/api/api_generator.rb +10 -4
- data/lib/generators/api/templates/api.rb +8 -6
- data/lib/generators/api/templates/api_base.rb +13 -0
- data/lib/generators/api/templates/api_spec.rb +8 -2
- data/lib/generators/concern/USAGE +8 -0
- data/lib/generators/concern/concern_generator.rb +11 -0
- data/lib/generators/concern/templates/concern.rb +6 -0
- data/lib/generators/concern/templates/concern_spec.rb +5 -0
- data/lib/generators/datatable/datatable_generator.rb +2 -2
- data/lib/generators/datatable/templates/datatable.rb +4 -17
- data/lib/generators/datatable/templates/javascript.js.coffee +7 -6
- data/lib/generators/{api → firebase}/USAGE +1 -1
- data/lib/generators/firebase/firebase_generator.rb +11 -0
- data/lib/generators/firebase/templates/firebase.rb +17 -0
- data/lib/generators/firebase/templates/firebase_spec.rb +8 -0
- data/lib/{prefab/install → generators/prefab}/install_generator.rb +10 -4
- data/lib/{prefab/install/templates/assets/stylesheets/bootstrap-variables.less → generators/prefab/templates/assets/stylesheets/prefab-variables.less} +0 -0
- data/lib/{prefab/install/templates/assets/stylesheets/bootstrap-variables.scss → generators/prefab/templates/assets/stylesheets/prefab-variables.scss} +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/assets/stylesheets/starter.css +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/assets/stylesheets/starter.less +1 -1
- data/lib/{prefab/install → generators/prefab}/templates/assets/stylesheets/starter.scss +1 -1
- data/lib/{prefab/install → generators/prefab}/templates/form_builders/form_builder/_form.html.erb +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/form_builders/form_builder/_form.html.haml +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/form_builders/form_builder/_form.html.slim +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/layouts/starter.html.erb +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/layouts/starter.html.haml +1 -1
- data/lib/{prefab/install → generators/prefab}/templates/layouts/starter.html.slim +0 -0
- data/lib/{templates → generators/prefab/templates/lib/templates}/active_record/model/model.rb +5 -0
- data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/controller/view.html.erb +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/scaffold/edit.html.erb +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/scaffold/index.html.erb +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/scaffold/new.html.erb +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/scaffold/show.html.erb +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/lib/templates/haml/controller/view.html.haml +0 -0
- data/lib/generators/prefab/templates/lib/templates/haml/scaffold/_form.html.haml +19 -0
- data/lib/generators/prefab/templates/lib/templates/haml/scaffold/edit.html.haml +11 -0
- data/lib/generators/prefab/templates/lib/templates/haml/scaffold/index.html.haml +16 -0
- data/lib/{templates → generators/prefab/templates/lib/templates}/haml/scaffold/new.html.haml +0 -0
- data/lib/generators/prefab/templates/lib/templates/haml/scaffold/show.html.haml +14 -0
- data/lib/{templates → generators/prefab/templates/lib/templates}/rails/scaffold_controller/controller.rb +2 -2
- data/lib/{templates → generators/prefab/templates/lib/templates}/rspec/model/model_spec.rb +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/controller/view.html.slim +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/scaffold/edit.html.slim +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/scaffold/index.html.slim +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/scaffold/new.html.slim +0 -0
- data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/scaffold/show.html.slim +0 -0
- data/lib/generators/rails/prefab/USAGE +8 -0
- data/lib/generators/rails/prefab/prefab_generator.rb +53 -0
- data/lib/generators/rails/prefab/templates/javascript.js.coffee +9 -0
- data/lib/generators/report/templates/report_spec.rb +2 -2
- data/lib/generators/service/templates/service.rb +11 -0
- data/lib/generators/survey/survey_generator.rb +11 -0
- data/lib/generators/survey/templates/survey.rb +20 -0
- data/lib/generators/survey/templates/survey_spec.rb +8 -0
- data/lib/prefab.rb +4 -4
- data/lib/prefab/version.rb +1 -1
- data/prefab.gemspec +5 -5
- metadata +58 -49
- data/lib/prefab/install/templates/lib/templates/haml/scaffold/edit.html.haml +0 -10
- data/lib/prefab/install/templates/lib/templates/haml/scaffold/index.html.haml +0 -26
- data/lib/prefab/install/templates/lib/templates/haml/scaffold/new.html.haml +0 -7
- data/lib/prefab/install/templates/lib/templates/haml/scaffold/show.html.haml +0 -14
- data/lib/templates/haml/scaffold/_form.html.haml +0 -16
- data/lib/templates/haml/scaffold/edit.html.haml +0 -9
- data/lib/templates/haml/scaffold/index.html.haml +0 -22
- data/lib/templates/haml/scaffold/show.html.haml +0 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 131479d8fc6c466557455635a418628d74c54bca
|
|
4
|
+
data.tar.gz: 5f248bf34762f6eab2b47c03ac7c630ce84c4319
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 81d9854722d0b1d601a23d8a7e4234c1cbbaccb9fc26d04d719b5bf1afce65f86c59550112600dbd8dca7199f2213c50543cf1085b99cdee95392cf1fe34ad21
|
|
7
|
+
data.tar.gz: edf203d0febf6badbc85b26d15da1cd7dc825a3a5edd064f4eadf9254fe906332ce56a22e4e3f7ce1d8d0cc95002c7abedac973f40a9e91a7e2d8d38344d4a90
|
data/Gemfile
CHANGED
|
@@ -8,15 +8,15 @@ rails_version = ENV["RAILS_VERSION"] || "default"
|
|
|
8
8
|
case rails_version
|
|
9
9
|
when "master"
|
|
10
10
|
rails = { github: "rails/rails" }
|
|
11
|
-
gem 'sass-rails', '>=
|
|
11
|
+
gem 'sass-rails', '>= 5.0.6'
|
|
12
12
|
when "default"
|
|
13
|
-
rails = ">=
|
|
13
|
+
rails = ">= 5.0"
|
|
14
14
|
gem 'sass-rails'
|
|
15
15
|
else
|
|
16
16
|
rails = "~> #{rails_version}"
|
|
17
17
|
|
|
18
|
-
if rails_version[0] == '
|
|
19
|
-
gem 'sass-rails', '>=
|
|
18
|
+
if rails_version[0] == '5'
|
|
19
|
+
gem 'sass-rails', '>= 5.0.6'
|
|
20
20
|
else
|
|
21
21
|
gem 'sass-rails'
|
|
22
22
|
end
|
data/README.md
CHANGED
|
@@ -2,19 +2,19 @@ Prefab
|
|
|
2
2
|
======
|
|
3
3
|
[](https://travis-ci.org/jeperkins4/prefab)
|
|
4
4
|
|
|
5
|
-
Prefab provides [Twitter Bootstrap](http://getbootstrap.com/), jQuery Datatable, Spreadsheet, and Service class generators for Rails
|
|
5
|
+
Prefab provides [Twitter Bootstrap](http://getbootstrap.com/), jQuery Datatable, Spreadsheet, and Service class generators for Rails 5 (supported Rails >= 5.0.1). Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites.
|
|
6
6
|
|
|
7
7
|
This gem is heavily inspired by [Bootstrap-generator](https://github.com/decioferreira/bootstrap-generators). This gem began as a fork of his project, but then took on a life of its own.
|
|
8
8
|
|
|
9
9
|
## Current Twitter Bootstrap version
|
|
10
10
|
|
|
11
|
-
The current version of Twitter Bootstrap is 3.
|
|
11
|
+
The current version of Twitter Bootstrap is 3.3.7.
|
|
12
12
|
|
|
13
13
|
## Installing Gem
|
|
14
14
|
|
|
15
15
|
In your Gemfile, add this line:
|
|
16
16
|
|
|
17
|
-
gem 'prefab', '~>
|
|
17
|
+
gem 'prefab', '~> 1.0.2'
|
|
18
18
|
|
|
19
19
|
Or you can install from latest build:
|
|
20
20
|
|
|
@@ -40,9 +40,9 @@ You can easily customize colors, grid system, fonts, and much more by editing `b
|
|
|
40
40
|
|
|
41
41
|
## Usage
|
|
42
42
|
|
|
43
|
-
To print the options and usage run the command `rails generate
|
|
43
|
+
To print the options and usage run the command `rails generate prefab:install --help`
|
|
44
44
|
|
|
45
|
-
rails generate
|
|
45
|
+
rails generate prefab:install [options]
|
|
46
46
|
|
|
47
47
|
Options:
|
|
48
48
|
-e, [--template-engine=TEMPLATE_ENGINE] # Indicates when to generate template engine
|
|
@@ -74,7 +74,7 @@ Add the dependency on your Gemfile:
|
|
|
74
74
|
|
|
75
75
|
And then run:
|
|
76
76
|
|
|
77
|
-
rails generate
|
|
77
|
+
rails generate prefab:install --template-engine=haml
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
#### Stylesheet engines
|
|
@@ -90,7 +90,7 @@ Make sure you have `sass-rails` dependency on your Gemfile:
|
|
|
90
90
|
|
|
91
91
|
And then run:
|
|
92
92
|
|
|
93
|
-
rails generate
|
|
93
|
+
rails generate prefab:install --stylesheet-engine=scss
|
|
94
94
|
|
|
95
95
|
Now you can customize the look and feel of Bootstrap.
|
|
96
96
|
|
|
@@ -98,29 +98,13 @@ Now you can customize the look and feel of Bootstrap.
|
|
|
98
98
|
|
|
99
99
|
### Customize and extend Bootstrap
|
|
100
100
|
|
|
101
|
-
You will get an `app/assets/stylesheets/
|
|
101
|
+
You will get an `app/assets/stylesheets/prefab-variables.[less|scss]` file with all of the default variables of Bootstrap. This way you can customize the look and feel of Bootstrap without having to download any extra file.
|
|
102
102
|
|
|
103
103
|
### Javascript
|
|
104
104
|
|
|
105
|
-
Select all jQuery plugins (`app/assets/javascripts/
|
|
106
|
-
|
|
107
|
-
//= require bootstrap
|
|
108
|
-
|
|
109
|
-
Or quickly add only the necessary javascript (Transitions: required for any animation; Popovers: requires Tooltips)
|
|
110
|
-
|
|
111
|
-
//= require bootstrap/scrollspy
|
|
112
|
-
//= require bootstrap/dropdown
|
|
113
|
-
//= require bootstrap/tab
|
|
114
|
-
//= require bootstrap/button
|
|
115
|
-
//= require bootstrap/collapse
|
|
116
|
-
//= require bootstrap/modal
|
|
117
|
-
//= require bootstrap/carousel
|
|
118
|
-
//= require bootstrap/alert
|
|
119
|
-
//= require bootstrap/transition
|
|
120
|
-
//= require bootstrap/tooltip
|
|
121
|
-
//= require bootstrap/popover
|
|
122
|
-
//= require bootstrap/affix
|
|
105
|
+
Select all jQuery plugins (`app/assets/javascripts/prefab.js`)
|
|
123
106
|
|
|
107
|
+
//= require prefab
|
|
124
108
|
|
|
125
109
|
## Customizing Templates
|
|
126
110
|
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
class ApiGenerator < Rails::Generators::NamedBase
|
|
2
2
|
source_root File.expand_path('../templates', __FILE__)
|
|
3
3
|
|
|
4
|
-
def
|
|
5
|
-
|
|
4
|
+
def generate_api
|
|
5
|
+
copy_file "api_base.rb", "app/services/api/base.rb"
|
|
6
|
+
template "api.rb", "app/services/api/#{file_name.underscore}.rb"
|
|
6
7
|
end
|
|
7
8
|
|
|
8
|
-
def
|
|
9
|
-
|
|
9
|
+
def generate_controller
|
|
10
|
+
generate "scaffold_controller API::V1::#{file_name.camelize} --skip-assets --skip-template-engine --skip-helper --skip-jbuilder"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def generate_rspec
|
|
14
|
+
template "api_spec.rb", "spec/services/api/#{file_name.underscore}_spec.rb"
|
|
10
15
|
end
|
|
11
16
|
end
|
|
17
|
+
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
class Api::<%= file_name.camelize %> < Api::Base
|
|
2
|
+
|
|
3
|
+
def initialize(url, key, secret)
|
|
4
|
+
super
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def run
|
|
8
|
+
results = JSON.parse(open(url).read)
|
|
7
9
|
end
|
|
8
10
|
end
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
require '
|
|
1
|
+
require 'rails_helper'
|
|
2
2
|
|
|
3
|
-
describe <%= file_name.camelize
|
|
3
|
+
describe <%= file_name.camelize %> do
|
|
4
|
+
let!(:<%= class_name.downcase.underscore %>) { Fabricate(:<%= class_name.downcase.underscore %>) }
|
|
4
5
|
|
|
6
|
+
context 'run' do
|
|
7
|
+
it "should successfully run #{fire_name}" do
|
|
8
|
+
|
|
9
|
+
end
|
|
10
|
+
end
|
|
5
11
|
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class ConcernGenerator < Rails::Generators::NamedBase
|
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
3
|
+
|
|
4
|
+
def generate_concern_file
|
|
5
|
+
template "concern.rb", "app/concerns/#{file_name.underscore}.rb"
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def generate_spec_file
|
|
9
|
+
template "concern_spec.rb", "spec/concerns/#{file_name.underscore}_spec.rb"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -3,10 +3,10 @@ class DatatableGenerator < Rails::Generators::NamedBase
|
|
|
3
3
|
class_option :coffeescript, :type => :boolean, :default => true, :desc => 'Include Coffeescript file'
|
|
4
4
|
|
|
5
5
|
def generate_coffeescript
|
|
6
|
-
template "javascript.js.coffee", "app/assets/javascripts/#{file_name.underscore}.
|
|
6
|
+
template "javascript.js.coffee", "app/assets/javascripts/#{file_name.underscore}.coffee" if options.coffeescript?
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def create_datatable_file
|
|
10
|
-
template "datatable.rb", "app/datatables/#{file_name}_datatable.rb"
|
|
10
|
+
template "datatable.rb", "app/datatables/#{file_name}_datatable.rb"
|
|
11
11
|
end
|
|
12
12
|
end
|
|
@@ -24,7 +24,7 @@ private
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def fetch_<%= plural_name %>
|
|
27
|
-
<%= plural_name %> = <%= class_name.singularize %>.unscoped.select(columns).order(
|
|
27
|
+
<%= plural_name %> = <%= class_name.singularize %>.unscoped.select(columns).order(order_by(columns))
|
|
28
28
|
|
|
29
29
|
if params[:sSearch].present?
|
|
30
30
|
<%= plural_name %> = <%= plural_name %>.where('<%= plural_name %>.name like :search', search: "%#{params[:sSearch]}%")
|
|
@@ -33,23 +33,10 @@ private
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def columns
|
|
36
|
-
['<%= plural_name %>.name']
|
|
36
|
+
['<%= plural_name %>.name', '<%= plural_name %>.id']
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
def
|
|
40
|
-
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def sort_direction
|
|
44
|
-
params[:sSortDir_0] == "desc" ? "desc" : "asc"
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def links(obj)
|
|
48
|
-
html = []
|
|
49
|
-
html << link_to(t('edit').html_safe, edit_<%= class_name.singularize.downcase %>_path(obj), :class => 'btn btn-default btn-xs')
|
|
50
|
-
if can?(:manage, obj)
|
|
51
|
-
html << link_to(t('destroy').html_safe, obj, :method => :delete, :data => { :confirm => 'Are you sure?' }, :class => 'btn btn-xs btn-danger')
|
|
52
|
-
end
|
|
53
|
-
content_tag('div',html.join(' ').html_safe,:class => 'buttons')
|
|
39
|
+
def exceptions
|
|
40
|
+
['<%= plural_name %>.id']
|
|
54
41
|
end
|
|
55
42
|
end
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
$ ->
|
|
2
2
|
$("#<%= file_name.pluralize %>").dataTable
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
dom: "<'row'<'col-md-7'l><'col-md-5'f>r>t<'row'<'col-md-7'i><'col-md-5'p>>"
|
|
4
|
+
pagingType: "simple_numbers"
|
|
5
|
+
autoWidth: false
|
|
6
|
+
processing: true
|
|
7
|
+
serverSide: true
|
|
8
|
+
order: [[0, 'desc']]
|
|
9
|
+
ajax: $("#<%= file_name.pluralize %>").data('source')
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class FirebaseGenerator < Rails::Generators::NamedBase
|
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
3
|
+
|
|
4
|
+
def generate_firebase
|
|
5
|
+
template "firebase.rb", "app/services/firebase/#{file_name.underscore}.rb"
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def generate_rspec
|
|
9
|
+
template "firebase_spec.rb", "spec/services/firebase/#{file_name.underscore}_spec.rb"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class Firebase::<%= file_name.camelize %> < Firebase::Base
|
|
2
|
+
attr_accessor :<%= file_name.downcase.underscore %>, :client
|
|
3
|
+
|
|
4
|
+
def initialize(<%= file_name.downcase.underscore %>)
|
|
5
|
+
self.client = super
|
|
6
|
+
self.<%= file_name.downcase.underscore %> = <%= file_name.downcase.underscore %>
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def send(message)
|
|
10
|
+
msg = client.put("<%= file_name.downcase.underscore %>s/#{self.<%= file_name.downcase.underscore %>.id}", <%= file_name.downcase.underscore %>.to_json )
|
|
11
|
+
p msg
|
|
12
|
+
@reconnect = false
|
|
13
|
+
es = client.event_source("<%= file_name.downcase.underscore %>s/#{self.<%= file_name.downcase.underscore %>.id}")
|
|
14
|
+
es.close
|
|
15
|
+
return msg
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -10,12 +10,18 @@ module Prefab
|
|
|
10
10
|
|
|
11
11
|
def copy_lib
|
|
12
12
|
directory "lib/templates/#{options[:template_engine]}"
|
|
13
|
+
# directory "lib/generators/api"
|
|
14
|
+
# directory "lib/generators/datatable"
|
|
15
|
+
# directory "lib/generators/rails"
|
|
16
|
+
# directory "lib/generators/report"
|
|
17
|
+
# directory "lib/generators/service"
|
|
13
18
|
end
|
|
14
19
|
|
|
15
20
|
def copy_form_builder
|
|
16
21
|
copy_file "form_builders/form_builder/_form.html.#{options[:template_engine]}", "lib/templates/#{options[:template_engine]}/scaffold/_form.html.#{options[:template_engine]}"
|
|
17
22
|
end
|
|
18
23
|
|
|
24
|
+
# Expects lib/generators/prefab/templates
|
|
19
25
|
def create_layout
|
|
20
26
|
template "layouts/starter.html.#{options[:template_engine]}", "app/views/layouts/application.html.#{options[:template_engine]}"
|
|
21
27
|
end
|
|
@@ -23,15 +29,15 @@ module Prefab
|
|
|
23
29
|
def create_stylesheets
|
|
24
30
|
stylesheet_extension = options[:stylesheet_engine] || 'css'
|
|
25
31
|
|
|
26
|
-
copy_file "assets/stylesheets/starter.#{stylesheet_extension}", "app/assets/stylesheets/
|
|
32
|
+
copy_file "assets/stylesheets/starter.#{stylesheet_extension}", "app/assets/stylesheets/prefab.#{stylesheet_extension}"
|
|
27
33
|
|
|
28
34
|
if [:less, :scss].include?(options[:stylesheet_engine].to_sym)
|
|
29
|
-
copy_file "assets/stylesheets/
|
|
35
|
+
copy_file "assets/stylesheets/prefab-variables.#{stylesheet_extension}", "app/assets/stylesheets/prefab-variables.#{stylesheet_extension}"
|
|
30
36
|
end
|
|
31
37
|
end
|
|
32
38
|
|
|
33
|
-
def
|
|
34
|
-
application_js_path = 'app/assets/javascripts/application.
|
|
39
|
+
def inject_bootstrap
|
|
40
|
+
application_js_path = 'app/assets/javascripts/application.coffee'
|
|
35
41
|
|
|
36
42
|
if ::File.exists?(::File.join(destination_root, application_js_path))
|
|
37
43
|
inject_into_file application_js_path, before: '//= require_tree' do
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/{prefab/install → generators/prefab}/templates/form_builders/form_builder/_form.html.erb
RENAMED
|
File without changes
|
data/lib/{prefab/install → generators/prefab}/templates/form_builders/form_builder/_form.html.haml
RENAMED
|
File without changes
|
data/lib/{prefab/install → generators/prefab}/templates/form_builders/form_builder/_form.html.slim
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/{templates → generators/prefab/templates/lib/templates}/active_record/model/model.rb
RENAMED
|
@@ -22,5 +22,10 @@ class <%= class_name %> < <%= parent_class_name.classify %>
|
|
|
22
22
|
<%- end -%>
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
<%- if attributes_names.include?('latitude') && attributes_names.include?('location') -%>
|
|
26
|
+
before_save :geocode
|
|
27
|
+
|
|
28
|
+
geocoded_by :location
|
|
29
|
+
<%- end -%>
|
|
25
30
|
end
|
|
26
31
|
<% end -%>
|
data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/controller/view.html.erb
RENAMED
|
File without changes
|
data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/scaffold/edit.html.erb
RENAMED
|
File without changes
|
data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/scaffold/index.html.erb
RENAMED
|
File without changes
|
data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/scaffold/new.html.erb
RENAMED
|
File without changes
|
data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/scaffold/show.html.erb
RENAMED
|
File without changes
|
data/lib/{prefab/install → generators/prefab}/templates/lib/templates/haml/controller/view.html.haml
RENAMED
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
= form_for @<%= singular_table_name %>, :html => { :class => "form-horizontal" } do |f|
|
|
2
|
+
-if @<%= singular_table_name %>.errors.any?
|
|
3
|
+
.alert.alert-danger.alert-dismissable
|
|
4
|
+
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} ×
|
|
5
|
+
%h4= "#{pluralize(@<%= singular_table_name %>.errors.count, "error")} prohibited this <%= singular_table_name %> from being saved:"
|
|
6
|
+
|
|
7
|
+
%ul
|
|
8
|
+
- @<%= singular_table_name %>.errors.full_messages.each do |msg|
|
|
9
|
+
%li= msg
|
|
10
|
+
|
|
11
|
+
<% for attribute in attributes -%>
|
|
12
|
+
.form-group
|
|
13
|
+
= f.label :<%= attribute.name %>, :class => 'col-sm-2 control-label'
|
|
14
|
+
.col-sm-10
|
|
15
|
+
= f.<%= attribute.field_type %> :<%= attribute.name %>, :class => 'form-control'
|
|
16
|
+
<% end -%>
|
|
17
|
+
.form-group
|
|
18
|
+
.col-sm-offset-2.col-sm-10
|
|
19
|
+
= f.submit :class => 'btn btn-primary'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
.panel.panel-default
|
|
2
|
+
.panel-heading
|
|
3
|
+
.panel-title
|
|
4
|
+
Edit <%= singular_table_name.titleize %>
|
|
5
|
+
.pull-right
|
|
6
|
+
= link_to 'Show', <%= singular_table_name %>, class: 'btn btn-info'
|
|
7
|
+
= link_to t('back',to: "<%= plural_table_name.titleize %>").html_safe, <%= index_helper %>_path, class: 'btn btn-default'
|
|
8
|
+
.panel-body
|
|
9
|
+
= render 'form'
|
|
10
|
+
|
|
11
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.panel.panel-default
|
|
2
|
+
.panel-heading
|
|
3
|
+
.panel-title
|
|
4
|
+
<%= plural_table_name.capitalize.gsub("_","") %>
|
|
5
|
+
.pull-right
|
|
6
|
+
= link_to t('new', model_name: "<%= singular_table_name.gsub("_"," ").titleize %>").html_safe, new_<%= singular_table_name %>_path, :class => 'btn btn-primary'
|
|
7
|
+
|
|
8
|
+
.panel-body
|
|
9
|
+
%table#<%= plural_table_name %>.table.table-bordered.table-striped.dataTable{:data => {:source => <%= plural_table_name %>_url(:format => 'json', :protocol => protocol)}}
|
|
10
|
+
%thead
|
|
11
|
+
%tr
|
|
12
|
+
<% for attribute in attributes -%>
|
|
13
|
+
%th <%= attribute.human_name %>
|
|
14
|
+
<% end -%>
|
|
15
|
+
%th
|
|
16
|
+
%tbody
|
data/lib/{templates → generators/prefab/templates/lib/templates}/haml/scaffold/new.html.haml
RENAMED
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.panel.panel-default
|
|
2
|
+
.panel-heading
|
|
3
|
+
.panel-title
|
|
4
|
+
<%= singular_table_name.titleize %>
|
|
5
|
+
.pull-right
|
|
6
|
+
= link_to raw(t('edit')), edit_<%= singular_table_name %>_path(<%= singular_table_name %>), :class => 'btn btn-primary'
|
|
7
|
+
= link_to raw(t('back',to: "<%= plural_table_name.titleize %>")), <%= index_helper %>_path, :class => 'btn btn-default'
|
|
8
|
+
.panel-body
|
|
9
|
+
%dl
|
|
10
|
+
<% for attribute in attributes -%>
|
|
11
|
+
%dt <%= attribute.human_name %>:
|
|
12
|
+
%dd= <%= singular_table_name %>.<%= attribute.name %>
|
|
13
|
+
<% end -%>
|
|
14
|
+
|
|
@@ -4,13 +4,13 @@ require_dependency "<%= namespaced_file_path %>/application_controller"
|
|
|
4
4
|
<% end -%>
|
|
5
5
|
<% module_namespacing do -%>
|
|
6
6
|
class <%= controller_class_name %>Controller < ApplicationController
|
|
7
|
-
|
|
7
|
+
before_action :authenticate_user!
|
|
8
8
|
respond_to :html, :json
|
|
9
9
|
|
|
10
10
|
expose(:<%= plural_table_name %>) { <%= orm_class.all(class_name) %> }
|
|
11
11
|
expose(:<%= singular_table_name %>) { params[:id].present? ? <%= class_name %>.find(params[:id]) : <%= class_name %>.new(params[:<%= singular_table_name %>]) }
|
|
12
12
|
|
|
13
|
-
def
|
|
13
|
+
def index
|
|
14
14
|
respond_to do |format|
|
|
15
15
|
format.json { render json: <%= class_name.pluralize %>Datatable.new(view_context) }
|
|
16
16
|
end
|
|
File without changes
|
data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/controller/view.html.slim
RENAMED
|
File without changes
|
data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/scaffold/edit.html.slim
RENAMED
|
File without changes
|
data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/scaffold/index.html.slim
RENAMED
|
File without changes
|
data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/scaffold/new.html.slim
RENAMED
|
File without changes
|
data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/scaffold/show.html.slim
RENAMED
|
File without changes
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
class Rails::PrefabGenerator < Rails::Generators::NamedBase
|
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
3
|
+
class_option :coffeescript, :type => :boolean, :default => true, :desc => 'Include Coffeescript file'
|
|
4
|
+
|
|
5
|
+
def generate_coffeescript
|
|
6
|
+
template "javascript.js.coffee", "app/assets/javascripts/#{file_name.underscore}.js.coffee" if options.coffeescript?
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def create_datatable_file
|
|
10
|
+
create_file "app/datatables/#{file_name}_datatable.rb", <<-FILE
|
|
11
|
+
class #{class_name}Datatable < BaseDatatable
|
|
12
|
+
delegate :current_user, to: :@view
|
|
13
|
+
|
|
14
|
+
def as_json(options = {})
|
|
15
|
+
{
|
|
16
|
+
sEcho: params[:sEcho].to_i,
|
|
17
|
+
iTotalRecords: #{class_name.singularize}.count,
|
|
18
|
+
iTotalDisplayRecords: #{plural_name}.total_count,
|
|
19
|
+
aaData: data
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
def data
|
|
25
|
+
#{plural_name}.map do |#{plural_name.singularize}|
|
|
26
|
+
[
|
|
27
|
+
link_to(#{plural_name.singularize}.name, #{plural_name.singularize}),
|
|
28
|
+
links(#{plural_name.singularize})
|
|
29
|
+
]
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def #{plural_name}
|
|
34
|
+
@#{plural_name} || fetch_#{plural_name}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def fetch_#{plural_name}
|
|
38
|
+
search_columns = ['#{plural_name}.name']
|
|
39
|
+
#{plural_name} = #{class_name.singularize}.unscoped.select(columns).order(order_by(columns))
|
|
40
|
+
#{plural_name} = #{plural_name}.page(page_count).per(per_page)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def columns
|
|
44
|
+
%w['#{plural_name}.name']
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def exceptions
|
|
48
|
+
%w['#{plural_name}.id']
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
FILE
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
$ ->
|
|
2
|
+
$("#<%= file_name.pluralize %>").dataTable
|
|
3
|
+
dom: "<'row'<'col-md-7'l><'col-md-5'f>r>t<'row'<'col-md-7'i><'col-md-5'p>>"
|
|
4
|
+
pagingType: "simple_numbers"
|
|
5
|
+
autoWidth: false
|
|
6
|
+
processing: true
|
|
7
|
+
order: [[0,'desc']]
|
|
8
|
+
serverSide: true
|
|
9
|
+
ajax: $("#<%= file_name.pluralize %>").data('source')
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe <%= file_name.camelize %> do
|
|
4
|
-
let!(:<%= class_name.
|
|
4
|
+
let!(:<%= class_name.downcase.underscore %>) { Fabricate(:<%= class_name.downcase.underscore %>) }
|
|
5
5
|
|
|
6
6
|
context 'details' do
|
|
7
7
|
it "should generate an array of report records" do
|
|
8
|
-
<%= file_name.camelize %>.details.should_not be_empty
|
|
8
|
+
<%= file_name.camelize %>.details.should_not be_empty
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
+
<% if namespaced? -%>
|
|
2
|
+
require_dependency "<%= namespaced_file_path %>/application_controller"
|
|
3
|
+
|
|
4
|
+
<% end -%>
|
|
5
|
+
<% module_namespacing do -%>
|
|
1
6
|
class <%= file_name.camelize %>
|
|
2
7
|
def initialize
|
|
3
8
|
end
|
|
9
|
+
|
|
10
|
+
def run
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
4
14
|
end
|
|
15
|
+
<% end -%>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class SurveyGenerator < Rails::Generators::NamedBase
|
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
3
|
+
|
|
4
|
+
def generate_survey
|
|
5
|
+
template "survey.rb", "app/surveys/#{file_name.underscore}.rb"
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def generate_rspec
|
|
9
|
+
template "survey_spec.rb", "spec/surveys/#{file_name.underscore}_spec.rb"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class <%= file_name.camelize %>
|
|
2
|
+
include AskAwesomely::DSL
|
|
3
|
+
|
|
4
|
+
title "blah, blah"
|
|
5
|
+
|
|
6
|
+
field :statement do
|
|
7
|
+
say ->(user) { "Hello, #{user.name}!" }
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
field :multiple_choice do
|
|
11
|
+
ask "What is your favourite language?"
|
|
12
|
+
choice "Ruby"
|
|
13
|
+
choice "Python"
|
|
14
|
+
choice "Javascript"
|
|
15
|
+
choice "COBOL"
|
|
16
|
+
|
|
17
|
+
can_specify_other
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
data/lib/prefab.rb
CHANGED
|
@@ -6,12 +6,12 @@ module Prefab
|
|
|
6
6
|
config.app_generators.stylesheets false
|
|
7
7
|
|
|
8
8
|
initializer 'prefab.setup', group: :all do |app|
|
|
9
|
-
app.config.less.paths << ::File.expand_path('../../vendor/twitter/bootstrap/less', __FILE__) if app.config.respond_to?(:less)
|
|
10
|
-
app.config.assets.paths << ::File.expand_path('../../vendor/twitter/bootstrap/sass', __FILE__) if app.config.respond_to?(:sass)
|
|
9
|
+
#app.config.less.paths << ::File.expand_path('../../vendor/twitter/bootstrap/less', __FILE__) if app.config.respond_to?(:less)
|
|
10
|
+
#app.config.assets.paths << ::File.expand_path('../../vendor/twitter/bootstrap/sass', __FILE__) if app.config.respond_to?(:sass)
|
|
11
11
|
|
|
12
|
-
app.config.assets.paths << ::Rails.root.join('app', 'assets', 'fonts')
|
|
12
|
+
#app.config.assets.paths << ::Rails.root.join('app', 'assets', 'fonts')
|
|
13
13
|
|
|
14
|
-
app.config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/
|
|
14
|
+
#app.config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
end
|
data/lib/prefab/version.rb
CHANGED
data/prefab.gemspec
CHANGED
|
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
spec.version = Prefab::VERSION
|
|
9
9
|
spec.authors = ["John Perkins"]
|
|
10
10
|
spec.email = ["jeperkins4@gmail.com"]
|
|
11
|
-
spec.summary = %q{Prefab provides Twitter Bootstrap generators for Rails
|
|
12
|
-
spec.description = %q{Prefab provides Twitter Bootstrap generators for Rails
|
|
11
|
+
spec.summary = %q{Prefab provides Twitter Bootstrap generators for Rails 5 (supported Rails >= 5.0.1).}
|
|
12
|
+
spec.description = %q{Prefab provides Twitter Bootstrap generators for Rails 5 (supported Rails >= 5.0.1). Checkout http://getbootstrap.com.}
|
|
13
13
|
spec.homepage = "https://github.com/jeperkins4/prefab"
|
|
14
14
|
spec.license = "MIT"
|
|
15
15
|
|
|
@@ -20,10 +20,10 @@ Gem::Specification.new do |spec|
|
|
|
20
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
21
21
|
spec.require_paths = ["lib"]
|
|
22
22
|
|
|
23
|
-
spec.add_development_dependency "bundler", "~> 1.
|
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.14.2"
|
|
24
24
|
spec.add_development_dependency "rake"
|
|
25
25
|
spec.add_development_dependency 'rspec'
|
|
26
|
-
spec.add_development_dependency '
|
|
26
|
+
spec.add_development_dependency 'byebug'
|
|
27
27
|
|
|
28
|
-
spec.add_runtime_dependency "railties", ">=
|
|
28
|
+
spec.add_runtime_dependency "railties", ">= 5.0.1"
|
|
29
29
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: prefab
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Perkins
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-02-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 1.14.2
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 1.14.2
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rake
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -53,7 +53,7 @@ dependencies:
|
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
56
|
+
name: byebug
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - ">="
|
|
@@ -72,16 +72,16 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version:
|
|
75
|
+
version: 5.0.1
|
|
76
76
|
type: :runtime
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - ">="
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version:
|
|
83
|
-
description: Prefab provides Twitter Bootstrap generators for Rails
|
|
84
|
-
>=
|
|
82
|
+
version: 5.0.1
|
|
83
|
+
description: Prefab provides Twitter Bootstrap generators for Rails 5 (supported Rails
|
|
84
|
+
>= 5.0.1). Checkout http://getbootstrap.com.
|
|
85
85
|
email:
|
|
86
86
|
- jeperkins4@gmail.com
|
|
87
87
|
executables: []
|
|
@@ -95,14 +95,56 @@ files:
|
|
|
95
95
|
- MIT-LICENSE
|
|
96
96
|
- README.md
|
|
97
97
|
- Rakefile
|
|
98
|
-
- lib/generators/api/USAGE
|
|
99
98
|
- lib/generators/api/api_generator.rb
|
|
100
99
|
- lib/generators/api/templates/api.rb
|
|
100
|
+
- lib/generators/api/templates/api_base.rb
|
|
101
101
|
- lib/generators/api/templates/api_spec.rb
|
|
102
|
+
- lib/generators/concern/USAGE
|
|
103
|
+
- lib/generators/concern/concern_generator.rb
|
|
104
|
+
- lib/generators/concern/templates/concern.rb
|
|
105
|
+
- lib/generators/concern/templates/concern_spec.rb
|
|
102
106
|
- lib/generators/datatable/USAGE
|
|
103
107
|
- lib/generators/datatable/datatable_generator.rb
|
|
104
108
|
- lib/generators/datatable/templates/datatable.rb
|
|
105
109
|
- lib/generators/datatable/templates/javascript.js.coffee
|
|
110
|
+
- lib/generators/firebase/USAGE
|
|
111
|
+
- lib/generators/firebase/firebase_generator.rb
|
|
112
|
+
- lib/generators/firebase/templates/firebase.rb
|
|
113
|
+
- lib/generators/firebase/templates/firebase_spec.rb
|
|
114
|
+
- lib/generators/prefab/install_generator.rb
|
|
115
|
+
- lib/generators/prefab/templates/assets/stylesheets/prefab-variables.less
|
|
116
|
+
- lib/generators/prefab/templates/assets/stylesheets/prefab-variables.scss
|
|
117
|
+
- lib/generators/prefab/templates/assets/stylesheets/starter.css
|
|
118
|
+
- lib/generators/prefab/templates/assets/stylesheets/starter.less
|
|
119
|
+
- lib/generators/prefab/templates/assets/stylesheets/starter.scss
|
|
120
|
+
- lib/generators/prefab/templates/form_builders/form_builder/_form.html.erb
|
|
121
|
+
- lib/generators/prefab/templates/form_builders/form_builder/_form.html.haml
|
|
122
|
+
- lib/generators/prefab/templates/form_builders/form_builder/_form.html.slim
|
|
123
|
+
- lib/generators/prefab/templates/layouts/starter.html.erb
|
|
124
|
+
- lib/generators/prefab/templates/layouts/starter.html.haml
|
|
125
|
+
- lib/generators/prefab/templates/layouts/starter.html.slim
|
|
126
|
+
- lib/generators/prefab/templates/lib/templates/active_record/model/model.rb
|
|
127
|
+
- lib/generators/prefab/templates/lib/templates/erb/controller/view.html.erb
|
|
128
|
+
- lib/generators/prefab/templates/lib/templates/erb/scaffold/edit.html.erb
|
|
129
|
+
- lib/generators/prefab/templates/lib/templates/erb/scaffold/index.html.erb
|
|
130
|
+
- lib/generators/prefab/templates/lib/templates/erb/scaffold/new.html.erb
|
|
131
|
+
- lib/generators/prefab/templates/lib/templates/erb/scaffold/show.html.erb
|
|
132
|
+
- lib/generators/prefab/templates/lib/templates/haml/controller/view.html.haml
|
|
133
|
+
- lib/generators/prefab/templates/lib/templates/haml/scaffold/_form.html.haml
|
|
134
|
+
- lib/generators/prefab/templates/lib/templates/haml/scaffold/edit.html.haml
|
|
135
|
+
- lib/generators/prefab/templates/lib/templates/haml/scaffold/index.html.haml
|
|
136
|
+
- lib/generators/prefab/templates/lib/templates/haml/scaffold/new.html.haml
|
|
137
|
+
- lib/generators/prefab/templates/lib/templates/haml/scaffold/show.html.haml
|
|
138
|
+
- lib/generators/prefab/templates/lib/templates/rails/scaffold_controller/controller.rb
|
|
139
|
+
- lib/generators/prefab/templates/lib/templates/rspec/model/model_spec.rb
|
|
140
|
+
- lib/generators/prefab/templates/lib/templates/slim/controller/view.html.slim
|
|
141
|
+
- lib/generators/prefab/templates/lib/templates/slim/scaffold/edit.html.slim
|
|
142
|
+
- lib/generators/prefab/templates/lib/templates/slim/scaffold/index.html.slim
|
|
143
|
+
- lib/generators/prefab/templates/lib/templates/slim/scaffold/new.html.slim
|
|
144
|
+
- lib/generators/prefab/templates/lib/templates/slim/scaffold/show.html.slim
|
|
145
|
+
- lib/generators/rails/prefab/USAGE
|
|
146
|
+
- lib/generators/rails/prefab/prefab_generator.rb
|
|
147
|
+
- lib/generators/rails/prefab/templates/javascript.js.coffee
|
|
106
148
|
- lib/generators/report/USAGE
|
|
107
149
|
- lib/generators/report/report_generator.rb
|
|
108
150
|
- lib/generators/report/templates/report.rb
|
|
@@ -111,43 +153,11 @@ files:
|
|
|
111
153
|
- lib/generators/service/service_generator.rb
|
|
112
154
|
- lib/generators/service/templates/service.rb
|
|
113
155
|
- lib/generators/service/templates/service_spec.rb
|
|
156
|
+
- lib/generators/survey/survey_generator.rb
|
|
157
|
+
- lib/generators/survey/templates/survey.rb
|
|
158
|
+
- lib/generators/survey/templates/survey_spec.rb
|
|
114
159
|
- lib/prefab.rb
|
|
115
|
-
- lib/prefab/install/install_generator.rb
|
|
116
|
-
- lib/prefab/install/templates/assets/stylesheets/bootstrap-variables.less
|
|
117
|
-
- lib/prefab/install/templates/assets/stylesheets/bootstrap-variables.scss
|
|
118
|
-
- lib/prefab/install/templates/assets/stylesheets/starter.css
|
|
119
|
-
- lib/prefab/install/templates/assets/stylesheets/starter.less
|
|
120
|
-
- lib/prefab/install/templates/assets/stylesheets/starter.scss
|
|
121
|
-
- lib/prefab/install/templates/form_builders/form_builder/_form.html.erb
|
|
122
|
-
- lib/prefab/install/templates/form_builders/form_builder/_form.html.haml
|
|
123
|
-
- lib/prefab/install/templates/form_builders/form_builder/_form.html.slim
|
|
124
|
-
- lib/prefab/install/templates/layouts/starter.html.erb
|
|
125
|
-
- lib/prefab/install/templates/layouts/starter.html.haml
|
|
126
|
-
- lib/prefab/install/templates/layouts/starter.html.slim
|
|
127
|
-
- lib/prefab/install/templates/lib/templates/erb/controller/view.html.erb
|
|
128
|
-
- lib/prefab/install/templates/lib/templates/erb/scaffold/edit.html.erb
|
|
129
|
-
- lib/prefab/install/templates/lib/templates/erb/scaffold/index.html.erb
|
|
130
|
-
- lib/prefab/install/templates/lib/templates/erb/scaffold/new.html.erb
|
|
131
|
-
- lib/prefab/install/templates/lib/templates/erb/scaffold/show.html.erb
|
|
132
|
-
- lib/prefab/install/templates/lib/templates/haml/controller/view.html.haml
|
|
133
|
-
- lib/prefab/install/templates/lib/templates/haml/scaffold/edit.html.haml
|
|
134
|
-
- lib/prefab/install/templates/lib/templates/haml/scaffold/index.html.haml
|
|
135
|
-
- lib/prefab/install/templates/lib/templates/haml/scaffold/new.html.haml
|
|
136
|
-
- lib/prefab/install/templates/lib/templates/haml/scaffold/show.html.haml
|
|
137
|
-
- lib/prefab/install/templates/lib/templates/slim/controller/view.html.slim
|
|
138
|
-
- lib/prefab/install/templates/lib/templates/slim/scaffold/edit.html.slim
|
|
139
|
-
- lib/prefab/install/templates/lib/templates/slim/scaffold/index.html.slim
|
|
140
|
-
- lib/prefab/install/templates/lib/templates/slim/scaffold/new.html.slim
|
|
141
|
-
- lib/prefab/install/templates/lib/templates/slim/scaffold/show.html.slim
|
|
142
160
|
- lib/prefab/version.rb
|
|
143
|
-
- lib/templates/active_record/model/model.rb
|
|
144
|
-
- lib/templates/haml/scaffold/_form.html.haml
|
|
145
|
-
- lib/templates/haml/scaffold/edit.html.haml
|
|
146
|
-
- lib/templates/haml/scaffold/index.html.haml
|
|
147
|
-
- lib/templates/haml/scaffold/new.html.haml
|
|
148
|
-
- lib/templates/haml/scaffold/show.html.haml
|
|
149
|
-
- lib/templates/rails/scaffold_controller/controller.rb
|
|
150
|
-
- lib/templates/rspec/model/model_spec.rb
|
|
151
161
|
- prefab.gemspec
|
|
152
162
|
- test/dummy/Rakefile
|
|
153
163
|
- test/dummy/app/assets/javascripts/application.js
|
|
@@ -179,11 +189,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
179
189
|
version: '0'
|
|
180
190
|
requirements: []
|
|
181
191
|
rubyforge_project: prefab
|
|
182
|
-
rubygems_version: 2.
|
|
192
|
+
rubygems_version: 2.5.2
|
|
183
193
|
signing_key:
|
|
184
194
|
specification_version: 4
|
|
185
|
-
summary: Prefab provides Twitter Bootstrap generators for Rails
|
|
186
|
-
>=
|
|
195
|
+
summary: Prefab provides Twitter Bootstrap generators for Rails 5 (supported Rails
|
|
196
|
+
>= 5.0.1).
|
|
187
197
|
test_files:
|
|
188
198
|
- test/dummy/Rakefile
|
|
189
199
|
- test/dummy/app/assets/javascripts/application.js
|
|
@@ -195,4 +205,3 @@ test_files:
|
|
|
195
205
|
- test/dummy/config/environments/test.rb
|
|
196
206
|
- test/generators/prefab/install_generator_test.rb
|
|
197
207
|
- test/test_helper.rb
|
|
198
|
-
has_rdoc:
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
.page-header
|
|
2
|
-
= link_to <%= index_helper %>_path, :class => 'btn btn-default' do
|
|
3
|
-
%span.glyphicon.glyphicon-list-alt
|
|
4
|
-
Back
|
|
5
|
-
= link_to @<%= singular_table_name %>, :class => 'btn btn-primary' do
|
|
6
|
-
%span.glyphicon.glyphicon-info-sign
|
|
7
|
-
Show
|
|
8
|
-
%h1 Editing <%= singular_table_name %>
|
|
9
|
-
|
|
10
|
-
= render 'form'
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
.page-header
|
|
2
|
-
= link_to new_<%= singular_table_name %>_path, :class => 'btn btn-primary' do
|
|
3
|
-
%span.glyphicon.glyphicon-plus
|
|
4
|
-
New <%= human_name %>
|
|
5
|
-
%h1 Listing <%= plural_table_name %>
|
|
6
|
-
|
|
7
|
-
.table-responsive
|
|
8
|
-
%table.table.table-striped.table-bordered.table-hover
|
|
9
|
-
%thead
|
|
10
|
-
%tr
|
|
11
|
-
<% for attribute in attributes -%>
|
|
12
|
-
%th <%= attribute.human_name %>
|
|
13
|
-
<% end -%>
|
|
14
|
-
%th
|
|
15
|
-
%th
|
|
16
|
-
%th
|
|
17
|
-
|
|
18
|
-
%tbody
|
|
19
|
-
- @<%= plural_table_name %>.each do |<%= singular_table_name %>|
|
|
20
|
-
%tr
|
|
21
|
-
<% for attribute in attributes -%>
|
|
22
|
-
%td= <%= singular_table_name %>.<%= attribute.name %>
|
|
23
|
-
<% end -%>
|
|
24
|
-
%td= link_to 'Show', <%= singular_table_name %>
|
|
25
|
-
%td= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>)
|
|
26
|
-
%td= link_to 'Destroy', <%= singular_table_name %>, :data => { confirm: 'Are you sure?' }, :method => :delete
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
.page-header
|
|
2
|
-
= link_to <%= index_helper %>_path, :class => 'btn btn-default' do
|
|
3
|
-
%span.glyphicon.glyphicon-list-alt
|
|
4
|
-
Back
|
|
5
|
-
= link_to edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), :class => 'btn btn-primary' do
|
|
6
|
-
%span.glyphicon.glyphicon-pencil
|
|
7
|
-
Edit
|
|
8
|
-
%h1 Show <%= singular_table_name %>
|
|
9
|
-
|
|
10
|
-
%dl.dl-horizontal
|
|
11
|
-
<%- for attribute in attributes -%>
|
|
12
|
-
%dt <%= attribute.human_name %>:
|
|
13
|
-
%dd= @<%= singular_table_name %>.<%= attribute.name %>
|
|
14
|
-
<%- end -%>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
= simple_form_for(<%= singular_table_name %>, :html => {:class => 'form-horizontal'}, :wrapper => :bootstrap, defaults: {label_html: {class: 'col-md-6'}}, role: 'form') do |f|
|
|
2
|
-
= f.error_notification
|
|
3
|
-
|
|
4
|
-
.row
|
|
5
|
-
.col-md-6
|
|
6
|
-
<%- attributes.each do |attribute| -%>
|
|
7
|
-
<%- if attribute.name.include?('_at') || attribute.name.include?('_on') -%>
|
|
8
|
-
= f.input :<%= attribute.name %>, :as => :string, :input_html => { :class => "datepicker" }
|
|
9
|
-
<%- else -%>
|
|
10
|
-
= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
|
|
11
|
-
<%- end -%>
|
|
12
|
-
<%- end -%>
|
|
13
|
-
|
|
14
|
-
.row
|
|
15
|
-
.col-md-6.col-md-offset-6
|
|
16
|
-
= f.button :submit, :class => 'btn btn-primary'
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
.page-header
|
|
2
|
-
%h1
|
|
3
|
-
Edit <%= singular_table_name.titleize %>
|
|
4
|
-
.pull-right
|
|
5
|
-
= link_to 'Show', <%= singular_table_name %>, class: 'btn btn-info'
|
|
6
|
-
= link_to t('back',to: "<%= plural_table_name.titleize %>").html_safe, <%= index_helper %>_path, class: 'btn btn-default'
|
|
7
|
-
= render 'form'
|
|
8
|
-
|
|
9
|
-
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.page-header
|
|
2
|
-
%h1
|
|
3
|
-
<%= plural_table_name.capitalize.gsub("_","") %>
|
|
4
|
-
.pull-right
|
|
5
|
-
= link_to t('new', model_name: "<%= singular_table_name.gsub("_"," ").titleize %>").html_safe, new_<%= singular_table_name %>_path, :class => 'btn btn-primary'
|
|
6
|
-
|
|
7
|
-
%table#<%= plural_table_name %>.table.table-bordered.table-striped.dataTable{:data => {:source => list_<%= plural_table_name %>_url(:format => 'json', :protocol => protocol)}}
|
|
8
|
-
%thead
|
|
9
|
-
%tr
|
|
10
|
-
<% for attribute in attributes -%>
|
|
11
|
-
%th <%= attribute.human_name %>
|
|
12
|
-
<% end -%>
|
|
13
|
-
%th
|
|
14
|
-
%tbody
|
|
15
|
-
- <%= plural_table_name %>.each do |<%= singular_table_name %>|
|
|
16
|
-
%tr
|
|
17
|
-
<% for attribute in attributes -%>
|
|
18
|
-
%td= <%= singular_table_name %>.<%= attribute.name %>
|
|
19
|
-
<% end -%>
|
|
20
|
-
%td
|
|
21
|
-
= link_to t('edit').html_safe, edit_<%= singular_table_name %>_path(<%= singular_table_name %>), :class => 'btn btn-default btn-xs'
|
|
22
|
-
= link_to t('destroy').html_safe, <%= singular_table_name %>, :method => :delete, :data => { :confirm => 'Are you sure?' }, :class => 'btn btn-xs btn-danger'
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
.page-header
|
|
2
|
-
%h1
|
|
3
|
-
<%= singular_table_name.titleize %>
|
|
4
|
-
.pull-right
|
|
5
|
-
= link_to raw(t('edit')), edit_<%= singular_table_name %>_path(<%= singular_table_name %>), :class => 'btn btn-primary'
|
|
6
|
-
= link_to raw(t('back',to: "<%= plural_table_name.titleize %>")), <%= index_helper %>_path, :class => 'btn btn-default'
|
|
7
|
-
%dl
|
|
8
|
-
<% for attribute in attributes -%>
|
|
9
|
-
%dt <%= attribute.human_name %>:
|
|
10
|
-
%dd= <%= singular_table_name %>.<%= attribute.name %>
|
|
11
|
-
<% end -%>
|
|
12
|
-
|