app/views/pages/_settings_form.slim
.col-md-8
= form_for page, remote: true, html: {class: 'one-form', data: {type: "page" }} do |f|
.form-group
= label_with_tooltip(f, :tag_ids, t('pages.edit.tags'), t('tooltips.tags'))
= f.select :tag_ids, options_from_collection_for_select(Tag.all, 'id', 'name', page.tag_ids), {}, html_options= {class: 'selectize-container', multiple: true}
.form-group
= f.label :language_id, t('pages.edit.language_label')
= f.select :language_id, Language.all.map { |lang| [lang.name, lang.id] }, {}, class: "form-control"
.form-group
= label_with_tooltip(f, :liquid_layout_preview, t('pages.edit.layout_select'), t('tooltips.page_layout'))
= render 'collapsing_layout_select', f: f, field: :liquid_layout_id, dom_name: 'primary', association: :liquid_layout
.form-group
= label_with_tooltip(f, :liquid_layout_preview, t('pages.edit.follow_up_layout_select'), t('tooltips.follow_up'))
= render 'collapsing_layout_select', f: f, field: :follow_up_liquid_layout_id, dom_name: 'follow_up', association: :follow_up_liquid_layout, offer_redirect: true
.form-group
- js_hidden = ''
- if page.notes.blank?
a data-target=".notes-editor" data-toggle="collapse" class="notes-editor__toggle"
= t('pages.edit.add_notes')
- js_hidden = 'collapse'
.notes-editor class="#{js_hidden}"
= label_with_tooltip(f, :notes, t('pages.edit.notes'), t('tooltips.notes'))
= f.text_area :notes, class: 'form-control'
- if Settings.ak_api_url.present?
.form-group
label= t('pages.edit.ak_resources')
- if (page.ak_petition_resource_uri.blank? || page.ak_donation_resource_uri.blank?) && page.created_at < (DateTime.now - 2.minutes)
p.ak-resource-pending = t('pages.edit.ak_resource_missing')
= link_to create_resources_action_kit_path(id: page.id), method: :post, class: 'btn btn-danger ak-resource-pending', id: 'ak-resource-button'
= t('pages.edit.click_to_create')
p.ak-resource-queued.hidden-irrelevant = t('pages.edit.ak_resource_queued')
- else
br
= link_to t('pages.edit.ak_petition_resource', resource_id: ak_resource_id(page.ak_petition_resource_uri)),
ak_page_url(page.ak_petition_resource_uri),
target: '_blank'
br
= link_to t('pages.edit.ak_donation_resource', resource_id: ak_resource_id(page.ak_donation_resource_uri)),
ak_page_url(page.ak_donation_resource_uri),
target: '_blank'
- if Settings.ak_report_url.present? && page.status == 'success'
.form-group
label= t('pages.edit.ak_reports')
br
= link_to t('pages.edit.ak_petition_report', resource_id: ak_resource_id(page.ak_petition_resource_uri)),
ak_report_url(page.ak_petition_resource_uri),
target: '_blank'
br
= link_to t('pages.edit.ak_donation_report', resource_id: ak_resource_id(page.ak_donation_resource_uri)),
ak_report_url(page.ak_donation_resource_uri),
target: '_blank'
a data-toggle="collapse" data-target=".additional-settings" aria-expanded="false"
= t('pages.edit.more_settings')
.additional-settings.collapse
.form-group
= label_with_tooltip(f, :campaign, t('pages.edit.campaign'), t('tooltips.campaign'))
= f.select :campaign_id, options_from_collection_for_select(Campaign.all.order(name: :asc), 'id', 'name', page.campaign_id), {include_blank: '-- None --'}, class: 'form-control'
.form-group
= label_with_tooltip(f, :publish_actions, t('pages.edit.publish_actions'), t('tooltips.publish_actions'))
= f.select :publish_actions, Page.publish_actions.to_a.map{ |k, v| [k.humanize, k] }, {}, class: "form-control"
.form-group
= label_with_tooltip(f, :optimizely_status, t('pages.edit.optimizely_status'), t('tooltips.optimizely_status'))
= f.select :optimizely_status, Page.optimizely_statuses.to_a.map{ |k, v| [k.humanize, k] }, {}, class: "form-control"
.form-group
= label_with_tooltip(f, :canonical_url, t('pages.edit.canonical_url'), t('tooltips.canonical_url'))
= f.text_field :canonical_url, class: "form-control"
.form-group
= label_tag t('pages.edit.clone_page')
br
= link_to new_clone_page_path(id: page.id), class: 'btn btn-primary'
= t('menu.clone')
javascript:
$(function () {
window.ee.emit('layout:edit');
$('#ak-resource-button').click(function(){
$('.ak-resource-pending').addClass('hidden-irrelevant');
$('.ak-resource-queued').removeClass('hidden-irrelevant');
});
});