<%#= encoding: utf-8 %>

<script id="template-attributes" type="text/x-tmpl">
  <div class="attributes">
    <div class="attributes-header clearfix">
      <input class="toggle-check" data-deploy="right" id="${_disabled[0]}" name="${_disabled[1]}" type="hidden" value="false">
      <a class="btn btn-mini pull-right btn-danger delete" href="#"><i class="icon-trash"></i> Delete</a>
      <a class="btn btn-mini pull-right btn-inverse reply hide" href="#"><i class="icons-reply"></i> Reply</a>
      <input class="attribute_field_destroy" id="${_destroy[0]}" name="${_destroy[1]}" type="hidden" value="false">
      <h4>Field <span>${attributesHeaderLength}</span></h4>
    </div>
    <div class="attributes-body">
      <div class="control-group">
        <label class="control-label muted" for="${_key[0]}"><%= t(:key) %></label>
        <div class="controls">
          <input type="text" data-type="key" id="${_key[0]}" name="${_key[1]}" placeholder="<%= t(:key) %>">
        </div>
      </div>
      <div class="control-group">
        <label class="control-label muted" for=""><%= t(:name) %></label>
        <div class="controls">
          <div class="input-append">
            <div class="tab-content">
            <% @site_in_use_locales.each do |locale| %>
              <% active = (locale == @site_in_use_locales.first ? "active" : "") %>
              <div class="tab-pane <%= active %> fade in" id="${_title_translations[0]+'_<%= locale%>'}">
                <input type="text" data-type="lang_<%= locale%>" name="${_title_translations[1]+'[<%= locale%>]'}" placeholder="<%= t(locale).to_s %>">
              </div>
            <% end %>
            </div>
            <div class="btn-group" data-toggle="buttons-radio">
            <% @site_in_use_locales.each do |locale| %>
              <% active = (locale == @site_in_use_locales.first ? "active" : "") %>
              <a class="btn <%= active %>" href="${'#'+_title_translations[0]+'_<%= locale%>'}" data-toggle="tab"><%= t(locale).to_s %></a>
            <% end %>
            </div>
          </div>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label muted" for=""><%= t('seminar.to_require') %></label>
        <div class="controls">
            <label class="radio inline">
              <input type="radio" data-type="search_true" id="${_to_require[0]+'_true'}" name="${_to_require[1]}" value="true" checked=""> <%= t(:yes_)%>
            </label>
            <label class="radio inline">
              <input type="radio" data-type="search_false" id="${_to_require[0]+'_false'}" name="${_to_require[1]}" value="false"> <%= t(:no_)%>
            </label>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label muted" for=""><%= t(:type)%></label>
        <div class="controls">
          <select class="dataType" data-type="select" name="${_markup}">
            <%$seminar_list[:markups].each do |key,val|%>
            <% next if val["display_only"] && val["display_only"] != params["action"] %>
            <% if key != 'address' %>
             <option  value="<%= key %>" ref="<%=val["panel"]%>"><%=t("lists.markups."+key)%></option >
            <% end %>
            <% end %>
          </select>
        </div>
      </div>
    </div>
    <div class="field-type fade in typeA">
     <div class="control-group">
      <label class="control-label muted"><%= t(:enabled_for)%></label>
      <div class="controls">
          <label class="checkbox inline">
            <input type="checkbox" data-type="enable_monolingual" id="${_cross_lang[0]}" name="${_cross_lang[1]}" value="true">
            <%=  t(:cross_lang) %>
          </label>
          <label class="checkbox inline">
            <input type="checkbox" data-type="extendable_field" id="${_add_more[0]}" name="${_add_more[1]}" value="true">
            <%= t(:add_more)%>
          </label>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label muted"><%= t(:placeholder) %></label>
      <div class="controls">
        <div class="input-append">
          <div class="tab-content">

            <% @site_in_use_locales.each do |locale| %>
              <% active = (locale == @site_in_use_locales.first ? "active" : "") %>

            <div class="tab-pane <%= active %> fade in" id="${_placeholder[0]+'_<%= locale %>'}">
              <input type="text" data-type="lang_<%= locale %>" placeholder="<%= t(locale).to_s %>" name="${_placeholder[1]+'[<%= locale %>]'}">
            </div>

            <% end %>

          </div>
          <div class="btn-group" data-toggle="buttons-radio">

            <% @site_in_use_locales.each do |locale| %>
              <% active = (locale == @site_in_use_locales.first ? "active" : "") %>

            <a class="btn <%= active %>" href="${'#'+_placeholder[0]+'_<%= locale %>'}" data-toggle="tab"><%= t(locale).to_s %></a>
            <% end %>

          </div>
        </div>
      </div>
    </div>

    </div>
  </div>
</script>


<script id="template-type" type="text/x-tmpl">
  {{if templateType == 'typeA' || templateType == 'typeD' || templateType == 'typeG'}}
    <div class="control-group">
      <label class="control-label muted"><%= t(:enabled_for)%></label>
      <div class="controls">
        {{if templateType == 'typeA' || templateType == 'typeD'}}
          <label class="checkbox inline">
            <input type="checkbox" data-type="enable_monolingual" id="${_cross_lang[0]}" name="${_cross_lang[1]}" value="true">
            <%=  t(:cross_lang) %>
          </label>
        {{/if}}
        {{if templateType == 'typeA' || templateType == 'typeG'}}
          <label class="checkbox inline">
            <input type="checkbox" data-type="extendable_field" id="${_add_more[0]}" name="${_add_more[1]}" value="true">
            <%= t(:add_more)%>
          </label>
        {{/if}}
      </div>
    </div>
  {{/if}}

  {{if templateType == 'typeA' || templateType == 'typeB' || templateType == 'typeD'}}
    <div class="control-group">
      <label class="control-label muted">
        {{if templateType == 'typeB'}}
          <%= t(:initial) %>
        {{else}}
          <%= t(:placeholder) %>
        {{/if}}
      </label>
      <div class="controls">
        <div class="input-append">
          <div class="tab-content">

            <% @site_in_use_locales.each do |locale| %>
              <% active = (locale == @site_in_use_locales.first ? "active" : "") %>

            <div class="tab-pane <%= active %> fade in" id=
              {{if templateType == 'typeB'}}
                "${_initial[0]+'_<%= locale %>'}"
              {{else}}
                "${_placeholder[0]+'_<%= locale %>'}"
              {{/if}}
            >
              <input type="text" data-type="lang_<%= locale %>" placeholder="<%= t(locale).to_s %>" name=
                {{if templateType == 'typeB'}}
                  "${_initial[1]+'[<%= locale %>]' }"
                {{else}}
                  "${_placeholder[1]+'[<%= locale %>]'}"
                {{/if}}
              >
            </div>

            <% end %>

          </div>
          <div class="btn-group" data-toggle="buttons-radio">

            <% @site_in_use_locales.each do |locale| %>
              <% active = (locale == @site_in_use_locales.first ? "active" : "") %>

            <a class="btn <%= active %>" href=
              {{if templateType == 'typeB'}}
                "${'#'+_initial[0]+'_<%= locale %>'}"
              {{else}}
                "${'#'+_placeholder[0]+'_<%= locale %>'}"
              {{/if}}
            data-toggle="tab"><%= t(locale).to_s %></a>

            <% end %>

          </div>
        </div>
      </div>
    </div>
  {{/if}}

  {{if templateType == 'typeB' || templateType == 'typeE'}}
    <div class="control-group">
      <label class="control-label muted" for=""><%= t(:options)%></label>
      <div class="controls add-input">
        <div class="add-target single">
          <%= content_tag :div,:class=>"input-append" do%>
            <% @site_in_use_locales.each do |locale| %>
              <% last = (locale == @site_in_use_locales.last ? true : false) %>
                <input type="text" data-type="${_option_list[2]+'_<%= locale %>' }" id="${_option_list[0]+'_<%= locale %>'}" name="${_option_list[1]+'[<%= locale %>]'}" class="input-medium" placeholder="<%= t(locale).to_s %>">
                <% if last %>
                  <a href="#" class="btn remove-input"> <i class="icon-trash"></i> </a> 
                <% end %>
            <% end %>
          <% end %>
        </div>
        <p class="add-btn">
          <a href="#" class="${templateType+' trigger btn btn-mini btn-primary'}"><i class="icons-plus"></i> Add</a>
        </p>
      </div>
    </div>
  {{/if}}

  {{if templateType == 'typeC'}}
    <div class="control-group">
      <label class="control-label muted" for=""><%= t("date.format")%></label>
      <div class="controls">
        <select data-type="date" id="${_format[0]}" name="${_format[1]}">
          <option value="format1">YYYY / MM / DD hh : mm</option>
          <option value="format2">YYYY / MM / DD</option>
          <option value="format3">YYYY / MM</option>
          <option value="format4">YYYY</option>
        </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label muted" for=""><%= t("date.range")%></label>
      <div class="controls">
        <label class="radio inline">
          <input type="radio" data-type="time_period_flase" id="${_is_range[0]+'_false'}" name="${_is_range[1]}" value="false" checked="checked"> <%= t(:yes_)%>
        </label>
        <label class="radio inline">
          <input type="radio" data-type="time_period_true" id="${_is_range[0]+'_true'}" name="${_is_range[1]}" value="true"> <%= t(:no_)%>
        </label>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label muted" for=""><%= t("date.calendar")%></label>
      <div class="controls">
        <label class="radio inline">
          <input type="radio" data-type="calendar_ac" id="${_calendar[0]+'_west_calendar'}" name="${_calendar[1]}" value="west_calendar" checked="checked"> <%= t("date.west_calendar")%>
        </label>
        <label class="radio inline">
          <input type="radio" data-type="calendar_roc" id="${_calendar[0]+'_tw_calendar'}" name="${_calendar[1]}" value="tw_calendar"> <%= t("date.tw_calendar")%>
        </label>
      </div>
    </div>
  {{/if}}
  {{if templateType == 'typeF'}}
    <div class="control-group">
      <label class="control-label muted" for=""><%= t(:options)%></label>
      <div class="controls add-input">
        <% if @attribute.enable_summary_choice %>
          <% @attribute.summary_chioices.each do |v| %>
            <div><%=v%></div>
          <% end %>
        <% end %>
      </div>
    </div>
  {{/if}}
</script>


<script id="template-input-append" type="text/x-tmpl">
  <%= content_tag :div,:class=>"input-append" do%>
    <% @site_in_use_locales.each do |locale| %>
      <% last = (locale == @site_in_use_locales.last ? true : false) %>
        <input type="text" data-type="${_option_list[2]+'_<%= locale %>' }" id="${_option_list[0]+'_<%= locale %>'}" name="${_option_list[1]+'[<%= locale %>]'}" class="input-medium" placeholder="<%= t(locale).to_s %>">
        <% if last %>
          <a href="#" class="btn remove-input"> <i class="icon-trash"></i> </a> 
        <% end %>
    <% end %>
  <% end %>
</script>

<script id="template-text" type="text/x-tmpl">
  <div class="input-append">
    <input type="text" id="${'text'+_text[0]}" name="${_text[1]+'[text]'}" class="input-medium" placeholder="Text">
    <a href="#" class="btn remove-input">
      <i class="icon-trash"></i>
    </a>
  </div>
</script>