Navigation Menu

Skip to content

Commit

Permalink
FLUID-4725: Update bindHighlightHander API to remove dependency on 't…
Browse files Browse the repository at this point in the history
…hat'
  • Loading branch information
acheetham committed Jul 18, 2012
1 parent 5421966 commit 625d80d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions src/webapp/components/inlineEdit/js/InlineEdit.js
Expand Up @@ -647,19 +647,21 @@ var fluid_1_5 = fluid_1_5 || {};
/**
* Bind keyboard focus and blur event handlers to an element
*
* Note: This function is an unsupported, NON-API function
*
* @param {Object} element The element to which the event handlers are bound
* @param {Object} displayModeRenderer The display mode container
* @param {Ojbect} styles The default styling for the display mode container on mouse hover
*/
fluid.inlineEdit.bindHighlightHandler = function (element, displayModeRenderer, that) {
fluid.inlineEdit.bindHighlightHandler = function (element, displayModeRenderer, styles, strings, model) {
element = $(element);

var makeFocusSwitcher = function (focusOn) {
return function () {
displayModeRenderer.toggleClass(that.options.styles.focus, focusOn);
displayModeRenderer.toggleClass(that.options.styles.invitation, focusOn);
if (!that.model || !that.model.value) {
displayModeRenderer.prevObject.text(focusOn ? that.options.strings.defaultFocussedViewText : that.options.strings.defaultViewText);
displayModeRenderer.toggleClass(styles.focus, focusOn);
displayModeRenderer.toggleClass(styles.invitation, focusOn);
if (!model || !model.value) {
displayModeRenderer.prevObject.text(focusOn ? strings.defaultFocussedViewText : strings.defaultViewText);
}
};
};
Expand Down Expand Up @@ -737,8 +739,8 @@ var fluid_1_5 = fluid_1_5 || {};
fluid.inlineEdit.bindMouseHandlers(that.viewEl, that.edit);
fluid.inlineEdit.bindMouseHandlers(that.textEditButton, that.edit);
fluid.inlineEdit.bindKeyboardHandlers(that.textEditButton, that.edit);
fluid.inlineEdit.bindHighlightHandler(that.viewEl, displayModeContainer, that);
fluid.inlineEdit.bindHighlightHandler(that.textEditButton, displayModeContainer, that);
fluid.inlineEdit.bindHighlightHandler(that.viewEl, displayModeContainer, that.options.styles, that.options.strings, that.model);
fluid.inlineEdit.bindHighlightHandler(that.textEditButton, displayModeContainer, that.options.styles, that.options.strings, that.model);
};

/**
Expand Down
Expand Up @@ -841,7 +841,7 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
// Add event handlers.
fluid.inlineEdit.bindHoverHandlers(displayModeRenderer, styles.invitation);
fluid.inlineEdit.bindMouseHandlers(that.viewEl, that.edit);
fluid.inlineEdit.bindHighlightHandler(that.viewEl, displayModeRenderer, that);
fluid.inlineEdit.bindHighlightHandler(that.viewEl, displayModeRenderer, that.options.styles, that.options.strings, that.model);

return displayModeRenderer;
};
Expand Down

0 comments on commit 625d80d

Please sign in to comment.