add_block.rhtml 1.34 KB
<div style='height:350px'>
  <% form_tag do %>

    <p><%= _('In what area do you want to put your new block?') %></p>

    <% @boxes.each do |box| %>
      <%= labelled_radio_button(_("Area %d") % box.position, :box_id, box.id, box.central?, { :class => 'box-position', 'data-position' => box.position })  %>
    <% end %>

    <script type="text/javascript">
      (function ($) {
        $(document).ready(function () {
          $(".box-position").live('change', function () {
            if ($(this).attr('data-position') == '1') {
              $('#center-block-types').show();
              $('#side-block-types').hide();
            } else {
              $('#center-block-types').hide();
              $('#side-block-types').show();
            };
          });
      })})(jQuery);
    </script>

    <p><%= _('Select the type of block you want to add to your page.') %></p>

    <div id='center-block-types'>
      <%= render :partial => 'block_types', :locals => { :block_types => @center_block_types } %>
    </div>

    <div id='side-block-types' style='display:none'>
      <%= render :partial => 'block_types', :locals => { :block_types => @side_block_types } %>
    </div>

    <br style='clear: both'/>

    <% button_bar do %>
      <%= submit_button(:add, _("Add")) %>
      <%= colorbox_close_button(_('Close')) %>
    <% end %>

  <% end %>
</div>