-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #350 from serhiyzhovnir/feature/issue-179
#issue-179 Added email template generation
- Loading branch information
Showing
27 changed files
with
1,638 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
resources/fileTemplates/code/Magento Module Email Template Xml.xml.ft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<template id="${ID}" label="${LABEL}" file="${FILE_NAME}.html" type="${TYPE}" module="${MODULE}" area="${AREA}"/> |
52 changes: 52 additions & 0 deletions
52
resources/fileTemplates/code/Magento Module Email Template Xml.xml.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<!-- | ||
/* | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<html> | ||
<body> | ||
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"> | ||
<tr> | ||
<td> | ||
<font face="verdana" size="-1">Email templates configuration.</font> | ||
</td> | ||
</tr> | ||
</table> | ||
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"> | ||
<tr> | ||
<td colspan="3"><font face="verdana" size="-1">Predefined variables explanation:</font></td> | ||
</tr> | ||
<tr> | ||
<td valign="top"><nobr><font face="verdana" size="-2"><b>${ID}</b></font></nobr></td> | ||
<td width="10"> </td> | ||
<td width="100%" valign="top"><font face="verdana" size="-1">Email template ID.</font></td> | ||
</tr> | ||
<tr> | ||
<td valign="top"><nobr><font face="verdana" size="-2"><b>${LABEL}</b></font></nobr></td> | ||
<td width="10"> </td> | ||
<td width="100%" valign="top"><font face="verdana" size="-1">Email Template Label.</font></td> | ||
</tr> | ||
<tr> | ||
<td valign="top"><nobr><font face="verdana" size="-2"><b>${FILE_NAME}</b></font></nobr></td> | ||
<td width="10"> </td> | ||
<td width="100%" valign="top"><font face="verdana" size="-1">Email template file name.</font></td> | ||
</tr> | ||
<tr> | ||
<td valign="top"><nobr><font face="verdana" size="-2"><b>${TYPE}</b></font></nobr></td> | ||
<td width="10"> </td> | ||
<td width="100%" valign="top"><font face="verdana" size="-1">Email template type. (HTML or TEXT)</font></td> | ||
</tr> | ||
<tr> | ||
<td valign="top"><nobr><font face="verdana" size="-2"><b>${MODULE}</b></font></nobr></td> | ||
<td width="10"> </td> | ||
<td width="100%" valign="top"><font face="verdana" size="-1">Module's name.</font></td> | ||
</tr> | ||
<tr> | ||
<td valign="top"><nobr><font face="verdana" size="-2"><b>${AREA}</b></font></nobr></td> | ||
<td width="10"> </td> | ||
<td width="100%" valign="top"><font face="verdana" size="-1">Email template area. (Adminhtml or Frontend)</font></td> | ||
</tr> | ||
</table> | ||
</body> | ||
</html> |
7 changes: 7 additions & 0 deletions
7
resources/fileTemplates/internal/Magento Module Email Template Html.html.ft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!--@subject {{trans "${SUBJECT}"}} @--> | ||
<!--@vars {} @--> | ||
|
||
#if (${HTML_TYPE}){{template config_path="design/email/header_template"}}#end | ||
|
||
<!-- @todo: implement ${TYPE} template --> | ||
#if (${HTML_TYPE}){{template config_path="design/email/footer_template"}}#end |
37 changes: 37 additions & 0 deletions
37
resources/fileTemplates/internal/Magento Module Email Template Html.html.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!-- | ||
/* | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<html> | ||
<body> | ||
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"> | ||
<tr> | ||
<td> | ||
<font face="verdana" size="-1">Email template.</font> | ||
</td> | ||
</tr> | ||
</table> | ||
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"> | ||
<tr> | ||
<td colspan="3"><font face="verdana" size="-1">Predefined variables explanation:</font></td> | ||
</tr> | ||
<tr> | ||
<td valign="top"><nobr><font face="verdana" size="-2"><b>${SUBJECT}</b></font></nobr></td> | ||
<td width="10"> </td> | ||
<td width="100%" valign="top"><font face="verdana" size="-1">Email subject.</font></td> | ||
</tr> | ||
<tr> | ||
<td valign="top"><nobr><font face="verdana" size="-2"><b>${HTML_TYPE}</b></font></nobr></td> | ||
<td width="10"> </td> | ||
<td width="100%" valign="top"><font face="verdana" size="-1">Defines if it's HTML type template.</font></td> | ||
</tr> | ||
<tr> | ||
<td valign="top"><nobr><font face="verdana" size="-2"><b>${TYPE}</b></font></nobr></td> | ||
<td width="10"> </td> | ||
<td width="100%" valign="top"><font face="verdana" size="-1">Email template type. (HTML or TEXT)</font></td> | ||
</tr> | ||
</table> | ||
</body> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
resources/fileTemplates/internal/Magento Module Email Templates Xml.xml.ft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0"?> | ||
|
||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd"> | ||
</config> |
17 changes: 17 additions & 0 deletions
17
resources/fileTemplates/internal/Magento Module Email Templates Xml.xml.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- | ||
/* | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<html> | ||
<body> | ||
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse"> | ||
<tr> | ||
<td> | ||
<font face="verdana" size="-1">Email templates configurations.</font> | ||
</td> | ||
</tr> | ||
</table> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/com/magento/idea/magento2plugin/actions/generation/NewEmailTemplateAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
package com.magento.idea.magento2plugin.actions.generation; | ||
|
||
import com.intellij.ide.IdeView; | ||
import com.intellij.openapi.actionSystem.AnAction; | ||
import com.intellij.openapi.actionSystem.AnActionEvent; | ||
import com.intellij.openapi.actionSystem.CommonDataKeys; | ||
import com.intellij.openapi.actionSystem.DataContext; | ||
import com.intellij.openapi.actionSystem.LangDataKeys; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.psi.PsiDirectory; | ||
import com.magento.idea.magento2plugin.MagentoIcons; | ||
import com.magento.idea.magento2plugin.actions.generation.dialog.NewEmailTemplateDialog; | ||
|
||
@SuppressWarnings({"PMD.OnlyOneReturn", "PMD.FieldNamingConventions"}) | ||
public class NewEmailTemplateAction extends AnAction { | ||
public static final String ACTION_NAME = "Magento 2 Email Template"; | ||
public static final String ACTION_DESCRIPTION = "Create a new Magento 2 email template"; | ||
|
||
/** | ||
* New email template action constructor. | ||
*/ | ||
public NewEmailTemplateAction() { | ||
super(ACTION_NAME, ACTION_DESCRIPTION, MagentoIcons.MODULE); | ||
} | ||
|
||
@Override | ||
public void actionPerformed(final AnActionEvent event) { | ||
final DataContext dataContext = event.getDataContext(); | ||
final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext); | ||
|
||
if (view == null) { | ||
return; | ||
} | ||
|
||
final Project project = CommonDataKeys.PROJECT.getData(dataContext); | ||
if (project == null) { | ||
return; | ||
} | ||
|
||
final PsiDirectory directory = view.getOrChooseDirectory(); | ||
if (directory == null) { | ||
return; | ||
} | ||
|
||
NewEmailTemplateDialog.open(project, directory); | ||
} | ||
|
||
@Override | ||
public boolean isDumbAware() { | ||
return false; | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
src/com/magento/idea/magento2plugin/actions/generation/data/EmailTemplateHtmlData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
package com.magento.idea.magento2plugin.actions.generation.data; | ||
|
||
@SuppressWarnings({"PMD.DataClass"}) | ||
public class EmailTemplateHtmlData { | ||
private final String module; | ||
private final String fileName; | ||
private final String area; | ||
private final String subject; | ||
private final String type; | ||
|
||
/** | ||
* Email template HTML data constructor. | ||
* | ||
* @param module String | ||
* @param area String | ||
* @param subject String | ||
* @param type String | ||
*/ | ||
public EmailTemplateHtmlData( | ||
final String module, | ||
final String fileName, | ||
final String area, | ||
final String subject, | ||
final String type | ||
) { | ||
this.module = module; | ||
this.fileName = fileName; | ||
this.area = area; | ||
this.subject = subject; | ||
this.type = type; | ||
} | ||
|
||
/** | ||
* Get module name. | ||
* | ||
* @return String | ||
*/ | ||
public String getModule() { | ||
return module; | ||
} | ||
|
||
/** | ||
* Get file name. | ||
* | ||
* @return String | ||
*/ | ||
public String getFileName() { | ||
return fileName; | ||
} | ||
|
||
/** | ||
* Get area. | ||
* | ||
* @return String | ||
*/ | ||
public String getArea() { | ||
return area; | ||
} | ||
|
||
/** | ||
* Get subject. | ||
* | ||
* @return String | ||
*/ | ||
public String getSubject() { | ||
return subject; | ||
} | ||
|
||
/** | ||
* Get type. | ||
* | ||
* @return String | ||
*/ | ||
public String getType() { | ||
return type; | ||
} | ||
} |
96 changes: 96 additions & 0 deletions
96
src/com/magento/idea/magento2plugin/actions/generation/data/EmailTemplatesXmlData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
package com.magento.idea.magento2plugin.actions.generation.data; | ||
|
||
@SuppressWarnings({"PMD.DataClass"}) | ||
public class EmailTemplatesXmlData { | ||
private final String module; | ||
private final String emailTemplateId; | ||
private final String label; | ||
private final String templateFileName; | ||
private final String type; | ||
private final String area; | ||
|
||
/** | ||
* Email templates data constructor. | ||
* | ||
* @param module String | ||
* @param emailTemplateId String | ||
* @param label String | ||
* @param templateFileName String | ||
* @param type String | ||
* @param area String | ||
*/ | ||
public EmailTemplatesXmlData( | ||
final String module, | ||
final String emailTemplateId, | ||
final String label, | ||
final String templateFileName, | ||
final String type, | ||
final String area | ||
) { | ||
this.module = module; | ||
this.emailTemplateId = emailTemplateId; | ||
this.label = label; | ||
this.templateFileName = templateFileName; | ||
this.type = type; | ||
this.area = area; | ||
} | ||
|
||
/** | ||
* Get template file name. | ||
* | ||
* @return String | ||
*/ | ||
public String getTemplateFileName() { | ||
return templateFileName; | ||
} | ||
|
||
/** | ||
* Get ID. | ||
* | ||
* @return String | ||
*/ | ||
public String getId() { | ||
return emailTemplateId; | ||
} | ||
|
||
/** | ||
* Get label. | ||
* | ||
* @return String | ||
*/ | ||
public String getLabel() { | ||
return label; | ||
} | ||
|
||
/** | ||
* Get module. | ||
* | ||
* @return String | ||
*/ | ||
public String getModule() { | ||
return module; | ||
} | ||
|
||
/** | ||
* Get type. | ||
* | ||
* @return String | ||
*/ | ||
public String getType() { | ||
return type; | ||
} | ||
|
||
/** | ||
* Get area. | ||
* | ||
* @return String | ||
*/ | ||
public String getArea() { | ||
return area; | ||
} | ||
} |
Oops, something went wrong.