Skip to content

Commit e86ebb7

Browse files
committed
Move hints to page definition
1 parent 82ea9f8 commit e86ebb7

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

app/models/alchemy/page.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444

4545
module Alchemy
4646
class Page < BaseRecord
47-
include Alchemy::Hints
4847
include Alchemy::Logger
4948
include Alchemy::Taggable
5049

@@ -164,6 +163,7 @@ class Page < BaseRecord
164163

165164
# site_name accessor
166165
delegate :name, to: :site, prefix: true, allow_nil: true
166+
delegate :has_hint?, :hint, to: :definition
167167

168168
# Class methods
169169
#

app/models/alchemy/page_definition.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module Alchemy
44
class PageDefinition
55
include ActiveModel::Model
66
include ActiveModel::Attributes
7+
include Alchemy::Hints
78

89
extend ActiveModel::Translation
910

@@ -104,5 +105,12 @@ def human_name
104105
def attributes
105106
super.with_indifferent_access
106107
end
108+
alias_method :definition, :attributes
109+
110+
private
111+
112+
def hint_translation_scope
113+
:page_hints
114+
end
107115
end
108116
end

spec/dummy/config/locales/alchemy.de.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ de:
3434
richtext: Dieser Inhaltstyp stellt formatierbaren Text dar
3535
select: Dieser Inhaltstyp stellt Werte dar aus denen der Redakteur wählen kann
3636
text: Dieser Inhaltstyp stellt eine einfache Zeile Text dar
37+
page_hints:
38+
everything: Diese Seite demonstriert alles, was Seiten und Elemente zu bieten haben.
39+
3740
activerecord:
3841
attributes:
3942
alchemy/picture_description:

spec/dummy/config/locales/alchemy.en.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ en:
5454
element_deprecation_notices:
5555
old: Old element is deprecated
5656
page_hints:
57-
everything: This page is for everything.
57+
everything: This page demonstrates everything that pages and elements have to offer.
5858

5959
activemodel:
6060
models:

0 commit comments

Comments
 (0)