We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit b58aa291 authored by Brion Vibber's avatar Brion Vibber

Notice form cleanup: removing hardcoded id from counter references; prep for reusable notice forms.

parent f94a5e1a
...@@ -50,7 +50,6 @@ var SN = { // StatusNet ...@@ -50,7 +50,6 @@ var SN = { // StatusNet
Processing: 'processing', Processing: 'processing',
CommandResult: 'command_result', CommandResult: 'command_result',
FormNotice: 'form_notice', FormNotice: 'form_notice',
NoticeTextCount: 'notice_text-count',
NoticeInReplyTo: 'notice_in-reply-to', NoticeInReplyTo: 'notice_in-reply-to',
NoticeActionSubmit: 'notice_action-submit', NoticeActionSubmit: 'notice_action-submit',
NoticeLat: 'notice_data-lat', NoticeLat: 'notice_data-lat',
...@@ -103,7 +102,7 @@ var SN = { // StatusNet ...@@ -103,7 +102,7 @@ var SN = { // StatusNet
*/ */
FormNoticeEnhancements: function(form) { FormNoticeEnhancements: function(form) {
if (jQuery.data(form[0], 'ElementData') === undefined) { if (jQuery.data(form[0], 'ElementData') === undefined) {
MaxLength = form.find('#'+SN.C.S.NoticeTextCount).text(); MaxLength = form.find('.count').text();
if (typeof(MaxLength) == 'undefined') { if (typeof(MaxLength) == 'undefined') {
MaxLength = SN.C.I.MaxLength; MaxLength = SN.C.I.MaxLength;
} }
...@@ -131,7 +130,7 @@ var SN = { // StatusNet ...@@ -131,7 +130,7 @@ var SN = { // StatusNet
.bind('paste', delayedUpdate); .bind('paste', delayedUpdate);
} }
else { else {
form.find('#'+SN.C.S.NoticeTextCount).text(jQuery.data(form[0], 'ElementData').MaxLength); form.find('.count').text(jQuery.data(form[0], 'ElementData').MaxLength);
} }
}, },
...@@ -159,7 +158,7 @@ var SN = { // StatusNet ...@@ -159,7 +158,7 @@ var SN = { // StatusNet
} }
var remaining = MaxLength - SN.U.CharacterCount(form); var remaining = MaxLength - SN.U.CharacterCount(form);
var counter = form.find('#'+SN.C.S.NoticeTextCount); var counter = form.find('.count');
if (remaining.toString() != counter.text()) { if (remaining.toString() != counter.text()) {
if (!SN.C.I.CounterBlackout || remaining === 0) { if (!SN.C.I.CounterBlackout || remaining === 0) {
......
This diff is collapsed.
...@@ -163,8 +163,7 @@ class MessageForm extends Form ...@@ -163,8 +163,7 @@ class MessageForm extends Form
if ($contentLimit > 0) { if ($contentLimit > 0) {
$this->out->element('span', $this->out->element('span',
array('id' => 'notice_text-count', array('class' => 'count'),
'class' => 'form_note'),
$contentLimit); $contentLimit);
} }
} }
......
...@@ -183,8 +183,7 @@ class NoticeForm extends Form ...@@ -183,8 +183,7 @@ class NoticeForm extends Form
if ($contentLimit > 0) { if ($contentLimit > 0) {
$this->out->element('span', $this->out->element('span',
array('id' => 'notice_text-count', array('class' => 'count'),
'class' => 'form_note'),
$contentLimit); $contentLimit);
} }
......
...@@ -141,7 +141,7 @@ class GroupMessageForm extends Form ...@@ -141,7 +141,7 @@ class GroupMessageForm extends Form
if ($contentLimit > 0) { if ($contentLimit > 0) {
$this->out->elementStart('dl', 'form_note'); $this->out->elementStart('dl', 'form_note');
$this->out->element('dt', null, _('Available characters')); $this->out->element('dt', null, _('Available characters'));
$this->out->element('dd', array('id' => 'notice_text-count'), $this->out->element('dd', array('class' => 'count'),
$contentLimit); $contentLimit);
$this->out->elementEnd('dl'); $this->out->elementEnd('dl');
} }
......
...@@ -355,7 +355,7 @@ class MobileProfilePlugin extends WAP20Plugin ...@@ -355,7 +355,7 @@ class MobileProfilePlugin extends WAP20Plugin
$contentLimit = Notice::maxContent(); $contentLimit = Notice::maxContent();
if ($contentLimit > 0) { if ($contentLimit > 0) {
$form->out->element('div', array('id' => 'notice_text-count'), $form->out->element('div', array('class' => 'count'),
$contentLimit); $contentLimit);
} }
......
...@@ -94,7 +94,7 @@ width:60%; ...@@ -94,7 +94,7 @@ width:60%;
height:20px; height:20px;
} }
#notice_text-count { .form_notice .count {
position:absolute; position:absolute;
bottom:2px; bottom:2px;
right:40%; right:40%;
...@@ -104,7 +104,7 @@ z-index:9; ...@@ -104,7 +104,7 @@ z-index:9;
/*input type=file no good in /*input type=file no good in
iPhone/iPod Touch, Android, Opera Mini Simulator iPhone/iPod Touch, Android, Opera Mini Simulator
*/ */
#form_notice #notice_text-count + label, .form_notice .count + label,
#form_notice label[for="notice_data-attach"] { #form_notice label[for="notice_data-attach"] {
display:none; display:none;
} }
......
...@@ -611,17 +611,17 @@ height:16px; ...@@ -611,17 +611,17 @@ height:16px;
padding:0; padding:0;
height:16px; height:16px;
} }
.form_notice .form_note { .form_notice .count {
position:absolute; position:absolute;
bottom:2px; bottom:2px;
right:21.715%; right:21.715%;
z-index:9; z-index:9;
} }
.form_notice .form_note dt { .form_notice .count dt {
font-weight:bold; font-weight:bold;
display:none; display:none;
} }
.form_notice #notice_text-count { .form_notice .count {
font-weight:bold; font-weight:bold;
line-height:1.15; line-height:1.15;
padding:1px 2px; padding:1px 2px;
......
...@@ -13,7 +13,7 @@ top:0; ...@@ -13,7 +13,7 @@ top:0;
.form_notice textarea { .form_notice textarea {
width:78%; width:78%;
} }
.form_notice .form_note + label { .form_notice .count + label {
position:absolute; position:absolute;
top:25px; top:25px;
left:83%; left:83%;
......
...@@ -480,17 +480,17 @@ text-indent:-279px; ...@@ -480,17 +480,17 @@ text-indent:-279px;
#form_notice #notice_submit label { #form_notice #notice_submit label {
display:none; display:none;
} }
#form_notice .form_note { .form_notice .count {
position:absolute; position:absolute;
top:99px; top:99px;
right:98px; right:98px;
z-index:9; z-index:9;
} }
#form_notice .form_note dt { .form_notice .count dt {
font-weight:bold; font-weight:bold;
display:none; display:none;
} }
#notice_text-count { .form_notice .count {
font-weight:bold; font-weight:bold;
line-height:1.15; line-height:1.15;
padding:1px 2px; padding:1px 2px;
......
...@@ -60,12 +60,12 @@ border-color:#DDDDDD; ...@@ -60,12 +60,12 @@ border-color:#DDDDDD;
background:none; background:none;
} }
.form_notice.warning #notice_text-count, .form_notice.warning .count,
.form_settings .form_note { .form_settings .form_note {
background-color:#9BB43E; background-color:#9BB43E;
} }
input.submit, input.submit,
.form_notice.warning #notice_text-count, .form_notice.warning .count,
.form_settings .form_note, .form_settings .form_note,
.entity_actions a, .entity_actions a,
.entity_actions input, .entity_actions input,
...@@ -83,7 +83,7 @@ background-color:transparent; ...@@ -83,7 +83,7 @@ background-color:transparent;
} }
input:focus, textarea:focus, select:focus, input:focus, textarea:focus, select:focus,
.form_notice.warning textarea, .form_notice.warning textarea,
.form_notice.warning #notice_text-count, .form_notice.warning .count,
.form_settings .form_note { .form_settings .form_note {
border-color:#9BB43E; border-color:#9BB43E;
} }
...@@ -166,10 +166,10 @@ background-image:url(../images/illustrations/illu_pattern-02.png); ...@@ -166,10 +166,10 @@ background-image:url(../images/illustrations/illu_pattern-02.png);
background-repeat:no-repeat; background-repeat:no-repeat;
} }
#notice_text-count { .form_notice .count {
color:#333333; color:#333333;
} }
#form_notice.warning #notice_text-count { #form_notice.warning .count {
color:#000000; color:#000000;
} }
.form_notice label[for=notice_data-attach] { .form_notice label[for=notice_data-attach] {
......
...@@ -7,7 +7,7 @@ top:0; ...@@ -7,7 +7,7 @@ top:0;
.form_notice textarea { .form_notice textarea {
width: 362px; width: 362px;
} }
.form_notice .form_note + label { .form_notice .count + label {
position:absolute; position:absolute;
top:25px; top:25px;
left:83%; left:83%;
...@@ -65,7 +65,7 @@ line-height:auto; ...@@ -65,7 +65,7 @@ line-height:auto;
filter: alpha(opacity=0); filter: alpha(opacity=0);
} }
.form_notice .form_note + label { .form_notice .count + label {
background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -328px; background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -328px;
} }
......
...@@ -75,7 +75,7 @@ float:left; ...@@ -75,7 +75,7 @@ float:left;
padding: 4px; padding: 4px;
} }
#notice_text-count { .form_notice .count {
position:absolute; position:absolute;
bottom:2px; bottom:2px;
left: 175px; left: 175px;
...@@ -83,14 +83,14 @@ bottom:2px; ...@@ -83,14 +83,14 @@ bottom:2px;
z-index:9; z-index:9;
} }
#form_notice-direct.form_notice #notice_text-count { #form_notice-direct.form_notice .count {
left: 0px; left: 0px;
} }
/*input type=file no good in /*input type=file no good in
iPhone/iPod Touch, Android, Opera Mini Simulator iPhone/iPod Touch, Android, Opera Mini Simulator
*/ */
.form_notice #notice_text-count + label, .form_notice .count + label,
.form_notice label[for="notice_data-attach"] { .form_notice label[for="notice_data-attach"] {
display:none; display:none;
} }
......
...@@ -7,7 +7,7 @@ top:0; ...@@ -7,7 +7,7 @@ top:0;
.form_notice textarea { .form_notice textarea {
width: 328px; width: 328px;
} }
.form_notice .form_note + label { .form_notice .count + label {
position:absolute; position:absolute;
top:25px; top:25px;
left:83%; left:83%;
...@@ -69,7 +69,7 @@ line-height:auto; ...@@ -69,7 +69,7 @@ line-height:auto;
filter: alpha(opacity=0); filter: alpha(opacity=0);
} }
.form_notice .form_note + label { .form_notice .count + label {
background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -328px; background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -328px;
} }
......
...@@ -80,7 +80,7 @@ float:left; ...@@ -80,7 +80,7 @@ float:left;
padding: 4px; padding: 4px;
} }
#notice_text-count { .form_notice .count {
position:absolute; position:absolute;
bottom:2px; bottom:2px;
left: 175px; left: 175px;
...@@ -88,14 +88,14 @@ bottom:2px; ...@@ -88,14 +88,14 @@ bottom:2px;
z-index:9; z-index:9;
} }
#form_notice-direct.form_notice #notice_text-count { #form_notice-direct.form_notice .count {
left: 0px; left: 0px;
} }
/*input type=file no good in /*input type=file no good in
iPhone/iPod Touch, Android, Opera Mini Simulator iPhone/iPod Touch, Android, Opera Mini Simulator
*/ */
.form_notice #notice_text-count + label, .form_notice .count + label,
.form_notice label[for="notice_data-attach"] { .form_notice label[for="notice_data-attach"] {
display:none; display:none;
} }
......
...@@ -509,17 +509,17 @@ height:16px; ...@@ -509,17 +509,17 @@ height:16px;
padding:0; padding:0;
height:16px; height:16px;
} }
.form_notice .form_note { .form_notice .count {
position:absolute; position:absolute;
bottom:2px; bottom:2px;
right:21.715%; right:21.715%;
z-index:9; z-index:9;
} }
.form_notice .form_note dt { .form_notice .count dt {
font-weight:bold; font-weight:bold;
display:none; display:none;
} }
.form_notice #notice_text-count { .form_notice .count {
font-weight:bold; font-weight:bold;
line-height:1.15; line-height:1.15;
padding:1px 2px; padding:1px 2px;
...@@ -1673,7 +1673,7 @@ background-position:0 -1912px; ...@@ -1673,7 +1673,7 @@ background-position:0 -1912px;
} }
input.submit, input.submit,
.form_notice.warning #notice_text-count, .form_notice.warning .count,
.form_settings .form_note, .form_settings .form_note,
.entity_actions a, .entity_actions a,
.entity_actions input, .entity_actions input,
...@@ -1691,7 +1691,7 @@ background-color:transparent; ...@@ -1691,7 +1691,7 @@ background-color:transparent;
} }
input:focus, textarea:focus, select:focus, input:focus, textarea:focus, select:focus,
.form_notice.warning textarea, .form_notice.warning textarea,
.form_notice.warning #notice_text-count, .form_notice.warning .count,
.form_settings .form_note { .form_settings .form_note {
border-color:#9BB43E; border-color:#9BB43E;
} }
...@@ -1706,7 +1706,7 @@ background-color:transparent; ...@@ -1706,7 +1706,7 @@ background-color:transparent;
} }
input:focus, textarea:focus, select:focus, input:focus, textarea:focus, select:focus,
.form_notice.warning textarea, .form_notice.warning textarea,
.form_notice.warning #notice_text-count, .form_notice.warning .count,
.form_settings .form_note { .form_settings .form_note {
border-color:#9BB43E; border-color:#9BB43E;
} }
...@@ -1781,10 +1781,10 @@ border-color:#AAAAAA; ...@@ -1781,10 +1781,10 @@ border-color:#AAAAAA;
background-color:#DDFFCC; background-color:#DDFFCC;
} }
#notice_text-count { .form_notice .count {
color:#000000; color:#000000;
} }
#form_notice.warning #notice_text-count { #form_notice.warning .count {
color:#000000; color:#000000;
} }
#form_notice label[for=notice_data-attach] { #form_notice label[for=notice_data-attach] {
...@@ -2071,7 +2071,7 @@ border-color:#FFFF00; ...@@ -2071,7 +2071,7 @@ border-color:#FFFF00;
} }
#form_notice .form_note { .form_notice .count {
color:#CCC; color:#CCC;
} }
......
...@@ -18,14 +18,14 @@ background-color:#ddffcc; ...@@ -18,14 +18,14 @@ background-color:#ddffcc;
#form_notice { #form_notice {
width:525px; width:525px;
} }
#form_notice .form_note { .form_notice .count {
top:-5px; top:-5px;
right:0; right:0;
} }
#form_notice textarea { #form_notice textarea {
width:97.75%; width:97.75%;
} }
#form_notice .form_note + label { .form_notice .count + label {
position:absolute; position:absolute;
top:87px; top:87px;
left:77%; left:77%;
......
...@@ -57,12 +57,12 @@ border-color:#DDDDDD; ...@@ -57,12 +57,12 @@ border-color:#DDDDDD;
background:none; background:none;
} }
.form_notice.warning #notice_text-count, .form_notice.warning .count,
.form_settings .form_note { .form_settings .form_note {
background-color:#9BB43E; background-color:#9BB43E;
} }
input.submit, input.submit,
.form_notice.warning #notice_text-count, .form_notice.warning .count,
.form_settings .form_note, .form_settings .form_note,
.entity_actions a, .entity_actions a,
.entity_actions input, .entity_actions input,
...@@ -81,7 +81,7 @@ background-color:transparent; ...@@ -81,7 +81,7 @@ background-color:transparent;
} }
input:focus, textarea:focus, select:focus, input:focus, textarea:focus, select:focus,
.form_notice.warning textarea, .form_notice.warning textarea,
.form_notice.warning #notice_text-count, .form_notice.warning .count,
.form_settings .form_note, .form_settings .form_note,
.entity_actions .dialogbox .form_data input:focus { .entity_actions .dialogbox .form_data input:focus {
border-color:#9BB43E; border-color:#9BB43E;
...@@ -144,10 +144,10 @@ border-top-color:#C8D1D5; ...@@ -144,10 +144,10 @@ border-top-color:#C8D1D5;
background-color:#C8D1D5; background-color:#C8D1D5;
} }
#notice_text-count { .form_notice .count {
color:#333333; color:#333333;
} }
.form_notice.warning #notice_text-count, .form_notice.warning .count,
.dialogbox, .dialogbox,
.entity_actions .dialogbox input { .entity_actions .dialogbox input {
color:#000000; color:#000000;
......
...@@ -13,7 +13,7 @@ color:#FFFFFF; ...@@ -13,7 +13,7 @@ color:#FFFFFF;
#site_nav_local_views a { #site_nav_local_views a {
background-color:#C8D1D5; background-color:#C8D1D5;
} }
.form_notice .form_note + label { .form_notice .count + label {
background:transparent url(../../base/images/icons/icons-01.gif) no-repeat 0 -328px; background:transparent url(../../base/images/icons/icons-01.gif) no-repeat 0 -328px;
} }
.form_notice #notice_data-attach { .form_notice #notice_data-attach {
......
...@@ -432,17 +432,17 @@ margin-bottom:7px; ...@@ -432,17 +432,17 @@ margin-bottom:7px;
#form_notice #notice_submit label { #form_notice #notice_submit label {
display:none; display:none;
} }
#form_notice .form_note { .form_notice .count {
position:absolute; position:absolute;
top:99px; top:99px;
right:98px; right:98px;
z-index:9; z-index:9;
} }
#form_notice .form_note dt { .form_notice .count dt {
font-weight:bold; font-weight:bold;
display:none; display:none;
} }
#notice_text-count { .form_notice .count {
font-weight:bold;