prefab 1.0.0 → 1.0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -4
  3. data/README.md +10 -26
  4. data/lib/generators/api/api_generator.rb +10 -4
  5. data/lib/generators/api/templates/api.rb +8 -6
  6. data/lib/generators/api/templates/api_base.rb +13 -0
  7. data/lib/generators/api/templates/api_spec.rb +8 -2
  8. data/lib/generators/concern/USAGE +8 -0
  9. data/lib/generators/concern/concern_generator.rb +11 -0
  10. data/lib/generators/concern/templates/concern.rb +6 -0
  11. data/lib/generators/concern/templates/concern_spec.rb +5 -0
  12. data/lib/generators/datatable/datatable_generator.rb +2 -2
  13. data/lib/generators/datatable/templates/datatable.rb +4 -17
  14. data/lib/generators/datatable/templates/javascript.js.coffee +7 -6
  15. data/lib/generators/{api → firebase}/USAGE +1 -1
  16. data/lib/generators/firebase/firebase_generator.rb +11 -0
  17. data/lib/generators/firebase/templates/firebase.rb +17 -0
  18. data/lib/generators/firebase/templates/firebase_spec.rb +8 -0
  19. data/lib/{prefab/install → generators/prefab}/install_generator.rb +10 -4
  20. data/lib/{prefab/install/templates/assets/stylesheets/bootstrap-variables.less → generators/prefab/templates/assets/stylesheets/prefab-variables.less} +0 -0
  21. data/lib/{prefab/install/templates/assets/stylesheets/bootstrap-variables.scss → generators/prefab/templates/assets/stylesheets/prefab-variables.scss} +0 -0
  22. data/lib/{prefab/install → generators/prefab}/templates/assets/stylesheets/starter.css +0 -0
  23. data/lib/{prefab/install → generators/prefab}/templates/assets/stylesheets/starter.less +1 -1
  24. data/lib/{prefab/install → generators/prefab}/templates/assets/stylesheets/starter.scss +1 -1
  25. data/lib/{prefab/install → generators/prefab}/templates/form_builders/form_builder/_form.html.erb +0 -0
  26. data/lib/{prefab/install → generators/prefab}/templates/form_builders/form_builder/_form.html.haml +0 -0
  27. data/lib/{prefab/install → generators/prefab}/templates/form_builders/form_builder/_form.html.slim +0 -0
  28. data/lib/{prefab/install → generators/prefab}/templates/layouts/starter.html.erb +0 -0
  29. data/lib/{prefab/install → generators/prefab}/templates/layouts/starter.html.haml +1 -1
  30. data/lib/{prefab/install → generators/prefab}/templates/layouts/starter.html.slim +0 -0
  31. data/lib/{templates → generators/prefab/templates/lib/templates}/active_record/model/model.rb +5 -0
  32. data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/controller/view.html.erb +0 -0
  33. data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/scaffold/edit.html.erb +0 -0
  34. data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/scaffold/index.html.erb +0 -0
  35. data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/scaffold/new.html.erb +0 -0
  36. data/lib/{prefab/install → generators/prefab}/templates/lib/templates/erb/scaffold/show.html.erb +0 -0
  37. data/lib/{prefab/install → generators/prefab}/templates/lib/templates/haml/controller/view.html.haml +0 -0
  38. data/lib/generators/prefab/templates/lib/templates/haml/scaffold/_form.html.haml +19 -0
  39. data/lib/generators/prefab/templates/lib/templates/haml/scaffold/edit.html.haml +11 -0
  40. data/lib/generators/prefab/templates/lib/templates/haml/scaffold/index.html.haml +16 -0
  41. data/lib/{templates → generators/prefab/templates/lib/templates}/haml/scaffold/new.html.haml +0 -0
  42. data/lib/generators/prefab/templates/lib/templates/haml/scaffold/show.html.haml +14 -0
  43. data/lib/{templates → generators/prefab/templates/lib/templates}/rails/scaffold_controller/controller.rb +2 -2
  44. data/lib/{templates → generators/prefab/templates/lib/templates}/rspec/model/model_spec.rb +0 -0
  45. data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/controller/view.html.slim +0 -0
  46. data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/scaffold/edit.html.slim +0 -0
  47. data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/scaffold/index.html.slim +0 -0
  48. data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/scaffold/new.html.slim +0 -0
  49. data/lib/{prefab/install → generators/prefab}/templates/lib/templates/slim/scaffold/show.html.slim +0 -0
  50. data/lib/generators/rails/prefab/USAGE +8 -0
  51. data/lib/generators/rails/prefab/prefab_generator.rb +53 -0
  52. data/lib/generators/rails/prefab/templates/javascript.js.coffee +9 -0
  53. data/lib/generators/report/templates/report_spec.rb +2 -2
  54. data/lib/generators/service/templates/service.rb +11 -0
  55. data/lib/generators/survey/survey_generator.rb +11 -0
  56. data/lib/generators/survey/templates/survey.rb +20 -0
  57. data/lib/generators/survey/templates/survey_spec.rb +8 -0
  58. data/lib/prefab.rb +4 -4
  59. data/lib/prefab/version.rb +1 -1
  60. data/prefab.gemspec +5 -5
  61. metadata +58 -49
  62. data/lib/prefab/install/templates/lib/templates/haml/scaffold/edit.html.haml +0 -10
  63. data/lib/prefab/install/templates/lib/templates/haml/scaffold/index.html.haml +0 -26
  64. data/lib/prefab/install/templates/lib/templates/haml/scaffold/new.html.haml +0 -7
  65. data/lib/prefab/install/templates/lib/templates/haml/scaffold/show.html.haml +0 -14
  66. data/lib/templates/haml/scaffold/_form.html.haml +0 -16
  67. data/lib/templates/haml/scaffold/edit.html.haml +0 -9
  68. data/lib/templates/haml/scaffold/index.html.haml +0 -22
  69. 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: 9deed1e9db474cd286c31d32750dd4c3c52ae507
4
- data.tar.gz: 5bc67bb2859a91a01c34800dca7591e0eff7a49f
3
+ metadata.gz: 131479d8fc6c466557455635a418628d74c54bca
4
+ data.tar.gz: 5f248bf34762f6eab2b47c03ac7c630ce84c4319
5
5
  SHA512:
6
- metadata.gz: 3f6fc6cf34fa80201d94b1aca98378fb23e164bf5076114ec66edf00f1bf4700a368113336503cd1127eb0bbe07a4a6ccc43578b10a1df1440d5eb4330eaa925
7
- data.tar.gz: 7442e32a896f9580fc5efc592450d3542d99e9ff27b633204e6dbe2ff99daf20aeae8b57a60c09982a68e8fa7d86595c31738a8e33e8eda34056ba90c1618ab3
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', '>= 4.0.2'
11
+ gem 'sass-rails', '>= 5.0.6'
12
12
  when "default"
13
- rails = ">= 3.1.0"
13
+ rails = ">= 5.0"
14
14
  gem 'sass-rails'
15
15
  else
16
16
  rails = "~> #{rails_version}"
17
17
 
18
- if rails_version[0] == '4'
19
- gem 'sass-rails', '>= 4.0.2'
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
  [![Build Status](https://travis-ci.org/jeperkins4/prefab.png?branch=master)](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 4 (supported Rails >= 3.1). Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites.
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.1.1.
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', '~> 3.1.1'
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 bootstrap:install --help`
43
+ To print the options and usage run the command `rails generate prefab:install --help`
44
44
 
45
- rails generate bootstrap:install [options]
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 bootstrap:install --template-engine=haml
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 bootstrap:install --stylesheet-engine=scss
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/bootstrap-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.
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/bootstrap.js`)
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 generate_api_file
5
- template "api.rb", "lib/#{file_name.underscore}.rb"
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 generate_report_spec_file
9
- template "api_spec.rb", "spec/lib/#{file_name.underscore}_spec.rb"
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
- module <%= file_name.camelize %>
2
- class API
3
- def initialize
4
- @key = APP[:<%= file_name.camelize %>][:key]
5
- @base_url = ""
6
- end
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
@@ -0,0 +1,13 @@
1
+ require 'builder'
2
+ require 'cgi'
3
+ require 'open-uri'
4
+
5
+ class Api::Base
6
+ attr_accessor :url, :key, :secret
7
+
8
+ def initialize(url, key, secret)
9
+ self.url = url
10
+ self.key = key
11
+ self.secret = secret
12
+ end
13
+ end
@@ -1,5 +1,11 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
- describe <%= file_name.camelize %>::API do
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,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate Concern
6
+
7
+ This will create:
8
+ app/concerns/file_name.rb
@@ -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
@@ -0,0 +1,6 @@
1
+ module <%= file_name.camelize %>
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe <%= file_name.camelize %> do
4
+
5
+ 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}.js.coffee" if options.coffeescript?
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("#{sort_column} #{sort_direction}")
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 sort_column
40
- columns[params[:iSortCol_0].to_i]
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
- sDom: "<'row'<'col-md-7'l><'col-md-5'f>r>t<'row'<'col-md-7'i><'col-md-5'p>>"
4
- sPaginationType: "bootstrap"
5
- bAutoWidth: false
6
- bProcessing: true
7
- bServerSide: true
8
- sAjaxSource: $("#<%= file_name.pluralize %>").data('source')
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')
@@ -2,7 +2,7 @@ Description:
2
2
  Explain the generator
3
3
 
4
4
  Example:
5
- rails generate api Thing
5
+ rails generate service Thing
6
6
 
7
7
  This will create:
8
8
  what/will/it/create
@@ -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
@@ -0,0 +1,8 @@
1
+ require 'rails_helper'
2
+
3
+ describe <%= file_name.camelize %> do
4
+ let!(:<%= class_name.downcase.underscore %>) { Fabricate(:<%= class_name.downcase.underscore %>) }
5
+
6
+ context 'basic' do
7
+ end
8
+ 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/bootstrap-generators.#{stylesheet_extension}"
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/bootstrap-variables.#{stylesheet_extension}", "app/assets/stylesheets/bootstrap-variables.#{stylesheet_extension}"
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 inject_backbone
34
- application_js_path = 'app/assets/javascripts/application.js'
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
@@ -4,7 +4,7 @@ body {
4
4
  padding-top: @navbar-height + 10px;
5
5
  }
6
6
 
7
- @import "bootstrap-variables";
7
+ @import "prefab-variables";
8
8
 
9
9
  .page-header {
10
10
  a.btn {
@@ -1,4 +1,4 @@
1
- @import "bootstrap-variables";
1
+ @import "prefab-variables";
2
2
  @import "bootstrap.scss";
3
3
 
4
4
  body {
@@ -23,7 +23,7 @@
23
23
  %span.icon-bar
24
24
  %span.icon-bar
25
25
  %span.icon-bar
26
- = link_to "Project name", "#", :class => "navbar-brand"
26
+ = link_to t('project_name').html_safe, "#", :class => "navbar-brand"
27
27
  .collapse.navbar-collapse
28
28
  %ul.nav.navbar-nav
29
29
  %li.active
@@ -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 -%>
@@ -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"} &times;
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
@@ -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
- before_filter :authenticate_user!
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 list
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
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate datatable Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -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.snakecase %>) { Fabricate(:<%= class_name.snakecase %>) }
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
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe <%= file_name.camelize %> do
4
+ context 'basic' do
5
+ user = OpenStruct.new(name: "Rubyist")
6
+ typeform = file_name.camelize.build(user)
7
+ end
8
+ end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Prefab
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.3.1'
3
3
  end
@@ -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 4 (supported Rails >= 3.1).}
12
- spec.description = %q{Prefab provides Twitter Bootstrap generators for Rails 4 (supported Rails >= 3.1). Checkout http://getbootstrap.com.}
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.5"
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 'debugger'
26
+ spec.add_development_dependency 'byebug'
27
27
 
28
- spec.add_runtime_dependency "railties", ">= 3.1.0"
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.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: 2014-04-09 00:00:00.000000000 Z
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: '1.5'
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: '1.5'
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: debugger
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: 3.1.0
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: 3.1.0
83
- description: Prefab provides Twitter Bootstrap generators for Rails 4 (supported Rails
84
- >= 3.1). Checkout http://getbootstrap.com.
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.2.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 4 (supported Rails
186
- >= 3.1).
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,7 +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
- %h1 New <%= singular_table_name %>
6
-
7
- = render 'form'
@@ -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
-