Skip to content

Commit 82ae0bd

Browse files
committed
Allow to set image on page definitions
Helps to visualize the usage of the page.
1 parent dc1e81d commit 82ae0bd

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

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
@@ -135,6 +135,12 @@
135135
background-color: white;
136136
border-radius: var(--border-radius_medium);
137137

138+
> img {
139+
width: auto;
140+
max-width: 100%;
141+
max-height: 160px;
142+
}
143+
138144
p {
139145
margin: var(--spacing-4) 0;
140146
}

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)