Skip to content

Commit

Permalink
Move Template editing to Sidebar (#1612)
Browse files Browse the repository at this point in the history
* Move Template editing to Sidebar

* Removed logs

* Linting fixes

* i18n updates

* renamed filed to remove email designation

* package name update

* add info box around React message
  • Loading branch information
kieckhafer authored and brent-hoover committed Dec 20, 2016
1 parent 0816308 commit 8217a5d
Show file tree
Hide file tree
Showing 8 changed files with 314 additions and 224 deletions.
18 changes: 17 additions & 1 deletion imports/plugins/core/layout/server/publications/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,29 @@ import { Reaction } from "/server/api";
import { Meteor } from "meteor/meteor";
import { Templates } from "/lib/collections";

Meteor.publish("Templates", () => {
Meteor.publish("Templates", function (query, options) {
check(query, Match.Optional(Object));
check(options, Match.Optional(Object));

const shopId = Reaction.getShopId();

if (!shopId) {
return this.ready();
}

const select = query || {};
// append shopId to query
// templates could be shared
// if you disregarded shopId
select.shopId = shopId;

// appends a count to the collection
// we're doing this for use with griddleTable
Counts.publish(this, "templates-count", Templates.find(
select,
options
));

return Templates.find({
shopId
});
Expand Down
4 changes: 2 additions & 2 deletions imports/plugins/core/templates/client/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import "./templates/email.html";
import "./templates/email.js";
import "./templates/settings.html";
import "./templates/settings.js";
60 changes: 0 additions & 60 deletions imports/plugins/core/templates/client/templates/email.html

This file was deleted.

116 changes: 0 additions & 116 deletions imports/plugins/core/templates/client/templates/email.js

This file was deleted.

69 changes: 69 additions & 0 deletions imports/plugins/core/templates/client/templates/settings.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<template name="templateSettings">
<div class="panel panel-default">
<div class="panel-body">
<div class="col-md-12">
{{> React templateGrid }}
</div>
</div>
</div>

{{#if instance.state.get 'isEditing'}}
{{#if instance.state.get 'editingId'}}
{{#if typeEmail}}
<div>
{{#autoForm
collection=Collections.Templates
schema=emailTemplateSchema
id="email-template-edit-form"
template="bootstrap3-inline"
doc=template
}}

<div class="panel panel-default">
<div class="panel-heading" data-i18n="templateUpdateForm.emailTemplates.updateEmailTemplate">Update email template</div>
<div class="panel-body">
<div class="col-md-12 form-group">
{{>afQuickField name="title" class="form-control"}}
{{>afQuickField name="name" class="form-control" disabled=true}}
{{>afQuickField name="language" class="form-control" disabled=true}}
{{>afQuickField name="subject" class="form-control"}}
{{>afQuickField name="template" label="HTML" class="form-control" type="textarea" rows="15"}}
</div>
</div>

<div class="panel-footer">
<div class="right">
{{> templateSubmitButton instance=instance }}
</div>
</div>
</div>

{{/autoForm}}
</div>
{{else}}
<div>
<div class="panel panel-default">
<div class="panel-heading" data-i18n="templateUpdateForm.reactTemplates.updateReactTemplate">Update React template</div>
<div class="panel-body">
<div class="col-md-12">
<div class="alert alert-info">
<span data-i18n="templateUpdateForm.reactTemplates.updateUnavailable">React templates cannot be edited through this interface</span>
</div>
</div>
</div>
</div>
</div>
{{/if}}
{{/if}}
{{/if}}
</template>


<template name="templateSubmitButton">
<div class="clearfix">
<div class="pull-right">
<button type="button" class="btn btn-primary cancel" data-i18n="app.cancel">Cancel</button>
<button type="submit" class="btn btn-primary" data-i18n="app.saveChanges">Save Changes</button>
</div>
</div>
</template>
Loading

0 comments on commit 8217a5d

Please sign in to comment.