_highlights_block.rhtml 2.23 KB
<strong><%= _('Highlights') %></strong>
<div id='edit-highlights-block' style='width:450px'>
<table id='highlights' class='noborder'>
  <tr><th><%= _('Image') %></th><th><%= _('Address') %></th><th><%= _('Position') %></th><th><%= _('Title') %></th></tr>
  <% for image in @block.images do %>
    <tr>
      <td>
        <%= select_tag 'block[images][][image_id]', content_tag(:option) + option_groups_from_collection_for_select(@block.folder_choices, :images, :name, :id, :name, image[:image_id].to_i).html_safe, :style => "width: 100px" %></p>
      </td>
      <td><%= text_field_tag 'block[images][][address]', image[:address], :class => 'highlight-address', :size => 10 %></td>
      <td><%= text_field_tag 'block[images][][position]', image[:position], :class => 'highlight-position', :size => 3 %></td>
      <td><%= text_field_tag 'block[images][][title]', image[:title], :class => 'highlight-title', :size => 10 %></td>
    </tr>
  <% end %>
</table>
</div>

<%= link_to_function(_('New highlight'), nil, :class => 'button icon-add with-text') do |page|
    page.insert_html :bottom, 'highlights', content_tag('tr',
                  content_tag('td', select_tag('block[images][][image_id]', content_tag(:option) + option_groups_from_collection_for_select(@block.folder_choices, :images, :name, :id, :name).html_safe, :style => "width: 100px")) +
                  content_tag('td', text_field_tag('block[images][][address]', nil, :class => 'highlight-address', :size => 10)) +
                  content_tag('td', text_field_tag('block[images][][position]', nil, :class => 'highlight-position', :size => 3)) +
                  content_tag('td', text_field_tag('block[images][][title]', nil, :class => 'highlight-position', :size => 10))
    ) +
    javascript_tag("$('edit-link-list-block').scrollTop = $('edit-link-list-block').scrollHeight")
end %>

<%= labelled_form_field _('Image transition:'), select('block', 'interval', [[_('No automatic transition'), 0]] + [1, 2, 3, 4, 5, 10, 20, 30, 60].map {|item| [n_('Every 1 second', 'Every %d seconds', item) % item, item]}) %>

<%= labelled_form_field check_box(:block, :shuffle) + _('Show images in random order'), '' %>

<%= labelled_form_field check_box(:block, :navigation) + _('Display navigation buttons'), '' %>