Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x

This commit is contained in:
Evan Prodromou 2010-01-02 21:35:46 -10:00
commit de74c64490
5 changed files with 85 additions and 23 deletions

View File

@ -52,7 +52,9 @@ var SN = { // StatusNet
NoticeLocationId: 'notice_data-location_id', NoticeLocationId: 'notice_data-location_id',
NoticeLocationNs: 'notice_data-location_ns', NoticeLocationNs: 'notice_data-location_ns',
NoticeLocationName: 'notice_data-location_name', NoticeLocationName: 'notice_data-location_name',
NoticeLocationCookieName: 'location_enabled' NoticeLocationCookieName: 'location_enabled',
NoticeDataGeo: 'notice_data-geo',
NoticeDataGeoSelected: 'notice_data-geo_selected'
} }
}, },
@ -433,34 +435,63 @@ var SN = { // StatusNet
$('#'+SN.C.S.NoticeDataAttachSelected+' button').click(function(){ $('#'+SN.C.S.NoticeDataAttachSelected+' button').click(function(){
$('#'+SN.C.S.NoticeDataAttachSelected).remove(); $('#'+SN.C.S.NoticeDataAttachSelected).remove();
NDA.val(''); NDA.val('');
return false;
}); });
}); });
}, },
NoticeLocationAttach: function() { NoticeLocationAttach: function() {
if ($('#notice_data-location_enabled').length > 0) { var NDG = $('#'+SN.C.S.NoticeDataGeo);
if (NDG.length > 0) {
var NLE = $('#notice_data-location_wrap'); var NLE = $('#notice_data-location_wrap');
var geocodeURL = NLE.attr('title'); var geocodeURL = NLE.attr('title');
NLE.insertAfter('#'+SN.C.S.FormNotice+' fieldset'); $('label[for=notice_data-geo]').attr('title', NLE.text());
if (navigator.geolocation) { if (navigator.geolocation) {
NLE.change(function() { NDG.change(function() {
NLE.removeAttr('title'); NLE.removeAttr('title');
$.cookie(SN.C.S.NoticeLocationCookieName, $('#notice_data-location_enabled').attr('checked')); $.cookie(SN.C.S.NoticeLocationCookieName, $('#'+SN.C.S.NoticeDataGeo).attr('checked'));
var NLN = $('#'+SN.C.S.NoticeLocationName); var NLN = $('#'+SN.C.S.NoticeLocationName);
if (NLN.length > 0) { if (NLN.length > 0) {
NLN.remove(); NLN.remove();
} }
NLE.prepend('<span id="'+SN.C.S.NoticeLocationName+'">Geo</span>'); var S = '<div id="'+SN.C.S.NoticeDataGeoSelected+'" class="'+SN.C.S.Success+'"/>';
NDGS = $('#'+SN.C.S.NoticeDataGeoSelected);
if (NDGS.length > 0) {
NDGS.replaceWith(S);
}
else {
$('#'+SN.C.S.FormNotice).append(S);
}
NDGS = $('#'+SN.C.S.NoticeDataGeoSelected);
NDGS.prepend('<span id="'+SN.C.S.NoticeLocationName+'">Geo</span>');
NLN = $('#'+SN.C.S.NoticeLocationName); NLN = $('#'+SN.C.S.NoticeLocationName);
if ($('#notice_data-location_enabled').attr('checked') === true) { if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true) {
NLN.show();
NLN.addClass('processing'); NLN.addClass('processing');
$('label[for=notice_data-geo]').addClass('checked');
NDGS.append('<button class="minimize">&#95;</button> <button class="close">&#215;</button>');
$('#'+SN.C.S.NoticeDataGeoSelected+' button.close').click(function(){
$('#'+SN.C.S.NoticeDataGeoSelected).remove();
$('#'+SN.C.S.NoticeDataGeo).attr('checked', false);
$('label[for=notice_data-geo]').removeClass('checked');
return false;
});
$('#'+SN.C.S.NoticeDataGeoSelected+' button.minimize').click(function(){
$('#'+SN.C.S.NoticeDataGeoSelected).hide();
return false;
});
navigator.geolocation.getCurrentPosition(function(position) { navigator.geolocation.getCurrentPosition(function(position) {
$('#'+SN.C.S.NoticeLat).val(position.coords.latitude); $('#'+SN.C.S.NoticeLat).val(position.coords.latitude);
@ -497,7 +528,8 @@ var SN = { // StatusNet
}); });
} }
else { else {
NLN.hide(); $('label[for=notice_data-geo]').removeClass('checked');
NDGS.hide();
$('#'+SN.C.S.NoticeLat).val(''); $('#'+SN.C.S.NoticeLat).val('');
$('#'+SN.C.S.NoticeLon).val(''); $('#'+SN.C.S.NoticeLon).val('');
$('#'+SN.C.S.NoticeLocationNs).val(''); $('#'+SN.C.S.NoticeLocationNs).val('');
@ -506,8 +538,8 @@ var SN = { // StatusNet
}); });
var cookieVal = $.cookie(SN.C.S.NoticeLocationCookieName); var cookieVal = $.cookie(SN.C.S.NoticeLocationCookieName);
$('#notice_data-location_enabled').attr('checked', (cookieVal == null || cookieVal == 'true')); NDG.attr('checked', (cookieVal == null || cookieVal == 'true'));
NLE.change(); NDG.change();
} }
} }
}, },

View File

@ -208,9 +208,8 @@ class NoticeForm extends Form
$this->out->hidden('notice_data-location_ns', empty($this->location_ns) ? (empty($this->profile->location_ns) ? null : $this->profile->location_ns) : $this->location_ns, 'location_ns'); $this->out->hidden('notice_data-location_ns', empty($this->location_ns) ? (empty($this->profile->location_ns) ? null : $this->profile->location_ns) : $this->location_ns, 'location_ns');
$this->out->elementStart('div', array('id' => 'notice_data-location_wrap', $this->out->elementStart('div', array('id' => 'notice_data-location_wrap',
'class' => 'success',
'title' => common_local_url('geocode'))); 'title' => common_local_url('geocode')));
$this->out->checkbox('notice_data-location_enabled', _('Share your location'), true); $this->out->checkbox('notice_data-geo', _('Share your location'), true);
$this->out->elementEnd('div'); $this->out->elementEnd('div');
} }

View File

@ -554,34 +554,54 @@ width:81.5%;
margin-bottom:0; margin-bottom:0;
line-height:1.618; line-height:1.618;
} }
.form_notice #notice_data-attach_selected code { .form_notice #notice_data-attach_selected code,
.form_notice #notice_data-location_name {
float:left; float:left;
width:90%; width:80%;
display:block; display:block;
font-size:1.1em;
line-height:1.8; line-height:1.8;
overflow:auto; overflow:auto;
margin-right:2.5%;
} }
.form_notice #notice_data-attach_selected button { .form_notice #notice_data-attach_selected code {
font-size:1.1em;
}
.form_notice #notice_data-attach_selected button.close,
.form_notice #notice_data-geo_selected button.close {
float:right; float:right;
font-size:0.8em; font-size:0.8em;
} }
.form_notice #notice_data-location_wrap input { ,
margin-right:7px; .form_notice #notice_data-geo_selected button.minimize {
float:left; float:left;
top:3px; }
.form_notice #notice_data-location_wrap label {
position:absolute;
top:25px;
right:4px;
left:auto;
cursor:pointer;
width:16px;
height:16px;
display:block;
}
.form_notice #notice_data-location_wrap input {
display:none;
} }
.form_notice #notice_data-location_wrap label { .form_notice #notice_data-location_wrap label {
font-weight:normal; font-weight:normal;
font-size:1em; font-size:1em;
margin-bottom:0;
text-indent:-9999px;
} }
.form_notice #notice_data-location_name { .form_notice #notice_data-location_name {
display:block; display:block;
line-height:1.6;
padding-left:21px; padding-left:21px;
} }
button.close { button.close,
button.minimize {
width:16px; width:16px;
height:16px; height:16px;
text-indent:-9999px; text-indent:-9999px;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -117,6 +117,12 @@ background-position:0 47%;
.form_notice a#notice_data-location_name { .form_notice a#notice_data-location_name {
background-position:0 -1711px; background-position:0 -1711px;
} }
.form_notice label[for=notice_data-geo] {
background-position:0 -1780px;
}
.form_notice label[for=notice_data-geo].checked {
background-position:0 -1846px;
}
a, a,
.form_settings input.form_action-primary, .form_settings input.form_action-primary,
@ -185,7 +191,9 @@ button.close,
.entity_silence input.submit, .entity_silence input.submit,
.entity_delete input.submit, .entity_delete input.submit,
.notice-options .repeated, .notice-options .repeated,
.form_notice a#notice_data-location_name { .form_notice a#notice_data-location_name,
.form_notice label[for=notice_data-geo],
button.minimize {
background-image:url(../../base/images/icons/icons-01.gif); background-image:url(../../base/images/icons/icons-01.gif);
background-repeat:no-repeat; background-repeat:no-repeat;
background-color:transparent; background-color:transparent;
@ -246,6 +254,9 @@ background-color:#EFF3DC;
button.close { button.close {
background-position:0 -1120px; background-position:0 -1120px;
} }
button.minimize {
background-position:0 -1912px;
}
#anon_notice { #anon_notice {
background-color:#87B4C8; background-color:#87B4C8;