Skip to content

Commit

Permalink
Merge branch 'UIO-justin' into FLUID-4938
Browse files Browse the repository at this point in the history
Conflicts:
	src/webapp/components/uiOptions/html/UIOptionsTemplate-contrast.html
  • Loading branch information
heidiv committed Mar 25, 2013
2 parents 972b8bf + 36d87af commit 4733ea7
Show file tree
Hide file tree
Showing 33 changed files with 1,080 additions and 661 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
display: inline-block;
padding: 1em;
min-height: 8em;
width: 27em;
width: 25em;
background-color: #fff;
margin-right: 10px;
float: left;
Expand Down Expand Up @@ -115,10 +115,10 @@
/* Radio buttons */
.fl-uiOptions-fatPanel .fl-choice {
display: inline;
float: left;
}

.fl-uiOptions-fatPanel .fl-choice label {
float: left;
margin-right: 5px;

border: 1px solid black;
Expand All @@ -143,7 +143,7 @@
}

.fl-uiOptions-fatPanel .fl-choice input {
display: none;

}

/* Theming */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
<div>
<h2>Colour & Contrast</h2>
<div class="flc-uiOptions-themeRow fl-choice fl-preview-default">
<label for="default" class="flc-uiOptions-themeLabel"><span class="fl-preview-A">A</span><span class="fl-hidden-accessible">Default</span></label>
<input type="radio" class="flc-uiOptions-themeInput" name="theme" id="default" value="default" />
</div>
<div class="flc-uiOptions-themeRow fl-choice">
<label for="bw" class="flc-uiOptions-themeLabel fl-theme-bw"><span class="fl-preview-A">A</span><span class="fl-hidden-accessible">Black on White</span></label>
<input type="radio" class="flc-uiOptions-themeInput" name="theme" id="bw" value="bw" />
</div>
<div class="flc-uiOptions-themeRow fl-choice">
<label for="wb" class="flc-uiOptions-themeLabel fl-theme-wb"><span class="fl-preview-A">A</span><span class="fl-hidden-accessible">White on Black</span></label>
<input type="radio" class="flc-uiOptions-themeInput " name="theme" id="wb" value="wb" />
</div>
<div class="flc-uiOptions-themeRow fl-choice">
<label for="by" class="flc-uiOptions-themeLabel fl-theme-by"><span class="fl-preview-A">A</span><span class="fl-hidden-accessible">Black on Yellow</span></label>
<input type="radio" class="flc-uiOptions-themeInput fl-inputs" name="theme" id="by" value="by" />
</div>
<div class="flc-uiOptions-themeRow fl-choice">
<label for="yb" class="flc-uiOptions-themeLabel fl-theme-yb"><span class="fl-preview-A">A</span><span class="fl-hidden-accessible">Yellow on Black</span></label>
<input type="radio" class="flc-uiOptions-themeInput fl-inputs" name="theme" id="yb" value="yb" />
</div>
</div>
<h2>Colour & Contrast</h2>
<div class="flc-uiOptions-themeRow fl-choice">
<label for="bw" class="flc-uiOptions-themeLabel fl-theme-bw"><span class="fl-preview-A">A</span><span class="fl-hidden-accessible">Black on White</span></label>
<input type="radio" class="flc-uiOptions-themeInput" name="theme" id="bw" value="bw" />
</div>

<!-- div class="flc-uiOptions-themeRow fl-choice fl-preview-default">
<label for="default" class="flc-uiOptions-themeLabel"><span class="fl-preview-A">A</span><span class="fl-hidden-accessible">Default</span></label>
<input type="radio" class="flc-uiOptions-themeInput" name="theme" id="default" value="default" />
</div>
<div class="flc-uiOptions-themeRow fl-choice">
<label for="bw" class="flc-uiOptions-themeLabel fl-theme-bw"><span class="fl-preview-A">A</span><span class="fl-hidden-accessible">Black on White</span></label>
<input type="radio" class="flc-uiOptions-themeInput" name="theme" id="bw" value="bw" />
</div>
<div class="flc-uiOptions-themeRow fl-choice">
<label for="wb" class="flc-uiOptions-themeLabel fl-theme-wb"><span class="fl-preview-A">A</span><span class="fl-hidden-accessible">White on Black</span></label>
<input type="radio" class="flc-uiOptions-themeInput " name="theme" id="wb" value="wb" />
</div>
<div class="flc-uiOptions-themeRow fl-choice">
<label for="by" class="flc-uiOptions-themeLabel fl-theme-by"><span class="fl-preview-A">A</span><span class="fl-hidden-accessible">Black on Yellow</span></label>
<input type="radio" class="flc-uiOptions-themeInput fl-inputs" name="theme" id="by" value="by" />
</div>
<div class="flc-uiOptions-themeRow fl-choice">
<label for="yb" class="flc-uiOptions-themeLabel fl-theme-yb"><span class="fl-preview-A">A</span><span class="fl-hidden-accessible">Yellow on Black</span></label>
<input type="radio" class="flc-uiOptions-themeInput fl-inputs" name="theme" id="yb" value="yb" />
</div -->
26 changes: 12 additions & 14 deletions src/webapp/components/uiOptions/js/Enactors.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,16 @@ var fluid_1_5 = fluid_1_5 || {};
listener: "{that}.set",
args: "{that}.model.value"
}
},
members: {
initialSize: {
expander: {
func: "{that}.getTextSizeInEm"
}
}
}
});

fluid.uiOptions.actionAnts.textSizerEnactor.set = function (times, that) {
// Calculating the initial size here rather than using a members expand because the "font-size"
// cannot be detected on hidden containers such as fat paenl iframe.
if (!that.initialSize) {
that.initialSize = that.getTextSizeInEm();
}

if (that.initialSize) {
var targetSize = times * that.initialSize;
that.container.css("font-size", targetSize + "em");
Expand Down Expand Up @@ -337,13 +336,6 @@ var fluid_1_5 = fluid_1_5 || {};
listener: "{that}.set",
args: "{that}.model.value"
}
},
members: {
initialSize: {
expander: {
func: "{that}.numerizeLineHeight"
}
}
}
});

Expand Down Expand Up @@ -386,6 +378,12 @@ var fluid_1_5 = fluid_1_5 || {};
};

fluid.uiOptions.actionAnts.lineSpacerEnactor.set = function (times, that) {
// Calculating the initial size here rather than using a members expand because the "line-height"
// cannot be detected on hidden containers such as fat paenl iframe.
if (!that.initialSize) {
that.initialSize = that.numerizeLineHeight();
}

// that.initialSize === 0 when the browser returned "lineHeight" css value is undefined,
// which occurs when firefox detects "line-height" value on a hidden container.
// @ See numerizeLineHeight() & http://issues.fluidproject.org/browse/FLUID-4500
Expand Down
14 changes: 13 additions & 1 deletion src/webapp/components/uiOptions/js/FatPanelUIOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,15 @@ var fluid_1_5 = fluid_1_5 || {};
container: "{iframeRenderer}.renderUIOContainer",
createOnEvent: "afterRender",
options: {
gradeNames: ["fluid.uiEnhancer.defaultActions"],
components: {
settingsStore: "{pageEnhancer}.settingsStore"
},
jQuery: "{iframeRenderer}.jQuery",
tocTemplate: "{pageEnhancer}.options.tocTemplate"
tocTemplate: "{pageEnhancer}.options.tocTemplate",
events: {
onIframeVisible: null
}
}
}
}
Expand Down Expand Up @@ -204,6 +208,7 @@ var fluid_1_5 = fluid_1_5 || {};
// TODO: This binding should be done declaratively - needs ginger world in order to bind onto slidingPanel
// which is a child of this component - and also uiOptionsLoader which is another child
fatPanel.slidingPanel.events.afterPanelShow.addListener(function () {
iframeEnhancer.events.onIframeVisible.fire(iframeEnhancer);
fluid.uiOptions.fatPanel.updateView(uiOptions, iframeEnhancer);
});

Expand All @@ -224,6 +229,13 @@ var fluid_1_5 = fluid_1_5 || {};
iframe.animate(attrs, 400);
});

// Re-apply text size and line spacing to iframe content since these initial css values are not detectable
// when the iframe is hidden.
iframeEnhancer.events.onIframeVisible.addListener(function () {
iframeEnhancer.textSize.set(iframeEnhancer.model.textSize);
iframeEnhancer.lineSpacing.set(iframeEnhancer.model.lineSpacing);
});

fatPanel.slidingPanel.events.afterPanelHide.addListener(function () {
fatPanel.iframeRenderer.iframe.height(0);

Expand Down
22 changes: 9 additions & 13 deletions src/webapp/components/uiOptions/js/ModelRelay.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,27 @@ var fluid_1_5 = fluid_1_5 || {};

fluid.defaults("fluid.uiOptions.modelRelay", {
gradeNames: ["fluid.modelComponent", "fluid.eventedComponent", "autoInit"],
mergePolicy: {
sourceApplier: "nomerge"
},
sourceApplier: null, // must be supplied by implementors
rules: {}, // must be supplied by implementors, in format: "externalModelKey": "internalModelKey"

postInitFunction: "fluid.uiOptions.modelRelay.postInit"
});

fluid.uiOptions.modelRelay.postInit = function (that) {
fluid.transform(that.options.rules, function (internalKey, sourceKey) {
that.options.sourceApplier.guards.addListener(sourceKey, function (model, changeRequest) {
if (changeRequest.value === model[sourceKey]) {
return false;
that.applier.modelChanged.addListener(internalKey, function (newModel, oldModel) {
if (!that.applier.hasChangeSource(sourceKey)) {
fluid.fireSourcedChange(that.options.sourceApplier, sourceKey, fluid.get(newModel, internalKey), internalKey);
}
});
that.options.sourceApplier.modelChanged.addListener(sourceKey, function (newModel, oldModel) {
that.applier.requestChange(internalKey, fluid.get(newModel, sourceKey));
});

that.applier.guards.addListener(internalKey, function (model, changeRequest) {
if (changeRequest.value === model[internalKey]) {
return false;
that.options.sourceApplier.modelChanged.addListener(sourceKey, function (newModel, oldModel) {
if (!that.options.sourceApplier.hasChangeSource(internalKey)) {
fluid.fireSourcedChange(that.applier, internalKey, fluid.get(newModel, sourceKey), sourceKey);
}
});
that.applier.modelChanged.addListener(internalKey, function (newModel, oldModel) {
that.options.sourceApplier.requestChange(sourceKey, fluid.get(newModel, internalKey));
});
});
};

Expand Down
Loading

0 comments on commit 4733ea7

Please sign in to comment.