Sha256: 8b6969f31a91df743882d5809d5526a32896305c1ce491599fc0809e719db506

Contents?: true

Size: 1.55 KB

Versions: 8

Compression:

Stored size: 1.55 KB

Contents

<%= alchemy_form_for([:admin, node]) do |f| %>
  <% if node.root? %>
    <%= f.input :name,
      collection: Alchemy::Node.available_menu_names.map { |n| [I18n.t(n, scope: [:alchemy, :menu_names]), n] },
      include_blank: false,
      input_html: { class: 'alchemy_selectbox' } %>
  <% else %>
    <%= f.input :name, input_html: {
      autofocus: true,
      value: node.page && node.read_attribute(:name).blank? ? nil : node.name,
      placeholder: node.page ? node.page.name : nil
    } %>
    <%= f.input :page_id, label: Alchemy::Page.model_name.human, input_html: { class: 'alchemy_selectbox' } %>
    <%= f.input :url, input_html: { disabled: node.page }, hint: Alchemy.t(:node_url_hint) %>
    <%= f.input :title %>
    <%= f.input :nofollow %>
    <%= f.input :external %>
    <%= f.hidden_field :parent_id %>
  <% end %>
  <%= f.hidden_field :site_id %>
  <%= f.hidden_field :language_id %>
  <%= f.submit button_label %>
<% end %>

<script>
  $('#node_page_id').alchemyPageSelect({
    placeholder: "<%= Alchemy.t(:search_page) %>",
    url: "<%= alchemy.api_pages_path %>",
    <% if node.page %>
    initialSelection: {
      id: <%= node.page_id %>,
      text: "<%= node.page.name %>",
      url_path: "<%= node.page.url_path %>"
    }
    <% end %>
  }).on('change', function(e) {
    if (e.val === '') {
      $('#node_name').removeAttr('placeholder')
      $('#node_url').val('').prop('disabled', false)
    } else {
      $('#node_name').attr('placeholder', e.added.name)
      $('#node_url').val(e.added.url_path).prop('disabled', true)
    }
  })
</script>

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
alchemy_cms-4.6.7 app/views/alchemy/admin/nodes/_form.html.erb
alchemy_cms-4.6.6 app/views/alchemy/admin/nodes/_form.html.erb
alchemy_cms-4.6.5 app/views/alchemy/admin/nodes/_form.html.erb
alchemy_cms-4.6.4 app/views/alchemy/admin/nodes/_form.html.erb
alchemy_cms-4.6.3 app/views/alchemy/admin/nodes/_form.html.erb
alchemy_cms-4.6.2 app/views/alchemy/admin/nodes/_form.html.erb
alchemy_cms-4.6.1 app/views/alchemy/admin/nodes/_form.html.erb
alchemy_cms-4.6.0 app/views/alchemy/admin/nodes/_form.html.erb