psc-cms-js
Advanced tools
Comparing version 1.4.0-c7e710b to 1.4.0-e14fdf0
@@ -38,3 +38,3 @@ define(['joose', 'Psc/UI/Button', 'CoMun/City', 'CoMun/Curver', 'CoMun/Relation', 'Psc/Code', 'Psc/UI/Group', 'Psc/UI/WidgetWrapper', 'Psc/EventDispatching'], function(Joose) { | ||
}, | ||
after: { | ||
@@ -44,10 +44,10 @@ initialize: function(props) { | ||
this.linkWidget(); | ||
if (props.main) { | ||
props.main.getEventManager().triggerEvent('collapse-right'); // pli-pla-platz | ||
//props.main.getEventManager().triggerEvent('collapse-right'); // pli-pla-platz | ||
} | ||
// das zuerst damit | ||
this.initUI(); | ||
// das darüber liegen kann | ||
@@ -60,57 +60,68 @@ this.$$curver = new CoMun.Curver({ | ||
}); | ||
this.$$eventManager.setLogging(true); | ||
} | ||
}, | ||
methods: { | ||
initUI: function () { | ||
initUI: function() { | ||
var that = this; | ||
//this.unwrap().append( | ||
//this.$$img = $('<img class="map" />').attr('src', this.$$imgUrlBlank) | ||
//this.$$img = $('<img class="map" />').attr('src', this.$$imgUrlBlank) | ||
//); | ||
this.unwrap().find('.info-left, .info-bottom, .info-right').css('opacity', 0.8); | ||
if (this.$$editMode) { | ||
this.unwrap().find('.info-left, .info-bottom, .info-right, .control-layer').remove(); | ||
that.unwrap() | ||
.css('width','100%') | ||
.css('height',1200) | ||
.css('background-image', 'url('+this.$$imgUrlBlank+')') | ||
.css('background-repeat', 'no-repeat'); | ||
.css('width', '100%') | ||
.css('height', 1200) | ||
.css('background-image', 'url(' + this.$$imgUrlBlank + ')') | ||
.css('background-repeat', 'no-repeat'); | ||
var $overlay = $('<img class="overlay" src="' + this.$$imgUrlOverlay + '" />'); | ||
$overlay.css('position', 'absolute'); | ||
that.unwrap().prepend($overlay); | ||
} else { | ||
this.unwrap().find('.info-left, .info-bottom, .info-right').css('opacity', 0.8); | ||
that.unwrap() | ||
.css('width','920px') | ||
.css('height','836px') | ||
.css('background-image', 'url('+this.$$imgUrlBlank+')') | ||
.css('background-repeat', 'no-repeat'); | ||
.css('width', '920px') | ||
.css('height','748px') | ||
.css('background-image', 'url(' + this.$$imgUrlBlank + ')') | ||
.css('background-repeat', 'no-repeat'); | ||
} | ||
if (this.$$editMode) { | ||
this.unwrap().addClass('psc-cms-ui-serializable'); | ||
// temporärer switchbutton für die platzierung: | ||
var switchButton = new Psc.UI.Button({label: 'toggle Städte'}); | ||
var switchButton = new Psc.UI.Button({ | ||
label: 'view cities' | ||
}); | ||
this.unwrap().append( | ||
switchButton | ||
.create() | ||
.addClass('switch-map') | ||
.create() | ||
.addClass('switch-map') | ||
); | ||
this.getSwitchButton().on('click', function (e) { | ||
var img = that.unwrap(); | ||
this.getSwitchButton().on('click', function(e) { | ||
e.preventDefault(); | ||
if (img.css('background-image') === 'url('+that.getImgUrlBlank()+')') { | ||
img.css('background-image', 'url('+this.$$imgUrl+')'); | ||
} else { | ||
img.css('background-image', 'url('+this.$$imgUrlBlank+')'); | ||
} | ||
that.unwrap().find('.overlay').toggle(); | ||
}); | ||
} | ||
// städte | ||
this.initCities(); | ||
if (this.$$editMode && this.$$controlWidget) { | ||
if (this.$$controlWidget.hasClass('psc-cms-ui-accordion')) { | ||
@@ -121,19 +132,19 @@ this.on('relation-active', function(e) { | ||
} | ||
this.initControlWidget(); | ||
} | ||
this.initHandlers(); | ||
}, | ||
initHandlers: function () { | ||
initHandlers: function() { | ||
var that = this; | ||
this.unwrap().on('mouseenter', 'area', function (e) { | ||
this.unwrap().on('mouseenter', 'area', function(e) { | ||
var position = $(this).attr('alt'); | ||
that.showInfo(position); | ||
}); | ||
this.unwrap().on('mouseleave', 'area', function (e) { | ||
this.unwrap().on('mouseleave', 'area', function(e) { | ||
var position = $(this).attr('alt'); | ||
@@ -143,6 +154,6 @@ that.hideInfo(position); | ||
}, | ||
initCities: function() { | ||
var that = this; | ||
//var city = function(name, x, y, labelPosition) { | ||
@@ -161,3 +172,3 @@ // return new CoMun.City({ | ||
var city; | ||
for(var i = 0, l = this.$$cities.length; i < l; i++) { | ||
for (var i = 0, l = this.$$cities.length; i < l; i++) { | ||
city = this.$$cities[i]; | ||
@@ -168,25 +179,33 @@ city.setWidget(this.unwrap()); | ||
city.draw(); | ||
//city.disableDragging(); | ||
} | ||
}, | ||
initControlWidget: function() { | ||
var that = this, | ||
$control = this.$$controlWidget.find('.map-control'), | ||
$relationContainer = this.$$controlWidget.find('.map-relation'); | ||
$control = this.$$controlWidget.find('.map-control'), | ||
$relationContainer = this.$$controlWidget.find('.map-relation'); | ||
var selectContainers = { | ||
german: new Psc.UI.Group({label: 'Deutsche Städte'}), | ||
other: new Psc.UI.Group({label: 'Partner Städte'}) | ||
german: new Psc.UI.Group({ | ||
label: 'Deutsche Städte' | ||
}), | ||
other: new Psc.UI.Group({ | ||
label: 'Partner Städte' | ||
}) | ||
}; | ||
$control.append(selectContainers.german.html()); | ||
$control.append(selectContainers.other.html()); | ||
selectContainers.german.getContentTag().append(this.$$el['selects.german'] = this.createCitySelect('german')); | ||
selectContainers.german.getContentTag().append(this.$$el['selects.german'] = this.createCitySelect('german')); | ||
selectContainers.other.getContentTag().append(this.$$el['selects.other'] = this.createCitySelect('other')); | ||
var $editButton; | ||
$control.append($editButton = (new Psc.UI.Button({label: 'bearbeiten','leftIcon':'wrench'})).create()); | ||
$editButton.on('click', function (e) { | ||
$control.append($editButton = (new Psc.UI.Button({ | ||
label: 'bearbeiten', | ||
'leftIcon': 'wrench' | ||
})).create()); | ||
$editButton.on('click', function(e) { | ||
e.preventDefault(); | ||
@@ -200,13 +219,14 @@ that.createAndChangeActiveRelation( | ||
getSelect: function(type) { | ||
return this.$$el['selects.'+type]; | ||
return this.$$el['selects.' + type]; | ||
}, | ||
/** | ||
* Triggered, dass das Info-Popup angezeigt werden soll | ||
* | ||
* | ||
* @param position bottom|left|right | ||
*/ | ||
showInfo: function (position) { | ||
var $info = this.unwrap().find('.info-'+position), that = this; | ||
showInfo: function(position) { | ||
var $info = this.unwrap().find('.info-' + position), | ||
that = this; | ||
if (this.$$hideTimers[position]) { | ||
@@ -216,5 +236,5 @@ window.clearTimeout(this.$$hideTimers[position]); | ||
} | ||
if (!this.$$showTimers[position]) { | ||
this.$$showTimers[position] = window.setTimeout(function () { | ||
this.$$showTimers[position] = window.setTimeout(function() { | ||
$info.stop().show('fade', {}, 200); | ||
@@ -226,4 +246,5 @@ that.$$showTimers[position] = undefined; | ||
hideInfo: function(position) { | ||
var $info = this.unwrap().find('.info-'+position), that = this; | ||
var $info = this.unwrap().find('.info-' + position), | ||
that = this; | ||
if (this.$$showTimer) { | ||
@@ -233,5 +254,5 @@ window.clearTimeout(this.$$showTimers[position]); | ||
} | ||
if (!this.$$hideTimers[position]) { | ||
this.$$hideTimers[position] = window.setTimeout(function () { | ||
this.$$hideTimers[position] = window.setTimeout(function() { | ||
$info.stop().hide('fade', {}, 200); | ||
@@ -243,32 +264,33 @@ that.$$hideTimers[position] = undefined; | ||
createAndChangeActiveRelation: function(id1, id2) { | ||
var germanCity = this.city(id1), otherCity = this.city(id2); | ||
var relation = this.relation(germanCity,otherCity); | ||
var germanCity = this.city(id1), | ||
otherCity = this.city(id2); | ||
var relation = this.relation(germanCity, otherCity); | ||
this.changeActiveRelation(relation); | ||
}, | ||
changeActiveRelation: function (relation) { | ||
changeActiveRelation: function(relation) { | ||
this.$$activeRelation = relation; | ||
this._trigger('relation-active', [relation]); | ||
}, | ||
createCitySelect: function(type) { | ||
var $select = $('<select class="city-select"></select>'); | ||
var city; | ||
for(var i = 0, l = this.$$cities.length; i < l; i++) { | ||
for (var i = 0, l = this.$$cities.length; i < l; i++) { | ||
city = this.$$cities[i]; | ||
if (city.getType() === type) { | ||
$select.append('<option value="'+city.getId()+'">'+city.getName()+'</option>'); | ||
$select.append('<option value="' + city.getId() + '">' + city.getName() + '</option>'); | ||
} | ||
} | ||
return $select; | ||
}, | ||
city: function(id) { | ||
@@ -278,6 +300,6 @@ if (Psc.Code.isInstanceOf(id, CoMun.City)) { | ||
} | ||
var city; | ||
for(var i = 0, l = this.$$cities.length; i < l; i++) { | ||
for (var i = 0, l = this.$$cities.length; i < l; i++) { | ||
city = this.$$cities[i]; | ||
@@ -288,6 +310,6 @@ if (city.getId() === id) { | ||
} | ||
return undefined; | ||
}, | ||
relation: function(germanCity, otherCity) { | ||
@@ -300,7 +322,7 @@ var ownRelations, relation; | ||
} | ||
if (ownRelations[otherCity.getId()]) { | ||
return ownRelations[otherCity.getId()]; | ||
} | ||
// geht das wohl so? setting by ref? | ||
@@ -312,33 +334,35 @@ ownRelations[otherCity.getId()] = relation = new CoMun.Relation({ | ||
}); | ||
relation.draw(this.$$curver); | ||
return relation; | ||
}, | ||
getRelationColor: function() { | ||
return "hsb(.8, .75, .75)"; | ||
}, | ||
serialize: function (data) { | ||
serialize: function(data) { | ||
data.cities = []; | ||
var city; | ||
for(var i = 0, l = this.$$cities.length; i < l; i++) { | ||
for (var i = 0, l = this.$$cities.length; i < l; i++) { | ||
city = this.$$cities[i]; | ||
data.cities.push(city.serialize()); | ||
} | ||
Psc.Code.debug('map serialized cities', data.cities); | ||
return data; | ||
}, | ||
getSwitchButton: function () { | ||
getSwitchButton: function() { | ||
return this.unwrap().find('button.switch-map'); | ||
}, | ||
_trigger: function (eventName, data) { | ||
return this.$$eventManager.triggerEvent(eventName, {map: this}, data); | ||
_trigger: function(eventName, data) { | ||
return this.$$eventManager.triggerEvent(eventName, { | ||
map: this | ||
}, data); | ||
}, | ||
toString: function() { | ||
@@ -345,0 +369,0 @@ return "[CoMun.WebsiteMap]"; |
@@ -62,3 +62,3 @@ /* global requirejs */ | ||
'jquery-tmpl': "../vendor/jquery-tmpl/jquery.tmpl", | ||
'jqwidgets': "../vendor/jqwidgets/jqx-all.min", | ||
'jqwidgets': "../vendor/jqwidgets/jqx.custom.min", | ||
'jquery-simulate': "../vendor/jquery-simulate/jquery.simulate.patched", | ||
@@ -65,0 +65,0 @@ 'jquery-rangyinputs': "../vendor/jquery-rangyinputs/rangyinputs_jquery.min", |
@@ -24,3 +24,3 @@ define(['joose', 'Psc/Code'], function(Joose) { | ||
Psc.Code.group('Loader'); | ||
Psc.Code.info('scheduling '+jobsNum+' Jobs'); | ||
Psc.Code.info('scheduling/executing '+jobsNum+' Jobs'); | ||
@@ -27,0 +27,0 @@ var complete = function () { |
@@ -33,2 +33,10 @@ define(['joose', 'jquery'], function(Joose, $) { | ||
return "„"+this.$$content+"“ ("+this.$$number+")"; | ||
}, | ||
asString: function() { | ||
if (!this.$$content) { | ||
return '[tiptoi.Sound]'; | ||
} | ||
return "„"+this.$$content+"“ ("+this.$$number+")"; | ||
} | ||
@@ -35,0 +43,0 @@ } |
@@ -33,6 +33,13 @@ define(['joose', 'Psc/Code', 'tiptoi/cpu', 'Psc/Exception'], function(Joose) { | ||
'play-sounds': function (e, sounds, soundType) { | ||
output(sounds.join("\n + "), e.type, [soundType]); | ||
var soundTexts = []; | ||
for (var i = 0, sound; i < sounds.length; i++) { | ||
sound = sounds[i]; | ||
soundTexts.push(sound.asString()); | ||
} | ||
output(soundTexts.join("\n + "), e.type, [soundType]); | ||
}, | ||
'play-sound': function (e, sound, soundType) { | ||
output(sound.toString(), e.type, [soundType]); | ||
output(sound.asString(), e.type, [soundType]); | ||
}, | ||
@@ -39,0 +46,0 @@ |
@@ -18,3 +18,3 @@ { | ||
}, | ||
"version": "1.4.0-c7e710b", | ||
"version": "1.4.0-e14fdf0", | ||
"config": { | ||
@@ -21,0 +21,0 @@ "branch-alias": { |
19031625
1295
352247