<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

<!-- Template Choice page -->
<template id="email_designer" name="Email Designer">
    <t t-call="website.layout">
        <div id="wrap" class="container" t-ignore="True">
            <div id="email_template" class="mb32" t-att-style="mode != 'email_template' and 'display: none' or ''">
                <a class="mt16 btn btn-default pull-right css_editable_mode_hidden" 
                  t-attf-href="/web#return_label=Website&amp;model=#{model}&amp;id=#{res_id}&amp;view_type=form&amp;action=#{return_action}">
                    Back
                </a>
                <h1 class="page-header mt16">
                    Choose an Email Template
                </h1>
                <div class="row">
                    <div class="col-md-3 col-sm-4 text-center img-border">
                        <div class="email_preview_border">
                            <div class="email_preview js_content"/>
                        </div>
                        <h4>New Template</h4>
                        <button class="btn btn-primary js_template_set">Select</button>
                    </div>
                    <div t-foreach="templates" t-as="template" class="col-md-3 col-sm-4 text-center">
                        <div class="email_preview_border">
                            <div t-raw="html_sanitize(template.body_html)" class="email_preview js_content"/>
                        </div>
                        <h4 t-field="template.name"/>
                        <button class="btn btn-primary js_template_set">Select</button>
                    </div>
                </div>
            </div>
            <div id="email_designer" class="mb32" t-att-style="mode != 'email_designer' and 'display: none' or ''">
                <a class="mt16 btn btn-primary pull-right css_editable_mode_hidden" 
                  t-attf-href="/web#return_label=Website&amp;model=#{model}&amp;id=#{res_id}&amp;view_type=form&amp;action=#{return_action}">
                    Back to the mass mailing
                </a>
                <h1 class="page-header mt16">
                    Design Your Email
                </h1>
                <div class="form-horizontal">
                    <!-- email_from fields-->
                    <div class="form-group" t-if="email_from_field == 'email_from'">
                        <label class="col-sm-2 control-label">From:</label>
                        <div class="col-sm-7"><span t-field="record.email_from" class="form-control"/></div>
                    </div>
                    <div class="form-group" t-if="email_from_field == 'email'">
                        <label class="col-sm-2 control-label">From:</label>
                        <div class="col-sm-7"><span t-field="record.email" class="form-control"/></div>
                    </div>
                    <!-- email_from fields-->
                    <div class="form-group" t-if="subject_field == 'subject'">
                        <label class="col-sm-2 control-label">Subject:</label>
                        <div class="col-sm-7"><span t-field="record.subject" class="form-control"/></div>
                    </div>
                    <div class="form-group" t-if="subject_field == 'name'">
                        <label class="col-sm-2 control-label">Subject:</label>
                        <div class="col-sm-7"><span t-field="record.name" class="form-control"/></div>
                    </div>
                </div>
                <hr/>
                <!-- body fields -->
                <div t-if="body_field == 'body_html'" class="col-sm-offset-2">
                    <div t-field="record.body_html" id="email_body_html" class="o_mail_body"/>
                </div>
                <div t-if="body_field == 'body'" class="col-sm-offset-2">
                    <div t-field="record.body" id="email_body" class="o_mail_body"/>
                </div>
            </div>
        </div>
    </t>
    <t t-set="website.footer"></t>
</template>

    </data>
</openerp>



