Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responsive design #726

Closed
wants to merge 55 commits into from
Closed
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
294dffb
Made the show/hide button responsive and changed its theming to be bl…
styki Jun 8, 2016
c496e76
Change the ordering of the UI panel and the button for small screens.
styki Jun 9, 2016
f96cdd2
Ordered the options in the UI panel to be vertical for small screens.
styki Jun 10, 2016
a01f72d
Changed the styling of the titles of all the tools in the UI panel to…
styki Jun 13, 2016
aa04ab9
Made a different height of the UI panel for different screens. Change…
styki Jun 13, 2016
ffa069b
Changed the scroll in the UI panel to go to the next element instead …
styki Jun 14, 2016
935990d
Removed the padding of the body in the UI panel.
styki Jun 14, 2016
8b1fa31
Made minor syntactical changes.
styki Jun 29, 2016
0f98bb1
Made new templates for responsive and default. The contextAwareness s…
styki Jun 29, 2016
c09a509
Removed the initial declaration of the check variable.
styki Jul 4, 2016
1d42a49
Separated the textSize component options between the general grade, t…
styki Jul 4, 2016
d0430a9
Defined a component for the increase and decrease button. The click e…
styki Jul 4, 2016
c8629b7
Remove a useless wrapper div and add wrappers for the + and - signs.
styki Jul 4, 2016
92f6338
Made the styling of the responsive version of the textSize panel to m…
styki Jul 4, 2016
a884896
Renamed the nonresponsive lineSpace template.
styki Jul 5, 2016
01c6422
Created a template for the responsive version of the lineSpace panel …
styki Jul 5, 2016
0c53265
Added a new class to the textfieldButtons inputs wrapper.
styki Jul 5, 2016
023dc46
Added contextAwareness to the lineSpace components.
styki Jul 5, 2016
1c94fd5
Made the buttons in textSize and lineSpace work properly.
styki Jul 5, 2016
c7f28b2
Changed the styling of the buttons to look better.
styki Jul 5, 2016
e56091e
Fixed most of the conflicts.
styki Jul 6, 2016
d8205c5
Made some changes, but still did not fix the bug.
styki Jul 6, 2016
1699481
Resolved the issue with the contextAwareness, but it also does not wo…
styki Jul 7, 2016
8f87d25
Merge remote-tracking branch 'upstream/master' into Responsive-Design
styki Jul 7, 2016
a4160bb
Styled the on/off buttons according to the mock-ups for the responsiv…
styki Jul 11, 2016
843b85b
Made changes based on jobara's comments in the pull request.
styki Jul 15, 2016
f3f4d28
Started the implementation of the blue color filter, but it still thr…
styki Jul 19, 2016
e3ce4d6
Fixed some of the typing errors, but there are the same error message…
styki Jul 19, 2016
bd7bf86
Found a gradeNames that I forgot to add, but it still does not work.
styki Jul 21, 2016
7a55013
Fixed the logic of the blue color filter. Now it functions properly, …
styki Jul 22, 2016
a02ff73
Removed the comments which cause the messages to not appear.
styki Jul 25, 2016
048eb2b
Fixed the bug with the responsive version.
styki Jul 26, 2016
71b2cf3
Fixed some of the bugs with the blue color filter, when it did not ap…
styki Jul 29, 2016
0eb87d5
Fixed some of the bugs with the blue color filter. It now also change…
styki Aug 2, 2016
94dec58
Added styling for the hide/show button when the UI panel is open on s…
styki Aug 2, 2016
e612f92
Merged the 2 dictionaries into one.
styki Aug 2, 2016
7aa656f
Added image filter to make the images' colors fit the contrass themes…
styki Aug 3, 2016
b09bfe0
Changed the blue color filter to have a default value 0 and 1 to the …
styki Aug 4, 2016
26dbbb7
Added a message to appearto show that the blue color filter is not ac…
styki Aug 4, 2016
65baacc
Fixed the mutationObservers to work on Safari.
styki Aug 5, 2016
ec95c23
Fixed the bug with the popping image in front of the UI panel.
styki Aug 5, 2016
ea628d5
Added comments to css that fixes the popping image bug.
styki Aug 5, 2016
3afa053
Implemented a mute button, which stops the audio from all audio and v…
styki Aug 9, 2016
689c289
Added two videos to the UI demo for testing the mute button.
styki Aug 9, 2016
c9f415c
Removed some console.log-s used during testing.
styki Aug 9, 2016
3fccf29
Added some CSS to make the UI panel look better for narrower screens.
styki Aug 15, 2016
042f62f
Made some minor changes based on Cindy's comments in the pull request.
styki Aug 15, 2016
2a30a29
Resolved the conplift that appear after pulling from upstream/master.
styki Aug 15, 2016
5939e35
Fixed most of the mistakes pointed out by Cindy in the pull request.
styki Aug 17, 2016
e3247fe
Removed the mutationObserver that added a class to the on/off buttons…
styki Aug 19, 2016
9385bfd
Removed some unnecessary checks and simplified the buttonCalculateVal…
styki Aug 19, 2016
a268b0e
Made the demo video responsive.
styki Aug 22, 2016
a634e6e
Fixed the last issues from the pull request.
styki Aug 22, 2016
0aa3cb3
Moved the screen width check to a new file and added them to the demo…
styki Aug 23, 2016
cb46623
Removed a linting error and added a comment.
styki Aug 23, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions demos/uiOptions/index.html
Expand Up @@ -48,6 +48,7 @@
<script type="text/javascript" src="../../src/framework/preferences/js/URLUtilities.js"></script>
<script type="text/javascript" src="../../src/framework/preferences/js/Store.js"></script>
<script type="text/javascript" src="../../src/components/textfieldSlider/js/TextfieldSlider.js"></script>
<script type="text/javascript" src="../../src/components/textfieldButtons/js/TextfieldButtons.js"></script>
<script type="text/javascript" src="../../src/framework/preferences/js/UIEnhancer.js"></script>
<script type="text/javascript" src="../../src/framework/preferences/js/PrefsEditor.js"></script>
<script type="text/javascript" src="../../src/framework/preferences/js/Panels.js"></script>
Expand Down Expand Up @@ -114,6 +115,12 @@ <h2>Some helpful tips</h2>
<li>Try tinkering with the options.</li>
</ol>
</div>
<video controls autoplay>
<source src="http://static.idrc.ocad.ca/videos/IDI2HQ_sm.mp4" type="video/mp4">
</video>
<video controls autoplay muted>
<source src="http://static.idrc.ocad.ca/videos/IDI1HQ_sm.webm" type="video/webm">
</video>
<div class="demo-columns content">
<div class="demo-columns">
<h2>Introduction</h2>
Expand Down
123 changes: 123 additions & 0 deletions src/components/textfieldButtons/js/TextfieldButtons.js
@@ -0,0 +1,123 @@
/*
Copyright 2016 OCAD University

Licensed under the Educational Community License (ECL), Version 2.0 or the New
BSD license. You may not use this file except in compliance with one these
Licenses.

You may obtain a copy of the ECL 2.0 License and BSD License at
https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
*/

var fluid_2_0_0 = fluid_2_0_0 || {};

(function ($, fluid) {
"use strict";

/********************
* Textfield Buttons *
********************/

fluid.defaults("fluid.textfieldButtons", {
gradeNames: ["fluid.viewComponent"],
distributeOptions: {
target: "{that > fluid.stepper.button}.options",
record: {
model: "{fluid.textfieldButtons}.model",
range: "{textfieldButtons}.options.range",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to be consistent with other lines by using {fluid.textfieldButtons}.

buttonOptions: "{fluid.textfieldButtons}.options.buttonOptions"
}
},
components: {
textfield: {
type: "fluid.textfieldSlider.textfield",
container: "{textfieldButtons}.dom.textfield",
options: {
model: "{textfieldButtons}.model",
range: "{textfieldButtons}.options.range"
}
},
increaseButton: {
type: "fluid.stepper.button",
container: "{textfieldButtons}.dom.increaseButton",
options: {
incrementCoefficient: 1
}
},
decreaseButton: {
type: "fluid.stepper.button",
container: "{textfieldButtons}.dom.decreaseButton",
options: {
incrementCoefficient: -1
}
}
},
selectors: {
textfield: ".flc-textfieldButtons-field",
increaseButton: ".fl-increase-button",
decreaseButton: ".fl-decrease-button"
},
model: {
value: null
},
modelRelay: {
target: "value",
singleTransform: {
type: "fluid.transforms.limitRange",
input: "{that}.model.value",
min: "{that}.options.range.min",
max: "{that}.options.range.max"
}
},
range: {
min: 0,
max: 100
}
});

fluid.defaults("fluid.stepper.button", {
gradeNames: ["fluid.viewComponent"],
range: {}, // should be used to specify the min, max range e.g. {min: 0, max: 100}
invokers: {
setModel: {
changePath: "value",
value: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 127-131 can be simplified to value: "{that}.calculateValue".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, the use of expander is correct.

expander: {
funcName: "{that}.calculateValue"
}
}
},
calculateValue: {
funcName: "fluid.stepper.button.buttonCalculateValue",
args: ["{that}.options.incrementCoefficient", "{that}.options.buttonOptions.stepMultiplier", "{that}.model.value", "{that}.options.range.min", "{that}.options.range.max"]
}
},
listeners: {
"onCreate.bindClickEvt": {
"this": "{that}.container",
"method": "click",
"args": "{that}.setModel"
}
},
incrementCoefficient: 1,
buttonOptions: {
stepMultiplier: 10
}
});

fluid.stepper.button.buttonCalculateValue = function (value, stepMultiplier, modelValue, min, max) {
modelValue = Math.round(modelValue * stepMultiplier);
min = Math.round(min * stepMultiplier);
max = Math.round(max * stepMultiplier);
if ((modelValue + value) < min) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't line 155-160 already guarded by fluid.transforms.limitRange checking at line 60-69?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not entirely sure how the limit Range works. Does it return the max value if the supplied value is greater than the max and what is its syntax? I use stepMultipliers to avoid rounding errors. We discussed that with jobara here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some test cases to help you understand how limitRange works: https://github.com/fluid-project/infusion/blob/master/tests/framework-tests/core/js/ModelTransformationTests.js#L4028-L4077

The effectiveness should be tested in your test coverage for this component.

From my understanding, this function simply needs one line:
return modelValue + stepMultiplier * incrementCoefficient;

BTW, using the name value in the parameter signature for incrementCoefficient is confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure where to put the transform. If I put it in the setModel invoker in the place of value the model ends up being a function. I am using this transformation
type: "fluid.transforms.limitRange",
input: "{that}.calculateValue",
min: "{that}.options.range.min",
max: "{that}.options.range.max"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The transformation has already been placed in the parent component fluid.textfieldButtons - https://github.com/styki/infusion/blob/3fccf2929f4f10e2fc5f01e893ef6971c6fb1095/src/components/textfieldButtons/js/TextfieldButtons.js#L61-L69. Since the parent and children components are sharing the same model. It's enough to guard for all of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see I have just made some unnecessary checks.

return min/stepMultiplier;
}
else if ((modelValue + value) > max) {
return max/stepMultiplier;
}
else {
return (modelValue + value)/stepMultiplier;
}
};

})(jQuery, fluid_2_0_0);
18 changes: 18 additions & 0 deletions src/components/textfieldButtons/textfieldButtonsDependencies.json
@@ -0,0 +1,18 @@
{
"textfieldButtons": {
"name": "Textfield Buttons",
"description": "A synchronized buttons and textfield",
"cssFiles": [],
"files": [
"./js/TextfieldButtons.js"
],
"dependencies": [
"jQuery",
"jQueryUICore",
"normalize",
"framework",
"jQueryUIWidgets",
"jQueryTouchPunchPlugin"
]
}
}
153 changes: 153 additions & 0 deletions src/framework/preferences/css/stylus/PrefsEditor.styl
Expand Up @@ -3,6 +3,16 @@
@import "utils/Helpers"
@import "utils/Themes"

//function to generate border radius
border-radius(n)
-webkit-border-radius: n;
-moz-border-radius: n;
border-top-left-radius: n;
border-top-right-radius: n;
border-bottom-left-radius: n;
border-bottom-right-radius: n;


@font-face {
font-family: 'InfusionIcons';
src: url('../fonts/InfusionIcons-PrefsEditor.ttf'),
Expand Down Expand Up @@ -363,6 +373,149 @@
.fl-icon-toc:before {
content: "\e012";
}

.flc-prefsEditor-blue-color-filter-inactive-message {
display: none;
}
}

// A message to show that the blue color filter is not active when a cotrast theme is on
body.fl-theme {
&-bw, &-wb, &-by, &-yb, &-lgdg {
.fl-prefsEditor-panels {
.fl-prefsEditor-panel {
.flc-prefsEditor-blue-color-filter {
.flc-prefsEditor-blue-color-filter-descr {
display: none;
}

div.fl-inputs {
display: none;
}

.flc-prefsEditor-blue-color-filter-inactive-message {
display: block;
}
}
}
}
}
}

// Styling for the responsive version
@media only screen and (max-width: 639px), only screen and (max-device-width: 639px) {
.fl-prefsEditor {
.fl-prefsEditor-panel {
.fl-prefsEditor-onoff {
margin-top: 1.2em;

.flc-prefsEditor-toc-descr, .flc-prefsEditor-mute-audio-descr {
display: none;
}

label {
display: flex;
}

.fl-prefsEditor-switch {
margin: auto;
width: 4em;
padding-left: 4em;
border: 1px solid #a7a9ac;
border-radius(4px);
box-shadow: none;
background: #ffffff;
}

//When the on button is checked
input:checked + label {
.fl-prefsEditor-switch {
box-shadow: none;
width: 4em;
padding-left: 4em;
background: #ffffff;

//On button
&:before {
text-indent: -3.15em;
content: "\002713 " attr(data-checkboxStateOn);
}

//Off button
&:after {
top: 0;
left: 1em;
content: attr(data-checkboxStateOff);
}

.fl-prefsEditor-switch-inner {
top: 0;
left: 0.5em;
width: 0;
height: inherit;

//The moving berder
&:before {
top: 0.15em;
left: -6.05em;
}
}
}

}

//When the off button is checked
input + label {
.fl-prefsEditor-switch {
//On button
&:before {
border: none;
box-shadow: none;
background: transparent;
width: 0;
line-height: 2em;
text-indent: -2.7em;
text-transform: uppercase;
text-shadow: none;
color: #3a3a3c;
content: attr(data-checkboxStateOn);
}

//Off button
&:after {
top: 0;
left: 0.5em;
line-height: 2em;
text-transform: uppercase;
text-shadow: none;
color: #3a3a3c;
content: "\002713 "attr(data-checkboxStateOff);
}
}
}

.fl-prefsEditor-switch-inner {
border: none;
background: none;
box-shadow: none;

//Moving border
&:before {
float: left;
position: relative;
top: -0.3em;
left: 0.4em;
width: 3.3em;
height: 1.5em;
border: 0.15em solid #3a3a3c;
border-radius(0.2em);
content: " ";
transition: left 0.4s;
}
}
}
}
}
}
// Theming
build-themes-prefsEditor(themes);