ops_backups 0.1.13 → 0.1.14

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: 9fd477dfd14deed2d6a2781ed4da42ccd0acd90e1c72111d1b577d7392f5cda5
4
- data.tar.gz: c881e6740abefb06b6367a855be6a46b3231def32529c6773b1e471d57705d25
3
+ metadata.gz: 676b08b7df0898e0bc8fbc2572b8aa7801f09c74cba43f5544836d6111a27cfe
4
+ data.tar.gz: 6377a44547eb4a34e97d13ccdf16db48a3739ca2c61ed43c5f8cf371be6fbfe1
5
5
  SHA512:
6
- metadata.gz: a5d2218b533240662da7fa48af937ea24b7f5c7e669278c0dd352b59ba28dde091a03ebdda9202045867bbbe2d82f911b3214a16d66a343f7951b99a3a26ad6b
7
- data.tar.gz: 8211a1acf5bffbb596c709e9dbc1f857fade276d017d83cd246ba03c6b084378deea6afa1ac3c9753348724ca082d41a675648ce685f8e2dce7b26f2064599c7
6
+ metadata.gz: 0d03c15b798b0fe5cef8ced86cbb27ff14cf657ceb9052883e88e6e24d132cf28e712797ac87c3f436a2e04da5fc4c1dfc65540877648615c9c9fade12658da8
7
+ data.tar.gz: f3cbf7c12f6f54feaeca3a05fed9c667fbcc559936b36eb2b81408f02bd802c1e6354a9b7574e42c236427de6700acb47965180d57b26809e9262cd5fa38e33f
@@ -1,4 +1,17 @@
1
1
  module OpsBackups
2
2
  class ApplicationController < ActionController::Base
3
+ before_action :set_locale
4
+
5
+ private
6
+
7
+ def set_locale
8
+ # set the locale only if the locale is available
9
+ locale = extract_locale
10
+ I18n.locale = locale if I18n.available_locales.map(&:to_s).include?(locale)
11
+ end
12
+
13
+ def extract_locale
14
+ request.env["HTTP_ACCEPT_LANGUAGE"].split(",")&.first&.split(";")&.first.to_s
15
+ end
3
16
  end
4
17
  end
@@ -8,10 +8,6 @@ module OpsBackups
8
8
 
9
9
  default_scope { order(updated_at: :desc) }
10
10
 
11
- def self.ransackable_attributes(auth_object = nil)
12
- [ "created_at", "id", "name", "new_id", "tag", "updated_at" ]
13
- end
14
-
15
11
  def size
16
12
  backup_file.attached? ? number_to_human_size(backup_file.byte_size) : "N/A"
17
13
  end
@@ -18,7 +18,7 @@
18
18
  }
19
19
  & ops-backup {
20
20
  display: grid;
21
- grid-template-columns: 3em 1fr 1fr 6em 8em 16em 8em;
21
+ grid-template-columns: 3em 3fr 2fr 6em 6em 12em 6em;
22
22
  gap: 0.5em;
23
23
  padding: 0.25em;
24
24
  & ops-backup-index,
@@ -91,10 +91,10 @@
91
91
  <ops-backup id="ops-backup-<%= i %>">
92
92
  <ops-backup-index><%= i %></ops-backup-index>
93
93
  <ops-backup-name><%= backup.name %></ops-backup-name>
94
- <ops-backup-tag><%= backup.name %></ops-backup-tag>
94
+ <ops-backup-tag><%= backup.tag %></ops-backup-tag>
95
95
  <ops-backup-size><%= backup.size %></ops-backup-size>
96
96
  <ops-backup-duration><%= backup.duration %></ops-backup-duration>
97
- <ops-backup-created_at><%= backup.created_at %></ops-backup-created_at>
97
+ <ops-backup-created_at data-time="<%= backup.created_at.iso8601 %>"><%= l backup.created_at, format: :short %></ops-backup-created_at>
98
98
  <ops-backup-actions>
99
99
  <% if backup.backup_file.attached? %>
100
100
  <%= button_to "📎", download_backup_path(backup), method: :get %>
@@ -109,3 +109,11 @@
109
109
  <div class="alert alert-<%= key %>"><%= value %></div>
110
110
  <% end %>
111
111
  </div>
112
+ <script>
113
+ // document.addEventListener("DOMContentLoaded", function() {
114
+ // document.querySelectorAll("ops-backup-created_at").forEach(function(element) {
115
+ // const time = new Date(element.getAttribute("data-time"));
116
+ // element.textContent = time.toLocaleString();
117
+ // });
118
+ // });
119
+ </script>
@@ -1,3 +1,13 @@
1
+ # monkey patch the Backup model to allow for ransackable_attributes
2
+ module OpsBackups
3
+ class Backup < ActiveRecord::Base
4
+ def self.ransackable_attributes(auth_object = nil)
5
+ [ "created_at", "id", "name", "new_id", "tag", "updated_at" ]
6
+ end
7
+ end
8
+ end
9
+
10
+ # ActiveAdmin resource for OpsBackups::Backup
1
11
  ActiveAdmin.register OpsBackups::Backup do
2
12
  menu parent: "Ops", label: I18n.t("admin.ops.backup")
3
13
 
@@ -1,3 +1,3 @@
1
1
  module OpsBackups
2
- VERSION = "0.1.13"
2
+ VERSION = "0.1.14"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ops_backups
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koen Handekyn