Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from Wtower/v0-1-7
Browse files Browse the repository at this point in the history
Version 0.1.7
  • Loading branch information
Wtower committed Jan 23, 2017
2 parents 47aa7c8 + 5bc021d commit 7248bfa
Show file tree
Hide file tree
Showing 17 changed files with 158 additions and 21 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@ generator-django-ana

[![NPM version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Dependency Status][daviddm-image]][daviddm-url]
[![Coverage percentage][coveralls-image]][coveralls-url]
[![npm](https://img.shields.io/npm/dt/generator-django-ana.svg?maxAge=2592000)](https://www.npmjs.com/package/generator-django-ana)

[npm-image]: https://badge.fury.io/js/generator-django-ana.svg
[npm-url]: https://npmjs.org/package/generator-django-ana
[travis-image]: https://travis-ci.org/Wtower/generator-django-ana.svg?branch=master
[travis-url]: https://travis-ci.org/Wtower/generator-django-ana
[daviddm-image]: https://david-dm.org/Wtower/generator-django-ana.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/Wtower/generator-django-ana
[coveralls-image]: https://coveralls.io/repos/Wtower/generator-django-ana/badge.svg
[coveralls-url]: https://coveralls.io/r/Wtower/generator-django-ana

Expand Down
4 changes: 2 additions & 2 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ module.exports = yeoman.Base.extend({
'_name_/',
'_name__core/',
'private/',
'templates/',
'_editorconfig',
'_gitignore',
'_venv',
'CONTRIBUTING.md',
'CONTRIBUTING.rst',
'gulpfile.js',
'LICENSE',
'manage.py',
Expand All @@ -113,7 +114,6 @@ module.exports = yeoman.Base.extend({
var copyPaths = [
'media/',
'static/',
'templates/',
'CHANGELOG',
'requirements.txt'
];
Expand Down
23 changes: 16 additions & 7 deletions generators/app/templates/_name_/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import os
from django.contrib import messages

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand Down Expand Up @@ -34,7 +35,8 @@
'django.contrib.staticfiles',
'<%= name %>_core',
'debug_toolbar',
'rest_framework',
'envelope',
# 'rest_framework',
# 'mptt',
# 'guardian',
# 'ninecms',
Expand Down Expand Up @@ -171,6 +173,10 @@

DEFAULT_FROM_EMAIL = 'do-not-reply@9-dev.com'

ENVELOPE_EMAIL_RECIPIENTS = ('web@9-dev.com', )

ENVELOPE_SUBJECT_INTRO = EMAIL_SUBJECT_PREFIX


# Security

Expand Down Expand Up @@ -219,13 +225,16 @@

# DAB_FIELD_RENDERER = 'django_admin_bootstrapped.renderers.BootstrapFieldRenderer'

# from django.contrib import messages

# MESSAGE_TAGS = {
# messages.SUCCESS: 'alert-success success',
# messages.WARNING: 'alert-warning warning',
# messages.ERROR: 'alert-danger error'
# }
# Messages

MESSAGE_TAGS = {
messages.DEBUG: 'primary',
messages.INFO: 'info',
messages.SUCCESS: 'success',
messages.WARNING: 'warning',
messages.ERROR: 'danger',
}


# CMS settings
Expand Down
1 change: 1 addition & 0 deletions generators/app/templates/_name_/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
urlpatterns = [
# url(r'^admin/', include(admin.site.urls)),
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^', include('<%= name %>_core.urls', namespace='front')),
# url(r'^robots\.txt/$', TemplateView.as_view(template_name='ninecms/robots.txt', content_type='text/plain')),
]

Expand Down
11 changes: 11 additions & 0 deletions generators/app/templates/_name__core/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""
URL routing for core app
Generated by yeoman generator-django-ana <%= version %> on <%= date %>.
"""
from django.conf.urls import url
from <%= name %>_core import views

urlpatterns = [
url(r'^contact/', views.ContactView.as_view(), name='contact'),
url(r'^$', views.IndexView.as_view(), name='index'),
]
19 changes: 19 additions & 0 deletions generators/app/templates/_name__core/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
View handler definitions for core
Generated by yeoman generator-django-ana <%= version %> on <%= date %>.
"""
from django.views.generic.base import TemplateView
from braces.views import FormMessagesMixin
from envelope.views import ContactView as EnvelopeContactView


class IndexView(TemplateView):
template_name = '<%= name %>_core/index.html'

def get_context_data(self, **kwargs):
return {}


class ContactView(FormMessagesMixin, EnvelopeContactView):
form_valid_message = "Message sent."
form_invalid_message = "Please fill in all fields in the contact form."
17 changes: 14 additions & 3 deletions generators/app/templates/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ var paths = {
'private/javascripts/*.js',
'*.js'
],
base64: [],
inlineCss: {
html: 'private/html/email_body.html',
build: 'templates/envelope/'
},
fonts: 'private/',
build: 'static/',
images: '',
Expand Down Expand Up @@ -158,6 +163,8 @@ var tasks = {
clean_image_opts: function () { return taskMethods.clean_image_opts() },
fonts: function () { return taskMethods.fonts(paths); },
nsp: function () { return taskMethods.nsp(); },
base64: function () { return taskMethods.base64(paths); },
inlineCss: function () { return taskMethods.inlineCss(paths); },

adminAssets: function () { return taskMethods.assets(paths.admin); },
adminCss: function () { return taskMethods.css(paths.admin); },
Expand All @@ -183,6 +190,8 @@ gulp.task('clean_image_opts', req, tasks.clean_image_opts);
gulp.task('fonts', req, tasks.fonts);
gulp.task('nsp', tasks.nsp);
gulp.task('karma', tasks.karma);
gulp.task('base64', req.concat(['sass']), tasks.base64);
gulp.task('inlineCss', req.concat(['sass']), tasks.inlineCss);
gulp.task('adminAssets', req, tasks.adminAssets);
gulp.task('adminSass', req, tasks.adminSass);
gulp.task('adminCss', req.concat(['adminSass']), tasks.adminCss);
Expand All @@ -198,6 +207,7 @@ gulp.task('build', [
'concatJs',
'images',
'fonts',
'inlineCss',
'adminAssets',
'adminSass',
'adminCss',
Expand All @@ -214,14 +224,15 @@ gulp.task('test', [
// watch task
gulp.task('watch', ['build'], function () {
gulp.watch(paths.css, ['css']);
gulp.watch(paths.less, ['less', 'css']);
gulp.watch(paths.sass, ['sass', 'css']);
gulp.watch(paths.less, ['css']);
gulp.watch(paths.sass, ['css', 'inlineCss']);
gulp.watch(paths.js_watch, ['concatJs']);
gulp.watch(paths.admin.css, ['adminCss']);
gulp.watch(paths.admin.sass, ['adminSass', 'adminCss']);
gulp.watch(paths.admin.js_watch, ['adminConcatJs']);
gulp.watch(paths.admin.partials, ['adminConcatJs']);
gulp.watch(['./fonts.list'], ['fonts']);
gulp.watch(paths.inlineCss.html, ['inlineCss']);
gulp.watch([paths.fonts + './fonts.list'], ['fonts']);
gutil.log(gutil.colors.bgGreen('Watching for changes...'));
});

Expand Down
3 changes: 2 additions & 1 deletion generators/app/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"font-awesome": "^4.6.3",
"gentelella": "^1.3.0",
"jquery": "^2.2.4",
"ng-gentelella": "^0.1.0"
"ng-gentelella": "^0.1.0",
"responsive-html-email-template": "^1.0.0"
},
"devDependencies": {
"angular-mocks": "^1.5.7",
Expand Down
58 changes: 58 additions & 0 deletions generators/app/templates/private/html/email_body.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><%= verboseName %> contact form: {{ subject }}</title>
<link rel="stylesheet" href="../../static/css/email_body.css">
</head>
<body class="">
<table border="0" cellpadding="0" cellspacing="0" class="body">
<tr>
<td>&nbsp;</td>
<td class="container">
<div class="content">

<span class="preheader"><%= verboseName %> contact form: {{ subject }}</span>
<table class="main">

<tr>
<td class="wrapper">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<h1>{{ subject }}</h1>
<p><span class="sender">Sender:</span>
<a href="mailto:{{ email }}">{{ sender }} ({{ email }})</a></p>
<p>&nbsp;</p>
{{ message|linebreaks }}
</td>
</tr>
</table>
</td>
</tr>

</table>

<div class="footer">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="content-block powered-by">
<span class="apple-link">
<a href="http://<%= deployHost %>"><%= verboseName %></a> contact form</span>
</td>
</tr>
<tr>
<td class="content-block powered-by">
<!--Powered by <a href="http://9-dev.com">9dev</a>.-->
</td>
</tr>
</table>
</div>
</div>
</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>
21 changes: 21 additions & 0 deletions generators/app/templates/private/stylesheets/email_body.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@import ../../node_modules/responsive-html-email-template/src/email

/* -------------
* Custom styles
*--------------
h1, h2, h3, h4, h5, h6, p
padding-top: 10px
text-align: left

h1, h2, h3, h4, h5, h6
color: #e8bb48

h1
border-bottom: 1px solid

p
color: #2b2a33

.sender
font-weight: 700
padding-right: 10px
Empty file.
2 changes: 2 additions & 0 deletions generators/app/templates/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ coverage~=4.3.1
# django-admin-bootstrapped~=2.5.6
# django-admin-bootstrapped-plus>=0.1.1
# django-bootstrap3~=7.0.1
django-braces==1.10.0
django-debug-toolbar~=1.6.0
django-envelope==1.2
djangorestframework==3.5.3
mysqlclient~=1.3.7
newrelic~=2.78.0.57
Expand Down
2 changes: 0 additions & 2 deletions generators/app/templates/templates/README.rst

This file was deleted.

9 changes: 9 additions & 0 deletions generators/app/templates/templates/envelope/email_body.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{ subject }}
{% with subject|length as n %}{% with ''|center:n as range %}{% for _ in range %}={% endfor %}{% endwith %}{% endwith %}

Sender: {{ sender }} ({{ email }})

{{ message }}

--
<%= verboseName %> contact form
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-django-ana",
"version": "0.1.6",
"version": "0.1.7",
"description": "Generate Django boilerplate. Featuring REST, gulp build and ng-gentelella.",
"homepage": "https://github.com/Wtower/generator-django-ana.git",
"author": {
Expand Down
4 changes: 2 additions & 2 deletions test/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ describe('generator-django-ana:app', function () {
'yeotests/',
'yeotests_core/',
'private/',
'templates/',
'.editorconfig',
'.gitignore',
'.venv',
'CONTRIBUTING.md',
'CONTRIBUTING.rst',
'gulpfile.js',
'LICENSE',
'manage.py',
Expand All @@ -41,7 +42,6 @@ describe('generator-django-ana:app', function () {
];
var copyPaths = [
'media/',
'templates/',
'CHANGELOG',
'requirements.txt'
];
Expand Down

0 comments on commit 7248bfa

Please sign in to comment.