-
-
Save barneycarroll/5238d176a2b862a2c6f0 to your computer and use it in GitHub Desktop.
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
// MODEL | |
'use strict'; | |
var m = require('mithril'); | |
module.exports = function get_himage(){ | |
return m.request({ | |
method: 'GET', | |
url: '/config.json' | |
}) | |
.then(function (data) { | |
return data["himage"]; | |
}); | |
// COMPONENT | |
'use strict'; | |
var m = require('mithril'); | |
var get_himage = require('../models/config'); | |
var Slider = module.exports = { | |
controller: function () { | |
this.himage = get_himage() | |
}, | |
view: function (ctrl) { | |
return m("img[alt='slider image 1'][src='" + ctrl.himage() + "']") | |
}; | |
// JSON DATA | |
[ | |
"{\n\t\"title\": \"Site title name\",\n\t\"description\": \"Site description\",\n\t\"keywords\": \"Site, keywords\",\n\t\"aboutus\": \"Site about us\",\n\t\"contact\": {\n\t\t\"phones\": {\n\t\t\t\"fix1\": \"0210545665\",\n\t\t\t\"fix2\": \"0210545665\",\n\t\t\t\"mobile1\": \"0732577794\",\n\t\t\t\"mobile2\": \"0732577794\",\n\t\t\t\"mobile3\": \"0732577794\",\n\t\t\t\"fax1\": \"0210545665\",\n\t\t\t\"fax2\": \"0210545665\"\n\t\t},\n\t\t\"adresses\": {\n\t\t\t\"adress1\": \"Placeholder, A1\",\n\t\t\t\"adress2\": \"Placeholder, A2\"\n\t\t},\n\t\t\"email\": {\n\t\t\t\"email1\": \"[email protected]\",\n\t\t\t\"email2\": \"[email protected]\"\n\t\t}\n\t},\n\t\"himage\": \"style/images/slider/slide1.jpg\"\n}" | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment