Sha256: d37fbe3a95f60bb59ba10392d3f8149dbd2490adce0d3d718f0c870a42d7ad81

Contents?: true

Size: 1.96 KB

Versions: 16

Compression:

Stored size: 1.96 KB

Contents

<div class="field">
  <%= f.label :layout, "Layout" %>
  <div class="clearer"></div>

  <!-- list all kinds of layouts -->
  <% MailEngine::PLACEHOLDERS_IN_LAYOUT.keys.each do |layout_name| %>
    <div class="layout_option_item left">
      <%= f.radio_button :layout, layout_name, :class => "layout_option hidden", :ref => layout_name %>

      <label for="mail_engine_mail_template_layout_<%= layout_name %>" style="font-size: 11px">
        <img class="layout_option_image" src="/images/mail_engine/unselect_<%= layout_name %>_layout.png"/>
      </label>
    </div>
  <% end %>
  <div class="clearer"></div>

  <% MailEngine::PLACEHOLDERS_IN_LAYOUT.keys.each do |layout_name| %>
    <!-- list all placeholders -->
    <div class="placeholder_list <%= layout_name %> quiet" style="margin-left: 7px"></div>
  <% end %>

  <div class="hint">Choose a template layout.</div>
</div>

<script>
  $(function(){
    function resetAllImageSelectionState() {
      $("img.layout_option_image").each(function(i){
        if(!$.string(this.src).include('unselect')) {
          $(this).attr("src", $.string(this.src).gsub("images/mail_engine/", "images/mail_engine/unselect_").str);
        }
      });
    }

    $("input[type=radio].layout_option").click(function(){
      // change image to selected state.
      resetAllImageSelectionState();
      var image_el = $(this).next("label").children('img');
      var selected_layout_image_name = $.string(image_el.attr('src')).gsub("unselect_", "").str
      image_el.attr('src', selected_layout_image_name);

      var layout_name = $(this).attr('ref');
      $('.placeholder_list').html("");
      $("." + layout_name).load("<%= partial_options_mail_templates_path %>", {id:<%= f.object.id||"''" %>, layout:layout_name, template_format:$('#mail_engine_mail_template_format').val(), template_locale:$('#mail_engine_mail_template_locale').val()});
    });

    // load options when editing.
    $("input[type=radio].layout_option:checked").click();
  });
</script>

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mail_engine-0.1.15 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.14 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.13 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.12 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.11 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.10 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.9 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.8 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.7 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.6 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.5 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.4 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.3 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.2 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.1 app/views/mail_engine/mail_templates/_layout_selector.html.erb
mail_engine-0.1.0 app/views/mail_engine/mail_templates/_layout_selector.html.erb