<div class='content-list span6'>
  <h3>{{i18n 'admin.customize.css_html.long_title'}}</h3>
  <ul>
    {{#each style in model}}
      <li><a {{action "selectStyle" style}} {{bind-attr class="style.selected:active"}}>{{style.description}}</a></li>
    {{/each}}
  </ul>
  <button {{action "newCustomization"}} class='btn'>
    {{fa-icon "plus"}}{{i18n 'admin.customize.new'}}
  </button>
</div>

{{#if selectedItem}}
  <div {{bind-attr class=":current-style view.maximized:maximized"}}>
    <div class='wrapper'>
      {{text-field class="style-name" value=selectedItem.name}}

      <div class='admin-controls'>
        <ul class="nav nav-pills">
          {{#if view.mobile}}
            <li><a {{bind-attr class="view.mobileStylesheetActive:active"}} {{action "select" "mobile_stylesheet" target="view"}}>{{fa-icon "mobile"}}&nbsp;{{i18n 'admin.customize.css'}}</a></li>
            <li><a {{bind-attr class="view.mobileHeaderActive:active"}} {{action "select" "mobile_header" target="view"}}>{{fa-icon "mobile"}}&nbsp;{{i18n 'admin.customize.header'}}</a></li>
            <li><a {{bind-attr class="view.mobileTopActive:active"}} {{action "select" "mobile_top" target="view"}}>{{fa-icon "mobile"}}&nbsp;{{i18n 'admin.customize.top'}}</a></li>
            <li><a {{bind-attr class="view.mobileFooterActive:active"}} {{action "select" "mobile_footer" target="view"}}>{{fa-icon "mobile"}}&nbsp;{{i18n 'admin.customize.footer'}}</a></li>
          {{else}}
            <li><a {{bind-attr class="view.stylesheetActive:active"}} {{action "select" "stylesheet" target="view"}}>{{i18n 'admin.customize.css'}}</a></li>
            <li><a {{bind-attr class="view.headerActive:active"}} {{action "select" "header" target="view"}}>{{i18n 'admin.customize.header'}}</a></li>
            <li><a {{bind-attr class="view.topActive:active"}} {{action "select" "top" target="view"}}>{{i18n 'admin.customize.top'}}</a></li>
            <li><a {{bind-attr class="view.footerActive:active"}} {{action "select" "footer" target="view"}}>{{i18n 'admin.customize.footer'}}</a></li>
            <li><a {{bind-attr class="view.headTagActive:active"}} {{action "select" "head_tag" target="view"}} title="{{i18n 'admin.customize.head_tag.title'}}">{{fa-icon "file-text-o"}}&nbsp;{{i18n 'admin.customize.head_tag.text'}}</a></li>
            <li><a {{bind-attr class="view.bodyTagActive:active"}} {{action "select" "body_tag" target="view"}} title="{{i18n 'admin.customize.body_tag.title'}}">{{fa-icon "file-text-o"}}&nbsp;{{i18n 'admin.customize.body_tag.text'}}</a></li>
          {{/if}}
          <li class='toggle-mobile'>
            <a {{bind-attr class="view.mobile:active"}} {{action "toggleMobile" target="view"}}>{{fa-icon "mobile"}}</a>
          </li>
          <li class='toggle-maximize'>
            <a {{action "toggleMaximize" target="view"}}>
              {{#if view.maximized}}
                {{fa-icon "compress"}}
              {{else}}
                {{fa-icon "expand"}}
              {{/if}}
            </a>
          </li>
        </ul>
      </div>

      <div class="admin-container">
        {{#if view.stylesheetActive}}{{ace-editor content=selectedItem.stylesheet mode="scss"}}{{/if}}
        {{#if view.headerActive}}{{ace-editor content=selectedItem.header mode="html"}}{{/if}}
        {{#if view.topActive}}{{ace-editor content=selectedItem.top mode="html"}}{{/if}}
        {{#if view.footerActive}}{{ace-editor content=selectedItem.footer mode="html"}}{{/if}}
        {{#if view.headTagActive}}{{ace-editor content=selectedItem.head_tag mode="html"}}{{/if}}
        {{#if view.bodyTagActive}}{{ace-editor content=selectedItem.body_tag mode="html"}}{{/if}}
        {{#if view.mobileStylesheetActive}}{{ace-editor content=selectedItem.mobile_stylesheet mode="scss"}}{{/if}}
        {{#if view.mobileHeaderActive}}{{ace-editor content=selectedItem.mobile_header mode="html"}}{{/if}}
        {{#if view.mobileTopActive}}{{ace-editor content=selectedItem.mobile_top mode="html"}}{{/if}}
        {{#if view.mobileFooterActive}}{{ace-editor content=selectedItem.mobile_footer mode="html"}}{{/if}}
      </div>
      <div class='admin-footer'>
        <div class='status-actions'>
          <span>{{i18n 'admin.customize.enabled'}} {{input type="checkbox" checked=selectedItem.enabled}}</span>
          {{#unless selectedItem.changed}}
          <a class='preview-link' {{bind-attr href="selectedItem.previewUrl"}} target='_blank' title="{{i18n 'admin.customize.explain_preview'}}">{{i18n 'admin.customize.preview'}}</a>
          |
          <a href="/?preview-style=" target='_blank' title="{{i18n 'admin.customize.explain_undo_preview'}}">{{i18n 'admin.customize.undo_preview'}}</a>
          |
          <a href="/?preview-style=default" target='_blank' title="{{i18n 'admin.customize.explain_rescue_preview'}}">{{i18n 'admin.customize.rescue_preview'}}</a><br>
          {{/unless}}
        </div>

        <div class='buttons'>
          <button {{action "save"}} {{bind-attr disabled="selectedItem.disableSave"}} class='btn'>{{i18n 'admin.customize.save'}}</button>
          <span class='saving'>{{selectedItem.savingStatus}}</span>
          <a {{action "destroy"}} class='delete-link'>{{i18n 'admin.customize.delete'}}</a>
        </div>
      </div>
    </div>
  </div>
{{else}}
  <p class="about">{{i18n 'admin.customize.about'}}</p>
{{/if}}