recourse 7.5.0 → 7.6.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: 28a482b8977d87fe680f8b1bff7502998e09202d1c5e95364746cc01b9c92596
4
- data.tar.gz: a8fdb47ce0906854dd0164ac638d8d43155ca9d5561b3f47641c100b326113bf
3
+ metadata.gz: f8e518ee85484be8de5cc4a1533a9b8677d97417706a8c93210a02b2ad067040
4
+ data.tar.gz: 98e1b1f4173a12c8935783d5194715affd66ebfd33de377b0010c86352be83c4
5
5
  SHA512:
6
- metadata.gz: b03910594792d293f48c138e3ebc186527fa8e08b4784a8c45924479290342ff83776775d508222b7b127b4d7dad5d19f24c5d6b08e9ad46df8be6aff418bfc3
7
- data.tar.gz: e6951d50584a7d913f575caeaa4e141d842e990902abee2326e65080b382587ec416cdedc73bf136265a3d5902374b3b5250546c1cdddd7d0513b5b4a16bdd86
6
+ metadata.gz: 11c62eca29bcd4fdd171ff3d1fe2f5829b41ff0d4d057cff38a8c24749b5bb8d610962906746ba828e6163d7ad0ac89bb0e7a5a1ef44b84250967b95e4173708
7
+ data.tar.gz: f4801d3c52a5228fe075f50940fd01833c81966c232b17e0d093dffda29d0b75f93e73cf91d13fdf05a9a55bd41e7adaad2c84653d8a5f5b79fe7102c8146458
data/CHANGELOG.md CHANGED
@@ -7,6 +7,28 @@ For more information about changelogs, check [Keep a Changelog](http://keepachan
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## 7.6.1 - 2026-09-20
11
+
12
+ * [FIX] The three write seams are marked `@api private`
13
+
14
+ `create_resource`, `update_resource` and `destroy_resource` are how the gem writes a
15
+ record, not a shelf for a host to reach. A host with something of its own to do on a
16
+ write writes the action.
17
+
18
+ The comment over `destroy_resource` still described the `destroy!` it stopped being in
19
+ 7.2.0, and said the opposite of what it now does.
20
+
21
+ ## 7.6.0 - 2026-09-20
22
+
23
+ * [CHANGE] The layout titles the page, so a host template cannot lose it
24
+
25
+ The four templates each set `content_for :title`, so a host writing one of its own —
26
+ which is the whole point of the gem drawing the rest — left the tab reading `Recourse`.
27
+ The title is chrome like the trail beside it, and the layout works it out from the same
28
+ place: what the trail ends with, the resource it is of where the record names nothing,
29
+ and the app's own name where neither answers. `content_for :title` still wins where a
30
+ host sets one.
31
+
10
32
  ## 7.5.0 - 2026-09-20
11
33
 
12
34
  * [FEATURE] A model may word its own deletion
@@ -9,17 +9,20 @@ module Recourse
9
9
 
10
10
  # A new record, then the files that came with it, in one transaction: a record
11
11
  # half-saved is worse than one not saved.
12
+ # @api private
12
13
  def create_resource(record)
13
14
  record.transaction { super && attach_submitted_files(record) }
14
15
  end
15
16
 
16
- # The same for one that already exists.
17
+ # A record that already exists, then the files that came with it.
18
+ # @api private
17
19
  def update_resource(record)
18
20
  super && attach_submitted_files(record)
19
21
  end
20
22
 
21
23
  # On a page of what a record has attached, the row between the two goes and the
22
24
  # file stays for whatever else points at it; everywhere else the record itself goes.
25
+ # @api private
23
26
  def destroy_resource(record)
24
27
  return super unless attachment_reflection
25
28
 
@@ -7,14 +7,16 @@ module Recourse
7
7
 
8
8
  # A new record, unless a typed label named more than one row, which is answered on
9
9
  # the form rather than by writing a guess.
10
+ # @api private
10
11
  def create_resource(record)
11
12
  return false if ambiguous_references? record
12
13
 
13
14
  record.save
14
15
  end
15
16
 
16
- # The same for one that already exists. The parameters are read before the refusal
17
- # is asked about, since reading them is what notices an ambiguous label.
17
+ # A record that already exists, under the same refusal. The parameters are read
18
+ # before it is asked about, since reading them is what notices an ambiguous label.
19
+ # @api private
18
20
  def update_resource(record)
19
21
  attributes = resource_params
20
22
  return false if ambiguous_references? record
@@ -22,8 +24,9 @@ module Recourse
22
24
  record.update attributes
23
25
  end
24
26
 
25
- # And the record gone. `destroy!`, so a callback that stops one says so rather than
26
- # leaving the page claiming it worked.
27
+ # The record gone, or false where a callback refused to give it up, which the page
28
+ # says where the row still is.
29
+ # @api private
27
30
  def destroy_resource(record) = record.destroy
28
31
 
29
32
  # A foreign key whose label is typed arrives as that label, so it is looked up
@@ -2,7 +2,7 @@
2
2
  <html lang='en'>
3
3
  <head>
4
4
  <meta charset='utf-8'>
5
- <title><%= content_for(:title) || 'Recourse' %></title>
5
+ <title><%= content_for(:title) || page_title %></title>
6
6
  <meta name='viewport' content='width=device-width, initial-scale=1'>
7
7
  <meta name='color-scheme' content='light dark'>
8
8
  <%# A refresh Turbo is sent morphs the page in place and keeps the scroll; without these it
@@ -1,3 +1 @@
1
- <% content_for :title, resource_record_label %>
2
-
3
1
  <%= render 'form', resource_key => resource_record %>
@@ -1,5 +1,3 @@
1
- <% content_for :title, resources_name %>
2
-
3
1
  <% if (new_path = new_resource_path) %>
4
2
  <% content_for :actions do %>
5
3
  <%= link_to t('recourse.add', model: resource_name), new_path,
@@ -1,3 +1 @@
1
- <% content_for :title, t('recourse.new', model: resource_name) %>
2
-
3
1
  <%= render 'form', resource_key => resource_record %>
@@ -1,5 +1,3 @@
1
- <% content_for :title, resource_record_label %>
2
-
3
1
  <%# Nothing to read out where the host found no record: a singular resource is reached
4
2
  with no id, so the one it stands for is one it may not have yet, and the page says so
5
3
  rather than reading attributes off nothing. -%>
@@ -46,6 +46,14 @@ module Recourse
46
46
  safe_join [tag.i(class: "bi bi-#{icon}"), word], ' '
47
47
  end
48
48
 
49
+ # What the tab calls this page: what the trail ends with, the resource it is of
50
+ # where the record names nothing, and the app's own name where neither answers.
51
+ def page_title
52
+ breadcrumb_leaf.presence || breadcrumb_name.presence || app_name
53
+ end
54
+
55
+ def app_name = Rails.application.class.module_parent_name
56
+
49
57
  # Only a page beneath the index names itself, and names what it is showing.
50
58
  def breadcrumb_leaf
51
59
  case controller.action_name
@@ -1,4 +1,4 @@
1
1
  module Recourse
2
2
  # Version of the gem, read by the gemspec and by hosts checking compatibility.
3
- VERSION = '7.5.0'
3
+ VERSION = '7.6.1'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recourse
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.5.0
4
+ version: 7.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob