Last active
December 22, 2015 15:39
-
-
Save jbgutierrez/6494058 to your computer and use it in GitHub Desktop.
Mental mapping code smell
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>Mental mapping code smell</title> | |
<style> | |
.language-flag { | |
float: left; | |
} | |
</style> | |
</head> | |
<body> | |
<div> | |
<span>Current language</span> | |
<img src="{baseImagePath}/flag-{languageCode}_{storeCode}.jpg"></img> | |
</div> | |
<div> | |
<span>Available languages</span> | |
<ul id="available-flags"></ul> | |
</div> | |
<script> | |
(function(){ | |
var g = core.globals; | |
core.ajax.requestJson({ | |
url: '/rest/store/' + g.storeId, | |
params: { | |
languageId: g.languageId | |
}, | |
success: function(store) { | |
var TMPL = '<li><img src="{baseImagePath}/flag-{languageCode}_{storeCode}.jpg"></img></li>', | |
html = store.languages.map(function(language){ | |
return TMPL.substitute({ | |
baseImagePath: g.baseImagePath, | |
languageCode: language.code, | |
storeCode: g.storeCode | |
}); | |
}); | |
core.dom.findById("available-flags").innerHtml = html; | |
} | |
}); | |
})(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment