Input form switcher works

This change adds the input form switcher, which adds a navigation menu
across the top of the input form, letting you switch between different kinds of input.

The input menu doesn't yet look like a nice set of tabs; it could use some love.
This commit is contained in:
Evan Prodromou 2011-03-07 04:57:49 -05:00
parent 7aa55f8200
commit cf1a4d8292
4 changed files with 37 additions and 8 deletions

View File

@ -1272,7 +1272,16 @@ var SN = { // StatusNet
// UI links currently on the page use malleable names. // UI links currently on the page use malleable names.
return false; return false;
} },
switchInputFormTab: function(tag) {
// The one that's current isn't current anymore
$('.input_form_nav_tab.current').removeClass('current');
$('#input_form_nav_'+tag).addClass('current');
$('.input_form.current').removeClass('current');
$('#input_form_'+tag).addClass('current');
}
}, },
Init: { Init: {

2
js/util.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -657,7 +657,8 @@ class Action extends HTMLOutputter // lawsuit
foreach ($tabs as $tag => $title) { foreach ($tabs as $tag => $title) {
$attrs = array('id' => 'input_form_nav_'.$title); $attrs = array('id' => 'input_form_nav_'.$tag,
'class' => 'input_form_nav_tab');
if ($tag == 'status') { if ($tag == 'status') {
$attrs['class'] = 'current'; $attrs['class'] = 'current';
@ -666,7 +667,7 @@ class Action extends HTMLOutputter // lawsuit
$this->elementStart('li', $attrs); $this->elementStart('li', $attrs);
$this->element('a', $this->element('a',
array('href' => 'javascript:switchInputFormTab("'.$tag.'")'), array('href' => 'javascript:SN.U.switchInputFormTab("'.$tag.'")'),
$title); $title);
$this->elementEnd('li'); $this->elementEnd('li');
} }
@ -679,9 +680,7 @@ class Action extends HTMLOutputter // lawsuit
'id' => 'input_form_'.$tag); 'id' => 'input_form_'.$tag);
if ($tag == 'status') { if ($tag == 'status') {
$attrs['class'] .= ' active'; $attrs['class'] .= ' current';
} else {
$attrs['class'] .= ' inactive';
} }
$this->elementStart('div', $attrs); $this->elementStart('div', $attrs);
@ -698,6 +697,8 @@ class Action extends HTMLOutputter // lawsuit
if (!empty($form)) { if (!empty($form)) {
$form->show(); $form->show();
} }
$this->elementEnd('div');
} }
} }
} }

View File

@ -1953,8 +1953,27 @@ margin-bottom:18px;
padding-left:20px; padding-left:20px;
} }
#input_form_nav {
list-style-type: none;
}
}/*end of @media screen, projection, tv*/ #input_form_nav li {
display:inline;
}
.input_form_nav_tab.current {
text-decoration: underline;
}
.input_form {
display: none;
}
.input_form.current {
display: block;
}
/*end of @media screen, projection, tv*/
@media print { @media print {