forked from 0x2620/oxjs
some work on ListCalendar
This commit is contained in:
parent
2928058f87
commit
efca832c76
10 changed files with 532 additions and 192 deletions
|
|
@ -58,6 +58,7 @@ Ox.ListMap = function(options, self) {
|
|||
.css({
|
||||
width: '14px',
|
||||
height: '14px',
|
||||
borderRadius: '4px',
|
||||
marginLeft: '-3px',
|
||||
marginTop: 0
|
||||
});
|
||||
|
|
@ -343,15 +344,15 @@ Ox.ListMap = function(options, self) {
|
|||
});
|
||||
self.$placeTitle = $('<div>')
|
||||
.hide()
|
||||
.appendTo(self.$placeTitlebar.$element)
|
||||
self.$placeTitleFlag = $('<img>')
|
||||
.appendTo(self.$placeTitlebar)
|
||||
self.$placeFlag = $('<img>')
|
||||
.addClass('OxFlag')
|
||||
.attr({
|
||||
src: Ox.getImageByGeoname('icon', 16, '')
|
||||
})
|
||||
.css({float: 'left', margin: '4px'})
|
||||
.appendTo(self.$placeTitle);
|
||||
self.$placeTitleName = Ox.Label({
|
||||
self.$placeName = Ox.Label({
|
||||
title: '',
|
||||
width: 208
|
||||
})
|
||||
|
|
@ -365,7 +366,6 @@ Ox.ListMap = function(options, self) {
|
|||
self.$map.zoomToPlace();
|
||||
}
|
||||
});
|
||||
|
||||
self.$deselectPlaceButton = Ox.Button({
|
||||
title: 'close',
|
||||
tooltip: 'Done',
|
||||
|
|
@ -429,10 +429,10 @@ Ox.ListMap = function(options, self) {
|
|||
country = Ox.getCountryByGeoname(geoname),
|
||||
countryCode = country ? country.code : '',
|
||||
isResult = self.selectedPlace[0] == '_';
|
||||
self.$placeTitleFlag.attr({
|
||||
self.$placeFlag.attr({
|
||||
src: Ox.getImageByGeoname('icon', 16, geoname)
|
||||
});
|
||||
self.$placeTitleName.options({title: geoname});
|
||||
self.$placeName.options({title: geoname});
|
||||
self.$placeForm.values({countryCode: countryCode});
|
||||
if (!self.isAsync) {
|
||||
if (!isResult) {
|
||||
|
|
@ -647,7 +647,7 @@ Ox.ListMap = function(options, self) {
|
|||
})
|
||||
.bindEvent({
|
||||
resize: function(data) {
|
||||
self.$placeTitleName.options({width: data.size - 48});
|
||||
self.$placeName.options({width: data.size - 48});
|
||||
// fixme: pass width through form
|
||||
self.$placeFormItems.forEach(function($item) {
|
||||
$item.options({width: data.size - 16});
|
||||
|
|
@ -706,7 +706,7 @@ Ox.ListMap = function(options, self) {
|
|||
}
|
||||
|
||||
function editPlace(keys) {
|
||||
values = Ox.filter(self.$placeForm.values(), function(values, key) {
|
||||
var values = Ox.filter(self.$placeForm.values(), function(values, key) {
|
||||
return keys.indexOf(key) > -1;
|
||||
});
|
||||
values.id = self.selectedPlace;
|
||||
|
|
@ -724,10 +724,31 @@ Ox.ListMap = function(options, self) {
|
|||
});
|
||||
}
|
||||
|
||||
function initList(data) {
|
||||
self.$status.html(
|
||||
Ox.formatNumber(data.items) + ' Place' + (
|
||||
data.items == 1 ? '' : 's'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function openItem(data) {
|
||||
selectItem(data);
|
||||
self.$map.zoomToPlace(data.ids[0]);
|
||||
}
|
||||
|
||||
function removeItem(data) {
|
||||
var id = data.ids[0];
|
||||
// fixme: events or callback functions??
|
||||
that.triggerEvent('removeplace', {id: id});
|
||||
self.$map.removePlace(id);
|
||||
}
|
||||
|
||||
function removePlace() {
|
||||
var index;
|
||||
Ox.print('REMOVE PLACE', self.selectedPlace, index)
|
||||
if (!self.isAsync) {
|
||||
// fixme: doesn't call self.options.removePlace!
|
||||
index = Ox.getPositionById(self.options.places, self.selectedPlace);
|
||||
self.options.places.splice(index, 1);
|
||||
self.$list.options({items: Ox.clone(self.options.places)});
|
||||
|
|
@ -744,34 +765,13 @@ Ox.ListMap = function(options, self) {
|
|||
that.triggerEvent('removeplace', {id: self.selectedPlace});
|
||||
}
|
||||
|
||||
function initList(data) {
|
||||
self.$status.html(
|
||||
Ox.formatNumber(data.items) + ' Place' + (
|
||||
data.items == 1 ? '' : 's'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function openItem(data) {
|
||||
selectItem(data);
|
||||
self.$map.zoomToPlace(data.ids[0]);
|
||||
}
|
||||
|
||||
function removeItem(data) {
|
||||
var id = data.ids[0];
|
||||
that.triggerEvent('removeplace', {id: id});
|
||||
self.$map.removePlace(id);
|
||||
}
|
||||
|
||||
function selectItem(data) {
|
||||
Ox.print('selectItem', data.ids[0])
|
||||
var id = data.ids.length ? data.ids[0] : null;
|
||||
self.$map.options({selected: id});
|
||||
id && self.$map.panToPlace();
|
||||
}
|
||||
|
||||
function selectPlace(place) {
|
||||
Ox.print('selectPlace', place.id && !isResult ? [place.id] : [])
|
||||
var isResult = place.id && place.id[0] == '_';
|
||||
self.$list.options({
|
||||
selected: place.id && !isResult ? [place.id] : []
|
||||
|
|
@ -779,10 +779,10 @@ Ox.ListMap = function(options, self) {
|
|||
if (place.id) {
|
||||
//isResult && self.options.places.push(place);
|
||||
self.selectedPlace = place.id;
|
||||
self.$placeTitleFlag.attr({
|
||||
self.$placeFlag.attr({
|
||||
src: Ox.getImageByGeoname('icon', 16, place.geoname)
|
||||
});
|
||||
self.$placeTitleName.options({title: place.geoname || ''});
|
||||
self.$placeName.options({title: place.geoname || ''});
|
||||
self.$placeTitle.show();
|
||||
self.$placeForm.values(place).show();
|
||||
self.$areaKmInput.options({value: Ox.formatArea(place.area)});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue