Skip to content

Instantly share code, notes, and snippets.

'use strict';
var m = require('mithril');
var t = require('client/utils/translate');
var vagueTime = require('vague-time');
var l16n = require('client/utils/l16n');
function assignValue(obj, objAttr) {
return function (event) {
'use strict'
function createView(ctrl, opts, children) {
return m('h1', 'Cached')
}
function controller() {
return {
view: m.prop()
}
@StephanHoyer
StephanHoyer / filterinput.js
Created May 20, 2015 10:07
Select2-like mithril input
'use strict';
var m = require('mithril');
var icons = require('client/utils/icons');
var remove = require('lodash/array/remove');
var transform = require('lodash/object/transform');
var last = require('lodash/array/last');
var code = require('yields-keycode');
function sameAs(filterA) {
@gilbert
gilbert / gist:0cfa65ce832ce35a278e
Last active March 27, 2017 09:06
Global AJAX loading indicator for Mithril.js
(function () {
//
// Global ajax loaders
//
// This is useful for showing a loading animation, yet still taking
// advantage of the default behavior of m.request, which is to wait
// for all requests to complete before rendering the view.
//
// The loader is assumed to already be on the page
var loader = document.querySelector('.ajax-loader')
/*\
For now, back to the stable if less featureful v4
TODO: implement http://stackoverflow.com/questions/4845762/onload-handler-for-script-tag-in-internet-explorer
for old ie compatiblity (where script.onload doesn't fire).
`{loading, element} = mithrilLoader(libs::Arrary [, m::mithril])`
where `libs` is an array of strings and array:
@StephanHoyer
StephanHoyer / inlineedit.js
Last active October 13, 2015 16:46
Inline edit mithril component
'use strict';
var m = require('mithril');
var extend = require('lodash').extend;
var setFocus = require('../util/viewhelper').setFocus;
var keymage = require('keymage');
function noop(){}
function addClass(el, className) {