<%= form_remote_tag :url => { :action => 'edit_page', :id => @pg }, :loading => "$('btn_save').disabled = true; $('btn_save').value = 'Saving...';", :html => { :onsubmit => 'teardownTextFieldHints();' } do %> <%- if (@pg.id || 2) > 1 -%> <%- end -%> <%- if @pg.respond_to?(:redirect_enabled) -%> <%- end -%> <%- if @pg.respond_to?(:feature_image_path) -%> <%- end -%> <%- if @pg.respond_to?(:html_head) -%> <%- end -%>
Name (for URL): <%= text_field :pg, :name, :class => 'form', :style => 'margin-bottom: 0; width: 150px', :onchange => (@pg.new_record? ? '' : "if (!confirm('Are you sure you want to change the name of this page? Any bookmarks or links to this page will no longer work if you proceed with this change.')) { this.value = $('original_name').value; };") %>
<%= text_field_tag :original_name, @pg.name, :style => 'display: none' %> <%= text_field :pg, :parent_id, :style => 'display: none' %>
Page Title: <%= text_field :pg, :title, :class => 'form', :style => 'width: 100%;' %>
Page Type: <%= radio_button :pg, :redirect_enabled, false %> Normal <%= radio_button :pg, :redirect_enabled, true %> Redirect to: <%= text_field :pg, :redirect_to %>
Template:
<%= select :pg, :cms_template_id, CmsTemplate.find(:all, :order => 'name').collect { |t| [ t.name, t.id ] }, {}, :class => 'form', :style => 'width: 100%;' %>
<%= render :partial => 'template_options' %>
Article Date:
<%= date_picker :pg, :article_date, :default_value => (@pg.article_date || @pg.created_on || Time.now), :start_date => Time.utc(2006, 1, 1), :end_date => 5.years.from_now %>
>– <%= date_picker :pg, :article_end_date, :default_value => (@pg.article_end_date || @pg.article_date || @pg.created_on || Time.now), :start_date => Time.utc(2006, 1, 1), :end_date => 5.years.from_now %>
/>
Tags: <%= text_field_tag :tags, @tags, :class => 'form', :style => 'width: 100%' %>
Publish Version: <%= select :pg, :published_version, [ [ '[ None (offline) ]', -1 ], [ '[ Latest ]', 0 ] ].concat(@pg.versions.reverse.map { |pg| [ "#{pg.version} - #{ts_to_str pg.updated_on}#{" by #{pg.updated_by_username}" unless pg.updated_by_username.blank? }", pg.version ] }), {}, :class => 'form', :style => 'width: 100%' %>
Publish Date:
<%= date_picker :pg, :published_date, :default_value => (@pg.published_date || @pg.created_on || Time.now), :start_date => Time.utc(2006, 1, 1), :end_date => 2.years.from_now %> Position: <%= text_field :pg, :position, :class => 'form', :style => 'width: 20px' %>
Expiration Date:
<%= check_box :pg, :expires, {}, 'true', 'false' %> <%= date_picker :pg, :expiration_date, :default_value => (@pg.expiration_date || @pg.published_date || Time.now), :start_date => Time.utc(2006, 1, 1), :end_date => 2.years.from_now %>
Summary:
<%= text_area :pg, :summary, :class => 'form', :style => 'width: 100%; height: 50px;' %>
Thumbnail: <%- if @pg.new_record? -%> A thumbnail cannot be added until you save this page. <%- else -%>
<%- if @pg.thumbnail_path.blank? -%> <%- else -%> <%= image_tag(@pg.thumbnail_path, :onclick => "jQuery('#pg_thumbnail_path').show();") %> <%- end -%>
<%= button_to_function "Select Thumbnail...", "selectThumbnail('#{url_for :action => 'upload_thumb', :id => @pg}');", :class => 'form_button' %> <%- end -%> <%= text_field :pg, :thumbnail_path, :class => 'form', :style => 'width: 100%; display: none;' %>
Feature Image: <%- if @pg.new_record? -%> A feature image cannot be added until you save this page. <%- else -%>
<%- if @pg.feature_image_path.blank? -%> <%- else -%> <%= image_tag(@pg.feature_image_path, :onclick => "jQuery('#pg_feature_image_path').show();") %> <%- end -%>
<%= button_to_function "Select Feature Image...", "selectThumbnail('#{url_for :action => 'upload_feature_image', :id => @pg}');", :class => 'form_button' %> <%- end -%> <%= text_field :pg, :feature_image_path, :class => 'form', :style => 'width: 100%; display: none;' %>
HTML Head:
(advanced)
<%= text_area :pg, :html_head, :class => 'form', :style => 'width: 100%; height: 35px; overflow: auto;' %>
Custom Attributes:
(advanced)
Add an attribute:   <%= text_field_tag :custom_attribute_name, '', :class => 'form', :style => 'margin-bottom: 4px;' %> <%= javascript_tag "addTextFieldHint('custom_attribute_name', '[ attribute name ]'); setupTextFieldHints(); "%> <%= javascript_tag "$('custom_attribute_name').onkeydown = disableEnterKey; new Autocompleter.Local('custom_attribute_name', 'custom_attribute_name_auto_complete', attrlist, { frequency: 0.1, minChars: 1 });" %> <%= button_to_function 'Add', "new Ajax.Updater('custom_attributes', '/manage/cms/page_attribute?name=' + $('custom_attribute_name').value, {asynchronous:true, evalScripts:true, insertion:Insertion.Bottom}); $('custom_attribute_name').value = ''; return false;", :class => 'form_button', :style => 'margin-bottom: 5px;' %>
<%- @page_objects.each do |key,val| -%> <%- key =~ /^obj-(\w+?)-(.+?)$/ -%> <%= render :partial => 'page_attribute', :locals => { :name => $2 } if $1 == 'attribute' %> <%- end -%>
<%= submit_tag 'Save', :id => 'btn_save', :class => 'form_button', :style => 'width: 70px;' %> <%= link_to_function 'Cancel', "cancelEditProperties();", :style => 'font-weight: normal;' %> <%= hidden_field_tag 'return_to', params[:return_to] %>
<% end -%>