Add Data Field
<% if @page.errors.any? %>

<%= pluralize(@page.errors.count, 'error') %> prohibited this page from being saved:

<% end %>
<%= form_for(@page, url: admin_update_page_path, method: :put, html: { multipart: true }) do |f| %>
Page Content
<%= f.label 'Title:', class: 'control-label' %> <%= render 'cavy/admin_pages/page_localized_string_field', id: 'page-title', field_name: 'page[title]', translations: @page.title_translations %> <% @page.cavy_page_template.fields.try(:each) do |key, value| %> <%= f.label "#{key}:", class: 'control-label' %> <% if value == 'TEXT' %> <%= render 'cavy/admin_pages/page_localized_text_field', id: "page-elements-#{key}", field_name: "page[page_elements][#{key}]", translations: @page.get_translations(key) %> <% elsif value == 'STRING' %> <%= render 'cavy/admin_pages/page_localized_string_field', id: "page-elements-#{key}", field_name: "page[page_elements][#{key}]", translations: @page.get_translations(key) %> <% elsif value == 'PICTURE' %> <%= render 'cavy/admin_pages/page_localized_picture_field', id: "page-elements-#{key}", field_name: "page[page_elements][#{key}]", translations: @page.get_translations(key) %> <% end %> <% end unless @page.cavy_page_template.nil? %> <% unless @page.data == nil || @page.data == {} %>
Page Data
<% @page.data.try(:each) do |key, value| %> <%= f.label key, class: 'control-label' %> <%= f.text_field key, class: 'form-control', value: value, name: "page[data][#{key}]", id: "item[data][#{key}]" %> <% end %> <% end %> <%= f.submit('Submit', class: 'success button', id: 'submit_page_content', style: 'margin-top:1em') %> <% end %>
<%= form_for(@page, url: admin_update_page_path, method: :put) do |f| %>
Page Settings
<%= f.label :cavy_page_template_id, 'Page Template' %> <%= f.collection_select :cavy_page_template_id, Cavy::PageTemplate.all, :id, :name, { selected: @page.cavy_page_template_id } %> <%= f.label :route, class: 'control-label' %> <%= f.text_field :route, class: 'form-control' %>
SEO
<%= f.label :meta_tags, class: 'control-label' %> <%= f.text_field :tag_string, value: "#{@page.seo_keywords.to_h[I18n.locale.to_s].to_a.join(',')}", class: 'form-control', id: 'page_tag_string' %> <%= f.label :meta_description, class: 'control-label' %> <%= f.text_area :seo_description_string, class: 'form-control', value: @page.seo_description.to_h[I18n.locale.to_s].to_s %> <%= f.submit('Submit', class: 'success button', id: 'submit_page_settings') %> <% end %>