I want to make a Cordova (Phonegap) app that can be used on all devices. Including PC screens. I want the layout to adjust the number and layout of panels (views) acording to some simple instructions. I chose the Dojox.app because of the way the config.json file controls the MVC structure of the app.
A Dojox.app uses controllers to handle size and orientation events. The config.json file contains "controllers", "views" and other elements to define the MVC structure of the app
//Mandatory,listen App.emit events,implement dojox/app/Controller
"controllers": [
//listens to "app-init, app-load"
"dojox/app/controllers/Load",
//listens to "app-transition, app-domNode"
"dojox/app/controllers/Transition",
//listens to "app-initLayout,app-layoutVIew,app-resize"
"dojox/app/controllers/Layout"
],
//Mandatory, one or a set of views view1+view2+view3
"defaultView": "home+rightPane",
//Mandatory, Specify Application child views
"views": {
"home":{
//Mandatory set template for defaultViews
"template": "app/views/home/home.html",
"controller" : "app/views/home/home.js",
"defaultView": "rightPane",
/* when transitioning between tabs, use a flip animation by default */
"defaultTransition": "slide",
/* the views available to this scene */
"views": {
"rightPane":{
//Mandatory set template for defaultViews
"template": "app/views/rightPane/right.html",
"controller" : "app/views/rightPane/right.js",
"defaultView": "general",
/* when transitioning between tabs, use a flip animation by default */
"defaultTransition": "slide",
/* the views available to this scene */
"views": {
"about":{
"template": "app/views/about/about.html",
"controller" : "app/views/about/view.js"
},
"wifi":{
"template": "app/views/wifi/wifi.html",
"controller" : "app/views/wifi/wifi.js"
},
"general":{
"template": "app/views/general/general.html",
"controller" : "app/views/general/general.js"
},
"picture":{
"template": "app/views/picture/picture.html",
"controller" : "app/views/picture/picture.js"
},
"bright":{
"template": "app/views/bright/bright.html",
"controller" : "app/views/bright/bright.js"
}
}
}
}
}
},
...
I want to create a custom controller by changeing the "dojox/app/controllers/Layout" to allow for the addition and subtraction of views depending on the screen sizs.
Dojo already has the experimental 'dojox/mobile/ScreenSizeAware' module but it is limited to two panels and does not work (well I haven't been able to) in a MVC environment.
How to go about defining the views in the config.json file and how to create the controller.
I'll give it some serious thought over the next few days. If you have any suggestions please jot them down here.
You should take a look at the dojox/app/tests/mediaQuery3ColumnApp, it will show 1, 2 or 3 columns depending upon the screen size. It includes a custom layout controller which uses css to handle the layout, and a custom navigation controller to try to handle which views to show when transitioning. It is not perfect, there are some issues with the navigation between views when the displayed columns has changed, but it should get you started.
You can run it here:
http://archive.dojotoolkit.org/nightly/checkout/dojox/app/tests/mediaQuery3ColumnApp/
And you can see the code here:
https://github.com/dmachi/dojox_application/tree/master/tests/mediaQuery3ColumnApp
Regards,
Ed
Related
I have an old Mediawiki site (1.6.x) and I need to upgrade it to 1.31.x.
I need to add multiple Google fonts
#import url(https://fonts.googleapis.com/css?family=Oswald)
#import url(https://fonts.googleapis.com/css?family=Questrial)
#import url(https://fonts.googleapis.com/css?family=Dancing+Script)
The skin of my upgraded site is based on
https://www.mediawiki.org/wiki/Skin:Example
I tried a few ways, but none of them is working. For example, in skin.json:
"ResourceModules": {
"skins.navajo": {
"class": "ResourceLoaderSkinModule",
"styles": {
"resources/libraries/normalise.css": {
"media": "screen"
},
"resources/screen-common.less": {
"media": "screen"
},
"https://fonts.googleapis.com/css?family=Oswald": {
"media": "screen"
},
I also included the above three fonts in screen-common.less. Not working either.
Got it working by using OutputPage::addStyle in skins code.
$out->addStyle("https://fonts.googleapis.com/css?family=Oswald", "screen");
$out->addStyle("https://fonts.googleapis.com/css?family=Questrial", "screen");
$out->addStyle("https://fonts.googleapis.com/css?family=Dancing+Script", "screen");
Currently I have two Polymer components that share a great amount of data. You can see here:
<polymer-component1
series="{{series}}"
stackhelper={{stackhelper}}
stack={{stack}}
controls={{controls}}
camera={{camera}}
threed={{threed}}
scene={{scene}}
renderer={{renderer}}>
</polymer-component1>
<polymer-component2
stackhelper=[[stackhelper]]
stack={{stack}}
controls={{controls}}
camera={{camera}}
threed={{threed}}
scene={{scene}}
renderer={{renderer}}
guiobjects={{guiobjects}}>
</polymer-component2>
This is working fine right now but whats the best practice about sharing data? Any way to share all the properties between two components?
It's recommended to share data through data binding, just as what you're doing. You can share any property, not just strings and numbers. e.g. assuming you have an object
JS
data = {
series: "",
stackhelper: "",
stack: "",
controls: "",
camera: "",
threed: "",
scene: "",
renderer: "",
}
Your code can be rewritten like this.
HTML
<polymer-component1 data="{{data}}"></polymer-component1>
<polymer-component2 data="{{data}}"></polymer-component2>
In Polymer 2 one element can just inherit the properties by extending it.
class MyElementSubclass extends MyElement {...}
Or you create an element with just the properties both need and then both components extend the parent. You can find this here scroll down to Extending an existing element
This must have been asked somewhere, but can't find where :(
I was reading up on finding out which browser someone was using in html.
My site uses a 'theme' (DevExpress' Black glass) and was wondering if there was a way of accessing Chrome's current theme, when the user is logged in.
I understand this has the potential to be a huge undertaking, but if it was possible, is there a way of getting the 'css' of chromes theme (obviously this would only apply if user was using chrome)?
I am currently writing a project in mvc, but any html/css approaches would be beneficial here.
For Example:
Is it possible to obtain access to the css of the 'Grass' theme (please note, this is just one example, there are many other themes available)?
As far as I know it's not possible, because it doesn't work like CSS. You have to get the JSON file, because I don't think it's possible from CRX.
Here is how a JSON file for a GC theme looks like:
{
"version": "1.0",
"name": "test theme",
"description": "A test theme",
"theme": {
"images" : {
"theme_frame" : "images/theme_frame_camo.png",
"theme_toolbar" : "images/theme_toolbar_camo.png",
"theme_ntp_background" : "images/theme_ntp_background_norepeat.png",
"theme_ntp_attribution" : "images/attribution.png"
},
"colors" : {
"frame" : [71, 105, 91],
"toolbar" : [207, 221, 192],
"ntp_text" : [20, 40, 0],
"ntp_link" : [36, 70, 0],
"ntp_section" : [207, 221, 192],
"button_background" : [255, 255, 255]
},
"tints" : {
"buttons" : [0.33, 0.5, 0.47]
},
"properties" : {
"ntp_background_alignment" : "bottom"
}
}
}
More info:
https://code.google.com/p/chromium/wiki/ThemeCreationGuide
BTW: Why would you want this, when there are 3-4 colors, no styles? You can get the colors with color picker.
In Couchbase 2.2, I have set the updateInterval parameter both globally (for the view update daemon) and for an individual design document. It appears that only the global setting is always taking effect. On the other hand, if I set updateMinChanges for a design document, it takes effect just fine.
Curiously, the documentation example does not show updateInterval being set for a design document:
{
"_id": "_design/myddoc",
"views": {
"view1": {
"map": "function(doc, meta) { if (doc.value) { emit(doc.value, meta.id);} }"
}
},
"options": {
"updateMinChanges": 1000,
"replicaUpdateMinChanges": 20000
}
}
Can updateInterval be set for a design document?
it is not currently possible to set an updateInterval at the design document level. A feature request has been added to provide this function # https://www.couchbase.com/issues/browse/MB-11594
I am venturing into front-end testing. To make this task feel a bit easier I am using selenium builder, but I am struggling to target links on a drop down menu and on a rotating banner.
For simplicity I will stick with the drop down menu as an example (I assume that they are both going to be solved by targeting the correct path)
Selenium builder generates a JSON file. I think adjusting this file could be the answer to my problems, but I am struggling to work out what adjustments I can make to target the link I am after.
the HTML I am targeting
<div id="locale-switcher" style="display: none">
<li class="language-switcher OneLinkNoTx">
Select language
<ul id="language-options">
<li><a class="modal-link" href="#currency-change" rel="/uk/store/" onclick="confirmStoreSwitch(this.rel);">English</a></li>
<li><a class="modal-link" href="#currency-change" rel="/other/store/" onclick="confirmStoreSwitch(this.rel);">Other</a></li>
</ul>
</li>
</div>
the generated json file
{
"type": "script",
"seleniumVersion": "2",
"formatVersion": 2,
"steps": [
{
"type": "get",
"url": "http://www.mySite.co.uk/uk/store/"
},
{
"type": "clickElement",
"locator": {
"type": "link text",
"value": "English"
}
}
],
"data": {
"configs": {},
"source": "none"
},
"inputs": []
}
The program also suggests alternative to target a desired element, in this case:
"type": "clickElement" suggested alt1:
"locator": {
"type": "css selector",
"value": "a.modal-link"
}
"type": "clickElement" suggested alt2:
"locator": {
"type": "xpath",
"value": "//ul[#id='language-options']//a[.='English']"
}
"type": "clickElement" suggested alt3
"locator": {
"type": "xpath",
"value": "//div[1]/header/nav/ul/li[1]/ul/li[1]/a"
}
But non of these suggestions are working. How can I target the required element?
I finally solved it. The answer was not adjusting the JSON file as it seems that even if you pass valid JSON it may not be read by selenium builder.
Ultimately the answer was getting the correct xpath and not trying to click the element but verify its there, store it and retrieve it.
To get an xpath (using firebug)
Navigate to the link you are targeting
Right click and select "inspect element with firebug"
Right click on the element(or text) itself and select copy xpath
Selenium builder will also provide you with the xpath just by clicking on the link but it will set the command clickElementAttribute you will need to change this.
The order I took to target a drop down menu item in selenium builder is listed below:
get [www.myHomePage.com]
verifyTextPresent [visible menu link]
storeElementAttribute locator [xpath to hidden item], attribute name href, variable link
verifyElementAttribute locator [xpath to hidden item], attribute name href, variable ${link}
get ${link}
waitForCurrentUrl [the/url/you/are/targeting]
Please note link and ${link} are variables and should be written as they are written above. You could use the same technique for a rotating banner, alternatively you could use the command waitForTextPresent the clickElementAttribute