audits1984 0.1.3 → 0.1.4

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: d5767616c2784090ee12b68487d23185f14b4f50f4df6a9508ee5a348ea8c028
4
- data.tar.gz: 05a4d8e505d0dde7d600e1b2a8388306a155e6a1fb8bb36e68c3b8811d35a63e
3
+ metadata.gz: cb0886dcdc77043ac74450f624f7d02ab7360a969aa94178b40ae33a260a5c28
4
+ data.tar.gz: 685b9be01f924518abf626b94262e5dabd28240280d0430a7504240957ffa210
5
5
  SHA512:
6
- metadata.gz: ddeef7ee008c9bd3a27650892bc4c585f2614d63de7b46486a2ec97c9201a5544ae8b181575c21f87885dbd76737562db8cc543da4e04a3120b9588016642a7b
7
- data.tar.gz: 0a02a749677a67f90852095d8c66e99689a3e4feeaed0de2f8b30f543fd5e22b07a8695fd294b9d62184f21bd512c0ae14cffad1cc3a2ef9ec3dcb57beb2b96e
6
+ metadata.gz: 96a3cf3e7a98ac2e235de4ef3c7c9fb4cb01693802664bbdeb559946d1514f8f77d9985f67280a0aa006349d3edac747bbdebd1a32efdf88218541b790e5cf89
7
+ data.tar.gz: 6c0cd031a25dfcb7e5354a58b60d39792d5df44c7d3a197c400fdc9420117d73f63655287647bbd83b4b26b155f66a9ce53a09b4e2b2f1462729c46f4ed02350
data/README.md CHANGED
@@ -60,5 +60,5 @@ These config options are namespaced in `config.audits1984`:
60
60
  | Name | Description |
61
61
  | --------------------- | ------------------------------------------------------------ |
62
62
  | auditor_class | The name of the auditor class. By default it's `::User.` |
63
+ | auditor_name_attribute | The attribute on the auditor class that returns the auditor's name. By default it's `:name`. |
63
64
  | base_controller_class | The host application base class that will be the parent of `audit1984` controllers. By default it's `::ApplicationController`. |
64
-
@@ -2,6 +2,14 @@ require "rouge"
2
2
 
3
3
  module Audits1984
4
4
  module ApplicationHelper
5
+ def auditor_name_for(auditor)
6
+ if auditor == Audits1984::Current.auditor
7
+ "You"
8
+ else
9
+ auditor.public_send(Audits1984.auditor_name_attribute)
10
+ end
11
+ end
12
+
5
13
  def format_date(date)
6
14
  # <time datetime="2016-1-1">11:09 PM - 1 Jan 2016</time>
7
15
  date.strftime("%Y-%m-%d")
@@ -6,7 +6,7 @@
6
6
  <ul class="mb-6">
7
7
  <% session.audits.except(&:new_record?).each do |audit| %>
8
8
  <li> <%= audit.status.humanize %>
9
- by <%= audit.auditor == Audits1984::Current.auditor ? "You" : audit.auditor.name %>
9
+ by <%= auditor_name_for(audit.auditor) %>
10
10
  on <%= format_date_and_time(audit.created_at) %>
11
11
  </li>
12
12
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module Audits1984
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
data/lib/audits1984.rb CHANGED
@@ -7,5 +7,6 @@ loader.setup
7
7
 
8
8
  module Audits1984
9
9
  mattr_accessor :auditor_class, default: "::User"
10
+ mattr_accessor :auditor_name_attribute, default: :name
10
11
  mattr_accessor :base_controller_class, default: "::ApplicationController"
11
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: audits1984
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Manrubia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-06 00:00:00.000000000 Z
11
+ date: 2023-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rouge