From f990237c03ab8f5e2a7b3e90d79566b0901bec9b Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 1 Jan 2010 22:49:42 +0000 Subject: [PATCH 1/8] Don't need margin-bottom for share location option --- theme/base/css/display.css | 1 + 1 file changed, 1 insertion(+) diff --git a/theme/base/css/display.css b/theme/base/css/display.css index d876460e1a..a0b12a9f48 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -574,6 +574,7 @@ top:3px; .form_notice #notice_data-location_wrap label { font-weight:normal; font-size:1em; +margin-bottom:0; } .form_notice #notice_data-location_name { display:block; From ec5850d26a46b88c14579959c8bcf34e936b087e Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 3 Jan 2010 00:33:41 +0000 Subject: [PATCH 2/8] Changed location share representation to be more like the file attachment. Init UI. Probably a little buggy. --- js/util.js | 38 ++++++++++++++++++++------- lib/noticeform.php | 3 +-- theme/base/css/display.css | 29 ++++++++++++++------ theme/base/images/icons/icons-01.gif | Bin 3443 -> 3533 bytes theme/identica/css/display.css | 9 ++++++- 5 files changed, 59 insertions(+), 20 deletions(-) diff --git a/js/util.js b/js/util.js index dd7a74a7a0..8ee0dd05db 100644 --- a/js/util.js +++ b/js/util.js @@ -52,7 +52,9 @@ var SN = { // StatusNet NoticeLocationId: 'notice_data-location_id', NoticeLocationNs: 'notice_data-location_ns', NoticeLocationName: 'notice_data-location_name', - NoticeLocationCookieName: 'location_enabled' + NoticeLocationCookieName: 'location_enabled', + NoticeDataGeo: 'notice_data-geo', + NoticeDataGeoSelected: 'notice_data-geo_selected' } }, @@ -438,29 +440,46 @@ var SN = { // StatusNet }, NoticeLocationAttach: function() { - if ($('#notice_data-location_enabled').length > 0) { + var NDG = $('#'+SN.C.S.NoticeDataGeo); + if (NDG.length > 0) { + NDG.attr('title', NDG.text()); var NLE = $('#notice_data-location_wrap'); var geocodeURL = NLE.attr('title'); - NLE.insertAfter('#'+SN.C.S.FormNotice+' fieldset'); + var S = '
'; + var NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); + + if (NDGS.length > 0) { + NDGS.replaceWith(S); + } + else { + $('#'+SN.C.S.FormNotice).append(S); + } + NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); + + $('#'+SN.C.S.NoticeDataGeoSelected+' button.close').click(function(){ + $('#'+SN.C.S.NoticeDataGeoSelected).remove(); + $('#'+SN.C.S.NoticeDataGeo).attr('checked', false); + }); if (navigator.geolocation) { NLE.change(function() { 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); if (NLN.length > 0) { NLN.remove(); } - NLE.prepend('Geo'); + NDGS.prepend('Geo'); NLN = $('#'+SN.C.S.NoticeLocationName); - if ($('#notice_data-location_enabled').attr('checked') === true) { - NLN.show(); + if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true) { + NDGS.show(); NLN.addClass('processing'); + $('label[for=notice_data-geo]').addClass('checked'); navigator.geolocation.getCurrentPosition(function(position) { $('#'+SN.C.S.NoticeLat).val(position.coords.latitude); @@ -497,7 +516,8 @@ var SN = { // StatusNet }); } else { - NLN.hide(); + $('label[for=notice_data-geo]').removeClass('checked'); + NDGS.hide(); $('#'+SN.C.S.NoticeLat).val(''); $('#'+SN.C.S.NoticeLon).val(''); $('#'+SN.C.S.NoticeLocationNs).val(''); @@ -506,7 +526,7 @@ var SN = { // StatusNet }); var cookieVal = $.cookie(SN.C.S.NoticeLocationCookieName); - $('#notice_data-location_enabled').attr('checked', (cookieVal == null || cookieVal == 'true')); + $('#'+SN.C.S.NoticeDataGeo).attr('checked', (cookieVal == null || cookieVal == 'true')); NLE.change(); } } diff --git a/lib/noticeform.php b/lib/noticeform.php index d35655a0b2..99865645aa 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -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->elementStart('div', array('id' => 'notice_data-location_wrap', - 'class' => 'success', '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'); } diff --git a/theme/base/css/display.css b/theme/base/css/display.css index a0b12a9f48..fc8762cdc2 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -554,31 +554,44 @@ width:81.5%; margin-bottom:0; 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; -width:90%; +width:87%; display:block; -font-size:1.1em; line-height:1.8; overflow:auto; } -.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; font-size:0.8em; } + +.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 { -margin-right:7px; -float:left; -top:3px; +display:none; } .form_notice #notice_data-location_wrap label { font-weight:normal; font-size:1em; margin-bottom:0; +text-indent:-9999px; } .form_notice #notice_data-location_name { display:block; -line-height:1.6; padding-left:21px; } diff --git a/theme/base/images/icons/icons-01.gif b/theme/base/images/icons/icons-01.gif index cda9321611a67f2363122e04c1e31ae6b23aefb3..03db8c09c8ed58075bffaccf247232ab181ee668 100644 GIT binary patch delta 129 zcmV-{0Dk}T8qFIDM@dFFIbj+AMhCG95(5H82eTdn_z3~DlNSwFUk5mh#8`~R=plHg zYPl9^@OF6W6<7)dW6_9Wc?D>TSA5PTbkVqNe`jxehJE4Jd`jnMmDg*>c#i0pj_Qbv j7G#bmbRm=%a`CiutAt5$SC8%YMgW*u5tWZv6c7MAw_G+$ delta 39 vcmX>r{aK33-P6s&GEs`*5ZgvBA!epSY@6kne{eEJO%~@3XJru*V6X-N;}QwT diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index 34be6eefae..a478373870 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -117,6 +117,12 @@ background-position:0 47%; .form_notice a#notice_data-location_name { 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 -1847px; +} a, .form_settings input.form_action-primary, @@ -185,7 +191,8 @@ button.close, .entity_silence input.submit, .entity_delete input.submit, .notice-options .repeated, -.form_notice a#notice_data-location_name { +.form_notice a#notice_data-location_name, +.form_notice label[for=notice_data-geo] { background-image:url(../../base/images/icons/icons-01.gif); background-repeat:no-repeat; background-color:transparent; From 503d0acd49a855ba8853539448a0d6c11e2ca42a Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 3 Jan 2010 01:02:32 +0000 Subject: [PATCH 3/8] Added minimize functionality to selected location container --- js/util.js | 10 +++++++++- theme/base/css/display.css | 10 ++++++++-- theme/base/images/icons/icons-01.gif | Bin 3533 -> 3574 bytes theme/identica/css/display.css | 6 +++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/js/util.js b/js/util.js index 8ee0dd05db..7354a24ca5 100644 --- a/js/util.js +++ b/js/util.js @@ -446,7 +446,7 @@ var SN = { // StatusNet var NLE = $('#notice_data-location_wrap'); var geocodeURL = NLE.attr('title'); - var S = '
'; + var S = '
'; var NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); if (NDGS.length > 0) { @@ -460,6 +460,14 @@ var SN = { // StatusNet $('#'+SN.C.S.NoticeDataGeoSelected+' button.close').click(function(){ $('#'+SN.C.S.NoticeDataGeoSelected).remove(); $('#'+SN.C.S.NoticeDataGeo).attr('checked', false); + + return false; + }); + + $('#'+SN.C.S.NoticeDataGeoSelected+' button.minimize').click(function(){ + $('#'+SN.C.S.NoticeDataGeoSelected).hide(); + + return false; }); if (navigator.geolocation) { diff --git a/theme/base/css/display.css b/theme/base/css/display.css index fc8762cdc2..0bb3479ccd 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -557,10 +557,11 @@ line-height:1.618; .form_notice #notice_data-attach_selected code, .form_notice #notice_data-location_name { float:left; -width:87%; +width:80%; display:block; line-height:1.8; overflow:auto; +margin-right:2.5%; } .form_notice #notice_data-attach_selected code { font-size:1.1em; @@ -570,6 +571,10 @@ font-size:1.1em; float:right; font-size:0.8em; } +, +.form_notice #notice_data-geo_selected button.minimize { +float:left; +} .form_notice #notice_data-location_wrap label { position:absolute; @@ -595,7 +600,8 @@ display:block; padding-left:21px; } -button.close { +button.close, +button.minimize { width:16px; height:16px; text-indent:-9999px; diff --git a/theme/base/images/icons/icons-01.gif b/theme/base/images/icons/icons-01.gif index 03db8c09c8ed58075bffaccf247232ab181ee668..fccc35b8457c64295f17a9fe780364923e478a4a 100644 GIT binary patch delta 99 zcmX>r{Y{$3-P6s&GEs`5gZ+8HMxK96!tqlC6o0ZXaxwg8&|v@qpwwnr=AWF5cPESU zZq$4Iqn|-?0@F*QL&s|-nAbhMQMN<8lBaV*hb8 delta 58 zcmew+eO8*s-P6s&GEs`bjs5xmjXeLDg#Z8lulSRNk&EF!gAM}_0Hrp|GXLac+%j35 McOz?rhya5%09Tk2DgXcg diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index a478373870..e7da3612a3 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -192,7 +192,8 @@ button.close, .entity_delete input.submit, .notice-options .repeated, .form_notice a#notice_data-location_name, -.form_notice label[for=notice_data-geo] { +.form_notice label[for=notice_data-geo], +button.minimize { background-image:url(../../base/images/icons/icons-01.gif); background-repeat:no-repeat; background-color:transparent; @@ -253,6 +254,9 @@ background-color:#EFF3DC; button.close { background-position:0 -1120px; } +button.minimize { +background-position:0 -1912px; +} #anon_notice { background-color:#87B4C8; From 0a07aeb25a967e9d5b87478d970ce2769df580bb Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 3 Jan 2010 01:13:42 +0000 Subject: [PATCH 4/8] Updated pin icon --- theme/base/images/icons/icons-01.gif | Bin 3574 -> 3607 bytes theme/identica/css/display.css | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/theme/base/images/icons/icons-01.gif b/theme/base/images/icons/icons-01.gif index fccc35b8457c64295f17a9fe780364923e478a4a..06202a047b40daed0f0ceec269d9025232de4dc6 100644 GIT binary patch delta 175 zcmV;g08sz-8H6yQH5yvNRQwpkotIf|45HhhL8*yZBPY}QpIr1myQ;Bkr-Ki$ryeWAz67G33=n^ dk!^>2kynx-xp$FAxfW^gc6jO)SPBJW(THMs1!#*`e9k3w(YS4Y zXK#Flec{)9O6O;l*K5akj_8<<>WGXMWR53vA(R(#@w9ZSgh_E%kL~wH0GL@3m5=NA vj{q5v0_ifs$9#}Ce&yJ9xEFa0iI7xBa^fgn8uw}w33tOMeo6Na0RaFzOlm;V diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index e7da3612a3..a3e0f7ec3e 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -121,7 +121,7 @@ background-position:0 -1711px; background-position:0 -1780px; } .form_notice label[for=notice_data-geo].checked { -background-position:0 -1847px; +background-position:0 -1846px; } a, From 4983564949ff13f063bb833877b36fdb7a352014 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 3 Jan 2010 01:17:51 +0000 Subject: [PATCH 5/8] Reset location icon when container button.close is clicked --- js/util.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/util.js b/js/util.js index 7354a24ca5..35530d7458 100644 --- a/js/util.js +++ b/js/util.js @@ -460,6 +460,7 @@ var SN = { // StatusNet $('#'+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; }); From aef31280f38c6ecff2b3c1a4a9f871c6be0c9fae Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 3 Jan 2010 01:48:41 +0000 Subject: [PATCH 6/8] Moved location container's buttons inside enabled state --- js/util.js | 59 +++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/js/util.js b/js/util.js index 35530d7458..d43a99a180 100644 --- a/js/util.js +++ b/js/util.js @@ -442,37 +442,13 @@ var SN = { // StatusNet NoticeLocationAttach: function() { var NDG = $('#'+SN.C.S.NoticeDataGeo); if (NDG.length > 0) { - NDG.attr('title', NDG.text()); var NLE = $('#notice_data-location_wrap'); var geocodeURL = NLE.attr('title'); - var S = '
'; - var NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); - - if (NDGS.length > 0) { - NDGS.replaceWith(S); - } - else { - $('#'+SN.C.S.FormNotice).append(S); - } - NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); - - $('#'+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; - }); + $('label[for=notice_data-geo]').attr('title', NLE.text()); if (navigator.geolocation) { - NLE.change(function() { + NDG.change(function() { NLE.removeAttr('title'); $.cookie(SN.C.S.NoticeLocationCookieName, $('#'+SN.C.S.NoticeDataGeo).attr('checked')); @@ -482,14 +458,39 @@ var SN = { // StatusNet NLN.remove(); } + var S = '
'; + 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('Geo'); + NLN = $('#'+SN.C.S.NoticeLocationName); if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true) { - NDGS.show(); NLN.addClass('processing'); $('label[for=notice_data-geo]').addClass('checked'); + NDGS.append(' '); + + $('#'+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) { $('#'+SN.C.S.NoticeLat).val(position.coords.latitude); $('#'+SN.C.S.NoticeLon).val(position.coords.longitude); @@ -535,8 +536,8 @@ var SN = { // StatusNet }); var cookieVal = $.cookie(SN.C.S.NoticeLocationCookieName); - $('#'+SN.C.S.NoticeDataGeo).attr('checked', (cookieVal == null || cookieVal == 'true')); - NLE.change(); + NDG.attr('checked', (cookieVal == null || cookieVal == 'true')); + NDG.change(); } } }, From 467ae9d9e771fed21a0ebb572ee963f9160943c7 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 3 Jan 2010 02:00:12 +0000 Subject: [PATCH 7/8] Button should return false --- js/util.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/util.js b/js/util.js index d43a99a180..a460a9dbcf 100644 --- a/js/util.js +++ b/js/util.js @@ -435,6 +435,8 @@ var SN = { // StatusNet $('#'+SN.C.S.NoticeDataAttachSelected+' button').click(function(){ $('#'+SN.C.S.NoticeDataAttachSelected).remove(); NDA.val(''); + + return false; }); }); }, From 94af0d1279b98311dde2bbcaaa10729020d12468 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 3 Jan 2010 02:07:55 +0000 Subject: [PATCH 8/8] Fix end tag --- js/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/util.js b/js/util.js index a460a9dbcf..f6b59ec742 100644 --- a/js/util.js +++ b/js/util.js @@ -460,7 +460,7 @@ var SN = { // StatusNet NLN.remove(); } - var S = '
'; + var S = '
'; NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); if (NDGS.length > 0) { NDGS.replaceWith(S);