bullet_train 1.0.74 → 1.0.79

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7294b50cc6079a8483055c3a7f47ca4a4478c03abdb6eb34324631fc685787cf
4
- data.tar.gz: c4e08c260f151571f5b1910ad9d5a81fc875727b3bd9440fa820f06b740e45d6
3
+ metadata.gz: a70792f8491d35ee1bf17f01bb7d1dd4babaefbe63f7c06dccd44fb24e8a61c7
4
+ data.tar.gz: b44efecbf4d4cf2959f925907af96fdc8c76c76d4bf3a8714a7995868de05cf7
5
5
  SHA512:
6
- metadata.gz: 3978e046f569d024af01cfb3170c4c468e8a6429b7793a04aaebf90221af6d18ef37a922c7b63509529e5d6c86400a0da070f9efcb956cd49a663506d07ada27
7
- data.tar.gz: a641a2368ea1bd3b3e25cf2fcd9229fea5d99e22acc39c9aaf440a88da5935d15081b5ba727ed6bb9833e2e7d6883a6e0d51f74dd508f9b0c8c9f93c1f190d85
6
+ metadata.gz: 3b85176d054600ad69e0f69d0f85bbf26115a026efc5d43c8f17d3b1356858c3bb7ecb4590016e518c99a5d4c439ebc6fddcc4c8d4485b5851befc0d3bc5e35c
7
+ data.tar.gz: f8494ff2c63c8251bcbf9a13d941d760013ae7a775eaa6b4db247b9387838785986011e24340fd660450d81180ed0825ca9ebe13a22e50373267eb466e4125b7
@@ -81,7 +81,7 @@ module Account::Teams::ControllerBase
81
81
  format.html { redirect_to [:account, @team], notice: I18n.t("teams.notifications.created") }
82
82
  format.json { render :show, status: :created, location: [:account, @team] }
83
83
  else
84
- format.html { render :new, layout: "devise" }
84
+ format.html { render :new, layout: "devise", status: :unprocessable_entity }
85
85
  format.json { render json: @team.errors, status: :unprocessable_entity }
86
86
  end
87
87
  end
@@ -2,10 +2,6 @@ module RootRedirect
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  def index
5
- if ENV["MARKETING_SITE_URL"]
6
- redirect_to ENV["MARKETING_SITE_URL"]
7
- else
8
- redirect_to new_user_session_path
9
- end
5
+ redirect_to ENV["MARKETING_SITE_URL"] || new_user_session_path
10
6
  end
11
7
  end
@@ -0,0 +1,19 @@
1
+ # NOTE: This is a workaround to get Devise working with Turbo
2
+ class TurboDeviseController < ApplicationController
3
+ class Responder < ActionController::Responder
4
+ def to_turbo_stream
5
+ controller.render(options.merge(formats: :html))
6
+ rescue ActionView::MissingTemplate => error
7
+ if get?
8
+ raise error
9
+ elsif has_errors? && default_action
10
+ render rendering_options.merge(formats: :html, status: :unprocessable_entity)
11
+ else
12
+ redirect_to navigation_location
13
+ end
14
+ end
15
+ end
16
+
17
+ self.responder = Responder
18
+ respond_to :html, :turbo_stream
19
+ end
@@ -1,8 +1,10 @@
1
1
  module Account::DatesHelper
2
2
  # e.g. October 11, 2018
3
- def display_date(timestamp)
3
+ def display_date(timestamp, custom_date_format = nil)
4
4
  return nil unless timestamp
5
- if local_time(timestamp).year == local_time(Time.now).year
5
+ if custom_date_format
6
+ local_time(timestamp).strftime(custom_date_format)
7
+ elsif local_time(timestamp).year == local_time(Time.now).year
6
8
  local_time(timestamp).strftime("%B %-d")
7
9
  else
8
10
  local_time(timestamp).strftime("%B %-d, %Y")
@@ -12,23 +14,23 @@ module Account::DatesHelper
12
14
  # e.g. October 11, 2018 at 4:22 PM
13
15
  # e.g. Yesterday at 2:12 PM
14
16
  # e.g. April 24 at 7:39 AM
15
- def display_date_and_time(timestamp)
17
+ def display_date_and_time(timestamp, custom_date_format = nil, custom_time_format = nil)
16
18
  return nil unless timestamp
17
19
 
18
20
  # today?
19
21
  if local_time(timestamp).to_date == local_time(Time.now).to_date
20
- "Today at #{display_time(timestamp)}"
22
+ "Today at #{display_time(timestamp, custom_time_format)}"
21
23
  # yesterday?
22
24
  elsif (local_time(timestamp).to_date) == (local_time(Time.now).to_date - 1.day)
23
- "Yesterday at #{display_time(timestamp)}"
25
+ "Yesterday at #{display_time(timestamp, custom_time_format)}"
24
26
  else
25
- "#{display_date(timestamp)} at #{display_time(timestamp)}"
27
+ "#{display_date(timestamp, custom_date_format)} at #{display_time(timestamp, custom_time_format)}"
26
28
  end
27
29
  end
28
30
 
29
31
  # e.g. 4:22 PM
30
- def display_time(timestamp)
31
- local_time(timestamp).strftime("%l:%M %p")
32
+ def display_time(timestamp, custom_time_format = nil)
33
+ local_time(timestamp).strftime(custom_time_format || "%l:%M %p")
32
34
  end
33
35
 
34
36
  def local_time(time)
@@ -0,0 +1,14 @@
1
+ # NOTE: This is a workaround to get Devise working with Turbo
2
+ class TurboFailureApp < Devise::FailureApp
3
+ def respond
4
+ if request_format == :turbo_stream
5
+ redirect
6
+ else
7
+ super
8
+ end
9
+ end
10
+
11
+ def skip_format?
12
+ %w[html turbo_stream */*].include? request_format.to_s
13
+ end
14
+ end
@@ -76,7 +76,7 @@ When you're including multiple fields, you can DRY up redundant settings (e.g. `
76
76
  ```
77
77
 
78
78
  ## Field partials that integrate with third-party service providers
79
- - `cloudinary` makes it trivial to upload photos and images to [Cloudinary](https://cloudinary.com) and store their resulting Cloudinary ID as an attribute of the model backing the form.
79
+ - `cloudinary` makes it trivial to upload photos and images to [Cloudinary](https://cloudinary.com) and store their resulting Cloudinary ID as an attribute of the model backing the form. To enable this field partial, sign up for Cloudinary and copy the "Cloudinary URL" they provide you with into your `config/application.yml` as `CLOUDINARY_URL`. If you use our [Heroku app.json] to provision your production environment, this will happen in that environment automatically.
80
80
 
81
81
  ## Yaml Configuration
82
82
  The localization Yaml file (where you configure label and option values for a field) is automatically generated when you run Super Scaffolding for a model. If you haven't done this yet, the localization Yaml file for `Scaffolding::CompletelyConcrete::TangibleThing` serves as a good example. Under `en.scaffolding/completely_concrete/tangible_things.fields` you'll see definitions like this:
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.0.74"
2
+ VERSION = "1.0.79"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.74
4
+ version: 1.0.79
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-31 00:00:00.000000000 Z
11
+ date: 2022-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -451,6 +451,7 @@ files:
451
451
  - app/controllers/concerns/sessions/controller_base.rb
452
452
  - app/controllers/registrations_controller.rb
453
453
  - app/controllers/sessions_controller.rb
454
+ - app/controllers/turbo_devise_controller.rb
454
455
  - app/helpers/account/buttons_helper.rb
455
456
  - app/helpers/account/dates_helper.rb
456
457
  - app/helpers/account/forms_helper.rb
@@ -553,6 +554,7 @@ files:
553
554
  - app/views/user_mailer/invited.html.erb
554
555
  - app/views/user_mailer/welcome.html.erb
555
556
  - config/initializers/concerns/inflections_base.rb
557
+ - config/initializers/concerns/turbo_failure_app.rb
556
558
  - config/locales/en/base.yml
557
559
  - config/locales/en/devise.en.yml
558
560
  - config/locales/en/doorkeeper.en.yml