Skip to content

Instantly share code, notes, and snippets.

@elliots
Forked from jmanoto/options.js
Last active December 21, 2015 06:39
Show Gist options
  • Save elliots/6265672 to your computer and use it in GitHub Desktop.
Save elliots/6265672 to your computer and use it in GitHub Desktop.
NinjaBlocks notification device widget
return {
"name": "Notification",
"deviceMap": [{ "deviceType": "notification" }]
}
padding: 40px 10px 10px;
.notification-widget {
text-align: right;
button {
}
input {
width: 92%;
display: block;
margin: 0 auto 5px;
}
select {
float: left;
}
}
<div class="notification-widget">
<form>
<input class="input" type="text" name="message" placeholder="Message"/>
<input class="input" type="text" name="title" placeholder="Title"/>
<input class="input" type="text" name="subtitle" placeholder="Subtitle"/>
<input class="input" type="text" name="url" placeholder="URL"/>
<select name="type">
<option>info</option>
<option>pass</option>
<option>fail</option>
</select>
<button class="button orange-gradient compact">Notify</button>
</form>
</div>
$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
element.find('button').click(function() {
scope.ActuateAll(element.find('form').serializeObject());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment