Commit 5358f78e authored by Brion Vibber's avatar Brion Vibber

Reusable notice form fixes for geolocation

parent 9689bda2
......@@ -990,7 +990,7 @@ var SN = { // StatusNet
var NLN = ''; // @fixme
var NDGe = form.find('[name=notice_data-geo]');
var check = form.find('[name=notice_data-geo]');
var label = $('label[for='+check.attr('id')+']');
var label = form.find('label.notice_data-geo');
function removeNoticeDataGeo(error) {
label
......@@ -1164,7 +1164,6 @@ var SN = { // StatusNet
*/
NoticeGeoStatus: function(form, status, lat, lon, url)
{
var form = $('#form_notice');
var wrapper = form.find('.geo_status_wrapper');
if (wrapper.length == 0) {
wrapper = $('<div class="'+SN.C.S.Success+' geo_status_wrapper"><button class="close" style="float:right">&#215;</button><div class="geo_status"></div></div>');
......
......@@ -94,6 +94,8 @@ class NoticeForm extends Form
function __construct($out=null, $action=null, $content=null, $user=null, $inreplyto=null, $lat=null, $lon=null, $location_id=null, $location_ns=null)
{
$this->id_suffix = time();
parent::__construct($out);
$this->action = $action;
......@@ -125,7 +127,7 @@ class NoticeForm extends Form
function id()
{
return 'form_notice';
return 'form_notice_' . $this->id_suffix;
}
/**
......@@ -208,7 +210,21 @@ class NoticeForm extends Form
$this->out->elementStart('div', array('class' => 'notice_data-geo_wrap',
'title' => common_local_url('geocode')));
$this->out->checkbox('notice_data-geo', _('Share my location'), true);
// @fixme checkbox method allows no way to change the id without changing the name
//$this->out->checkbox('notice_data-geo', _('Share my location'), true);
$this->out->element('input', array(
'name' => 'notice_data-geo',
'type' => 'checkbox',
'class' => 'checkbox',
'id' => $this->id() . '-notice_data-geo',
'checked' => true, // ?
));
$this->out->text(' ');
$this->out->element('label', array('class' => 'notice_data-geo',
'for' => $this->id() . '-notice_data-geo'),
_('Share my location'));
$this->out->elementEnd('div');
$this->out->inlineScript(' var NoticeDataGeo_text = {'.
'ShareDisable: ' .json_encode(_('Do not share my location')).','.
......
......@@ -19,7 +19,7 @@ display:none;
.realtime-popup #form_notice label[for=notice_data-attach],
.realtime-popup #form_notice #notice_data-attach,
.realtime-popup #form_notice label[for=notice_data-geo] {
.realtime-popup #form_notice label.notice_data-geo {
top:0;
}
......
......@@ -118,10 +118,10 @@ box-shadow:3px 3px 3px rgba(194, 194, 194, 0.1);
text-shadow:none;
}
.form_notice label[for=notice_data-geo] {
.form_notice label.notice_data-geo {
background-position:0 -1780px;
}
.form_notice label[for=notice_data-geo].checked {
.form_notice label.notice_data-geo.checked {
background-position:0 -1846px;
}
......@@ -216,7 +216,7 @@ button.close,
.entity_role_administrator input.submit,
.entity_role_moderator input.submit,
.notice-options .repeated,
.form_notice label[for=notice_data-geo],
.form_notice label.notice_data-geo,
button.minimize,
.form_reset_key input.submit,
.entity_clear input.submit,
......
......@@ -1636,7 +1636,7 @@ button.close,
.entity_silence input.submit,
.entity_delete input.submit,
.notice-options .repeated,
.form_notice label[for=notice_data-geo],
.form_notice label.notice_data-geo,
button.minimize,
.form_reset_key input.submit,
.entity_clear input.submit,
......@@ -1746,10 +1746,10 @@ background-position:0 47%;
.form_notice a#notice_data-geo_name {
background-position:0 -1711px;
}
.form_notice label[for=notice_data-geo] {
.form_notice label.notice_data-geo {
background-position:0 -1780px;
}
.form_notice label[for=notice_data-geo].checked {
.form_notice label.notice_data-geo.checked {
background-position:0 -1846px;
}
......
......@@ -116,10 +116,10 @@ box-shadow:3px 3px 3px rgba(194, 194, 194, 0.1);
text-shadow:none;
}
.form_notice label[for=notice_data-geo] {
.form_notice label.notice_data-geo {
background-position:0 -1780px;
}
.form_notice label[for=notice_data-geo].checked {
.form_notice label.notice_data-geo.checked {
background-position:0 -1846px;
}
......@@ -196,7 +196,7 @@ button.close,
.entity_role_administrator input.submit,
.entity_role_moderator input.submit,
.notice-options .repeated,
.form_notice label[for=notice_data-geo],
.form_notice label.notice_data-geo,
button.minimize,
.form_reset_key input.submit,
.entity_clear input.submit,
......
......@@ -117,10 +117,10 @@ box-shadow:3px 3px 3px rgba(194, 194, 194, 0.1);
text-shadow:none;
}
.form_notice label[for=notice_data-geo] {
.form_notice label.notice_data-geo {
background-position:0 -1780px;
}
.form_notice label[for=notice_data-geo].checked {
.form_notice label.notice_data-geo.checked {
background-position:0 -1846px;
}
......@@ -197,7 +197,7 @@ button.close,
.entity_role_administrator input.submit,
.entity_role_moderator input.submit,
.notice-options .repeated,
.form_notice label[for=notice_data-geo],
.form_notice label.notice_data-geo,
button.minimize,
.form_reset_key input.submit,
.entity_clear input.submit,
......
......@@ -271,7 +271,7 @@ button.close,
.entity_role_administrator input.submit,
.entity_role_moderator input.submit,
.notice-options .repeated,
.form_notice label[for=notice_data-geo],
.form_notice label.notice_data-geo,
button.minimize,
.form_reset_key input.submit,
.entity_clear input.submit,
......@@ -286,10 +286,10 @@ button.minimize,
background-color:transparent;
}
.form_notice label[for=notice_data-geo] {
.form_notice label.notice_data-geo {
background-position:0 -1780px;
}
.form_notice label[for=notice_data-geo].checked {
.form_notice label.notice_data-geo.checked {
background-position:0 -1846px;
}
.form_notice label[for=notice_data-attach] {
......
......@@ -84,10 +84,10 @@ box-shadow:3px 3px 3px rgba(194, 194, 194, 0.1);
text-shadow:none;
}
.form_notice label[for=notice_data-geo] {
.form_notice label.notice_data-geo {
background-position:0 -1780px;
}
.form_notice label[for=notice_data-geo].checked {
.form_notice label.notice_data-geo.checked {
background-position:0 -1846px;
}
......@@ -233,7 +233,7 @@ button.close,
.entity_silence input.submit,
.entity_delete input.submit,
.notice-options .repeated,
.form_notice label[for=notice_data-geo],
.form_notice label.notice_data-geo,
button.minimize,
.form_reset_key input.submit,
.entity_clear input.submit,
......
......@@ -1771,7 +1771,7 @@ button.close,
.entity_role_administrator input.submit,
.entity_role_moderator input.submit,
.notice-options .repeated,
.form_notice label[for=notice_data-geo],
.form_notice label.notice_data-geo,
button.minimize,
.form_reset_key input.submit,
.entity_clear input.submit,
......@@ -1924,10 +1924,10 @@ background-position:0 -1054px;
.form_notice label[for=notice_data-attach] {
background-position: 0 -328px;
}
.form_notice label[for=notice_data-geo] {
.form_notice label.notice_data-geo {
background-position: 0 -1780px;
}
.form_notice label[for=notice_data-geo].checked {
.form_notice label.notice_data-geo.checked {
background-position: 0 -1846px;
}
......
......@@ -294,10 +294,10 @@ input.submit:focus {
text-shadow:none;
}
.form_notice label[for=notice_data-geo] {
.form_notice label.notice_data-geo {
background-position:0 -1780px;
}
.form_notice label[for=notice_data-geo].checked {
.form_notice label.notice_data-geo.checked {
background-position:0 -1846px;
}
......@@ -373,7 +373,7 @@ button.close,
.entity_role_administrator input.submit,
.entity_role_moderator input.submit,
.notice-options .repeated,
.form_notice label[for=notice_data-geo],
.form_notice label.notice_data-geo,
button.minimize,
.form_reset_key input.submit,
.entity_clear input.submit,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment