thredded_create_app 0.1.12 → 0.1.13

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.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/thredded_create_app/tasks/add_rails_email_preview.rb +1 -4
  3. data/lib/thredded_create_app/tasks/add_thredded/_thredded-variables.scss +9 -0
  4. data/lib/thredded_create_app/tasks/add_thredded.rb +3 -6
  5. data/lib/thredded_create_app/tasks/base.rb +13 -2
  6. data/lib/thredded_create_app/tasks/setup_app_skeleton/_header.html.erb +17 -0
  7. data/lib/thredded_create_app/tasks/setup_app_skeleton/application_helper_methods.rb +2 -0
  8. data/lib/thredded_create_app/tasks/setup_app_skeleton/en.yml.erb +4 -0
  9. data/lib/thredded_create_app/tasks/setup_app_skeleton/images/brightness.svg +3 -0
  10. data/lib/thredded_create_app/tasks/setup_app_skeleton/javascripts/app/monkey-patch-turbolinks.js +16 -0
  11. data/lib/thredded_create_app/tasks/setup_app_skeleton/javascripts/app/theme.js +11 -0
  12. data/lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/_app.scss +5 -0
  13. data/lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/_deps.scss +0 -0
  14. data/lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/_variables-night.scss +71 -0
  15. data/lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/_variables.scss.erb +17 -0
  16. data/lib/thredded_create_app/tasks/setup_app_skeleton/{_flash-messages.scss → stylesheets/app/_flash-messages.scss} +0 -0
  17. data/lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/app/_forms.scss +33 -0
  18. data/lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/app/_header.scss +28 -0
  19. data/lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/app/_layout.scss +31 -0
  20. data/lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/app/_typography.scss +38 -0
  21. data/lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/app/header/_theme_selector.scss +57 -0
  22. data/lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/day.scss +3 -0
  23. data/lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/night.scss +3 -0
  24. data/lib/thredded_create_app/tasks/setup_app_skeleton/themes_helper.rb +15 -0
  25. data/lib/thredded_create_app/tasks/setup_app_skeleton.rb +37 -17
  26. data/lib/thredded_create_app/version.rb +1 -1
  27. metadata +17 -4
  28. data/lib/thredded_create_app/tasks/setup_app_skeleton/_variables.scss.erb +0 -8
  29. data/lib/thredded_create_app/tasks/setup_app_skeleton/application.scss +0 -97
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 513368c529e15ea3dc4754fca05f14bc9079f6ea
4
- data.tar.gz: fa5a72dd4db36c920ca536a7c4ac1953bf627e63
3
+ metadata.gz: 839482e4e53aa216336b96787c30befc798a7703
4
+ data.tar.gz: db966ce9861f65c420e755831c6a7e536f9deb0b
5
5
  SHA512:
6
- metadata.gz: 7ef614456503b8c591ff0e34e4ddce7bda63e0bfd96d962975a28e1587d5bda8bfd519d106702d4529938e4dd67aca961435584853626b0afc4324ed3e375856
7
- data.tar.gz: cfc159231d9edd498a86138cde95f4e10988cbc125eac7c75bc2381e4ae4c11975e78a046a9c356b001619b19132b9863d3a487356374192346d69aebed6199f
6
+ metadata.gz: 262fda0690bea54024a3004c6477c67c3c1b6e528a84918871ce86e3ad4d8d031e64a49c0c66795f69eb0cffffc1666fd3fcb52602ff5f2b5f2607709441a90e
7
+ data.tar.gz: e66af9f678bb54c8de023e708091e917fabfe82eb0ceefd00281364efdd31e6f8c2361ebdf73d91df1c0a7856deaf6ae52f41442999c511e5e778f17d6b76fe1
@@ -21,13 +21,10 @@ module ThreddedCreateApp
21
21
  private
22
22
 
23
23
  def add_styles
24
- if File.file? 'app/assets/stylesheets/application.css'
25
- File.delete 'app/assets/stylesheets/application.css'
26
- end
27
24
  copy 'add_rails_email_preview/_rails_email_preview-custom.scss',
28
25
  'app/assets/stylesheets/_rails_email_preview-custom.scss'
29
26
 
30
- File.write 'app/assets/stylesheets/application.scss', <<~SCSS, mode: 'a'
27
+ File.write 'app/assets/stylesheets/_deps.scss', <<~SCSS, mode: 'a'
31
28
  @import "rails_email_preview-custom";
32
29
  SCSS
33
30
  end
@@ -1,8 +1,17 @@
1
1
  @import "variables";
2
+ $thredded-background-color: $background-color;
2
3
  $thredded-brand: $brand-primary;
3
4
  $thredded-text-color: $text-color;
4
5
  $thredded-secondary-text-color: $secondary-text-color;
6
+ $thredded-secondary-nav-color: $secondary-nav-color;
7
+ $thredded-button-color: $button-color;
8
+ $thredded-button-background: $button-background;
9
+ $thredded-button-hover-background: $button-hover-background;
10
+ $thredded-badge-active-background: $badge-active-background;
5
11
  $thredded-base-font-family: $base-font-family;
6
12
  $thredded-base-font-size: $base-font-size;
7
13
  $thredded-base-line-height: $base-line-height;
8
14
  $thredded-grid-container-max-width: $grid-container-max-width;
15
+ $thredded-action-color: $action-color;
16
+ $thredded-action-hover-color: $action-hover-color;
17
+ $thredded-light-gray: $light-gray;
@@ -63,12 +63,9 @@ module ThreddedCreateApp
63
63
  'app/assets/stylesheets/_thredded-variables.scss'
64
64
  copy 'add_thredded/_thredded-custom.scss',
65
65
  'app/assets/stylesheets/_thredded-custom.scss'
66
- if File.file? 'app/assets/stylesheets/application.css'
67
- File.delete 'app/assets/stylesheets/application.css'
68
- end
69
- File.write 'app/assets/stylesheets/application.scss',
70
- "@import \"thredded-custom\";\n",
71
- mode: 'a'
66
+ File.write 'app/assets/stylesheets/_deps.scss', <<~SCSS, mode: 'a'
67
+ @import "thredded-custom";
68
+ SCSS
72
69
  end
73
70
 
74
71
  def add_thredded_javascripts
@@ -42,12 +42,23 @@ module ThreddedCreateApp
42
42
  ('--quiet' unless verbose?)].compact)
43
43
  end
44
44
 
45
+ def expand_src_path(src_path)
46
+ File.expand_path src_path, File.dirname(__FILE__)
47
+ end
48
+
45
49
  def copy(src_path, target_path, mode: 'w')
46
50
  copy_template src_path, target_path, process_erb: false, mode: mode
47
51
  end
48
52
 
49
53
  def copy_template(src_path, target_path, process_erb: true, mode: 'w')
50
- src = File.read(File.expand_path(src_path, File.dirname(__FILE__)))
54
+ expanded_src_path = expand_src_path(src_path)
55
+ if File.directory?(expanded_src_path)
56
+ fail "Only 'w' mode is supported for directories" if mode != 'w'
57
+ fail 'ERB processing not supported for directories' if process_erb
58
+ FileUtils.cp_r expanded_src_path, target_path
59
+ return
60
+ end
61
+ src = File.read(expanded_src_path)
51
62
  src = ERB.new(src, nil, '-').result(binding) if process_erb
52
63
  FileUtils.mkdir_p(File.dirname(target_path))
53
64
  File.write target_path, src, mode: mode
@@ -76,7 +87,7 @@ module ThreddedCreateApp
76
87
  "Rails.application.config.assets.precompile += %w(#{asset})"
77
88
  else
78
89
  replace 'config/initializers/assets.rb',
79
- /config\.assets\.precompile += %w\((.*?)\)/,
90
+ /config\.assets\.precompile \+= %w\((.*?)\)/,
80
91
  "config.assets.precompile += %w(\\1 #{asset})"
81
92
  end
82
93
  end
@@ -10,4 +10,21 @@
10
10
  <% end %>
11
11
  </span>
12
12
  <a class="app-nav-logo" href="/"><%= t 'brand.name' %></a>
13
+ <div class="app-nav-theme">
14
+ <span class="app-nav-text"><%= t 'nav.theme' %>:</span>
15
+ <ul>
16
+ <% themes.each do |(theme_key, theme_name)| %>
17
+ <%= content_tag :li, class: ('app-current' if theme_key == current_theme), 'data-theme' => theme_key do -%>
18
+ <% if theme_key == current_theme -%>
19
+ <span class="app-nav-text"><%= theme_name %></span>
20
+ <% else -%>
21
+ <button type="button">
22
+ <span class="app-nav-text"><%= theme_name %></span>
23
+ <span class="app-nav-icon"><%= inline_svg 'brightness.svg' %></span>
24
+ </button>
25
+ <% end -%>
26
+ <% end -%>
27
+ <% end %>
28
+ </ul>
29
+ </div>
13
30
  </header>
@@ -1,3 +1,5 @@
1
+ include ThemesHelper
2
+
1
3
  def page_title
2
4
  safe_join [content_for(:page_title) || content_for(:thredded_page_title),
3
5
  t('brand.name')].compact, ' - '
@@ -8,3 +8,7 @@ en:
8
8
  forums: :thredded.nav.all_messageboards
9
9
  sign_in: :devise.shared.links.sign_in
10
10
  sign_out: Sign out
11
+ theme: Theme
12
+ themes:
13
+ day: Day
14
+ night: Night
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path d="M22.088 13.126L24 12l-1.912-1.126a2.172 2.172 0 0 1-.788-2.942L22.393 6l-2.22-.02a2.171 2.171 0 0 1-2.153-2.153L18 1.608l-1.932 1.093a2.172 2.172 0 0 1-2.941-.788L12 0l-1.127 1.913a2.172 2.172 0 0 1-2.941.788L6 1.608l-.02 2.219A2.171 2.171 0 0 1 3.827 5.98L1.607 6 2.7 7.932a2.172 2.172 0 0 1-.788 2.942L0 12l1.912 1.126a2.172 2.172 0 0 1 .788 2.942L1.607 18l2.22.02a2.171 2.171 0 0 1 2.153 2.153L6 22.392l1.932-1.093a2.172 2.172 0 0 1 2.941.788L12 24l1.127-1.913a2.172 2.172 0 0 1 2.941-.788L18 22.392l.02-2.219a2.173 2.173 0 0 1 2.153-2.153l2.22-.02-1.093-1.932a2.172 2.172 0 0 1 .788-2.942zM11.971 20c-4.411 0-8-3.589-8-8s3.588-8 8-8 8 3.589 8 8-3.589 8-8 8zM12 18a6 6 0 0 1 0-12v12z"/>
3
+ </svg>
@@ -0,0 +1,16 @@
1
+ // Monkey patch Turbolinks to render 403, 404 & 500 normally
2
+ // See https://github.com/turbolinks/turbolinks/issues/179
3
+ window.Turbolinks.HttpRequest.prototype.requestLoaded = function() {
4
+ return this.endRequest(function() {
5
+ var code = this.xhr.status;
6
+ if (200 <= code && code < 300 ||
7
+ code === 403 || code === 404 || code === 500) {
8
+ this.delegate.requestCompletedWithResponse(
9
+ this.xhr.responseText,
10
+ this.xhr.getResponseHeader("Turbolinks-Location"));
11
+ } else {
12
+ this.failed = true;
13
+ this.delegate.requestFailedWithStatusCode(code, this.xhr.responseText);
14
+ }
15
+ }.bind(this));
16
+ };
@@ -0,0 +1,11 @@
1
+ window.App.onPageLoad(function () {
2
+ jQuery('.app-nav-theme li button').click(function(evt) {
3
+ var expiresAt = new Date();
4
+ expiresAt.setMonth(expiresAt.getMonth() + 12);
5
+ document.cookie = 'app-theme=' + $(this.parentNode).data('theme') +
6
+ ';expires=' + expiresAt + ';path=/';
7
+ document.location.reload();
8
+ });
9
+ });
10
+
11
+
@@ -0,0 +1,5 @@
1
+ @import "app/layout";
2
+ @import "app/typography";
3
+ @import "app/forms";
4
+ @import "app/header";
5
+ @import "app/flash-messages";
@@ -0,0 +1,71 @@
1
+ // See https://www.google.com/design/spec/style/color.html#color-color-palette
2
+ // https://github.com/angular/material2/blob/master/src/lib/core/theming/_palette.scss
3
+ @at-root {
4
+ $black-87-opacity: rgba(black, 0.87);
5
+ $white-87-opacity: rgba(white, 0.87);
6
+ $black-12-opacity: rgba(black, 0.12);
7
+ $white-12-opacity: rgba(white, 0.12);
8
+ $black-6-opacity: rgba(black, 0.06);
9
+ $white-6-opacity: rgba(white, 0.06);
10
+
11
+ $mat-deep-orange: (
12
+ 50: #fbe9e7,
13
+ 100: #ffccbc,
14
+ 200: #ffab91,
15
+ 300: #ff8a65,
16
+ 400: #ff7043,
17
+ 500: #ff5722,
18
+ 600: #f4511e,
19
+ 700: #e64a19,
20
+ 800: #d84315,
21
+ 900: #bf360c,
22
+ A100: #ff9e80,
23
+ A200: #ff6e40,
24
+ A400: #ff3d00,
25
+ A700: #dd2c00,
26
+ contrast: (
27
+ 50: $black-87-opacity,
28
+ 100: $black-87-opacity,
29
+ 200: $black-87-opacity,
30
+ 300: $black-87-opacity,
31
+ 400: $black-87-opacity,
32
+ 500: white,
33
+ 600: white,
34
+ 700: white,
35
+ 800: white,
36
+ 900: white,
37
+ A100: $black-87-opacity,
38
+ A200: $black-87-opacity,
39
+ A400: white,
40
+ A700: white,
41
+ )
42
+ );
43
+
44
+ $mat-palette: $mat-deep-orange !global;
45
+ }
46
+
47
+ $brand-primary: map-get($mat-palette, 500);
48
+ $text-color: map-get($mat-palette, 50);
49
+ $secondary-text-color: rgba(map-get($mat-palette, 50), 0.87);
50
+ $body-background-color: #212121;
51
+ $background-color: #272727;
52
+
53
+ $action-hover-color: map-get($mat-palette, A200);
54
+ $secondary-nav-color: $text-color;
55
+
56
+ $button-color: $text-color;
57
+ $button-background: map-get($mat-palette, 800);
58
+ $button-hover-background: map-get($mat-palette, 700);
59
+
60
+ $badge-active-background: $brand-primary;
61
+ $light-gray: rgba(#424242, 0.8);
62
+
63
+ $thredded-onebox-favicon-properties: (
64
+ 'favicons/amazon.png': (filter: invert(100%) hue-rotate(175deg) brightness(150%)),
65
+ 'favicons/github.png': (filter: invert(100%)),
66
+ 'favicons/wikipedia.png': (filter: invert(100%)),
67
+ );
68
+
69
+ $thredded-code-selected-line-background: #541;
70
+
71
+ @import "variables";
@@ -0,0 +1,17 @@
1
+ $body-background-color: #fff !default;
2
+ $background-color: #fff !default;
3
+ $brand-primary: <%= brand_primary %> !default;
4
+ $light-gray: #eee !default;
5
+ $text-color: rgba(black, 0.87) !default;
6
+ $secondary-text-color: rgba(opacify($text-color, 1), 0.54) !default;
7
+ $secondary-nav-color: $secondary-text-color !default;
8
+ $base-font-family: -apple-system, BlinkMacSystemFont, "Raleway", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif !default;
9
+ $base-font-size: 1rem !default;
10
+ $base-line-height: 1.5 !default;
11
+ $grid-container-max-width: 45rem !default;
12
+ $action-color: $brand-primary !default;
13
+ $action-hover-color: darken($brand-primary, 15%) !default;
14
+ $button-color: #fff !default;
15
+ $button-background: $action-color !default;
16
+ $button-hover-background: darken($brand-primary, 15%) !default;
17
+ $badge-active-background: $action-color !default;
@@ -0,0 +1,33 @@
1
+ %form-hint {
2
+ color: $secondary-text-color;
3
+ }
4
+
5
+ .form-inputs {
6
+ .hint {
7
+ @extend %form-hint;
8
+ }
9
+ .error {
10
+ @extend %thredded--alert;
11
+ @extend %thredded--alert--danger;
12
+ display: block;
13
+ border-top-left-radius: 0;
14
+ border-top-right-radius: 0;
15
+ }
16
+ }
17
+
18
+ .form-hint {
19
+ @extend %form-hint;
20
+ }
21
+
22
+ .form-inputs .input,
23
+ .form-actions {
24
+ margin: 1rem 0;
25
+ }
26
+
27
+ button, input[type="submit"] {
28
+ @extend %thredded--button;
29
+ }
30
+
31
+ form {
32
+ @extend %thredded--form;
33
+ }
@@ -0,0 +1,28 @@
1
+ @import "./header/theme_selector";
2
+
3
+ .app-header {
4
+ border-bottom: 1px solid $light-gray;
5
+ a {
6
+ display: inline-block;
7
+ padding: 1rem 0;
8
+ }
9
+ }
10
+
11
+ .app-nav-logo {
12
+ color: $text-color;
13
+ text-decoration: none;
14
+ font-weight: bold;
15
+ }
16
+
17
+ .app-nav-auth {
18
+ float: right;
19
+
20
+ @include thredded-media-mobile {
21
+ font-size: 0;
22
+
23
+ a {
24
+ margin-left: 0.4rem;
25
+ font-size: 1rem;
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,31 @@
1
+ body {
2
+ background-color: $body-background-color;
3
+ }
4
+
5
+ .app {
6
+ @include thredded--clearfix;
7
+ -webkit-font-smoothing: antialiased;
8
+ color: $text-color;
9
+ font-family: $base-font-family;
10
+ font-size: $base-font-size;
11
+ line-height: $base-line-height;
12
+ margin: 0;
13
+ }
14
+
15
+ .app-container {
16
+ margin: 0 auto;
17
+ max-width: ($grid-container-max-width + 4rem);
18
+ padding: 0 1.2rem 0.75rem 1.2rem;
19
+ @include thredded-media-tablet-and-up {
20
+ padding: 0 2rem 0.75rem 2rem;
21
+ }
22
+ @media (min-width: $grid-container-max-width + 0.01rem) {
23
+ padding-left: 3.5rem;
24
+ padding-right: 3.5rem;
25
+ }
26
+ }
27
+
28
+ .turbolinks-progress-bar {
29
+ background-color: $brand-primary;
30
+ height: 0.25rem;
31
+ }
@@ -0,0 +1,38 @@
1
+ h1, h2, h3 {
2
+ font-size: 1em;
3
+ line-height: 1.1;
4
+ }
5
+
6
+ h1 {
7
+ @include thredded-media-tablet-and-up {
8
+ font-size: 1.25em;
9
+ }
10
+ @include thredded-media-desktop-and-up {
11
+ font-size: 1.625em;
12
+ }
13
+ }
14
+
15
+ h2 {
16
+ @include thredded-media-tablet-and-up {
17
+ font-size: 1.125em;
18
+ }
19
+ @include thredded-media-desktop-and-up {
20
+ font-size: 1.55em;
21
+ }
22
+ }
23
+
24
+ a {
25
+ @extend %thredded--link;
26
+ }
27
+
28
+ blockquote {
29
+ @extend %thredded--blockquote;
30
+ }
31
+
32
+ table {
33
+ @extend %thredded--table;
34
+ }
35
+
36
+ hr {
37
+ @extend %thredded--hr;
38
+ }
@@ -0,0 +1,57 @@
1
+ .app-nav-theme,
2
+ .app-nav-locale {
3
+ display: inline-block;
4
+ margin: 0 0 0 1.25rem;
5
+ font-size: 0.9rem;
6
+ color: $secondary-text-color;
7
+ > ul {
8
+ display: inline;
9
+ list-style: none;
10
+ padding: 0;
11
+ > li {
12
+ display: inline;
13
+ > button {
14
+ background: none;
15
+ border: none;
16
+ cursor: pointer;
17
+ font-size: inherit;
18
+ padding: 0;
19
+ vertical-align: baseline;
20
+ @extend %thredded--link;
21
+ }
22
+ > span {
23
+ color: $secondary-text-color;
24
+ font-weight: bold;
25
+ }
26
+ }
27
+ }
28
+ .app-nav-icon {
29
+ display: none;
30
+ }
31
+ }
32
+
33
+ @media (max-width: 620px) {
34
+ .app-nav-theme,
35
+ .app-nav-locale {
36
+ margin: 0 0 0 0.3125rem;
37
+ > .app-nav-text, .app-current {
38
+ display: none;
39
+ }
40
+ }
41
+ .app-nav-theme {
42
+ .app-nav-text {
43
+ display: none;
44
+ }
45
+ > ul > li > button {
46
+ vertical-align: middle;
47
+ }
48
+ .app-nav-icon {
49
+ display: block;
50
+ svg {
51
+ fill: currentColor;
52
+ height: 1.5rem;
53
+ width: 1.5rem;
54
+ }
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,3 @@
1
+ @import "variables";
2
+ @import "deps";
3
+ @import "app";
@@ -0,0 +1,3 @@
1
+ @import "variables-night";
2
+ @import "deps";
3
+ @import "app";
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ThemesHelper
4
+ def themes
5
+ {
6
+ 'day' => t('themes.day'),
7
+ 'night' => t('themes.night')
8
+ }
9
+ end
10
+
11
+ def current_theme
12
+ cookie_theme = cookies['app-theme']
13
+ themes.key?(cookie_theme) ? cookie_theme : themes.keys.first
14
+ end
15
+ end
@@ -60,26 +60,38 @@ module ThreddedCreateApp
60
60
  replace 'app/assets/javascripts/application.js',
61
61
  %r{^//= require jquery$},
62
62
  '//= require jquery3'
63
+ git_commit 'Use jQuery v3 instead of jQuery v1'
63
64
 
64
65
  copy 'setup_app_skeleton/javascripts/app.js',
65
66
  'app/assets/javascripts/app.js'
66
- copy 'setup_app_skeleton/javascripts/app/time_ago.js',
67
- 'app/assets/javascripts/app/time_ago.js'
68
- git_commit 'Use jQuery v3 instead of jQuery v1'
67
+ copy 'setup_app_skeleton/javascripts/app/',
68
+ 'app/assets/javascripts/app/'
69
+ git_commit 'Add app JavaScript'
69
70
  end
70
71
 
71
72
  def add_styles
72
- copy_template 'setup_app_skeleton/_variables.scss.erb',
73
+ copy 'setup_app_skeleton/images/brightness.svg',
74
+ 'app/assets/images/brightness.svg'
75
+ copy_template 'setup_app_skeleton/stylesheets/_variables.scss.erb',
73
76
  'app/assets/stylesheets/_variables.scss'
74
-
77
+ copy 'setup_app_skeleton/stylesheets/_variables-night.scss',
78
+ 'app/assets/stylesheets/_variables-night.scss'
79
+ copy 'setup_app_skeleton/stylesheets/_deps.scss',
80
+ 'app/assets/stylesheets/_deps.scss',
81
+ mode: 'a'
82
+ copy 'setup_app_skeleton/stylesheets/_app.scss',
83
+ 'app/assets/stylesheets/_app.scss'
84
+ copy 'setup_app_skeleton/stylesheets/app/',
85
+ 'app/assets/stylesheets/app/'
75
86
  if File.file? 'app/assets/stylesheets/application.css'
76
87
  File.delete 'app/assets/stylesheets/application.css'
77
88
  end
78
- copy_template 'setup_app_skeleton/application.scss',
79
- 'app/assets/stylesheets/application.scss',
80
- mode: 'a'
81
- copy 'setup_app_skeleton/_flash-messages.scss',
82
- 'app/assets/stylesheets/_flash-messages.scss'
89
+ copy 'setup_app_skeleton/stylesheets/day.scss',
90
+ 'app/assets/stylesheets/day.scss'
91
+ add_precompile_asset 'day.css'
92
+ copy 'setup_app_skeleton/stylesheets/night.scss',
93
+ 'app/assets/stylesheets/night.scss'
94
+ add_precompile_asset 'night.css'
83
95
  end
84
96
 
85
97
  def add_i18n
@@ -92,21 +104,28 @@ module ThreddedCreateApp
92
104
  RUBY
93
105
  end
94
106
 
95
- def add_app_layout # rubocop:disable Metrics/MethodLength
107
+ # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
108
+ def add_app_layout
96
109
  copy 'setup_app_skeleton/_header.html.erb',
97
110
  'app/views/shared/_header.html.erb'
98
111
  copy 'setup_app_skeleton/_flash_messages.html.erb',
99
112
  'app/views/shared/_flash_messages.html.erb'
100
113
  app_helper_src = File.read(
101
- File.join(File.dirname(__FILE__),
102
- 'setup_app_skeleton/application_helper_methods.rb')
114
+ expand_src_path('setup_app_skeleton/application_helper_methods.rb')
103
115
  )
104
116
  inject_into_file 'app/helpers/application_helper.rb',
105
117
  before: /end\n\z/,
106
118
  content: indent(2, app_helper_src)
119
+ copy 'setup_app_skeleton/themes_helper.rb',
120
+ 'app/helpers/themes_helper.rb'
107
121
  replace 'app/views/layouts/application.html.erb',
108
122
  %r{<title>.*?</title>},
109
123
  '<title><%= page_title %></title>'
124
+ replace 'app/views/layouts/application.html.erb',
125
+ /[ ]*<%= stylesheet_link_tag.*?%>/,
126
+ indent(4, <<~ERB)
127
+ <%= stylesheet_link_tag current_theme, media: 'all', 'data-turbolinks-track': 'reload' %>
128
+ ERB
110
129
  replace 'app/views/layouts/application.html.erb',
111
130
  /[ ]*<%= javascript_include_tag 'application', .*? %>/,
112
131
  <<-'ERB'
@@ -122,13 +141,14 @@ module ThreddedCreateApp
122
141
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
123
142
  ERB
124
143
 
144
+ body = File.read(
145
+ expand_src_path('setup_app_skeleton/application.body.html.erb')
146
+ )
125
147
  replace 'app/views/layouts/application.html.erb',
126
148
  %r{<body>.*?</body>}m,
127
- File.read(
128
- File.join(File.dirname(__FILE__),
129
- 'setup_app_skeleton/application.body.html.erb')
130
- )
149
+ body
131
150
  end
151
+ # rubocop:enable Metrics/AbcSize,Metrics/MethodLength
132
152
 
133
153
  def add_user_page
134
154
  run_generator 'controller users show' \
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ThreddedCreateApp
4
- VERSION = '0.1.12'
4
+ VERSION = '0.1.13'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thredded_create_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Mazovetskiy
@@ -136,20 +136,33 @@ files:
136
136
  - lib/thredded_create_app/tasks/production_configs/Procfile
137
137
  - lib/thredded_create_app/tasks/production_configs/puma.production.rb
138
138
  - lib/thredded_create_app/tasks/setup_app_skeleton.rb
139
- - lib/thredded_create_app/tasks/setup_app_skeleton/_flash-messages.scss
140
139
  - lib/thredded_create_app/tasks/setup_app_skeleton/_flash_messages.html.erb
141
140
  - lib/thredded_create_app/tasks/setup_app_skeleton/_header.html.erb
142
- - lib/thredded_create_app/tasks/setup_app_skeleton/_variables.scss.erb
143
141
  - lib/thredded_create_app/tasks/setup_app_skeleton/application.body.html.erb
144
- - lib/thredded_create_app/tasks/setup_app_skeleton/application.scss
145
142
  - lib/thredded_create_app/tasks/setup_app_skeleton/application_helper_methods.rb
146
143
  - lib/thredded_create_app/tasks/setup_app_skeleton/en.yml.erb
147
144
  - lib/thredded_create_app/tasks/setup_app_skeleton/home_show.html.erb.erb
145
+ - lib/thredded_create_app/tasks/setup_app_skeleton/images/brightness.svg
148
146
  - lib/thredded_create_app/tasks/setup_app_skeleton/javascripts/app.js
147
+ - lib/thredded_create_app/tasks/setup_app_skeleton/javascripts/app/monkey-patch-turbolinks.js
148
+ - lib/thredded_create_app/tasks/setup_app_skeleton/javascripts/app/theme.js
149
149
  - lib/thredded_create_app/tasks/setup_app_skeleton/javascripts/app/time_ago.js
150
150
  - lib/thredded_create_app/tasks/setup_app_skeleton/seeds.rb.erb
151
151
  - lib/thredded_create_app/tasks/setup_app_skeleton/spec/controllers/users_controller_spec.rb
152
152
  - lib/thredded_create_app/tasks/setup_app_skeleton/spec/features/homepage_spec.rb
153
+ - lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/_app.scss
154
+ - lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/_deps.scss
155
+ - lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/_variables-night.scss
156
+ - lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/_variables.scss.erb
157
+ - lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/app/_flash-messages.scss
158
+ - lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/app/_forms.scss
159
+ - lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/app/_header.scss
160
+ - lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/app/_layout.scss
161
+ - lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/app/_typography.scss
162
+ - lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/app/header/_theme_selector.scss
163
+ - lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/day.scss
164
+ - lib/thredded_create_app/tasks/setup_app_skeleton/stylesheets/night.scss
165
+ - lib/thredded_create_app/tasks/setup_app_skeleton/themes_helper.rb
153
166
  - lib/thredded_create_app/tasks/setup_app_skeleton/users_show.html.erb
154
167
  - lib/thredded_create_app/tasks/setup_database.rb
155
168
  - lib/thredded_create_app/tasks/setup_database/create_database_user.sh
@@ -1,8 +0,0 @@
1
- $brand-primary: <%= brand_primary %>;
2
- $text-color: #575d6b;
3
- $secondary-text-color: lighten($text-color, 30%);
4
- $light-gray: #eee;
5
- $base-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif;
6
- $base-font-size: 1rem;
7
- $base-line-height: 1.5;
8
- $grid-container-max-width: 43.125rem;
@@ -1,97 +0,0 @@
1
- @import "flash-messages";
2
-
3
- .app {
4
- @include thredded--clearfix;
5
- -webkit-font-smoothing: antialiased;
6
- color: $text-color;
7
- font-family: $base-font-family;
8
- font-size: $base-font-size;
9
- line-height: $base-line-height;
10
- margin: 0;
11
- }
12
-
13
- .app-container {
14
- margin: 0 auto;
15
- max-width: ($grid-container-max-width + 4rem);
16
- padding: 0 1.2rem 0.75rem 1.2rem;
17
- @include thredded-media-tablet-and-up {
18
- padding: 0 2rem 0.75rem 2rem;
19
- }
20
- @media (min-width: $grid-container-max-width + 0.01rem) {
21
- padding-left: 3.5rem;
22
- padding-right: 3.5rem;
23
- }
24
- }
25
-
26
- .app-header {
27
- border-bottom: 1px solid #eee;
28
- a {
29
- display: inline-block;
30
- padding: 1rem 0;
31
- }
32
- }
33
-
34
- .app-nav-logo {
35
- color: $text-color;
36
- text-decoration: none;
37
- font-weight: bold;
38
- }
39
-
40
- .app-nav-auth {
41
- float: right;
42
-
43
- @include thredded-media-mobile {
44
- font-size: 0;
45
-
46
- a {
47
- margin-left: 0.4rem;
48
- font-size: 1rem;
49
- }
50
- }
51
- }
52
-
53
- .turbolinks-progress-bar {
54
- background-color: $brand-primary;
55
- height: 0.25rem;
56
- }
57
-
58
- .form-inputs .input, .form-actions {
59
- margin: 1rem 0;
60
- }
61
-
62
- .form-inputs {
63
- .hint {
64
- color: $secondary-text-color;
65
- }
66
- .error {
67
- @extend %thredded--alert;
68
- @extend %thredded--alert--danger;
69
- display: block;
70
- border-top-left-radius: 0;
71
- border-top-right-radius: 0;
72
- }
73
- }
74
-
75
- a {
76
- @extend %thredded--link;
77
- }
78
-
79
- button, input[type="submit"] {
80
- @extend %thredded--button;
81
- }
82
-
83
- form {
84
- @extend %thredded--form;
85
- }
86
-
87
- blockquote {
88
- @extend %thredded--blockquote;
89
- }
90
-
91
- table {
92
- @extend %thredded--table;
93
- }
94
-
95
- hr {
96
- @extend %thredded--hr;
97
- }