Skip to content

Commit 458e1b1

Browse files
committed
Allow to set image on page definitions
Helps to visualize the usage of the page.
1 parent 7df9a07 commit 458e1b1

5 files changed

Lines changed: 12 additions & 2 deletions

File tree

app/assets/builds/alchemy/admin.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/assets/builds/alchemy/admin.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/models/alchemy/page_definition.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class PageDefinition
99
extend ActiveModel::Translation
1010

1111
attribute :name, :string
12+
attribute :image, :string
1213
attribute :elements, default: []
1314
attribute :autogenerate, default: []
1415
attribute :layoutpage, :boolean, default: false

app/stylesheets/alchemy/admin/page_definitions.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@
130130
background-color: white;
131131
border-radius: var(--border-radius_medium);
132132

133+
> img {
134+
width: auto;
135+
max-width: 100%;
136+
max-height: 160px;
137+
}
138+
133139
p {
134140
margin: var(--spacing-4) 0;
135141
}

app/views/alchemy/admin/page_definitions/_page_definition.html.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<% end %>
1212
</small>
1313
</h2>
14+
<% if page_definition.image %>
15+
<%= image_tag page_definition.image %>
16+
<% end %>
1417
<% if page_definition.has_hint? %>
1518
<p><%== page_definition.hint %></p>
1619
<% end %>

0 commit comments

Comments
 (0)