public
anonymous / client.html
Created

  • Download Gist
client.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
<head>
 
<!-- Basic Page Needs
================================================== -->
<meta charset="utf-8">
<title>cmon!work</title>
<meta name="description" content="casual app">
<meta name="author" content="ghostrunners">
 
<!-- Mobile Specific Metas
================================================== -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
 
<!-- CSS
================================================== -->
<link rel="stylesheet" type="text/css" href="base.css">
<link rel="stylesheet" href="skeleton.css">
<link rel="stylesheet" href="layout.css">
<link rel="stylesheet" href="client.css">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
 
<!-- Favicons
================================================== -->
<link rel="shortcut icon" href="favicon.ico">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="apple-touch-icon-114x114.png">
 
</head>
<body>
{{> page}}
</body>
 
<template name="page">
<!-- Delete everything in this .container and get started on your own site! -->
 
<div class="container">
<div class="sixteen columns header">
<h2 class="remove-bottom" style="float:left;">Cmon!</h2>
<hr />
</div>
<div class="12 columns">
{{> form}}
</div>
</div><!-- container -->
</template>
 
<template name="form">
<h3 style="margin-bottom: 25px;">Peter Piper Picked a Pickled Pepper.</h3>
 
<form action="">
<label for="from">From</label>
<input type="text" id="from" placeholder="Your email address" />
 
<label for="to">To</label>
<input type="text" id="to" placeholder="Their email address" />
 
<label for="subj">Subject</label>
<input type="text" id="subj" placeholder="The mighty Casey will strike out" />
 
<label for="msg">Message</label>
<input type="text" id="msg" placeholder="Cookier Jar is full." />
 
<button type="submit" class="submit btn-success">Go!</button>
</form>
</template>
client.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
// client
 
Template.form.events({
'click .submit' : function (event, template) {
var from = template.find("#from").value;
var to = template.find("#to").value;
var subj = template.find("#subj").value;
var msg = template.find("#msg").value;
var options = { from:from, to:to, subj:subj, msg: msg };
if (from.length) {
Meteor.call('send_message', options, function(err, data) {
if (err)
console.log(err);
});
}
}
});
directory structure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
project1/
/.meteor
/client
>client.js
>client.html
>client.css
>base.css
>skeleton.css
>layout.css
/lib
>readme.txt
/public
>favicon.ico
/server
>server.js
/model.js
model.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
Meteor.methods({
send_message: function (options) {
var options = options || {};
Email.send({
from: options.from,
to: options.to,
replyTo: options.from || undefined,
subject: options.subj,
text: options.msg,
});
},
});
 
var send_message = function (from, to, subj, msg) {
Email.send({
from: from,
to: to,
replyTo: from || undefined,
subject: subj,
text: msg,
});
};*/
packages
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
# Meteor packages used by this project, one per line.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
 
preserve-inputs
accounts-ui
accounts-password
bootstrap
email<head>
 
<!-- Basic Page Needs
================================================== -->
<meta charset="utf-8">
<title>cmon!work</title>
<meta name="description" content="casual app">
<meta name="author" content="ghostrunners">
 
<!-- Mobile Specific Metas
================================================== -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
 
<!-- CSS
================================================== -->
<link rel="stylesheet" type="text/css" href="base.css">
<link rel="stylesheet" href="skeleton.css">
<link rel="stylesheet" href="layout.css">
<link rel="stylesheet" href="cmonbetme.css">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
 
<!-- Favicons
================================================== -->
<link rel="shortcut icon" href="favicon.ico">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="apple-touch-icon-114x114.png">
 
</head>
<body>
{{> page}}
</body>
 
<template name="page">
<!-- Delete everything in this .container and get started on your own site! -->
 
<div class="container">
<div class="sixteen columns header">
<h2 class="remove-bottom" style="float:left;">Cmon!</h2>
<hr />
</div>
<div class="12 columns">
{{> form}}
</div>
</div><!-- container -->
</template>
 
<template name="form">
<h3 style="margin-bottom: 25px;">Peter Piper Picked a Pickled Pepper.</h3>
 
<form action="">
<label for="from">You</label>
<input type="text" id="from" placeholder="Your email address" />
 
<label for="to">Them</label>
<input type="text" id="to" placeholder="Their email address" />
 
<label for="subj">Subject</label>
<input type="text" id="subj" placeholder="The mighty Casey will strike out" />
 
<label for="msg">Message</label>
<input type="text" id="msg" placeholder="Cookier Jar is full." />
 
<button type="submit" class="submit btn-success">Go!</button>
</form>
</template>
server.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// server
Meteor.startup(function () {
process.env.MAIL_URL = 'smtp://postmaster%40<XYZ>.mailgun.org:<123>@smtp.mailgun.org:587';
});
 
Meteor.methods({
send_message: function (options) {
var options = options || {};
Email.send({
from: options.from,
to: options.to,
replyTo: options.from || undefined,
subject: options.subj,
text: options.msg,
});
},
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.