mvpkit 1.1.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -24
  3. data/README.md +43 -48
  4. data/VERSION +1 -1
  5. data/bin/mvp +2 -2
  6. data/config/routes.rb +0 -4
  7. data/mvpkit.gemspec +57 -129
  8. data/package.json +3 -22
  9. data/project/.babelrc +23 -1
  10. data/project/.gitignore +2 -0
  11. data/project/.postcssrc.yml +4 -0
  12. data/project/Gemfile +21 -13
  13. data/project/Gemfile.lock +181 -153
  14. data/project/Procfile +1 -1
  15. data/project/README.md +2 -116
  16. data/project/app/assets/javascripts/application.js +0 -8
  17. data/project/app/assets/stylesheets/application.scss +9 -3
  18. data/project/app/assets/stylesheets/elements/alerts.scss +10 -0
  19. data/project/app/assets/stylesheets/elements/badges.scss +16 -0
  20. data/project/app/assets/stylesheets/elements/buttons.scss +107 -0
  21. data/project/app/assets/stylesheets/elements/cards.scss +68 -0
  22. data/project/app/assets/stylesheets/elements/drawer.scss +66 -0
  23. data/project/app/assets/stylesheets/elements/forms.scss +64 -0
  24. data/project/app/assets/stylesheets/elements/interstitial.scss +24 -0
  25. data/project/app/assets/stylesheets/elements/navs.scss +15 -0
  26. data/project/app/assets/stylesheets/elements/sidebar.scss +30 -0
  27. data/project/app/assets/stylesheets/elements/tables.scss +61 -0
  28. data/project/app/assets/stylesheets/elements/timeline.scss +38 -0
  29. data/project/app/assets/stylesheets/elements/typography.scss +80 -0
  30. data/project/app/assets/stylesheets/init/bootstrap.scss +53 -0
  31. data/project/app/assets/stylesheets/init/reset.scss +20 -0
  32. data/project/app/assets/stylesheets/init/variables.scss +40 -0
  33. data/project/app/assets/stylesheets/treatments/backgrounds.scss +23 -0
  34. data/project/app/assets/stylesheets/treatments/borders.scss +7 -0
  35. data/project/app/{webpack/stylesheets/skin → assets/stylesheets/treatments}/spacing.scss +4 -10
  36. data/{app/controllers/mvp → project/app/controllers}/analytics_controller.rb +0 -0
  37. data/{app/controllers/concerns/mvp → project/app/controllers/concerns}/analytics_concern.rb +0 -0
  38. data/{app/controllers/concerns/mvp → project/app/controllers/concerns}/seo_concern.rb +0 -0
  39. data/{app/controllers/concerns/mvp → project/app/controllers/concerns}/session_concern.rb +0 -0
  40. data/project/app/controllers/conversions_controller.rb +1 -2
  41. data/{app/controllers/mvp → project/app/controllers}/seo_controller.rb +0 -0
  42. data/project/app/engines/admin/app/views/layouts/admin/_header.html.erb +18 -18
  43. data/project/app/helpers/application_helper.rb +0 -14
  44. data/{app/assets/stylesheets/mvp/application.scss → project/app/javascript/components/.gitkeep} +0 -0
  45. data/project/app/javascript/components/conversion.jsx +73 -0
  46. data/project/app/javascript/packs/application.js +28 -0
  47. data/project/app/javascript/packs/server_rendering.js +5 -0
  48. data/project/app/models/conversion.rb +1 -1
  49. data/project/app/views/conversions/show.json.jbuilder +1 -0
  50. data/project/app/views/home/index.html.erb +22 -22
  51. data/project/app/views/layouts/_header.html.erb +35 -34
  52. data/{app/views/layouts/mvp → project/app/views/layouts}/_instrumentation.html.erb +0 -0
  53. data/{app/views/layouts/mvp → project/app/views/layouts}/_meta.html.erb +0 -0
  54. data/project/app/views/layouts/application.html.erb +31 -21
  55. data/project/bin/setup +1 -1
  56. data/project/bin/webpack +28 -0
  57. data/project/bin/webpack-dev-server +43 -0
  58. data/project/config/initializers/assets.rb +2 -0
  59. data/{config → project/config}/initializers/canonical_host.rb +0 -0
  60. data/{config → project/config}/initializers/cloudinary.rb +0 -0
  61. data/{config → project/config}/initializers/rollbar.rb +0 -0
  62. data/{config → project/config}/initializers/routing.rb +0 -0
  63. data/{config → project/config}/initializers/spoof_ip.rb +0 -0
  64. data/{config → project/config}/initializers/ssl.rb +0 -0
  65. data/project/config/routes.rb +5 -7
  66. data/project/config/webpack/configuration.js +35 -0
  67. data/project/config/webpack/development.js +32 -0
  68. data/project/config/webpack/loaders/assets.js +12 -0
  69. data/project/config/webpack/loaders/babel.js +5 -0
  70. data/project/config/webpack/loaders/coffee.js +4 -0
  71. data/project/config/webpack/loaders/erb.js +9 -0
  72. data/project/config/webpack/loaders/react.js +5 -0
  73. data/project/config/webpack/loaders/sass.js +15 -0
  74. data/project/config/webpack/production.js +35 -0
  75. data/project/config/webpack/shared.js +58 -0
  76. data/project/config/webpack/test.js +6 -0
  77. data/project/config/webpacker.yml +38 -0
  78. data/project/package-lock.json +250 -0
  79. data/project/package.json +37 -17
  80. data/project/yarn.lock +4538 -0
  81. metadata +56 -326
  82. data/app/assets/javascripts/mvp/application.js +0 -1
  83. data/app/controllers/mvp/styleguide_controller.rb +0 -23
  84. data/app/helpers/minimum_viable_product/body_helper.rb +0 -14
  85. data/app/helpers/minimum_viable_product/bootstrap_helper.rb +0 -38
  86. data/app/helpers/minimum_viable_product/styleguide_helper.rb +0 -4
  87. data/app/models/concerns/mvp/slugification.rb +0 -24
  88. data/app/views/layouts/mvp/application.html.erb +0 -19
  89. data/app/views/mvp/styleguide/_example.html.erb +0 -6
  90. data/app/views/mvp/styleguide/bootstrap.html.erb +0 -43
  91. data/app/views/mvp/styleguide/bootstrap/_buttons.html.erb +0 -191
  92. data/app/views/mvp/styleguide/bootstrap/_forms.html.erb +0 -192
  93. data/app/views/mvp/styleguide/bootstrap/_header.html.erb +0 -48
  94. data/app/views/mvp/styleguide/bootstrap/_panels.html.erb +0 -16
  95. data/app/views/mvp/styleguide/bootstrap/_tables.html.erb +0 -34
  96. data/app/views/mvp/styleguide/bootstrap/_typography.html.erb +0 -51
  97. data/app/views/mvp/styleguide/elements/_grouping.html.erb +0 -1
  98. data/app/views/mvp/styleguide/elements/partials/_row_groups_of.html.erb +0 -7
  99. data/app/views/mvp/styleguide/index.html.erb +0 -17
  100. data/app/views/mvp/styleguide/layouts/basic.html.erb +0 -4
  101. data/app/views/mvp/styleguide/layouts/carousel.html.erb +0 -120
  102. data/app/views/mvp/styleguide/layouts/cover.html.erb +0 -34
  103. data/config/initializers/assets.rb +0 -2
  104. data/config/initializers/geocoder.rb +0 -9
  105. data/project/app/assets/javascripts/pack-compiled.js +0 -37394
  106. data/project/app/assets/javascripts/pack-compiled.js.map +0 -1
  107. data/project/app/assets/javascripts/templates.js.erb +0 -14
  108. data/project/app/assets/stylesheets/pack-compiled.css +0 -33946
  109. data/project/app/assets/stylesheets/pack-compiled.css.map +0 -1
  110. data/project/app/controllers/examples_controller.rb +0 -2
  111. data/project/app/views/examples/index.html.erb +0 -1
  112. data/project/app/views/examples/mustache.html.erb +0 -40
  113. data/project/app/views/examples/mustache/template.mustache +0 -1
  114. data/project/app/views/home/conversion.html.erb +0 -12
  115. data/project/app/webpack/javascripts/behaviors/example.js +0 -21
  116. data/project/app/webpack/javascripts/controllers/home.js +0 -15
  117. data/project/app/webpack/javascripts/lib/analytics.js +0 -22
  118. data/project/app/webpack/javascripts/lib/clientsidevalidations.js +0 -3
  119. data/project/app/webpack/javascripts/lib/controllers.js +0 -28
  120. data/project/app/webpack/javascripts/lib/forms.js +0 -28
  121. data/project/app/webpack/javascripts/lib/selectize.js +0 -1
  122. data/project/app/webpack/javascripts/pack.js +0 -50
  123. data/project/app/webpack/stylesheets/config/variables.scss +0 -41
  124. data/project/app/webpack/stylesheets/init/reset.scss +0 -48
  125. data/project/app/webpack/stylesheets/layout/main.scss +0 -7
  126. data/project/app/webpack/stylesheets/pack.scss +0 -20
  127. data/project/app/webpack/stylesheets/skin/alerts.scss +0 -3
  128. data/project/app/webpack/stylesheets/skin/buttons.scss +0 -38
  129. data/project/app/webpack/stylesheets/skin/hero.scss +0 -45
  130. data/project/app/webpack/stylesheets/skin/images.scss +0 -13
  131. data/project/app/webpack/stylesheets/skin/progress.scss +0 -3
  132. data/project/app/webpack/stylesheets/skin/selectize.scss +0 -30
  133. data/project/app/webpack/stylesheets/skin/tables.scss +0 -24
  134. data/project/app/webpack/stylesheets/skin/treatments.scss +0 -3
  135. data/project/app/webpack/stylesheets/skin/turbolinks.scss +0 -4
  136. data/project/app/webpack/stylesheets/skin/typography.scss +0 -116
  137. data/project/webpack.config.js +0 -76
@@ -1,21 +1,21 @@
1
- <nav class="navbar navbar-toggleable-md navbar-inverse bg-inverse">
2
- <div class="container">
3
- <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
4
- <span class="navbar-toggler-icon"></span>
5
- </button>
6
- <a class="navbar-brand" href="/">__PROJECT_NAME__ <span class="text-danger">Admin</span></a>
1
+ <nav class="navbar navbar-expand-lg navbar-light bg-light">
2
+ <a class="navbar-brand" href="/">__PROJECT_NAME__</a>
3
+ <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
4
+ <span class="navbar-toggler-icon"></span>
5
+ </button>
7
6
 
8
- <div class="collapse navbar-collapse" id="navbarSupportedContent">
9
- <ul class="navbar-nav mr-auto">
10
- </ul>
11
- <ul class="navbar-nav">
12
- <li class="nav-item <%= 'active' if controller_name == 'conversions' %>">
13
- <%= link_to 'Conversions', conversions_path, class: "nav-link" %>
14
- </li>
15
- <li class="nav-item <%= 'active' if controller_name == 'users' %>">
16
- <%= link_to 'Users', users_path, class: "nav-link" %>
17
- </li>
18
- </ul>
19
- </div>
7
+ <div class="collapse navbar-collapse" id="navbarSupportedContent">
8
+ <ul class="navbar-nav mr-auto">
9
+ <li class="nav-item <%= 'active' if controller_name == 'conversions' %>">
10
+ <%= link_to 'Conversions', conversions_path, class: "nav-link" %>
11
+ </li>
12
+ <li class="nav-item <%= 'active' if controller_name == 'users' %>">
13
+ <%= link_to 'Users', users_path, class: "nav-link" %>
14
+ </li>
15
+ </ul>
16
+ <form class="form-inline my-2 my-lg-0">
17
+ <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
18
+ <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
19
+ </form>
20
20
  </div>
21
21
  </nav>
@@ -17,20 +17,6 @@ module ApplicationHelper
17
17
  )
18
18
  end
19
19
 
20
- def render_mustache(template, object)
21
- mustache = Mustache.new
22
- mustache.template_extension = 'mustache'
23
- mustache.template_path = Rails.root.join("app/templates")
24
- mustache.template_file = Rails.root.join("app/templates/#{template}.mustache")
25
- mustache.instance_eval %%
26
- def logged_in
27
- #{!!current_user}
28
- end
29
- %
30
- # mustache.template_extension = 'mustache'
31
- mustache.render(object).html_safe
32
- end
33
-
34
20
  def store_and_redirect_path(path)
35
21
  url_for(:only_path => false, :trailing_slash => true) + "r/" + path
36
22
  end
@@ -0,0 +1,73 @@
1
+ import autobind from 'react-autobind';
2
+ import React from 'react';
3
+ import { Form, Input } from 'reactstrap';
4
+ import validator from 'validator';
5
+ import SuperAgent from 'superagent';
6
+
7
+ class Conversion extends React.Component {
8
+ constructor(props){
9
+ super(props);
10
+ this.state = {
11
+ disabled: true,
12
+ }
13
+ autobind(this);
14
+ }
15
+
16
+ onEmailChange(e){
17
+ let val = e.target.value;
18
+
19
+ if (!validator.isEmail(val)) {
20
+ this.setState({disabled: true})
21
+ return;
22
+ }
23
+
24
+ this.setState({
25
+ disabled: false,
26
+ email: val,
27
+ })
28
+ }
29
+
30
+ onSubmit(e){
31
+ e.preventDefault();
32
+
33
+ SuperAgent
34
+ .post('/conversion')
35
+ .send({ conversion: {email: this.state.email} })
36
+ .end((err, res) => {
37
+ if (res.ok) {
38
+ this.setState({success: true});
39
+ } else {
40
+ this.setState({
41
+ errors: res.body.errors,
42
+ });
43
+ }
44
+ })
45
+ }
46
+
47
+ render(){
48
+ if (this.state.success){
49
+ return(
50
+ <div className="card">
51
+ <div className="card-body text-center">
52
+ <h4>Conversion Successful!</h4>
53
+ </div>
54
+ </div>
55
+ )
56
+ }
57
+ return (
58
+ <div className="card">
59
+ <div className="card-body">
60
+ <h4 className="mb10">Conversion Form</h4>
61
+ <Form onSubmit={(e)=>{e.preventDefault()}}>
62
+ <Input onChange={this.onEmailChange} placeholder="Enter your email ..."/>
63
+ <div className="mt15">
64
+ <button onClick={this.onSubmit} className="btn btn-primary" disabled={this.state.disabled}>Join Now</button>
65
+ </div>
66
+ </Form>
67
+ </div>
68
+ </div>
69
+ )
70
+ }
71
+ }
72
+
73
+ export default Conversion;
@@ -0,0 +1,28 @@
1
+ /* eslint no-console:0 */
2
+ // This file is automatically compiled by Webpack, along with any other files
3
+ // present in this directory. You're encouraged to place your actual application logic in
4
+ // a relevant structure within app/javascript and only use these pack files to reference
5
+ // that code so it'll be compiled.
6
+ //
7
+ // To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
8
+ // layout file, like app/views/layouts/application.html.erb
9
+
10
+ // Support component names relative to this directory:
11
+ var componentRequireContext = require.context("components", true)
12
+ var ReactRailsUJS = require("react_ujs")
13
+ ReactRailsUJS.useContext(componentRequireContext)
14
+
15
+ window.Tether = require('tether');
16
+ window.Popper = require('popper.js').default
17
+ window.jQuery = require('jquery')
18
+ window.jQueryUJS = require('jquery-ujs');
19
+ window.$ = window.jQuery;
20
+
21
+ window.is = require('is_js');
22
+ window._ = require('lodash');
23
+ _.mixin(require('lodash-inflection'));
24
+
25
+ window.Moment = require('moment');
26
+ window.bs = require('bootstrap');
27
+
28
+ window.Conversion = require('components/conversion');
@@ -0,0 +1,5 @@
1
+ // By default, this pack is loaded for server-side rendering.
2
+ // It must expose react_ujs as `ReactRailsUJS` and prepare a require context.
3
+ var componentRequireContext = require.context("components", true)
4
+ var ReactRailsUJS = require("react_ujs")
5
+ ReactRailsUJS.useContext(componentRequireContext)
@@ -1,3 +1,3 @@
1
1
  class Conversion < ApplicationRecord
2
- validates :email, presence: true, uniqueness: true, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }
2
+ validates :email, presence: true, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }
3
3
  end
@@ -0,0 +1 @@
1
+ json.extract! @conversion, :id, :email
@@ -1,28 +1,28 @@
1
- <div class="row mt100">
2
- <div class="col-sm-8 offset-sm-2 col-md-6 offset-md-3">
3
- <p class='text-center mb50'>
4
- By default, this page is setup to accept an email submission and store in the database. Depending on your configuration, this will fire an conversion event and even submit to Slack.
5
- </p>
6
- <div class="card">
7
- <div class="card-header">
8
- <h4>Sign Up</h4>
9
- </div>
10
- <div class="card-block">
11
- <%= simple_form_for Conversion.new, url: conversion_path, remote:true, validate: true, html: { class: 'disable-on-submit' } do |f| %>
12
- <div class="row">
13
- <div class="col-sm-7 pr10-sm">
14
- <%= f.input :email, placeholder: 'joe@example.com', label: false, input_html: { class: "mb0" } %>
15
- </div>
16
- <div class="col-sm-5 pl0-sm">
17
- <%= f.submit "Register for Free", class: 'btn btn-primary btn-block' %>
18
- </div>
19
- </div>
1
+ <div class="row mt100 justify-content-center">
2
+ <div class="col-lg-8">
3
+ <div class="mb50">
4
+ <h1 class="text-center mb10">mvpkit is running</h1>
5
+ <p class='text-center'>
6
+ Hopefully that was easy. Now, onto the good stuff.
7
+ </p>
8
+ </div>
9
+
10
+ <h2 class="mb20">Quick Tour</h2>
20
11
 
21
- <p class="text-center mt10 mb0 text-grey">
22
- <small>We hate spam, don't worry, we'll never try to sell you anything or your info to anyone.</small>
23
- </p>
12
+ <div class="mb50">
13
+ <p class="mb20">You've got <a href="https://getbootstrap.com/docs/4.0/getting-started/introduction/">Bootstrap 4</a> ready to go.</p>
14
+
15
+ <div class="row">
16
+ <% ['primary','secondary','success','warning','danger'].each do |color| %>
17
+ <div class="col-sm-4 mb20">
18
+ <a href="#" class="btn btn-<%= color %> btn-block">.btn-<%= color %></a>
19
+ </div>
24
20
  <% end %>
25
21
  </div>
26
22
  </div>
23
+
24
+ <p class="mb15">Here's a sample React conversion form. It takes an email as an input, validates and submits to the server to create a conversion, which will show up in <a href="/a/conversions">conversions admin</a></p>
25
+
26
+ <%= react_component 'Conversion' %>
27
27
  </div>
28
28
  </div>
@@ -1,37 +1,38 @@
1
- <nav class="navbar navbar-toggleable-md navbar-light bg-faded">
2
- <div class="container">
3
- <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
4
- <span class="navbar-toggler-icon"></span>
5
- </button>
6
- <a class="navbar-brand" href="/">__PROJECT_NAME__</a>
1
+ <nav class="navbar navbar-expand-lg navbar-light bg-light">
2
+ <a class="navbar-brand" href="/">__PROJECT_NAME__</a>
3
+ <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
4
+ <span class="navbar-toggler-icon"></span>
5
+ </button>
7
6
 
8
- <div class="collapse navbar-collapse" id="navbarSupportedContent">
9
- <ul class="navbar-nav mr-auto">
10
- </ul>
11
- <ul class="navbar-nav">
12
- <li class="nav-item">
13
- <%= link_to 'Examples', examples_path, class: 'nav-link' %>
14
- </li>
15
- <li class="nav-item">
16
- <%= link_to 'Admin', admin_path, class: 'nav-link' %>
17
- </li>
18
- </ul>
19
- <ul class="navbar-nav">
20
- <% if user_signed_in? %>
21
- <li class="nav-item dropdown">
22
- <a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
23
- <%= current_user.email %>
24
- </a>
25
- <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
26
- <%= link_to 'Log Out', destroy_user_session_path, method: :delete, class: 'nav-link' %>
27
- </div>
28
- </li>
29
- <% else %>
30
- <li class="nav-item">
31
- <%= link_to 'Log In / Register', new_user_session_path, class: 'nav-link' %>
32
- </li>
33
- <% end %>
34
- </ul>
35
- </div>
7
+ <div class="collapse navbar-collapse" id="navbarSupportedContent">
8
+ <ul class="navbar-nav mr-auto">
9
+ <li class="nav-item active">
10
+ <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
11
+ </li>
12
+ <li class="nav-item">
13
+ <%= link_to 'Admin', admin_path, class: 'nav-link' %>
14
+ </li>
15
+ </ul>
16
+ <form class="form-inline my-2 my-lg-0">
17
+ <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
18
+ <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
19
+ </form>
36
20
  </div>
37
21
  </nav>
22
+
23
+ <!-- <ul class="navbar-nav">
24
+ <% if user_signed_in? %>
25
+ <li class="nav-item dropdown">
26
+ <a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
27
+ <%= current_user.email %>
28
+ </a>
29
+ <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
30
+ <%= link_to 'Log Out', destroy_user_session_path, method: :delete, class: 'nav-link' %>
31
+ </div>
32
+ </li>
33
+ <% else %>
34
+ <li class="nav-item">
35
+ <%= link_to 'Log In / Register', new_user_session_path, class: 'nav-link' %>
36
+ </li>
37
+ <% end %>
38
+ </ul> -->
@@ -1,28 +1,38 @@
1
- <%- content_for :javascripts do %>
2
- <%= javascript_include_tag 'https://npmcdn.com/tether@1.2.4/dist/js/tether.min.js' %>
3
- <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
4
- <%= javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.4/js/standalone/selectize.js' %>
5
- <% end %>
1
+ <!DOCTYPE HTML>
2
+ <html lang='en'>
3
+ <head>
4
+ <%= render('layouts/meta').gsub(/\n/,'').html_safe %>
5
+ <%= yield :meta %>
6
6
 
7
- <%- content_for :stylesheets do %>
8
7
  <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
9
- <% end %>
8
+ <%= yield :stylesheets %>
10
9
 
11
- <%- content_for :body do %>
12
- <% unless page.hide_header == true %>
13
- <% if content_for :header %>
14
- <%= yield :header %>
15
- <% else %>
16
- <%= render 'layouts/header' %>
10
+ <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]-->
11
+ <%= csrf_meta_tags %>
12
+ <%= render 'layouts/instrumentation' %>
13
+ </head>
14
+ <body id="<%= body_id %>" class="<%= body_classes %>" data-controller="<%= controller.controller_path %>" data-action="<%= controller.action_name %>" data-iteration="<%= MVP::Iteration.version %>">
15
+ <% if content_for? :body %>
16
+ <%= yield :body %>
17
+ <% else %>
18
+ <% unless page.hide_header == true %>
19
+ <% if content_for :header %>
20
+ <%= yield :header %>
21
+ <% else %>
22
+ <%= render 'layouts/header' %>
23
+ <% end %>
17
24
  <% end %>
18
- <% end %>
19
25
 
20
- <%= yield :pre %>
26
+ <%= yield :pre %>
21
27
 
22
- <div class="container <%= page.container_class %>">
23
- <%= render 'layouts/notifications' %>
24
- <%= yield %>
25
- </div>
26
- <% end %>
28
+ <div class="container <%= page.container_class %>">
29
+ <%= render 'layouts/notifications' %>
30
+ <%= yield %>
31
+ </div>
32
+ <% end %>
27
33
 
28
- <%= render template: "layouts/mvp/application" %>
34
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
35
+ <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
36
+ <%= yield :javascripts %>
37
+ </body>
38
+ </html>
data/project/bin/setup CHANGED
@@ -14,7 +14,7 @@ chdir APP_ROOT do
14
14
  puts '== Installing dependencies =='
15
15
  system! 'gem install bundler --conservative'
16
16
  system!('bundle install')
17
- system!('npm install')
17
+ system!('yarn')
18
18
 
19
19
  # puts "\n== Copying sample files =="
20
20
  # unless File.exist?('config/database.yml')
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+ $stdout.sync = true
3
+
4
+ require "shellwords"
5
+ require "yaml"
6
+
7
+ ENV["RAILS_ENV"] ||= "development"
8
+ RAILS_ENV = ENV["RAILS_ENV"]
9
+
10
+ ENV["NODE_ENV"] ||= RAILS_ENV
11
+ NODE_ENV = ENV["NODE_ENV"]
12
+
13
+ APP_PATH = File.expand_path("../", __dir__)
14
+ NODE_MODULES_PATH = File.join(APP_PATH, "node_modules")
15
+ WEBPACK_CONFIG = File.join(APP_PATH, "config/webpack/#{NODE_ENV}.js")
16
+
17
+ unless File.exist?(WEBPACK_CONFIG)
18
+ puts "Webpack configuration not found."
19
+ puts "Please run bundle exec rails webpacker:install to install webpacker"
20
+ exit!
21
+ end
22
+
23
+ newenv = { "NODE_PATH" => NODE_MODULES_PATH.shellescape }
24
+ cmdline = ["yarn", "run", "webpack", "--", "--config", WEBPACK_CONFIG] + ARGV
25
+
26
+ Dir.chdir(APP_PATH) do
27
+ exec newenv, *cmdline
28
+ end
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+ $stdout.sync = true
3
+
4
+ require "shellwords"
5
+ require "yaml"
6
+
7
+ ENV["RAILS_ENV"] ||= "development"
8
+ RAILS_ENV = ENV["RAILS_ENV"]
9
+
10
+ ENV["NODE_ENV"] ||= RAILS_ENV
11
+ NODE_ENV = ENV["NODE_ENV"]
12
+
13
+ APP_PATH = File.expand_path("../", __dir__)
14
+ CONFIG_FILE = File.join(APP_PATH, "config/webpacker.yml")
15
+ NODE_MODULES_PATH = File.join(APP_PATH, "node_modules")
16
+ WEBPACK_CONFIG = File.join(APP_PATH, "config/webpack/development.js")
17
+
18
+ def args(key)
19
+ index = ARGV.index(key)
20
+ index ? ARGV[index + 1] : nil
21
+ end
22
+
23
+ begin
24
+ dev_server = YAML.load_file(CONFIG_FILE)["development"]["dev_server"]
25
+
26
+ DEV_SERVER_HOST = "http#{"s" if args('--https') || dev_server["https"]}://#{args('--host') || dev_server["host"]}:#{args('--port') || dev_server["port"]}"
27
+
28
+ rescue Errno::ENOENT, NoMethodError
29
+ puts "Webpack dev_server configuration not found in #{CONFIG_FILE}."
30
+ puts "Please run bundle exec rails webpacker:install to install webpacker"
31
+ exit!
32
+ end
33
+
34
+ newenv = {
35
+ "NODE_PATH" => NODE_MODULES_PATH.shellescape,
36
+ "ASSET_HOST" => DEV_SERVER_HOST.shellescape
37
+ }.freeze
38
+
39
+ cmdline = ["yarn", "run", "webpack-dev-server", "--", "--progress", "--color", "--config", WEBPACK_CONFIG] + ARGV
40
+
41
+ Dir.chdir(APP_PATH) do
42
+ exec newenv, *cmdline
43
+ end