Commit eaa5b070 authored by Franz Geffke's avatar Franz Geffke 💬
Browse files

Merge branch 'master' into 'contributions'

update contributions from master

See merge request !12
parents c8471be4 c167211d
/* THIS IS A BIT-AUTO-GENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */
{
"franz.js/global/jekyll_formmixin@0.0.1": {
"files": [
{
"name": "form.js",
"relativePath": "form.js",
"test": false
}
],
"mainFile": "form.js",
"rootDir": "components/global/jekyll_formmixin",
"origin": "IMPORTED",
"originallySharedDir": "src/utils"
},
"version": "13.0.4"
}
\ No newline at end of file
......@@ -10,3 +10,4 @@ assets/css
assets/js
assets/uploads/images/thumbnail
assets/uploads/cover/preview
.idea/
\ No newline at end of file
image: starefossen/ruby-node:latest
image: franzos/ruby-node-gulp-java
cache:
paths:
......@@ -9,42 +9,25 @@ before_script:
stages:
- build
- test
- deploy
build:
stage: build
script:
- apt-get update
- apt-get install -y graphicsmagick
- npm install --global gulp-cli
- yarn
- gulp
- JEKYLL_ENV=production bundle exec jekyll build -d public/
artifacts:
when: on_success
paths:
- public
test:
type: test
script:
- echo "TESTING..."
expire_in: 1h
deploy:
stage: deploy
script:
- export AWS_ACCESS_KEY_ID="$(echo "$AWS_ACCESS_KEY_ID")"
- export AWS_SECRET_ACCESS_KEY="$(echo "$AWS_SECRET_ACCESS_KEY")"
- echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" >> /etc/apt/sources.list.d/java-8-debian.list
- echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" >> /etc/apt/sources.list.d/java-8-debian.list
- apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
- apt-get update
- echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
- apt-get install -y oracle-java8-installer
- apt-get install -y oracle-java8-set-default
- bundle exec s3_website push
artifacts:
paths:
- public
only:
- master
......@@ -79,6 +79,10 @@ exclude:
- gulpfile.js
- src
- README.md
- .idea
- bit.json
- .bitmap
- components
# Translation
# languages: ["en"]
......
......@@ -44,8 +44,8 @@
<div class="field-body">
<div class="field">
<p :class="{ 'control': true }">
<input v-validate="'required'" :class="{'input': true, 'is-danger': errors.has('name_first') }" name="name_first" type="text" placeholder="First name *">
<span v-show="errors.has('name_first')" class="help is-danger">Enter your first name</span>
<input v-validate="'required'" :class="{'input': true, 'is-danger': errors.has('name') }" name="name" v-model="name" type="text" placeholder="Name *">
<span v-show="errors.has('name')" class="help is-danger">Enter your first name</span>
</p>
</div>
</div>
......@@ -73,7 +73,8 @@
</section>
<footer class="modal-card-foot">
<button class="button" type="button" @click="isAdvisorActive = false">Close</button>
<button type="submit" class="button">{{ site.form.send[site.active_lang]}}</button>
<button v-if="!isWaiting" type="submit" class="button">{{ site.form.send[site.active_lang]}}</button>
<a v-if="isWaiting" class="button is-loading">Loading</a>
</footer>
</div>
</form>
......
......@@ -9,17 +9,6 @@
<button class="modal-close is-large" @click="hasError = false" aria-label="close"></button>
</div>
<div class="modal has-priority" v-bind:class="{ 'is-active': hasSuccess }" v-if="hasSuccess">
<div class="modal-background"></div>
<div class="modal-content">
<div class="notification is-success">
<button class="delete" @click="hasSuccess = false"></button>
Thank you, <% name_first %>! We will get back to you shortly. <a href="/">back to homepage</a>
</div>
</div>
<button class="modal-close is-large" @click="hasSuccess = false" aria-label="close"></button>
</div>
<div class="modal has-priority" v-bind:class="{ 'is-active': hasFailure }" v-if="hasFailure">
<div class="modal-background"></div>
<div class="modal-content">
......
......@@ -54,29 +54,6 @@ myLayer.setGeoJSON(geojson);
mapPopupsJS.scrollWheelZoom.disable();
</script>
{% endif %}
{% if page.url == "/contact/" %}
<script>
Vue.use(VeeValidate)
new Vue({
mixins: [formMixin],
el: '#contactUs',
data: {
member: false
}
})
</script>
{% endif %}
<script>
Vue.use(VeeValidate)
var navigation = new Vue({
mixins: [formMixin],
el: '#quicklinks',
data: {
isAdvisorActive: false,
member: false
},
});
</script>
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
......
{
"env": {},
"dependencies": {
"franz.js/global/jekyll_formmixin": "0.0.1"
},
"componentsDefaultDirectory": "components/{namespace}/{name}",
"packageManager": "npm"
}
\ No newline at end of file
Copyright (c) 2018 m@f-a.nz
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OROTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USEOR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
var formMixin = {
delimiters:['<%', '%>'],
data() {
return {
hasError: false,
hasSuccess: false,
hasFailure: false,
isWaiting: false,
name: null,
data: null
}
},
methods: {
onSubmit: function(event) {
let t = this;
t.$validator.validateAll().then((result) => {
if (result) {
t.isWaiting = true;
const formData = new FormData(this.$refs['form']);
const data = {};
for (let [key, val] of formData.entries()) {
Object.assign(data, { [key]: val })
}
axios.post(t.formAPI, data, {
headers: {
'Content-type': 'application/x-www-form-urlencoded',
}
})
.then(function (response) {
let nameEncoded = encodeURI(t.name);
let destination = t.formThankYou + '?name=' + nameEncoded;
window.location.replace(destination);
})
.catch(function (error) {
console.log("Failure!");
console.log(error);
t.data = data;
t.hasFailure = true
});
return;
}
t.hasError = true
});
},
}
};
{
"name": "@bit/franz.js.global.jekyll_formmixin",
"version": "0.0.1",
"homepage": "https://bitsrc.io/franz/js/global/jekyll_formmixin",
"main": "form.js",
"dependencies": {},
"devDependencies": {},
"peerDependencies": {},
"license": "SEE LICENSE IN LICENSE"
}
......@@ -84,7 +84,7 @@ permalink: /contact/
<div class="field-body">
<div class="field">
<p :class="{ 'control': true }">
<input v-validate="'required'" :class="{'input': true, 'is-danger': errors.has('name') }" name="name" v-model="name" type="text" placeholder="First name *">
<input v-validate="'required'" :class="{'input': true, 'is-danger': errors.has('name') }" name="name" v-model="name" type="text" placeholder="Name *">
<span v-show="errors.has('name')" class="help is-danger">Enter your name</span>
</p>
</div>
......
......@@ -11,11 +11,11 @@ gulp.task('js', function (cb) {
pump([
gulp.src
([
'node_modules/vue/dist/vue.min.js',
'node_modules/vue/dist/vue.js',
'node_modules/buefy/dist/buefy.min.js',
'node_modules/axios/dist/axios.min.js',
'node_modules/vee-validate/dist/vee-validate.js',
'src/form.js',
'components/global/jekyll_formmixin/form.js',
'src/custom.js'
]),
concat('bundle.min.js'),
......
{
"name": "erasmusoxygen-web",
"version": "0.1.0",
"description": "ErasmusOxygen Website.",
"repository": {
"url": "https://git.sedv.org/erasmusoxygen/website",
"type": "git"
},
"author": "Franz Geffke <m@f-a.nz>",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.3.1",
"axios": "^0.18.0",
......@@ -17,6 +25,7 @@
"optipng": "^1.1.0",
"pump": "^3.0.0",
"vee-validate": "^2.1.0-beta.8",
"vue": "^2.5.17"
"vue": "^2.5.17",
"@bit/franz.js.global.jekyll_formmixin": "file:./components/global/jekyll_formmixin"
}
}
......@@ -13,54 +13,112 @@ document.addEventListener('DOMContentLoaded', function () {
});
function goBack() {
window.history.back();
window.history.back();
}
Vue.use(Buefy.default)
Vue.use(VeeValidate)
var istanbul = new Vue({
delimiters:['<%', '%>'],
el: '#istanbul',
data: {},
var quicklinks = new Vue({
mixins: [formMixin],
el: '#quicklinks',
data: {
formThankYou: '/thanks/',
formAPI: 'https://hooks.zapier.com/hooks/catch/184367/qslh0h/',
isAdvisorActive: false,
member: false,
name: ''
},
});
var events = new Vue({
delimiters:['<%', '%>'],
el: '#events',
data: {},
});
(function () {
if (document.getElementById("contactUs")) {
var contactUs = new Vue({
mixins: [formMixin],
el: '#contactUs',
data: {
formThankYou: '/thanks/',
formAPI: 'https://hooks.zapier.com/hooks/catch/184367/qslh0h/',
member: false,
name: ''
}
})
}
})();
(function () {
if (document.getElementById("istanbul")) {
var istanbul = new Vue({
delimiters:['<%', '%>'],
el: '#istanbul',
data: {},
});
}
})();
var events = new Vue({
delimiters:['<%', '%>'],
el: '#events_footer',
data: {},
delimiters:['<%', '%>'],
el: '#events',
data: {},
});
var contact = new Vue({
delimiters:['<%', '%>'],
el: '#contact',
data: {},
var eventsFooter = new Vue({
delimiters:['<%', '%>'],
el: '#events_footer',
data: {},
});
var contact = new Vue({
delimiters:['<%', '%>'],
el: '#mapmodal',
data: {
isMapModalActive: false
},
methods: {
open: function(long,lat){
console.log(long + ', ' + lat)
this.isMapModalActive = true
setTimeout(function(){
mapboxgl.accessToken = 'pk.eyJ1IjoiZGtrbWEiLCJhIjoiU05aOVdrRSJ9._Ahj-qQ5cCyLUCM2dp4tAw';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v9',
center: [long, lat],
zoom: 16
});
}, 100);
}
}
});
(function () {
if (document.getElementById("contact")) {
var contact = new Vue({
delimiters:['<%', '%>'],
el: '#contact',
data: {},
});
}
})();
(function () {
if (document.getElementById("mapmodal")) {
var mapModal = new Vue({
delimiters:['<%', '%>'],
el: '#mapmodal',
data: {
isMapModalActive: false
},
methods: {
open: function(long,lat){
console.log(long + ', ' + lat)
this.isMapModalActive = true
setTimeout(function(){
mapboxgl.accessToken = 'pk.eyJ1IjoiZGtrbWEiLCJhIjoiU05aOVdrRSJ9._Ahj-qQ5cCyLUCM2dp4tAw';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v9',
center: [long, lat],
zoom: 16
});
}, 100);
}
}
});
}
})();
(function() {
if (document.getElementById("thankYou")) {
let url_string = window.location.href;
let url = new URL(url_string);
let name = url.searchParams.get("name");
if (name == null) {
name = "unknown"
}
var thankYou = new Vue({
mixins: [formMixin],
el: '#thankYou',
data: {
name,
}
});
}
})();
\ No newline at end of file
var formMixin = {
delimiters:['<%', '%>'],
data() {
return {
hasError: false,
hasSuccess: false,
hasFailure: false,
isWaiting: false,
name_first: null,
data: null,
api: 'https://hooks.zapier.com/hooks/catch/184367/qslh0h/'
}
},
methods: {
onSubmit: function(event) {
let t = this
t.$validator.validateAll().then((result) => {
if (result) {
t.isWaiting = true
const formData = new FormData(this.$refs['form']);
const data = {};
for (let [key, val] of formData.entries()) {
Object.assign(data, { [key]: val })
}
axios.post(t.api, data, {
headers: {
'Content-type': 'application/x-www-form-urlencoded',
}
})
.then(function (response) {
console.log("Success!")
console.log(response)
t.hasSuccess = true
})
.catch(function (error) {
console.log("Failure!")
console.log(error)
t.data = data
t.hasFailure = true
});
return;
}
t.hasError = true
});
}
}
}
......@@ -5,8 +5,9 @@ permalink: /thanks/
lang: en
---
<div class="has-text-centered">
<div class="has-text-centered" id="thankYou">
<h2>Thanks! We'll reach out shortly.</h2>
<h2 v-if="name === 'unknown'">Thanks! We'll reach out shortly.</h2>
<h2 v-else>Thanks <% name %>! We'll reach out shortly.</h2>
</div>
</div>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment