Renommage projet en Pitaya
This commit is contained in:
50
js/app.js
50
js/app.js
@ -1,4 +1,4 @@
|
||||
(function(Papaye, window) {
|
||||
(function(Pitaya, window) {
|
||||
|
||||
"use strict";
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
var minimist = require('minimist');
|
||||
|
||||
// Load templates
|
||||
var itemsListTpl = Handlebars.compile(Papaye.DOM.select('#items-list-tpl').innerHTML);
|
||||
var itemsListTpl = Handlebars.compile(Pitaya.DOM.select('#items-list-tpl').innerHTML);
|
||||
|
||||
// Internal constants
|
||||
var DEFAULT_PROFILE = './default-profile.json';
|
||||
@ -20,19 +20,19 @@
|
||||
* Start the app
|
||||
*
|
||||
* @param rootEl The application root element selector
|
||||
* @return Papaye
|
||||
* @return Pitaya
|
||||
*/
|
||||
Papaye.start = function(rootEl) {
|
||||
Pitaya.start = function(rootEl) {
|
||||
|
||||
Papaye._opts = minimist(gui.App.argv);
|
||||
Papaye._rootEl = Papaye.DOM.select(rootEl);
|
||||
Papaye._initListeners();
|
||||
Pitaya._opts = minimist(gui.App.argv);
|
||||
Pitaya._rootEl = Pitaya.DOM.select(rootEl);
|
||||
Pitaya._initListeners();
|
||||
|
||||
var profilePath = Papaye._opts.profile || DEFAULT_PROFILE;
|
||||
var profilePath = Pitaya._opts.profile || DEFAULT_PROFILE;
|
||||
|
||||
return Papaye.loadProfile(profilePath)
|
||||
return Pitaya.loadProfile(profilePath)
|
||||
.then(function() {
|
||||
return Papaye;
|
||||
return Pitaya;
|
||||
})
|
||||
;
|
||||
|
||||
@ -44,11 +44,11 @@
|
||||
* @param profilePath The path of the profile file
|
||||
* @return Promise
|
||||
*/
|
||||
Papaye.loadProfile = function(profilePath) {
|
||||
return Papaye._loadJSONFile(profilePath)
|
||||
Pitaya.loadProfile = function(profilePath) {
|
||||
return Pitaya._loadJSONFile(profilePath)
|
||||
.then(function(profile) {
|
||||
Papaye._profile = profile;
|
||||
Papaye.render();
|
||||
Pitaya._profile = profile;
|
||||
Pitaya.render();
|
||||
return profile;
|
||||
})
|
||||
;
|
||||
@ -57,11 +57,11 @@
|
||||
/**
|
||||
* Update the application view
|
||||
*
|
||||
* @return Papaye
|
||||
* @return Pitaya
|
||||
*/
|
||||
Papaye.render = function() {
|
||||
var rootEl = Papaye._rootEl;
|
||||
var profile = Papaye._profile;
|
||||
Pitaya.render = function() {
|
||||
var rootEl = Pitaya._rootEl;
|
||||
var profile = Pitaya._profile;
|
||||
rootEl.innerHTML = itemsListTpl(profile);
|
||||
};
|
||||
|
||||
@ -70,19 +70,19 @@
|
||||
* Initialize DOM event listeners
|
||||
* @private
|
||||
*/
|
||||
Papaye._initListeners = function() {
|
||||
var rootEl = Papaye._rootEl;
|
||||
rootEl.addEventListener('click', Papaye._onItemClick);
|
||||
Pitaya._initListeners = function() {
|
||||
var rootEl = Pitaya._rootEl;
|
||||
rootEl.addEventListener('click', Pitaya._onItemClick);
|
||||
};
|
||||
|
||||
/**
|
||||
* App item click handler
|
||||
* @private
|
||||
*/
|
||||
Papaye._onItemClick = function(evt) {
|
||||
Pitaya._onItemClick = function(evt) {
|
||||
|
||||
var appItemEl = evt.srcElement.matches( '.app-item') ? evt.srcElement :
|
||||
Papaye.DOM.getClosestAncestor(evt.srcElement, '.app-item')
|
||||
Pitaya.DOM.getClosestAncestor(evt.srcElement, '.app-item')
|
||||
;
|
||||
|
||||
if( !appItemEl ) return;
|
||||
@ -109,7 +109,7 @@
|
||||
* @param filePath The path of the json file
|
||||
* @return Promise
|
||||
*/
|
||||
Papaye._loadJSONFile = function(filePath) {
|
||||
Pitaya._loadJSONFile = function(filePath) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
fs.readFile(filePath, 'utf8', function(err, fileContent) {
|
||||
if(err) return reject(err);
|
||||
@ -123,4 +123,4 @@
|
||||
});
|
||||
};
|
||||
|
||||
}(window.Papaye = window.Papaye || {}, window));
|
||||
}(window.Pitaya = window.Pitaya || {}, window));
|
||||
|
@ -1,8 +1,8 @@
|
||||
(function(Papaye, window) {
|
||||
(function(Pitaya, window) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var DOM = Papaye.DOM = {};
|
||||
var DOM = Pitaya.DOM = {};
|
||||
|
||||
/**
|
||||
* Select an element in the DOM by its CSS selector
|
||||
@ -50,4 +50,4 @@
|
||||
};
|
||||
|
||||
|
||||
}(window.Papaye = window.Papaye || {}, window));
|
||||
}(window.Pitaya = window.Pitaya || {}, window));
|
||||
|
Reference in New Issue
Block a user