Showing
7 changed files
with
24 additions
and
4 deletions
| ... | ... | @@ -45,7 +45,7 @@ module Kanjai |
| 45 | 45 | private |
| 46 | 46 | |
| 47 | 47 | def permitted_params |
| 48 | - params.permit(:domain => [:title, :default_lang_id, :robots, :page_404_id, language_domains_attributes: [:id, :title, :page_lang_id, :_destroy], page_lang_ids: []]) | |
| 48 | + params.permit(:domain => [:title, :default_lang_id, :robots, :page_404_id, :template_id, language_domains_attributes: [:id, :title, :page_lang_id, :_destroy], page_lang_ids: []]) | |
| 49 | 49 | end |
| 50 | 50 | |
| 51 | 51 | end | ... | ... |
| ... | ... | @@ -39,7 +39,11 @@ module Kanjai |
| 39 | 39 | use_cache = false |
| 40 | 40 | |
| 41 | 41 | if current_admin_user || @page_data.page.private_flag == true || use_cache == false |
| 42 | - layer = @page_data.page.page_template.get_html_content | |
| 42 | + layer = if @page_data.page.domain.template.present? | |
| 43 | + @page_data.page.domain.template.get_html_content | |
| 44 | + else | |
| 45 | + @page_data.page.page_template.get_html_content | |
| 46 | + end | |
| 43 | 47 | content_for_render = setTemplateContent(@page_data.page.domain, @page_data.page.page_template, layer, @page_data) |
| 44 | 48 | |
| 45 | 49 | respond_to do |format| |
| ... | ... | @@ -49,7 +53,11 @@ module Kanjai |
| 49 | 53 | #render :text => content_for_render and return |
| 50 | 54 | else |
| 51 | 55 | if stale?(last_modified: @page_data.last_modified, etag: @page_data.cache_key_with_version) |
| 52 | - layer = @page_data.page.page_template.get_html_content | |
| 56 | + layer = if @page_data.page.domain.template.present? | |
| 57 | + @page_data.page.domain.template.get_html_content | |
| 58 | + else | |
| 59 | + @page_data.page.page_template.get_html_content | |
| 60 | + end | |
| 53 | 61 | content_for_render = setTemplateContent(@page_data.page.domain, @page_data.page.page_template, layer, @page_data) |
| 54 | 62 | respond_to do |format| |
| 55 | 63 | format.html{render :plain => content_for_render, status: render_status} | ... | ... |
| ... | ... | @@ -10,6 +10,7 @@ module Kanjai |
| 10 | 10 | accepts_nested_attributes_for :language_domains, reject_if: :all_blank, allow_destroy: true |
| 11 | 11 | |
| 12 | 12 | belongs_to :page_404, class_name: "Kanjai::Page", optional: true |
| 13 | + belongs_to :template, class_name: "Kanjai::PageTemplate", optional: true | |
| 13 | 14 | |
| 14 | 15 | end |
| 15 | 16 | end | ... | ... |
| ... | ... | @@ -41,6 +41,11 @@ |
| 41 | 41 | <%= f.select :page_404_id, Kanjai::Page.pages_for_choose(@domain).collect{|p| ["-" * p[:level]*2 + p[:title], p[:id]] }, {:include_blank => true}, :class => "form-control" %> |
| 42 | 42 | </div> |
| 43 | 43 | |
| 44 | + <div class="form-group"> | |
| 45 | + <%= f.label :template_id, Kanjai::Domain.human_attribute_name(:template_id), class: 'col-form-label' %> | |
| 46 | + <%= f.select :template_id, Kanjai::PageTemplate.where(unzip: true).collect{|p| [p.title, p.id] }, {:include_blank => true}, :class => "form-control" %> | |
| 47 | + </div> | |
| 48 | + | |
| 44 | 49 | |
| 45 | 50 | |
| 46 | 51 | <div class="card-footer mt-20"> | ... | ... |