administration-zero 0.0.17 → 0.0.18

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: 48700b15bc64b0480184e97ff4ceae284e8a4c2403d9bf0ae083291570a3147e
4
- data.tar.gz: ac351aa3ffc2eefb5b588adb3a5076ea790b00e5f360152126db725690dc4ef2
3
+ metadata.gz: 002cc16c4991ff76fa333e03d38220537d021c2eff150ea87b6456db59da6fb2
4
+ data.tar.gz: 16336855dbac4b38d7fe2ca0a0336aebb4a0812e9cd89e19b69aebeef4d97745
5
5
  SHA512:
6
- metadata.gz: 77646b36ce47942d583972f37e99fd83d886cdbf759f12054fd0b3982916130ca5c0936c98c654e90aa2438d03f53889397f1bae4636cadfd59b506ae8c35ea4
7
- data.tar.gz: 6ea59ae1da5b860d1c80be4575fd5abe828d0c12aff33c0a5b09a97eae2ddb6f83c7f748a8d6251d9738d7c825e98f8fdf65729b341c115c6ee73178bf5e5e3b
6
+ metadata.gz: 742ce20b62c3357138c6088e6eeb972410a38df4c53482473ba8d43c2e58cede13d7b6ab657318d3dfed9a5b1ffc25be44fede6e391749c3b9cc9ddc3b18553c
7
+ data.tar.gz: 2490f2b73022d79f1e6867775f2e52657adc0cae61f6b85d9c718be45018164b289f7611e705ea7d200d74e0faa9e1db8fb958b3c3107072b167c39c258e6c57
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- administration-zero (0.0.17)
4
+ administration-zero (0.0.18)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -18,14 +18,10 @@ The purpose of administration zero is to generate a pre-built administration pan
18
18
 
19
19
  ## Installation
20
20
 
21
- Add this line to your application's Gemfile:
22
-
23
21
  ```ruby
24
- gem "administration-zero"
22
+ bundle add administration-zero
25
23
  ```
26
24
 
27
- Then run `bundle install`
28
-
29
25
  You'll need to create a model to be administrated, if you don't have one. for this example let's use the following:
30
26
 
31
27
  ```
@@ -1,3 +1,3 @@
1
1
  module AdministrationZero
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
3
3
  end
@@ -4,15 +4,16 @@ class Admin::BaseController < ActionController::Base
4
4
  before_action :set_time_zone
5
5
  before_action :authenticate
6
6
 
7
- def set_time_zone
8
- Time.zone = cookies[:time_zone]
9
- end
7
+ private
8
+ def set_time_zone
9
+ Time.zone = cookies[:time_zone]
10
+ end
10
11
 
11
- def authenticate
12
- if user = Admin::User.find_by_id(session[:admin_user_id])
13
- Admin::Current.user = user
14
- else
15
- redirect_to admin_sign_in_path
12
+ def authenticate
13
+ if user = Admin::User.find_by_id(session[:admin_user_id])
14
+ Admin::Current.user = user
15
+ else
16
+ redirect_to admin_sign_in_path
17
+ end
16
18
  end
17
- end
18
19
  end
@@ -13,7 +13,7 @@ class Admin::PasswordResetsController < Admin::BaseController
13
13
 
14
14
  def create
15
15
  if @user = Admin::User.find_by(email: params[:email])
16
- Admin::UserMailer.with(user: @user).password_reset.deliver_later
16
+ send_password_reset_email
17
17
  redirect_to admin_sign_in_path, notice: "Check your email for reset instructions"
18
18
  else
19
19
  redirect_to new_admin_password_reset_path, alert: "Sorry, we didn't recognize that email address"
@@ -38,4 +38,8 @@ class Admin::PasswordResetsController < Admin::BaseController
38
38
  def user_params
39
39
  params.permit(:password, :password_confirmation)
40
40
  end
41
+
42
+ def send_password_reset_email
43
+ Admin::UserMailer.with(user: @user).password_reset.deliver_later
44
+ end
41
45
  end
@@ -1,5 +1,5 @@
1
1
  <!-- Tabler Core -->
2
- <script src="https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta11/dist/js/tabler.min.js"></script>
2
+ <script src="https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta17/dist/js/tabler.min.js"></script>
3
3
 
4
4
  <!-- Time zone cookie -->
5
5
  <script type="module">
@@ -12,15 +12,16 @@
12
12
  <script type="module">
13
13
  document.addEventListener("click", (event) => {
14
14
  if (!event.target.matches("[data-confirm]")) return
15
- if (!window.confirm(event.target.dataset["confirm"])) event.preventDefault()
15
+ if (!confirm(event.target.dataset["confirm"])) event.preventDefault()
16
16
  })
17
17
  </script>
18
18
 
19
19
  <!-- Stimulus controllers -->
20
20
  <script type="module">
21
- import { Application, Controller } from "https://cdn.jsdelivr.net/npm/@hotwired/stimulus@3.1.0/dist/stimulus.min.js"
21
+ import { Application, Controller } from "https://cdn.jsdelivr.net/npm/stimulus@3.2.1/dist/stimulus.min.js"
22
22
  window.Stimulus = Application.start()
23
23
 
24
+ // Flash message
24
25
  Stimulus.register("flash-message", class extends Controller {
25
26
  connect() {
26
27
  new bootstrap.Toast(this.element).show()
@@ -1,5 +1,5 @@
1
1
  <!-- Tabler Core -->
2
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta11/dist/css/tabler.min.css">
2
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta17/dist/css/tabler.min.css">
3
3
 
4
4
  <!-- Customize tabler here -->
5
5
  <style>body {
@@ -5,24 +5,10 @@ module Admin::ApplicationHelper
5
5
  content_for(:title) || Rails.application.class.to_s.split("::").first
6
6
  end
7
7
 
8
- def active_nav_item(controller, actions = %w( index show new edit create update))
9
- "active" if active_actions?(controller, actions)
8
+ def active_nav_item(controller, actions = %w(index show new edit create update))
9
+ active_actions?(controller, actions) ? "active" : ""
10
10
  end
11
11
 
12
- def np(number, options = {})
13
- number_with_precision number, options
14
- end
15
-
16
- def nd(number, options = {})
17
- number_with_delimiter number, options
18
- end
19
-
20
- def localize(object, **options)
21
- super(object, **options) if object
22
- end
23
-
24
- alias :l :localize
25
-
26
12
  private
27
13
  def active_actions?(controller, actions)
28
14
  params[:controller].include?(controller) && actions.include?(params[:action])
@@ -4,7 +4,7 @@ class Admin::User < Admin::ApplicationRecord
4
4
  validates :email, presence: true, uniqueness: true, format: { with: URI::MailTo::EMAIL_REGEXP }
5
5
  validates :password, allow_nil: true, length: { minimum: 12 }, format: { with: /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/ }
6
6
 
7
- before_validation do
8
- self.email = email.try(:downcase).try(:strip)
7
+ before_validation if: -> { email.present? } do
8
+ self.email = email.downcase.strip
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administration-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nixon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-16 00:00:00.000000000 Z
11
+ date: 2023-03-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -53,7 +53,6 @@ files:
53
53
  - lib/generators/admin/install/templates/erb/admin/password_resets/new.html.erb
54
54
  - lib/generators/admin/install/templates/erb/admin/sessions/new.html.erb
55
55
  - lib/generators/admin/install/templates/erb/admin/user_mailer/password_reset.html.erb
56
- - lib/generators/admin/install/templates/erb/admin/user_mailer/password_reset.text.erb
57
56
  - lib/generators/admin/install/templates/erb/admin/users/_form.html.erb
58
57
  - lib/generators/admin/install/templates/erb/admin/users/edit.html.erb
59
58
  - lib/generators/admin/install/templates/erb/admin/users/index.html.erb
@@ -1,9 +0,0 @@
1
- Hey there,
2
-
3
- Can't remember your password for <%= @user.email %>? That's OK, it happens. Just hit the link below to set a new one.
4
-
5
- [Reset my password]<%= edit_admin_password_reset_url(token: @signed_id) %>
6
-
7
- If you did not request a password reset you can safely ignore this email, it expires in 20 minutes. Only someone with access to this email account can reset your password.
8
-
9
- Have questions or need help? Just reply to this email and our support team will help you sort it out.