add_block.html.erb 1.47 KB
<div id="add-block-dialog">
  <%= form_tag do %>

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

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

    <script type="text/javascript">
      jQuery('#box-position input').bind('change',
        function () {
          showCenter = jQuery(this).attr('data-position') == '1';
          jQuery('#center-block-types').toggle(showCenter);
          jQuery('#side-block-types').toggle(!showCenter);
        }
      );
    </script>

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

    <div id="center-block-types" class="block-types">
      <% @center_block_types.each do |block| %>
        <div class='block-type'>
          <%= labelled_radio_button(block.description, :type, block.name) %>
        </div>
      <% end %>
    </div>

    <div id="side-block-types" class="block-types" style="display:none">
      <% @side_block_types.each do |block| %>
        <div class='block-type'>
          <%= labelled_radio_button(block.description, :type, block.name) %>
        </div>
      <% end %>
    </div>

    <br style='clear: both'/>

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

  <% end %>
</div>