Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into FLUID-5821
- Loading branch information
Showing
37 changed files
with
1,050 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
## Minimal Preferences Editor ## | ||
|
||
This folder provides an example of a minimal but fully functional preferences editor. It has: | ||
- only one preference | ||
- no enactor | ||
- no localization (Note that this is not best practice!) | ||
|
||
This code is the basis for the | ||
[Preferences Framework tutorial](http://docs.fluidproject.org/infusion/development/tutorial-prefsFramework/CreatingAPrefsEditor.html). |
15 changes: 15 additions & 0 deletions
15
examples/framework/preferences/minimalEditor/css/style.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.awe-instructions { | ||
background-color: #EEEEEE; | ||
padding: 1em; | ||
width: 50em; | ||
} | ||
|
||
.awe-panel { | ||
padding: 1em; | ||
border: 1px solid black; | ||
width: 50%; | ||
} | ||
|
||
.awe-save { | ||
margin: 1em; | ||
} |
8 changes: 8 additions & 0 deletions
8
examples/framework/preferences/minimalEditor/html/heatedSeats.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!-- This file is the template for the heated seats preference panel --> | ||
<section class="awe-panel"> | ||
<h2>Heated Seats</h2> | ||
|
||
<label for="prefsEd-heatedSeats">Enable the heated seats when the car starts</label> | ||
<input type="checkbox" id="prefsEd-heatedSeats" class="awec-heatedSeats"/> | ||
</section> | ||
|
7 changes: 7 additions & 0 deletions
7
examples/framework/preferences/minimalEditor/html/prefsEditorTemplate.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!-- This file is the template for the entire Preference Editor --> | ||
<h1>Flying Car Setup</h1> | ||
|
||
<!-- placeholder for the heated seats preference panel --> | ||
<div class="awec-heatedSeats"></div> | ||
|
||
<button class="flc-prefsEditor-save awe-save">save</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<link rel="stylesheet" type="text/css" href="css/style.css" /> | ||
|
||
<script type="text/javascript" src="../../../../src/lib/jquery/core/js/jquery.js"></script> | ||
|
||
<script type="text/javascript" src="../../../../src/framework/core/js/Fluid.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/core/js/FluidDocument.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/core/js/FluidRequests.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/core/js/FluidDOMUtilities.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/core/js/FluidIoC.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/core/js/DataBinding.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/core/js/ModelTransformation.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/core/js/ModelTransformationTransforms.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/enhancement/js/ContextAwareness.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/core/js/FluidView.js"></script> | ||
<script type="text/javascript" src="../../../../src/lib/fastXmlPull/js/fastXmlPull.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/renderer/js/fluidParser.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/renderer/js/fluidRenderer.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/renderer/js/RendererUtilities.js"></script> | ||
|
||
<script type="text/javascript" src="../../../../src/framework/preferences/js/Store.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> | ||
<script type="text/javascript" src="../../../../src/framework/preferences/js/FullNoPreviewPrefsEditor.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/preferences/js/PrimaryBuilder.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/preferences/js/AuxBuilder.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/preferences/js/Builder.js"></script> | ||
|
||
<script type="text/javascript" src="schemas/primary.js"></script> | ||
<script type="text/javascript" src="schemas/auxiliary.js"></script> | ||
<script type="text/javascript" src="js/prefsEditor.js"></script> | ||
</head> | ||
|
||
<body> | ||
|
||
<div class="awe-instructions"> | ||
<p>The Preference Editor below is an example of a minimal but fully functional preferences editor. It has: | ||
<ul> | ||
<li>only one preference</li> | ||
<li>no enactor</li> | ||
<li>no localization (Note that this is not best practice!)</li> | ||
</ul> | ||
This code is the basis for the | ||
<a href="http://docs.fluidproject.org/infusion/development/tutorial-prefsFramework/CreatingAPrefsEditor.html">Preferences Framework tutorial</a>.</p> | ||
</div> | ||
|
||
<!-- placeholder for the preferences editor --> | ||
<div id="preferencesEditor"></div> | ||
|
||
<script type="text/javascript"> | ||
awesomeCars.prefs.init("#preferencesEditor"); | ||
</script> | ||
|
||
</body> | ||
</html> |
58 changes: 58 additions & 0 deletions
58
examples/framework/preferences/minimalEditor/js/prefsEditor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
Copyright 2015 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 of 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 | ||
*/ | ||
|
||
/* global fluid, awesomeCars */ | ||
|
||
(function () { | ||
"use strict"; | ||
|
||
/** | ||
* Panel for the heated seats preference | ||
*/ | ||
fluid.defaults("awesomeCars.prefs.panels.heatedSeats", { | ||
gradeNames: ["fluid.prefs.panel"], | ||
|
||
// the Preference Map maps the information in the primary schema to this panel | ||
preferenceMap: { | ||
// the key must match the name of the pref in the primary schema | ||
"awesomeCars.prefs.heatedSeats": { | ||
// this key is the path into the panel's model where this preference is stored | ||
"model.heatedSeats": "default" | ||
} | ||
}, | ||
|
||
// selectors identify elements in the DOM that need to be accessed by the code; | ||
// in this case, the Renderer will render data into these particular elements | ||
selectors: { | ||
heatedSeats: ".awec-heatedSeats" | ||
}, | ||
|
||
// the ProtoTree is basically instructions to the Renderer | ||
// the keys in the prototree match the selectors above | ||
protoTree: { | ||
// this value is a reference to the last part of the model path in the preferenceMap | ||
heatedSeats: "${heatedSeats}" | ||
} | ||
}); | ||
|
||
/** | ||
* Initialize and instantiate the editor | ||
* TODO: Update this when https://issues.fluidproject.org/browse/FLUID-5817 is addressed | ||
*/ | ||
awesomeCars.prefs.init = function (container) { | ||
return fluid.prefs.create(container, { | ||
build: { | ||
gradeNames: ["awesomeCars.prefs.auxSchema"] | ||
} | ||
}); | ||
}; | ||
|
||
})(); |
56 changes: 56 additions & 0 deletions
56
examples/framework/preferences/minimalEditor/schemas/auxiliary.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
Copyright 2015 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 | ||
*/ | ||
|
||
/* global fluid */ | ||
|
||
(function () { | ||
"use strict"; | ||
|
||
/** | ||
* Auxiliary Schema | ||
*/ | ||
fluid.defaults("awesomeCars.prefs.auxSchema", { | ||
|
||
// the base grade for the schema | ||
gradeNames: ["fluid.prefs.auxSchema"], | ||
|
||
auxiliarySchema: { | ||
|
||
// the loaderGrade identifies the "base" form of preference editor desired | ||
loaderGrades: ["fluid.prefs.fullNoPreview"], | ||
|
||
// 'terms' are strings that can be re-used elsewhere in this schema; | ||
terms: { | ||
templatePrefix: "html" | ||
}, | ||
|
||
// the main template for the preference editor itself | ||
template: "%templatePrefix/prefsEditorTemplate.html", | ||
|
||
heatedSeats: { | ||
// this 'type' must match the name of the pref in the primary schema | ||
type: "awesomeCars.prefs.heatedSeats", | ||
panel: { | ||
// this 'type' must match the name of the panel grade created for this pref | ||
type: "awesomeCars.prefs.panels.heatedSeats", | ||
|
||
// selector indicating where, in the main template, to place this panel | ||
container: ".awec-heatedSeats", | ||
|
||
// the template for this panel | ||
template: "%templatePrefix/heatedSeats.html" | ||
} | ||
} | ||
} | ||
}); | ||
|
||
|
||
})(); |
37 changes: 37 additions & 0 deletions
37
examples/framework/preferences/minimalEditor/schemas/primary.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
Copyright 2015 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 | ||
*/ | ||
|
||
/* global fluid */ | ||
|
||
(function () { | ||
"use strict"; | ||
|
||
/** | ||
* Primary Schema | ||
* This schema defines the "heated seats" preference edited by this preferences | ||
* editor: its name, type, default value, etc. | ||
*/ | ||
fluid.defaults("awesomeCars.prefs.schemas.heatedSeats", { | ||
|
||
// the base grade for the schema; | ||
// using this grade tells the framework that this is a primary schema | ||
gradeNames: ["fluid.prefs.schemas"], | ||
|
||
schema: { | ||
// the actual specification of the preference | ||
"awesomeCars.prefs.heatedSeats": { | ||
"type": "boolean", | ||
"default": false | ||
} | ||
} | ||
}); | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.