From ca4fad98c8b54d73da2d0eca272a41b93a3189cc Mon Sep 17 00:00:00 2001 From: Norbert Fuksz Date: Thu, 21 Apr 2016 12:05:37 +0100 Subject: [PATCH 1/2] Make jinplace requireable in browserify --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ad6a8ea..a5de0af 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "files": [ "js/*" ], - + "main": "js/jinplace.js", "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-qunit": "~0.2.2", From f7acc498ce6a0d5403d9f0d8ee4b3717cb8894fb Mon Sep 17 00:00:00 2001 From: Norbert Fuksz Date: Thu, 21 Apr 2016 12:19:21 +0100 Subject: [PATCH 2/2] Add ability to set class on form and buttons --- js/jinplace.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/js/jinplace.js b/js/jinplace.js index 1c23094..6b29ee3 100644 --- a/js/jinplace.js +++ b/js/jinplace.js @@ -58,6 +58,9 @@ * @property {string} okButton - Create a submit button with this name * @property {string} cancelButton - Create a cancel button with this name * @property {string} inputClass - A css class that is added to the input field + * @property {string} formClass - A css class that is added to the form field + * @property {string} okClass - A css class that is added to the ok button + * @property {string} cancelClass - A css class that is added to the cancel button * @property {jQuery|string} activator - Object (or css selector) for object to activate editing. Defaults to the element itself. * @property {boolean} textOnly - When true (the default) text returned from server is displayed literally and not as html. * @property {string} placeholder - Text to display in empty elements. @@ -75,6 +78,9 @@ 'okButton', 'cancelButton', 'inputClass', + 'formClass', + 'okClass', + 'cancelClass', 'activator', 'textOnly', 'placeholder', @@ -298,7 +304,7 @@ * * @this {JinPlace} * @param {editorBase} editor - * @param {Options} opts + * @param {Options} opts */ submit: function (editor, opts) { var self = this; @@ -467,6 +473,7 @@ var form = $("
") .attr("style", "display: inline;") .attr("action", "javascript:void(0);") + .addClass(opts.formClass) .append(inputField); if (buttons) @@ -492,15 +499,17 @@ var ok = opts.okButton; if (ok) { - var $button = $("").attr("type", "button").attr("value", ok) - .addClass('jip-button jip-ok-button'); + var $button = $("