Sha256: 85bdd7e53e389664b2df543c4a8801b7baaafe26d166cbd1bfc148795b05953b

Contents?: true

Size: 1.32 KB

Versions: 3

Compression:

Stored size: 1.32 KB

Contents

<%= alchemy_form_for([:admin, node]) do |f| %>
  <%= 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
  } %>
  <% unless node.root? %>
    <%= 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: "/<%= node.page.urlname %>"
    }
    <% 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.urlname).prop('disabled', true)
    }
  })
</script>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alchemy_cms-4.4.5 app/views/alchemy/admin/nodes/_form.html.erb
alchemy_cms-4.4.4 app/views/alchemy/admin/nodes/_form.html.erb
alchemy_cms-4.4.3 app/views/alchemy/admin/nodes/_form.html.erb