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 +4 -4
- data/README.md +1 -1
- data/app/controllers/bible270/sessions_controller.rb +4 -4
- data/app/models/bible270/reader.rb +8 -0
- data/app/views/bible270/readers/index.html.erb +1 -1
- data/app/views/bible270/shared/_header.html.erb +2 -2
- data/lib/bible270/names.rb +19 -0
- data/lib/bible270/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 67906d69eea518bcb8153f7510c86ada862bf55aad58a89cdd1279033f91ed7c
|
|
4
|
+
data.tar.gz: a8ca91bbd8a8ea72e53f07c0ac6e508b8f7997ad0ed789c4d19921240802798f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: af14bd94dbda0373bb668e04f2538a5a85a3083cf5b959532cfc01300f1cdb3eba55b6cd91dda931ba9f47960a75d57512c009ceab547661534cb34850136197
|
|
7
|
+
data.tar.gz: 2b5ca2cad90026e4bda8ebc28ed201e027da09b3a8e7e4bbb1af7a482260e390f9ff345b591abd82bcd7748cc93494518dee2d9bc53b24306742626f06c1eb2a
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Bible 270
|
|
2
2
|
|
|
3
|
-
[](https://rubygems.org/gems/bible270) [](https://rubygems.org/gems/bible270) [](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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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 "
|
|
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.
|
|
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" } %>
|
data/lib/bible270/names.rb
CHANGED
|
@@ -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
|
data/lib/bible270/version.rb
CHANGED