shimmer 0.0.6 → 0.0.10

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: bfbc6b047d278bdb23bcb528277c436b79bc625b577d1d8c94c113644fdcbcf3
4
- data.tar.gz: 5002fecacde7a232259b2f0bd8652f8ab2e1a544758efe42db324f4e99907b27
3
+ metadata.gz: 7bd35afc832326e3510edad8c3bd0e4953ad4e34e6bd1b2c75f280df15efb4e6
4
+ data.tar.gz: bb11df2bdc2de3e2b94f9f3ebccf0732d903d1d045b1c159a138f5aa0dc9214d
5
5
  SHA512:
6
- metadata.gz: e6a8c5ed0339cb8ae2f924b0d4eeb97554388e479ff37cfa76a688db62d4bcb7303385567c2cf673c983c656fc49bdd808189a188dca52bb30cff4725be02292
7
- data.tar.gz: 7c027ab85b75df7b495539486f702f054d794fb393b18b3676f4c99e083fe822b8cd22c313a649ab509ea8f3428d08a533a65e7ef000bd33be04f35dbb6f0fba
6
+ metadata.gz: 53c455d63d7683234d565bac406c3deb95c2d6926b6bde7c71299fd0357842576cec99a10ae38b3a69656dd4594b15a93eca9d96351eea2110c26b0623ef7f09
7
+ data.tar.gz: 311c7cd5b3bf082fdeefec75b87cd50245459446490f35abd488429d2b3e13e508504a94dbc2976b4c8809366d041d4d003a7e781528bef80350b9ad61093c8a
@@ -3,14 +3,17 @@
3
3
  namespace :db do
4
4
  desc "Downloads the app database from heroku to local db"
5
5
  task pull_data: :environment do
6
- config = ActiveRecord::Base.connection_db_config.config
7
- # binding.pry
6
+ config = if Rails.version.to_f >= 7
7
+ ActiveRecord::Base.connection_db_config.configuration_hash.with_indifferent_access
8
+ else
9
+ ActiveRecord::Base.connection_db_config.config
10
+ end
8
11
  ENV["DISABLE_DATABASE_ENVIRONMENT_CHECK"] = "1"
9
12
  Rake::Task["db:drop"].invoke
10
13
  ENV["PGUSER"] = config["username"]
11
14
  ENV["PGHOST"] = config["host"]
12
15
  ENV["PGPORT"] = config["port"].to_s
13
- sh "heroku pg:pull DATABASE_URL #{config["database"]} --app thefetishtraveller"
16
+ sh "heroku pg:pull DATABASE_URL #{config["database"]}"
14
17
  sh "rails db:environment:set"
15
18
  sh "RAILS_ENV=test rails db:create"
16
19
  end
@@ -29,31 +29,32 @@ module Shimmer
29
29
  def url_locale
30
30
  params[:locale]
31
31
  end
32
- end
33
- end
34
- end
35
-
36
- module I18n
37
- UNTRANSLATED_SCOPES = ["number", "transliterate", "date", "datetime", "errors", "helpers", "support", "time", "faker"].map { |k| "#{k}." }
38
-
39
- thread_mattr_accessor :debug
40
32
 
41
- class << self
42
- alias_method :old_translate, :translate
43
- def translate(key, options = {})
44
- key = key.to_s.downcase
45
- untranslated = UNTRANSLATED_SCOPES.any? { |e| key.include? e }
46
- key_name = [options[:scope], key].flatten.compact.join(".")
47
- option_names = options.except(:count, :default, :raise, :scope).map { |k, v| "#{k}=#{v}" }.join(", ")
48
- return "#{key_name} #{option_names}" if I18n.debug && !untranslated
49
-
50
- options.reverse_merge!(default: old_translate(key, **options.merge(locale: :de))) if untranslated
51
- old_translate(key, **options)
52
- end
53
- alias_method :t, :translate
54
-
55
- def debug?
56
- debug
33
+ I18n.class_eval do
34
+ next if defined? debug
35
+
36
+ thread_mattr_accessor :debug
37
+
38
+ class << self
39
+ alias_method :old_translate, :translate
40
+ def translate(key, options = {})
41
+ untranslated_scopes = ["number", "transliterate", "date", "datetime", "errors", "helpers", "support", "time", "faker"].map { |k| "#{k}." }
42
+ key = key.to_s.downcase
43
+ untranslated = untranslated_scopes.any? { |e| key.include? e }
44
+ key_name = [options[:scope], key].flatten.compact.join(".")
45
+ option_names = options.except(:count, :default, :raise, :scope).map { |k, v| "#{k}=#{v}" }.join(", ")
46
+ return "#{key_name} #{option_names}" if I18n.debug && !untranslated
47
+
48
+ options.reverse_merge!(default: old_translate(key, **options.merge(locale: :de))) if untranslated
49
+ old_translate(key, **options)
50
+ end
51
+ alias_method :t, :translate
52
+
53
+ def debug?
54
+ debug
55
+ end
56
+ end
57
+ end
57
58
  end
58
59
  end
59
60
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Shimmer
4
- VERSION = "0.0.6"
4
+ VERSION = "0.0.10"
5
5
  end
data/src/index.ts CHANGED
@@ -16,14 +16,22 @@ declare global {
16
16
  }
17
17
  }
18
18
 
19
+ function createRemoteDestination(): void {
20
+ if (document.getElementById("shimmer")) {
21
+ return;
22
+ }
23
+ const root = document.createElement("div");
24
+ root.id = "shimmer";
25
+ document.body.append(root);
26
+ }
27
+
19
28
  export async function start({
20
29
  application,
21
30
  }: {
22
31
  application: Application;
23
32
  }): Promise<void> {
24
- const root = document.createElement("div");
25
- root.id = "shimmer";
26
- document.body.append(root);
33
+ window.addEventListener("turbo:load", createRemoteDestination);
34
+ createRemoteDestination();
27
35
  application.register("remote-navigation", RemoteNavigationController);
28
36
  window.ui = {
29
37
  modal: new ModalPresenter(),
data/src/modal.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { loaded, createElement, nextFrame, getHTML } from "./util";
1
+ import { createElement, nextFrame, getHTML } from "./util";
2
2
 
3
3
  export interface ModalOptions {
4
4
  id?: string;
@@ -11,7 +11,7 @@ export class ModalPresenter {
11
11
  private modals: Record<string, Modal> = {};
12
12
 
13
13
  constructor() {
14
- loaded.then(this.prepareBlind);
14
+ document.addEventListener("turbo:load", this.prepareBlind);
15
15
  }
16
16
 
17
17
  async open(options: ModalOptions): Promise<void> {
@@ -38,9 +38,9 @@ export class ModalPresenter {
38
38
  document.body.classList.toggle("modal-open", open);
39
39
  }
40
40
 
41
- private async prepareBlind(): Promise<void> {
41
+ private prepareBlind: () => void = () => {
42
42
  createElement(document.body, "modal-blind");
43
- }
43
+ };
44
44
  }
45
45
 
46
46
  export class Modal {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shimmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Ravens
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-28 00:00:00.000000000 Z
11
+ date: 2022-02-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: