summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2010-01-05 01:15:08 +0000
committerSarven Capadisli <csarven@status.net>2010-01-05 01:15:08 +0000
commiteb9514120a882aacae38f8b85a1f431852b44b89 (patch)
tree724bf2ec4069b012769c1445609b36fd007be47c
parentdb1a7d6f8883b5a37803b656c10305f082fdf270 (diff)
Retain the geo data when FormNoticeXHR is complete because form gets
reset
-rw-r--r--js/util.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/js/util.js b/js/util.js
index a2212cac2..d84d21582 100644
--- a/js/util.js
+++ b/js/util.js
@@ -178,12 +178,13 @@ var SN = { // StatusNet
},
FormNoticeXHR: function(form) {
+ var NDG, NLat, NLon, NLNS, NLID;
form_id = form.attr('id');
form.append('<input type="hidden" name="ajax" value="1"/>');
form.ajaxForm({
dataType: 'xml',
timeout: '60000',
- beforeSend: function(xhr) {
+ beforeSend: function(formData) {
if ($('#'+form_id+' #'+SN.C.S.NoticeDataText)[0].value.length === 0) {
form.addClass(SN.C.S.Warning);
return false;
@@ -191,6 +192,13 @@ var SN = { // StatusNet
form.addClass(SN.C.S.Processing);
$('#'+form_id+' #'+SN.C.S.NoticeActionSubmit).addClass(SN.C.S.Disabled);
$('#'+form_id+' #'+SN.C.S.NoticeActionSubmit).attr(SN.C.S.Disabled, SN.C.S.Disabled);
+
+ NDG = $('#'+SN.C.S.NoticeDataGeo).attr('checked');
+ NLat = $('#'+SN.C.S.NoticeLat).val();
+ NLon = $('#'+SN.C.S.NoticeLon).val();
+ NLNS = $('#'+SN.C.S.NoticeLocationNs).val();
+ NLID = $('#'+SN.C.S.NoticeLocationId).val();
+
return true;
},
error: function (xhr, textStatus, errorThrown) {
@@ -273,6 +281,12 @@ var SN = { // StatusNet
form.removeClass(SN.C.S.Processing);
$('#'+form_id+' #'+SN.C.S.NoticeActionSubmit).removeAttr(SN.C.S.Disabled);
$('#'+form_id+' #'+SN.C.S.NoticeActionSubmit).removeClass(SN.C.S.Disabled);
+
+ $('#'+SN.C.S.NoticeDataGeo).attr('checked', NDG);
+ $('#'+SN.C.S.NoticeLat).val(NLat);
+ $('#'+SN.C.S.NoticeLon).val(NLon);
+ $('#'+SN.C.S.NoticeLocationNs).val(NLNS);
+ $('#'+SN.C.S.NoticeLocationId).val(NLID);
}
});
},
@@ -444,6 +458,8 @@ var SN = { // StatusNet
NoticeLocationAttach: function() {
var NLat = $('#'+SN.C.S.NoticeLat).val();
var NLon = $('#'+SN.C.S.NoticeLon).val();
+ var NLNS = $('#'+SN.C.S.NoticeLocationNs).val();
+ var NLID = $('#'+SN.C.S.NoticeLocationId).val();
function removeNoticeDataGeo() {
$('label[for='+SN.C.S.NoticeDataGeo+']').removeClass('checked');