Skip to content
This repository

Inherit parent page layout & view templates #1581

Merged
merged 3 commits into from over 2 years ago

2 participants

xyz Uģis Ozols
xyz
xyz commented

Page layout_template & view_template should be inherited from parent (if any).

Uģis Ozols
Owner

It would be really nice if you could add some request specs for this.

.../refinery/admin/pages/_form_advanced_options.html.erb
@@ -36,7 +40,11 @@
36 40 <%= f.label :view_template, t('.view_template') %>
37 41 <%= refinery_help_tag t('.view_template_help') %>
38 42 </span>
39   - <%= f.select(:view_template, @valid_view_templates.map{|t| [t.titleize, t]}) %>
  43 + <% if @page.parent_id? %>
  44 + <%= f.select(:view_template, @valid_view_templates.map{|t| [t.titleize, t]}, {:selected => @page.parent.view_template } %>
1
Uģis Ozols Owner
ugisozols added a note

There's a missing ) at the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
xyz
xyz commented

Sorry, specs are beyond my reach at the moment.

Uģis Ozols ugisozols merged commit d5703c0 into from
Uģis Ozols ugisozols referenced this pull request from a commit
Uģis Ozols ugisozols Add specs for #1581. 9804c0f
Uģis Ozols ugisozols referenced this pull request from a commit
Uģis Ozols ugisozols Add specs for #1581. 09becb0
Uģis Ozols ugisozols referenced this pull request
Closed

Inherit parent layout #1580

Uģis Ozols
Owner

Thanks @xyz for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
12 pages/app/views/refinery/admin/pages/_form_advanced_options.html.erb
@@ -27,7 +27,11 @@
27 27 <%= f.label :layout_template, t('.layout_template') %>
28 28 <%= refinery_help_tag t('.layout_template_help') %>
29 29 </span>
30   - <%= f.select(:layout_template, @valid_layout_templates) %>
  30 + <% if @page.parent_id? %>
  31 + <%= f.select(:layout_template, @valid_layout_templates, {:selected => @page.parent.layout_template}) %>
  32 + <% else %>
  33 + <%= f.select(:layout_template, @valid_layout_templates) %>
  34 + <% end %>
31 35 </div>
32 36 <% end %>
33 37 <% if Refinery::Pages.use_view_templates %>
@@ -36,7 +40,11 @@
36 40 <%= f.label :view_template, t('.view_template') %>
37 41 <%= refinery_help_tag t('.view_template_help') %>
38 42 </span>
39   - <%= f.select(:view_template, @valid_view_templates.map{|t| [t.titleize, t]}) %>
  43 + <% if @page.parent_id? %>
  44 + <%= f.select(:view_template, @valid_view_templates.map{|t| [t.titleize, t]}, {:selected => @page.parent.view_template }) %>
  45 + <% else %>
  46 + <%= f.select(:view_template, @valid_view_templates.map{|t| [t.titleize, t]}) %>
  47 + <% end %>
40 48 </div>
41 49 <% end %>
42 50

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.