summaryrefslogtreecommitdiff
path: root/modules/node
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-09-17 14:53:22 +0000
committerDries Buytaert <dries@buytaert.net>2010-09-17 14:53:22 +0000
commit1d9f387c7c80969a0f3415be3187408b6fbdd1bf (patch)
tree590b9723e4cda60786be524677786e59e0a84cb0 /modules/node
parentfaf272e9060949adacb8f5d02d6e1093c3f3c7ac (diff)
downloadbrdo-1d9f387c7c80969a0f3415be3187408b6fbdd1bf.tar.gz
brdo-1d9f387c7c80969a0f3415be3187408b6fbdd1bf.tar.bz2
- Patch #732914 by Jacine, sun, reglogge, cosmicdreams: improve the markup/CSS for content and user filter forms.
Diffstat (limited to 'modules/node')
-rw-r--r--modules/node/node.admin.inc71
-rw-r--r--modules/node/node.css16
-rw-r--r--modules/node/node.module4
-rw-r--r--modules/node/node.test10
4 files changed, 28 insertions, 73 deletions
diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc
index 4214573b2..b3413a959 100644
--- a/modules/node/node.admin.inc
+++ b/modules/node/node.admin.inc
@@ -148,7 +148,7 @@ function node_filter_form() {
$form['filters'] = array(
'#type' => 'fieldset',
'#title' => t('Show only items where'),
- '#theme' => 'node_filters',
+ '#theme' => 'exposed_filters__node',
);
foreach ($session as $filter) {
list($type, $value) = $filter;
@@ -163,11 +163,12 @@ function node_filter_form() {
else {
$value = $filters[$type]['options'][$value];
}
+ $t_args = array('%property' => $filters[$type]['title'], '%value' => $value);
if ($i++) {
- $form['filters']['current'][] = array('#markup' => t('<em>and</em> where <strong>%type</strong> is <strong>%value</strong>', array('%type' => $filters[$type]['title'], '%value' => $value)));
+ $form['filters']['current'][] = array('#markup' => t('and where %property is %value', $t_args));
}
else {
- $form['filters']['current'][] = array('#markup' => t('<strong>%type</strong> is <strong>%value</strong>', array('%type' => $filters[$type]['title'], '%value' => $value)));
+ $form['filters']['current'][] = array('#markup' => t('where %property is %value', $t_args));
}
if (in_array($type, array('type', 'language'))) {
// Remove the option if it is already being filtered on.
@@ -175,9 +176,17 @@ function node_filter_form() {
}
}
+ $form['filters']['status'] = array(
+ '#type' => 'container',
+ '#attributes' => array('class' => array('clearfix')),
+ '#prefix' => ($i ? '<div class="additional-filters">' . t('and where') . '</div>' : ''),
+ );
+ $form['filters']['status']['filters'] = array(
+ '#type' => 'container',
+ '#attributes' => array('class' => array('filters')),
+ );
foreach ($filters as $key => $filter) {
- $names[$key] = $filter['title'];
- $form['filters']['status'][$key] = array(
+ $form['filters']['status']['filters'][$key] = array(
'#type' => 'select',
'#options' => $filter['options'],
'#title' => $filter['title'],
@@ -185,15 +194,17 @@ function node_filter_form() {
);
}
- $form['filters']['actions'] = array(
+ $form['filters']['status']['actions'] = array(
'#type' => 'actions',
- '#id' => 'node-admin-buttons',
'#attributes' => array('class' => array('container-inline')),
);
- $form['filters']['actions']['submit'] = array('#type' => 'submit', '#value' => (count($session) ? t('Refine') : t('Filter')));
+ $form['filters']['status']['actions']['submit'] = array(
+ '#type' => 'submit',
+ '#value' => count($session) ? t('Refine') : t('Filter'),
+ );
if (count($session)) {
- $form['filters']['actions']['undo'] = array('#type' => 'submit', '#value' => t('Undo'));
- $form['filters']['actions']['reset'] = array('#type' => 'submit', '#value' => t('Reset'));
+ $form['filters']['status']['actions']['undo'] = array('#type' => 'submit', '#value' => t('Undo'));
+ $form['filters']['status']['actions']['reset'] = array('#type' => 'submit', '#value' => t('Reset'));
}
drupal_add_js('misc/form.js');
@@ -202,46 +213,6 @@ function node_filter_form() {
}
/**
- * Returns HTML for a node administration filter selector.
- *
- * @param $variables
- * An associative array containing:
- * - form: A render element representing the form.
- *
- * @ingroup themeable
- */
-function theme_node_filters($variables) {
- $form = $variables['form'];
- $output = '';
-
- $output .= '<ul class="clearfix">';
- if (!empty($form['current'])) {
- foreach (element_children($form['current']) as $key) {
- $output .= '<li>' . drupal_render($form['current'][$key]) . '</li>';
- }
- }
- $output .= '</ul>';
-
- $output .= '<div class="clearfix">';
-
- $output .= '<dl class="multiselect">' . (!empty($form['current']) ? '<dt><em>' . t('and') . '</em> ' . t('where') . '</dt>' : '');
-
- $output .= '<dd>';
-
- foreach (element_children($form['status']) as $key) {
- $output .= drupal_render($form['status'][$key]);
- }
- $output .= '</dd>';
-
- $output .= '</dl>';
- $output .= drupal_render($form['actions']);
-
- $output .= '</div>';
-
- return $output;
-}
-
-/**
* Process result from node administration filter form.
*/
function node_filter_form_submit($form, &$form_state) {
diff --git a/modules/node/node.css b/modules/node/node.css
index 16143cb6f..efd21b589 100644
--- a/modules/node/node.css
+++ b/modules/node/node.css
@@ -6,22 +6,6 @@
.preview .node {
background-color: #ffffea;
}
-/* Override the default multiselect layout in system-behavior.css. */
-#node-admin-content dl.multiselect dd,
-dl.multiselect dd .form-item {
- width: 20em; /* 6em label + 14em select */
-}
-#node-admin-content dl.multiselect dd .form-item label {
- display: block;
- float: left; /* LTR */
- width: 6em;
- font-weight: normal;
-}
-#node-admin-buttons {
- float: left; /* LTR */
- margin-left: 0.5em; /* LTR */
- clear: right; /* LTR */
-}
td.revision-current {
background: #ffc;
}
diff --git a/modules/node/node.module b/modules/node/node.module
index b5de4d739..7d37e1f75 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -132,10 +132,6 @@ function node_theme() {
'node_search_admin' => array(
'render element' => 'form',
),
- 'node_filters' => array(
- 'render element' => 'form',
- 'file' => 'node.admin.inc',
- ),
'node_add_list' => array(
'variables' => array('content' => NULL),
'file' => 'node.pages.inc',
diff --git a/modules/node/node.test b/modules/node/node.test
index f2d6952d6..a31d1ae66 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -1224,7 +1224,9 @@ class NodeAdminTestCase extends DrupalWebTestCase {
'status' => 'status-1',
);
$this->drupalPost(NULL, $edit, t('Filter'));
- $this->assertRaw(t('<strong>%type</strong> is <strong>%value</strong>', array('%type' => t('status'), '%value' => t('published'))), t('Content list is filtered by status.'));
+
+ $this->assertRaw(t('where %property is %value', array('%property' => t('status'), '%value' => 'published')), t('Content list is filtered by status.'));
+
$this->assertLinkByHref('node/' . $nodes['published_page']->nid . '/edit');
$this->assertLinkByHref('node/' . $nodes['published_article']->nid . '/edit');
$this->assertNoLinkByHref('node/' . $nodes['unpublished_page_1']->nid . '/edit');
@@ -1234,8 +1236,10 @@ class NodeAdminTestCase extends DrupalWebTestCase {
'type' => 'page',
);
$this->drupalPost(NULL, $edit, t('Refine'));
- $this->assertRaw(t('<strong>%type</strong> is <strong>%value</strong>', array('%type' => t('status'), '%value' => t('published'))), t('Content list is filtered by status.'));
- $this->assertRaw(t('<strong>%type</strong> is <strong>%value</strong>', array('%type' => t('type'), '%value' => 'Basic page')), t('Content list is filtered by content type.'));
+
+ $this->assertRaw(t('where %property is %value', array('%property' => t('status'), '%value' => 'published')), t('Content list is filtered by status.'));
+ $this->assertRaw(t('and where %property is %value', array('%property' => t('type'), '%value' => 'Basic page')), t('Content list is filtered by content type.'));
+
$this->assertLinkByHref('node/' . $nodes['published_page']->nid . '/edit');
$this->assertNoLinkByHref('node/' . $nodes['published_article']->nid . '/edit');