bible270 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84d3ca14b2813767c7f837ec1844feaaff31b1ac12e37d691c95b8975313a9e9
4
- data.tar.gz: 69374a41cfaed437a5bb0367ac66b7500949cda2654e9f80e5ab46f9f8822547
3
+ metadata.gz: 67906d69eea518bcb8153f7510c86ada862bf55aad58a89cdd1279033f91ed7c
4
+ data.tar.gz: a8ca91bbd8a8ea72e53f07c0ac6e508b8f7997ad0ed789c4d19921240802798f
5
5
  SHA512:
6
- metadata.gz: 71c2ef21eb61bb68359ed3cd202ecc0278082cc97a18e4f9886093799d065409fd0529775edeb1a42f33d25a6ceaac702f44d7c53b59fda82e2c91d894cb704f
7
- data.tar.gz: 1cbd38d2f361892bb1cab9f981986598d3d03bc2c04ce63506d60907aca58b57ffd96f2dc9f607ead5dc1c6966086954898e60b7826955b9960c769aa8b8c26e
6
+ metadata.gz: af14bd94dbda0373bb668e04f2538a5a85a3083cf5b959532cfc01300f1cdb3eba55b6cd91dda931ba9f47960a75d57512c009ceab547661534cb34850136197
7
+ data.tar.gz: 2b5ca2cad90026e4bda8ebc28ed201e027da09b3a8e7e4bbb1af7a482260e390f9ff345b591abd82bcd7748cc93494518dee2d9bc53b24306742626f06c1eb2a
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Bible 270
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/bible270.svg?refresh=1)](https://badge.fury.io/rb/bible270) [![Gem Downloads](https://img.shields.io/gem/dt/bible270.svg?style=flat)](http://rubygems.org/gems/bible270) [![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/avonderluft/bible270?label=last%20release&color=seagreen)](https://github.com/avonderluft/bible270/releases)
3
+ [![Gem Version](https://img.shields.io/gem/v/bible270)](https://rubygems.org/gems/bible270) [![Downloads](https://img.shields.io/gem/dt/bible270)](https://rubygems.org/gems/bible270) [![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/avonderluft/bible270?label=last%20release&color=seagreen)](https://github.com/avonderluft/bible270/releases)
4
4
 
5
5
  A mountable **Rails engine** that drops a 270-day (9 month) interactive Bible reading plan into any Rails app, built with [ComfortableMediaSurfer](https://github.com/shakacode/comfortable-media-surfer) CMS in mind. Readers tick off each day's readings, post reflections, and see how everyone else is getting on, much like the social plans on Bible.com.
6
6
 
@@ -35,7 +35,7 @@ module Bible270
35
35
  session[:bible270_reader_id] = reader.id
36
36
  @current_reader = reader
37
37
 
38
- redirect_to destination, notice: "Welcome, #{reader.display_name}."
38
+ redirect_to destination, notice: "Welcome #{reader.first_name}."
39
39
  end
40
40
 
41
41
  def destroy
@@ -71,7 +71,7 @@ module Bible270
71
71
  names = Names.normalize(params[:first_name], params[:last_name])
72
72
 
73
73
  _record, raw = SignInToken.issue!(address, first_name: names&.dig(:first_name),
74
- last_name: names&.dig(:last_name))
74
+ last_name: names&.dig(:last_name))
75
75
 
76
76
  if raw && enrollment_closed? && !Reader.email_reader_exists?(address)
77
77
  Rails.logger.info("[bible270] enrolment closed; no link sent to #{address}")
@@ -102,7 +102,7 @@ module Bible270
102
102
  end
103
103
 
104
104
  reader = Reader.from_email(token.email, first_name: token.first_name,
105
- last_name: token.last_name, display_name: token.display_name)
105
+ last_name: token.last_name, display_name: token.display_name)
106
106
  redirect_to(sign_in_path, alert: "We couldn't set up your reader profile.") and return unless reader&.persisted?
107
107
 
108
108
  destination = safe_origin(params[:origin]) || after_sign_in_path
@@ -117,7 +117,7 @@ module Bible270
117
117
  return
118
118
  end
119
119
 
120
- redirect_to destination, notice: "Welcome, #{reader.display_name}."
120
+ redirect_to destination, notice: "Welcome #{reader.first_name}."
121
121
  end
122
122
 
123
123
  private
@@ -106,6 +106,14 @@ module Bible270
106
106
  [first_name, last_name].map { |n| n.to_s.strip }.reject(&:empty?).join(' ').presence
107
107
  end
108
108
 
109
+ # Shorter than the full name, for lists where a surname is more than needed.
110
+ # Falls back to the display name for readers who arrived with only one.
111
+ def first_with_last_initial
112
+ return display_name if first_name.blank?
113
+
114
+ Names.first_with_last_initial(first_name, last_name).presence || display_name
115
+ end
116
+
109
117
  def sort_name
110
118
  [last_name, first_name].map { |n| n.to_s.strip.downcase }.join(' ').strip.presence || display_name.to_s.downcase
111
119
  end
@@ -1,7 +1,7 @@
1
1
  <% content_for :title, "Community — #{Bible270.config.app_name}" %>
2
2
  <p class="b270-eyebrow">Reading together</p>
3
3
  <h1>The community</h1>
4
- <p class="lede">Everyone journeying through the plan, and how far each has come.</p>
4
+ <p class="lede">Everyone walking through the Word, seeing each pilgrim's progress.</p>
5
5
 
6
6
  <% if @readers.any? %>
7
7
  <div class="b270-list">
@@ -5,10 +5,10 @@
5
5
  </div>
6
6
  <nav class="b270-nav">
7
7
  <%= link_to "Plan", root_path %>
8
- <%= link_to "Community", community_path %>
8
+ <%= link_to "People", community_path %>
9
9
  <% if signed_in? %>
10
10
  <% if Bible270.config.admin?(current_reader) %><%= link_to "Admin", admin_path %><% end %>
11
- <%= link_to current_reader.display_name, reader_path(current_reader), class: "b270-me" %>
11
+ <%= link_to current_reader.first_with_last_initial, reader_path(current_reader), class: "b270-me" %>
12
12
  <%= link_to "Profile", profile_path %>
13
13
  <%= button_to "Sign out", sign_out_path, method: :delete, class: "b270-linkbtn",
14
14
  form: { style: "display:inline" } %>
@@ -23,6 +23,9 @@ module Bible270
23
23
  last_name = squish(last)
24
24
  return nil if first_name.empty? || last_name.empty?
25
25
 
26
+ # Only persisted columns belong here — this hash is assigned straight onto
27
+ # the model. Anything derived (see first_with_last_initial) is computed on
28
+ # demand, so it can't go stale when a name is edited.
26
29
  {
27
30
  first_name: first_name,
28
31
  last_name: last_name,
@@ -30,6 +33,22 @@ module Bible270
30
33
  }
31
34
  end
32
35
 
36
+ # "Andrew vonderLuft" -> "Andrew v."
37
+ # Particles are kept out of the initial: "von der Luft" gives "L.", not "v.",
38
+ # since the last word is the one people are known by.
39
+ def first_with_last_initial(first, last)
40
+ first_name = squish(first)
41
+ surname = squish(last)
42
+ return first_name if surname.empty?
43
+
44
+ initial = surname.split.last[0]
45
+ return first_name if initial.nil?
46
+
47
+ # Not upcased: a lowercase surname is usually deliberate (vonderLuft), and
48
+ # forcing "V." would override how someone writes their own name.
49
+ "#{first_name} #{initial}.".strip
50
+ end
51
+
33
52
  def valid?(first, last)
34
53
  !normalize(first, last).nil?
35
54
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bible270
4
- VERSION = '0.11.0'
4
+ VERSION = '0.11.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bible270
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew vonderLuft