Skip to content

Commit

Permalink
fixed broken test with locales
Browse files Browse the repository at this point in the history
  • Loading branch information
posabsolute committed May 24, 2015
1 parent 98768a7 commit 0fd6ba4
Show file tree
Hide file tree
Showing 22 changed files with 154 additions and 40 deletions.
8 changes: 4 additions & 4 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = function(grunt) {
configureEnvironment : function(env){
var self = this;
env.addFilter('trans', function(str, obj) {
var lang = self.options.lang || 'en_US';
var lang = self.options().lang || 'en_US';
var locale = YAML.load('locales/'+lang+'.yml');

var string = locale[str],
Expand Down Expand Up @@ -162,13 +162,13 @@ module.exports = function(grunt) {
nunjucks[lang] = {
options:{
lang:lang,
paths : "src"
paths : "src/templates"
},
files: [
{
expand: true,
cwd: "src",
src: ["templates/**/*.html","!templates/**/_*.html"],
cwd: "src/templates",
src: ["**/*.html","!**/_*.html"],
dest: "dist/templates/"+lang+"/",
ext: ".html"
}
Expand Down
8 changes: 4 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ Inker as an html component stucture that uses nunjucks macros. Example of compon
```

```html
// Import the component in the base.html file in html-components folder.
{% from "/html-components/component.button.html" import button %}
// Import the component in the base.html file in components folder.
{% from "/components/component.button.html" import button %}
```


Expand All @@ -113,7 +113,7 @@ Usage in html template :
{{ button('Go to google', 'http://www.google.com', 'button-green', 'left'); }}
```

**When creating new components, remember to add them to the base.html file situated in _src/html-components_**
**When creating new components, remember to add them to the base.html file situated in _src/components_**


### Creating new html templates
Expand All @@ -123,7 +123,7 @@ Open the template's folder, you should see a folder sidebar_hero, add your own f
#### Example of base template

```html
{% extends "/html-components/base.html" %}
{% extends "/components/_base.html" %}
{% block main_css %}
<link href="../../css/main.css" media="all" rel="stylesheet" type="text/css" />
{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
{% block main_css %}<link href="/css/main.css" media="all" rel="stylesheet" type="text/css" />{% endblock %}
{% block responsive_css %}<link href="/css/responsive.css" media="all" data-ignore="ignore" rel="stylesheet" type="text/css" />{% endblock %}
{% block theme_css %}{% endblock %}
{% from "html-components/_component.button.html" import button %}
{% from "html-components/_component.caption.html" import caption %}
{% from "html-components/_component.progressbar.html" import progressbar %}
{% from "html-components/_component.video.html" import video %}
{% from "html-components/_component.panel.html" import panel %}
{% from "html-components/_component.alertHeader.html" import alertHeader %}
{% from "components/_component.button.html" import button %}
{% from "components/_component.caption.html" import caption %}
{% from "components/_component.progressbar.html" import progressbar %}
{% from "components/_component.video.html" import video %}
{% from "components/_component.panel.html" import panel %}
{% from "components/_component.alertHeader.html" import alertHeader %}
</head>
<body>
<table class="body">
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
66 changes: 66 additions & 0 deletions src/templates/data_example/_content.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<table class="container">
<tr>
<td>

{% block header %} {% include "data_example/_header.html" %} {% endblock %}

<table class="row account-information">
<tr>
<td class="wrapper">

<table class="six columns">
<tr>
<td class="left-text-pad steps">

<p>1. Account Activation Complete</p>
<p>2. Update Account Info</p>
<p>3. Account set up complete!</p>
</td>
<td class="expander"></td>
</tr>
</table>
</td>
<td class="wrapper last">
<table class="six columns">
<tr>
<td class="left-text-pad">

<h4>{{ '{{ name }}' }} last step and you're done!</h4>

<p>
{{ '{% for item in loop %}' }}
{{ '{{ item }}' }} &nbsp;
{{ '{% endfor %}' }}
</p>
<p>We need you to update your account information. If there is ever a problem with your account, this information will make it easier for you to log back in.</p>
<p>{{ 'test_string' | trans }}</p>

</td>
<td class="expander"></td>
</tr>
</table>

</td>
</tr>
</table>

<table class="row update-button-ctn">
<tr>
<td class="wrapper last">
<table class="twelve columns">
<tr>
<td align="center">
{{ button('Update Account', '#', 'orange-button button-update', 'center') }}
</td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>

{% block footer %} {% include "data_example/_footer.html" %} {% endblock %}

</td>
</tr>
</table>
16 changes: 16 additions & 0 deletions src/templates/data_example/_footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<table class="row footer">
<tr>
<td class="wrapper last">
<table class="twelve columns">
<tr>
<td align="center" class="content">
<center>
<p style="text-align:center;"><a href="#">Terms</a> | <a href="#">Privacy</a> | <a href="#">Unsubscribe</a></p>
</center>
</td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>
26 changes: 26 additions & 0 deletions src/templates/data_example/_header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<table class="row header">
<tr>
<td class="wrapper last">

<table class="twelve columns">
<tbody><tr>
<td align="center" class="logo">
<a href="#"><img width="311" height="83" align="center" src="https://www.filepicker.io/api/file/HotdLrI8SCq4ZW3NRAUh" alt="company logo" ></a>
</td>
<tr>
<td style="background-color:#3bcdb0;" bgcolor="#3bcdb0" align="center" class="content">
<h2>You're almost finished!</h2>
<h3>Two out of three steps are completed.</h3>
</td>
</tr>
<tr>
<td align="center" class="content">
<a href="#"><img src="https://www.filepicker.io/api/file/4BgENLefRVCrgMGTAENj" style="max-width:100%;"></a>
</td>
<tr>
<td class="expander"></td>
</tr>
</tbody></table>
</td>
</tr>
</table>
13 changes: 13 additions & 0 deletions src/templates/data_example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends "components/_base.html" %}
{% block main_css %}<link href="../../../css/main.css" media="all" rel="stylesheet" type="text/css" />{% endblock %}
{% block theme_css %}<link href="../../../css/sunday/sunday.css" media="all" rel="stylesheet" type="text/css" />{% endblock %}

{% block responsive_css %}<link href="../../../css/responsive.css" media="all" data-ignore="ignore" rel="stylesheet" type="text/css" />{% endblock %}

{% block meta_title %}Sunday{% endblock %}

{% block mainContent %}

{% block content %} {% include "data_example/_content.html" %} {% endblock %}

{% endblock %}
2 changes: 1 addition & 1 deletion src/templates/sidebar_hero/_content.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h1>Hi, {{ name }}</h1>
</tr>
</tbody></table>

{% block content %} {% include "templates/sidebar_hero/_footer.html" %} {% endblock %}
{% block content %} {% include "sidebar_hero/_footer.html" %} {% endblock %}
<!-- container end below -->
</td>
</tr>
Expand Down
6 changes: 3 additions & 3 deletions src/templates/sidebar_hero/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "html-components/base.html" %}
{% extends "components/_base.html" %}
{% block main_css %}<link href="../../../css/main.css" media="all" rel="stylesheet" type="text/css" />{% endblock %}
{% block theme_css %}<link href="../../../css/sidebarhero/sidebarhero.css" media="all" rel="stylesheet" type="text/css" />{% endblock %}

Expand All @@ -8,7 +8,7 @@

{% block mainContent %}

{% block header %} {% include "templates/sidebar_hero/_header.html" %} {% endblock %}
{% block content %} {% include "templates/sidebar_hero/_content.html" %} {% endblock %}
{% block header %} {% include "sidebar_hero/_header.html" %} {% endblock %}
{% block content %} {% include "sidebar_hero/_content.html" %} {% endblock %}

{% endblock %}
8 changes: 4 additions & 4 deletions src/templates/transactional/_base-messages.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "html-components/base.html" %}
{% extends "components/_base.html" %}
{% block main_css %}<link href="../../../../css/main.css" media="all" rel="stylesheet" type="text/css" />{% endblock %}
{% block theme_css %}<link href="../../../../css/transactional/transactional.css" media="all" rel="stylesheet" type="text/css" />{% endblock %}

Expand All @@ -9,7 +9,7 @@
{% block mainContent %}

{% block header %}
{% include "templates/transactional/base/_header.html" %}
{% include "transactional/base/_header.html" %}
{% endblock %}

<table class="row ">
Expand All @@ -33,7 +33,7 @@
<td class="content-wrap">

{% block content %}
{% include "templates/transactional/base/_content.html" %}
{% include "transactional/base/_content.html" %}
{% endblock %}

</td>
Expand All @@ -45,7 +45,7 @@
</table>

{% block footer %}
{% include "templates/transactional/base/_footer.html" %}
{% include "transactional/base/_footer.html" %}
{% endblock %}

</td>
Expand Down
4 changes: 2 additions & 2 deletions src/templates/transactional/account_activation.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "html-components/base.html" %}
{% extends "components/_base.html" %}
{% block main_css %}<link href="../../../../css/main.css" media="all" rel="stylesheet" type="text/css" />{% endblock %}
{% block theme_css %}<link href="../../../../css/sunday/sunday.css" media="all" rel="stylesheet" type="text/css" />{% endblock %}

Expand All @@ -8,6 +8,6 @@

{% block mainContent %}

{% block content %} {% include "templates/transactional/account_activation/_content.html" %} {% endblock %}
{% block content %} {% include "transactional/account_activation/_content.html" %} {% endblock %}

{% endblock %}
4 changes: 2 additions & 2 deletions src/templates/transactional/account_activation/_content.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<tr>
<td>

{% block header %} {% include "templates/transactional/account_activation/_header.html" %} {% endblock %}
{% block header %} {% include "transactional/account_activation/_header.html" %} {% endblock %}

<table class="row account-information">
<tr>
Expand Down Expand Up @@ -58,7 +58,7 @@ <h4>{{ '{{ name }}' }} last step and you're done!</h4>
</tr>
</table>

{% block footer %} {% include "templates/transactional/account_activation/_footer.html" %} {% endblock %}
{% block footer %} {% include "transactional/account_activation/_footer.html" %} {% endblock %}

</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/transactional/action.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "templates/transactional/_base-messages.html" %}
{% extends "transactional/_base-messages.html" %}
{% block meta_title %}Action Email{% endblock %}
{% block tableClass %}{% endblock %}
{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion src/templates/transactional/alert.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "templates/transactional/_base-messages.html" %}
{% extends "transactional/_base-messages.html" %}
{% block meta_title %}Alert{% endblock %}

{% block alert %}
Expand Down
2 changes: 1 addition & 1 deletion src/templates/transactional/receipt.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "templates/transactional/_base-messages.html" %}
{% extends "transactional/_base-messages.html" %}
{% block meta_title %}Receipt{% endblock %}
{% block tableClass %}{% endblock %}

Expand Down
15 changes: 4 additions & 11 deletions tests/logs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ describe('Logs services', function() {
.post('/emails')
.set('x-authorization-token', configs.authToken)
.send(data)

.end(function(err, res){
logger.should.have.returned({
loggers: [ 'hipchat', 'logentries' ],
message: '"template not found: en_US/data_examples/index.html"'
});
console.log(logger + "ALERT");
logger.returned({message: 'template not found: en_US/data_examples/index.html'});
done();
});
});
Expand All @@ -51,12 +48,8 @@ describe('Logs services', function() {
.send(data)

.end(function(err, res){
logger.should.have.returned({
loggers: [ 'hipchat', 'logentries' ],
message: '{"code":"EAUTH","response":"535 5.7.0 Mailgun is not loving your login or password","responseCode":535}'
});

done();
logger.returned({message: '{"code":"EAUTH","response":"535 5.7.0 Mailgun is not loving your login or password","responseCode":535}'});
done();
});
});
});

0 comments on commit 0fd6ba4

Please sign in to comment.