rails_admin_draft 0.1.1 → 0.1.2

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: a0536b226a2009c0cea3563c66e3eb6e200a7b006cc211206a71c311f00e3964
4
- data.tar.gz: ac2c6be6868bb2099ee3b8d68a3cb19efa5ce4e6e76850d164a1959cd9c17527
3
+ metadata.gz: 96122c2d58423d2a963678b8fc06a923ff234f9ca7b6b038901acca099c8993e
4
+ data.tar.gz: 6a5557f4e8dbb370ed79553fde57e65c1421583c82e9a6ea19ebb45ae6d3b061
5
5
  SHA512:
6
- metadata.gz: 0c539d9f9642a1e39aff7fae1f90d406b30380f1b0d52392cb4ad9e447fcc2a9bf9693d3386454814340ef98404f843108b096acb05ac7f61acb53e27781c4eb
7
- data.tar.gz: 78dd9721239eb16052a5f44ba685d37d9f915c6b923945b7dfa0ac7b379139ed2259644bf5213b6bf9abe2fe3b68119467ef78637a84f4969a2ec946ea4853fc
6
+ metadata.gz: ada57b779764918b92cfc142d926935e6efd74bae1f5987cd4c440d32ae0e89769d82000c401749e5243e5c216e7f031fa996861e7a90f6fff53d3a9d65f229f
7
+ data.tar.gz: 5aeb25e7a722359a25133bd8656fd7d0e3104f854c4e4cc159e6918d4af96eedd3fa013eda69e556e0c67c450a5bb0c88a6baee43d84749d162fef772ee2c978
data/README.md CHANGED
@@ -43,7 +43,7 @@ $ rake db:migrate
43
43
  ```ruby
44
44
  class MyModel < ApplicationRecord
45
45
  include DraftConcern
46
- set_draft_relation(klass_name: "MyModel")
46
+ has_draft
47
47
  end
48
48
  ```
49
49
 
@@ -1,6 +1,9 @@
1
1
  <% if @draft_conf.draft? && @object.is_draft? %>
2
2
  <div class="alert alert-dark">
3
- <b><%=I18n.t('admin.form.draft_header')%></b>
3
+ <b><%= I18n.t('admin.form.draft_header') %></b>
4
+ <% if @object.draft_source_id.present? %>
5
+ <%= I18n.t('admin.form.of' )%> <%= link_to "#{@object.class.name} ID:1", edit_path(@abstract_model, @object.draft_source_id) %>
6
+ <% end %>
4
7
  </div>
5
8
  <% end %>
6
9
 
@@ -18,6 +18,7 @@ en:
18
18
 
19
19
  form:
20
20
  draft_header: Draft
21
+ of: of
21
22
  buttons:
22
23
  save_draft:
23
24
  title: Save as draft
@@ -18,6 +18,7 @@ fr:
18
18
 
19
19
  form:
20
20
  draft_header: Brouillon
21
+ of: de
21
22
  buttons:
22
23
  save_draft:
23
24
  title: Enregistrer au statut brouillon. Ne sera pas visible sur le site public.
@@ -98,8 +98,8 @@ module DraftConcern
98
98
 
99
99
  class_methods do
100
100
  # Creates bi-directional association for draft source.
101
- def set_draft_relation(klass_name:)
102
- association_class_name = klass_name.to_s
101
+ def has_draft
102
+ association_class_name = self.name.to_s
103
103
  class_eval do
104
104
  has_one :draft, class_name: "#{association_class_name}", foreign_key: :draft_source_id, inverse_of: :draft_source
105
105
  belongs_to :draft_source, class_name: "#{association_class_name}", optional: true
@@ -1,3 +1,3 @@
1
1
  module RailsAdminDraft
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_draft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grégory Huet