--- a/coffee/rivets.coffee Mon Mar 21 21:46:23 2016 +0800
+++ b/coffee/rivets.coffee Mon Mar 21 22:56:28 2016 +0800
+rivets.formatters['only'] = (value, allowed...) ->
+ if value in allowed then value else ''
+rivets.formatters['eq'] = (a, b) ->
rivets.formatters['format-date'] = (value, format) ->
if value? then value.format(format) else ''
--- a/js/rivets.js Mon Mar 21 21:46:23 2016 +0800
+++ b/js/rivets.js Mon Mar 21 22:56:28 2016 +0800
// Generated by CoffeeScript 1.10.0
+ indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
observe: function(obj, keypath, callback) {
return obj.on('change:' + keypath, callback);
+ rivets.formatters['only'] = function() {
+ value = arguments[0], allowed = 2 <= arguments.length ? slice.call(arguments, 1) : [];
+ if (indexOf.call(allowed, value) >= 0) {
+ rivets.formatters['eq'] = function(a, b) {
rivets.formatters['format-date'] = function(value, format) {
return value.format(format);
--- a/js/rivets.js.map Mon Mar 21 21:46:23 2016 +0800
+++ b/js/rivets.js.map Mon Mar 21 22:56:28 2016 +0800
- "mappings": ";AAAA;EAAA,MAAM,CAAC,QAAS,CAAA,GAAA,CAAhB,GACE;IAAA,OAAA,EAAS,SAAC,GAAD,EAAM,OAAN,EAAe,QAAf;aACP,GAAG,CAAC,EAAJ,CAAO,SAAA,GAAY,OAAnB,EAA4B,QAA5B;IADO,CAAT;IAGA,SAAA,EAAW,SAAC,GAAD,EAAM,OAAN,EAAe,QAAf;aACT,GAAG,CAAC,GAAJ,CAAQ,SAAA,GAAY,OAApB,EAA6B,QAA7B;IADS,CAHX;IAMA,GAAA,EAAK,SAAC,GAAD,EAAM,OAAN;aACH,GAAG,CAAC,GAAJ,CAAQ,OAAR;IADG,CANL;IASA,GAAA,EAAK,SAAC,GAAD,EAAM,OAAN,EAAe,KAAf;aACH,GAAG,CAAC,GAAJ,CAAQ,OAAR,EAAiB,KAAjB;IADG,CATL;;;EAaF,MAAM,CAAC,UAAW,CA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