/* * Copyright (c) 2012-2014 Kaarle Ritvanen * See LICENSE file for license details */ define(["acf2/navigation", "jquery", "underscore"], function(navi, $, _) { function href() { return $("").attr({href: "javascript:void(0);"}); } return { setText: function(el, s) { el.html(_.map(s.split("\n"), _.escape).join("
")); }, href: href, objectRef: function(value, el) { el = el || href(); if (value) { el.click(function() { navi.setPath(value); }).text("Show"); } return el; }, button: function(label, func) { return $("").attr( {type: "submit", value: label} ).click(func); }, makeRow: function(el) { if (el.is("td")) return $("").html(el); return el; }, setStatus: function(el, status) { el.prop("class", status); } }; });