sass now compiles, cleanup unused files, hooked in sign up form to post to gocardless
This commit is contained in:
parent
691bd1a9d9
commit
6fec0e64bd
48
.drone.yml
48
.drone.yml
|
@ -1,34 +1,38 @@
|
||||||
pipeline:
|
pipeline:
|
||||||
docker:
|
docker:
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
repo: maidstonehackspace_tests
|
#repo: maidstonehackspacewebsite_django
|
||||||
dockerfile: ./compose/django/Dockerfile-dev
|
dockerfile: ./compose/django/Dockerfile-dev
|
||||||
#image: maidstonehackspacewebsite_django
|
# tags: latest
|
||||||
|
|
||||||
|
tests:
|
||||||
|
image: maidstonehackspacewebsite_django
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=mhackspace
|
- POSTGRES_USER=mhackspace
|
||||||
- USE_DOCKER=yes
|
- USE_DOCKER=yes
|
||||||
- DJANGO_SETTINGS_MODULE=config.settings.test
|
- DJANGO_SETTINGS_MODULE=config.settings.test
|
||||||
# commands:
|
commands:
|
||||||
# - cp -n env.example .env
|
- cp -n env.example .env
|
||||||
# - pip install -r /requirements/test.txt
|
- pip install -r /requirements/test.txt
|
||||||
# - python manage.py test mhackspace --verbosity 2
|
- python manage.py test mhackspace --verbosity 2
|
||||||
|
|
||||||
|
|
||||||
#volumes:
|
#volumes:
|
||||||
# postgres_data_dev: {}
|
# postgres_data_dev: {}
|
||||||
# postgres_backup_dev: {}
|
# postgres_backup_dev: {}
|
||||||
|
|
||||||
services:
|
#services:
|
||||||
postgres:
|
# postgres:
|
||||||
dockerfile: ./compose/postgres
|
# build: ./compose/postgres
|
||||||
# build:
|
# build:
|
||||||
# context: .
|
# context: .
|
||||||
# dockerfile: ./compose/django/Dockerfile
|
# dockerfile: ./compose/django/Dockerfile
|
||||||
# volumes:
|
# volumes:
|
||||||
# - postgres_data_dev:/var/lib/postgresql/data
|
# - postgres_data_dev:/var/lib/postgresql/data
|
||||||
# - postgres_backup_dev:/backups
|
# - postgres_backup_dev:/backups
|
||||||
environment:
|
# environment:
|
||||||
- POSTGRES_USER=mhackspace
|
# - POSTGRES_USER=mhackspace
|
||||||
|
|
||||||
# django:
|
# django:
|
||||||
# build:
|
# build:
|
||||||
|
@ -59,14 +63,14 @@ services:
|
||||||
# - config/file
|
# - config/file
|
||||||
# cmd: /opt/bin/redeploy.sh
|
# cmd: /opt/bin/redeploy.sh
|
||||||
|
|
||||||
deploy:
|
#deploy:
|
||||||
ssh:
|
# ssh:
|
||||||
host: maidstone-hackspace-stage
|
# host: maidstone-hackspace-stage
|
||||||
port: 22
|
# port: 22
|
||||||
commands:
|
# commands:
|
||||||
- cd /var/www/stage/maidstone-hackspace-website/
|
# - cd /var/www/stage/maidstone-hackspace-website/
|
||||||
- docker-compose -fstage.yml build
|
# - docker-compose -fstage.yml build
|
||||||
- docker-compose -fstage.yml down --remove-orphans
|
# - docker-compose -fstage.yml down --remove-orphans
|
||||||
- docker-compose -fstage.yml up
|
# - docker-compose -fstage.yml up
|
||||||
when:
|
# when:
|
||||||
branch: master
|
# branch: master
|
||||||
|
|
|
@ -192,7 +192,6 @@ STATICFILES_FINDERS = (
|
||||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||||
'sass_processor.finders.CssFinder',
|
'sass_processor.finders.CssFinder',
|
||||||
)
|
)
|
||||||
SASS_PROCESSOR_AUTO_INCLUDE = True
|
|
||||||
# MEDIA CONFIGURATION
|
# MEDIA CONFIGURATION
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-root
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-root
|
||||||
|
@ -294,3 +293,12 @@ PAYMENT_PROVIDERS = {
|
||||||
|
|
||||||
SASS_PRECISION = 8
|
SASS_PRECISION = 8
|
||||||
|
|
||||||
|
|
||||||
|
SASS_PROCESSOR_INCLUDE_DIRS = [
|
||||||
|
# str(ROOT_DIR),
|
||||||
|
str(APPS_DIR) + '/static/sass',
|
||||||
|
str(ROOT_DIR) + '/node_modules',
|
||||||
|
]
|
||||||
|
print(SASS_PROCESSOR_INCLUDE_DIRS)
|
||||||
|
SASS_PROCESSOR_ENABLED = True
|
||||||
|
SASS_PROCESSOR_AUTO_INCLUDE = True
|
||||||
|
|
|
@ -90,4 +90,3 @@ CAPTCHA = {
|
||||||
'site': ''
|
'site': ''
|
||||||
}
|
}
|
||||||
|
|
||||||
SASS_PROCESSOR_AUTO_INCLUDE = False
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ from django.views.generic import TemplateView
|
||||||
from django.views import defaults as default_views
|
from django.views import defaults as default_views
|
||||||
from mhackspace.contact.views import contact
|
from mhackspace.contact.views import contact
|
||||||
from mhackspace.members.views import MemberListView
|
from mhackspace.members.views import MemberListView
|
||||||
|
from mhackspace.subscriptions.views import MembershipJoinView
|
||||||
from mhackspace.base.feeds import LatestEntriesFeed
|
from mhackspace.base.feeds import LatestEntriesFeed
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
@ -32,6 +33,7 @@ urlpatterns = [
|
||||||
# Your stuff: custom urls includes go here
|
# Your stuff: custom urls includes go here
|
||||||
url(r'^latest/$', LatestEntriesFeed()),
|
url(r'^latest/$', LatestEntriesFeed()),
|
||||||
|
|
||||||
|
url(r'membership/join/$', MembershipJoinView.as_view(), name='join_hackspace'),
|
||||||
|
|
||||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|
||||||
|
|
5
dev.yml
5
dev.yml
|
@ -36,5 +36,10 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- "8125:8025"
|
- "8125:8025"
|
||||||
|
|
||||||
|
node:
|
||||||
|
image: node:7-onbuild
|
||||||
|
command: npm install
|
||||||
|
volumes:
|
||||||
|
- ./:/usr/src/app
|
||||||
redis:
|
redis:
|
||||||
image: redis:latest
|
image: redis:latest
|
||||||
|
|
108
gulpfile.js
108
gulpfile.js
|
@ -1,108 +0,0 @@
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
//Setup//
|
|
||||||
////////////////////////////////
|
|
||||||
|
|
||||||
// Plugins
|
|
||||||
var gulp = require('gulp'),
|
|
||||||
pjson = require('./package.json'),
|
|
||||||
gutil = require('gulp-util'),
|
|
||||||
sass = require('gulp-sass'),
|
|
||||||
autoprefixer = require('gulp-autoprefixer'),
|
|
||||||
cssnano = require('gulp-cssnano'),
|
|
||||||
rename = require('gulp-rename'),
|
|
||||||
del = require('del'),
|
|
||||||
plumber = require('gulp-plumber'),
|
|
||||||
pixrem = require('gulp-pixrem'),
|
|
||||||
uglify = require('gulp-uglify'),
|
|
||||||
imagemin = require('gulp-imagemin'),
|
|
||||||
exec = require('child_process').exec,
|
|
||||||
runSequence = require('run-sequence'),
|
|
||||||
browserSync = require('browser-sync').create(),
|
|
||||||
reload = browserSync.reload;
|
|
||||||
|
|
||||||
|
|
||||||
// Relative paths function
|
|
||||||
var pathsConfig = function (appName) {
|
|
||||||
this.app = "./" + (appName || pjson.name);
|
|
||||||
|
|
||||||
return {
|
|
||||||
app: this.app,
|
|
||||||
templates: this.app + '/templates',
|
|
||||||
css: this.app + '/static/css',
|
|
||||||
sass: this.app + '/static/sass',
|
|
||||||
fonts: this.app + '/static/fonts',
|
|
||||||
images: this.app + '/static/images',
|
|
||||||
js: this.app + '/static/js',
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var paths = pathsConfig();
|
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
//Tasks//
|
|
||||||
////////////////////////////////
|
|
||||||
|
|
||||||
// Styles autoprefixing and minification
|
|
||||||
gulp.task('styles', function() {
|
|
||||||
return gulp.src(paths.sass + '/project.scss')
|
|
||||||
.pipe(sass().on('error', sass.logError))
|
|
||||||
.pipe(plumber()) // Checks for errors
|
|
||||||
.pipe(autoprefixer({browsers: ['last 2 version']})) // Adds vendor prefixes
|
|
||||||
.pipe(pixrem()) // add fallbacks for rem units
|
|
||||||
.pipe(gulp.dest(paths.css))
|
|
||||||
.pipe(rename({ suffix: '.min' }))
|
|
||||||
.pipe(cssnano()) // Minifies the result
|
|
||||||
.pipe(gulp.dest(paths.css));
|
|
||||||
});
|
|
||||||
|
|
||||||
// Javascript minification
|
|
||||||
gulp.task('scripts', function() {
|
|
||||||
return gulp.src(paths.js + '/project.js')
|
|
||||||
.pipe(plumber()) // Checks for errors
|
|
||||||
.pipe(uglify()) // Minifies the js
|
|
||||||
.pipe(rename({ suffix: '.min' }))
|
|
||||||
.pipe(gulp.dest(paths.js));
|
|
||||||
});
|
|
||||||
|
|
||||||
// Image compression
|
|
||||||
gulp.task('imgCompression', function(){
|
|
||||||
return gulp.src(paths.images + '/*')
|
|
||||||
.pipe(imagemin()) // Compresses PNG, JPEG, GIF and SVG images
|
|
||||||
.pipe(gulp.dest(paths.images))
|
|
||||||
});
|
|
||||||
|
|
||||||
// Run django server
|
|
||||||
gulp.task('runServer', function() {
|
|
||||||
exec('python manage.py runserver', function (err, stdout, stderr) {
|
|
||||||
console.log(stdout);
|
|
||||||
console.log(stderr);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Browser sync server for live reload
|
|
||||||
gulp.task('browserSync', function() {
|
|
||||||
browserSync.init(
|
|
||||||
[paths.css + "/*.css", paths.js + "*.js", paths.templates + '*.html'], {
|
|
||||||
proxy: "localhost:8000"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Default task
|
|
||||||
gulp.task('default', function() {
|
|
||||||
runSequence(['styles', 'scripts', 'imgCompression'], 'runServer', 'browserSync');
|
|
||||||
});
|
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
//Watch//
|
|
||||||
////////////////////////////////
|
|
||||||
|
|
||||||
// Watch
|
|
||||||
gulp.task('watch', ['default'], function() {
|
|
||||||
|
|
||||||
gulp.watch(paths.sass + '/*.scss', ['styles']);
|
|
||||||
gulp.watch(paths.js + '/*.js', ['scripts']).on("change", reload);
|
|
||||||
gulp.watch(paths.images + '/*', ['imgCompression']);
|
|
||||||
gulp.watch(paths.templates + '/**/*.html').on("change", reload);
|
|
||||||
|
|
||||||
});
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,49 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals, absolute_import
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.contrib.auth.models import AbstractUser
|
||||||
|
from django.core.urlresolvers import reverse
|
||||||
|
from django.db import models
|
||||||
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from django.shortcuts import redirect
|
||||||
|
|
||||||
|
from django.views.generic import UpdateView
|
||||||
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
|
|
||||||
|
from mhackspace.users.models import User
|
||||||
|
from mhackspace.users.forms import MembershipJoinForm
|
||||||
|
from mhackspace.subscriptions.payments import select_provider
|
||||||
|
|
||||||
|
class MembershipJoinView(LoginRequiredMixin, UpdateView):
|
||||||
|
model = User
|
||||||
|
fields = []
|
||||||
|
|
||||||
|
def get_object(self):
|
||||||
|
# Only get the User record for the user making the request
|
||||||
|
return User.objects.get(username=self.request.user.username)
|
||||||
|
|
||||||
|
def get_object(self):
|
||||||
|
# Only get the User record for the user making the request
|
||||||
|
return User.objects.get(username=self.request.user.username)
|
||||||
|
|
||||||
|
def form_valid(self, form):
|
||||||
|
app_domain = 'http://test.maidstone-hackspace.org.uk'
|
||||||
|
payment_provider = 'gocardless'
|
||||||
|
provider = select_provider(payment_provider)
|
||||||
|
user_code = str(self.request.user.id).zfill(5)
|
||||||
|
|
||||||
|
form_subscription = MembershipJoinForm(data=self.request.POST)
|
||||||
|
form_subscription.is_valid()
|
||||||
|
|
||||||
|
success_url = '%s/profile/membership/%s/success' % (app_domain, payment_provider)
|
||||||
|
failure_url = '%s/profile/membership/%s/failure' % (app_domain, payment_provider)
|
||||||
|
url = provider.create_subscription(
|
||||||
|
amount=form_subscription.cleaned_data.get('amount', 20.00),
|
||||||
|
name="Membership your membership id is MH%s" % user_code,
|
||||||
|
redirect_success=success_url,
|
||||||
|
redirect_failure=failure_url
|
||||||
|
)
|
||||||
|
|
||||||
|
return redirect(url)
|
|
@ -31,7 +31,7 @@
|
||||||
<!-- Your stuff: Third-party CSS libraries go here -->
|
<!-- Your stuff: Third-party CSS libraries go here -->
|
||||||
{# { compress css }#}
|
{# { compress css }#}
|
||||||
<!-- This file stores project-specific CSS -->
|
<!-- This file stores project-specific CSS -->
|
||||||
<link href="{% sass_src 'css/project.css' %}" rel="stylesheet">
|
<link href="{% sass_src 'sass/project.scss' %}" rel="stylesheet">
|
||||||
{# { endcompress }#}
|
{# { endcompress }#}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="middle">
|
<div class="middle">
|
||||||
|
|
||||||
<form method="POST" action="{% url 'contact' %}" class="contact_us_form">
|
<form method="POST" action="{% url 'join_hackspace' %}" class="contact_us_form">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ membership_form|crispy }}
|
{{ membership_form|crispy }}
|
||||||
<button class="btn btn-primary" type="submit" name="action">{% trans "Send" %}</button>
|
<button class="btn btn-primary" type="submit" name="action">{% trans "Send" %}</button>
|
||||||
|
|
18
package.json
18
package.json
|
@ -3,23 +3,5 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bootstrap": "^4.0.0-alpha.6"
|
"bootstrap": "^4.0.0-alpha.6"
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"browser-sync": "^2.14.0",
|
|
||||||
"del": "^2.2.2",
|
|
||||||
"gulp": "^3.9.1",
|
|
||||||
"gulp-autoprefixer": "^3.1.1",
|
|
||||||
"gulp-cssnano": "^2.1.2",
|
|
||||||
"gulp-imagemin": "^3.0.3",
|
|
||||||
"gulp-pixrem": "^1.0.0",
|
|
||||||
"gulp-plumber": "^1.1.0",
|
|
||||||
"gulp-rename": "^1.2.2",
|
|
||||||
"gulp-sass": "^2.3.2",
|
|
||||||
"gulp-uglify": "^2.0.0",
|
|
||||||
"gulp-util": "^3.0.7",
|
|
||||||
"run-sequence": "^1.2.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.8.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue