summaryrefslogtreecommitdiff
path: root/modules
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
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')
-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
-rw-r--r--modules/system/admin-rtl.css17
-rw-r--r--modules/system/admin.css33
-rw-r--r--modules/system/system-behavior.css22
-rw-r--r--modules/system/system.css1
-rw-r--r--modules/system/system.module29
-rw-r--r--modules/user/user-rtl.css12
-rw-r--r--modules/user/user.admin.inc67
-rw-r--r--modules/user/user.css16
-rw-r--r--modules/user/user.module4
13 files changed, 125 insertions, 177 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');
diff --git a/modules/system/admin-rtl.css b/modules/system/admin-rtl.css
index 35d92e956..4331fab4d 100644
--- a/modules/system/admin-rtl.css
+++ b/modules/system/admin-rtl.css
@@ -48,3 +48,20 @@ table.screenshot {
margin-right: 15px;
}
+/**
+ * Exposed filters
+ */
+.exposed-filters .filters {
+ float: right;
+ margin-left: 1em;
+ margin-right: 0;
+}
+.exposed-filters .form-item label {
+ float: right;
+}
+/* Current filters */
+.exposed-filters .additional-filters {
+ float: right;
+ margin-left: 1em;
+ margin-right: 0;
+}
diff --git a/modules/system/admin.css b/modules/system/admin.css
index 70d415a25..fbd32d427 100644
--- a/modules/system/admin.css
+++ b/modules/system/admin.css
@@ -138,3 +138,36 @@ table.screenshot {
html.js .custom-container label {
visibility: hidden;
}
+
+/**
+ * Exposed filters
+ */
+.exposed-filters .filters {
+ float: left; /* LTR */
+ margin-right: 1em; /* LTR */
+ width: 25em; /* IE6 */
+}
+.exposed-filters .form-item {
+ margin: 0 0 0.1em 0;
+ padding: 0;
+}
+.exposed-filters .form-item label {
+ float: left; /* LTR */
+ font-weight: normal;
+ width: 10em;
+}
+.exposed-filters .form-select {
+ width: 14em;
+}
+/* Current filters */
+.exposed-filters .current-filters {
+ margin-bottom: 1em;
+}
+.exposed-filters .current-filters .placeholder {
+ font-style: normal;
+ font-weight: bold;
+}
+.exposed-filters .additional-filters {
+ float: left; /* LTR */
+ margin-right: 1em; /* LTR */
+}
diff --git a/modules/system/system-behavior.css b/modules/system/system-behavior.css
index 15e65882f..343cff68a 100644
--- a/modules/system/system-behavior.css
+++ b/modules/system/system-behavior.css
@@ -183,28 +183,6 @@ tr .ajax-progress .throbber {
}
/**
- * Multiselect form
- */
-dl.multiselect dd,
-dl.multiselect dd .form-item,
-dl.multiselect dd select {
- font-family: inherit;
- font-size: inherit;
- width: 14em;
-}
-dl.multiselect dt,
-dl.multiselect dd {
- float: left; /* LTR */
- line-height: 1.75em;
- padding: 0;
- margin: 0 1em 0 0; /* LTR */
-}
-dl.multiselect .form-item {
- height: 1.75em;
- margin: 0;
-}
-
-/**
* Password strength indicator
*/
.password-strength {
diff --git a/modules/system/system.css b/modules/system/system.css
index a5fa7f957..0acff828a 100644
--- a/modules/system/system.css
+++ b/modules/system/system.css
@@ -82,7 +82,6 @@ thead th {
.item-list ul li {
margin: 0 0 0.25em 1.5em; /* LTR */
padding: 0;
- list-style: disc;
}
.form-item {
margin-top: 1em;
diff --git a/modules/system/system.module b/modules/system/system.module
index 21b2f79ad..9d0930476 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -3770,6 +3770,35 @@ function theme_system_settings_form($variables) {
}
/**
+ * Returns HTML for an exposed filter form.
+ *
+ * @param $variables
+ * An associative array containing:
+ * - form: An associative array containing the structure of the form.
+ *
+ * @return
+ * A string containing an HTML-formatted form.
+ *
+ * @ingroup themeable
+ */
+function theme_exposed_filters($variables) {
+ $form = $variables['form'];
+ $output = '';
+
+ if (isset($form['current'])) {
+ $items = array();
+ foreach (element_children($form['current']) as $key) {
+ $items[] = drupal_render($form['current'][$key]);
+ }
+ $output .= theme('item_list', array('items' => $items, 'attributes' => array('class' => array('clearfix', 'current-filters'))));
+ }
+
+ $output .= drupal_render_children($form);
+
+ return '<div class="exposed-filters">' . $output . '</div>';
+}
+
+/**
* Implements hook_admin_paths().
*/
function system_admin_paths() {
diff --git a/modules/user/user-rtl.css b/modules/user/user-rtl.css
index 9f8219619..1c5d178c0 100644
--- a/modules/user/user-rtl.css
+++ b/modules/user/user-rtl.css
@@ -4,18 +4,6 @@
padding-left: 0;
padding-right: 1.5em;
}
-
-#user-filter-form dl.multiselect dd .form-item label {
- float: right;
-}
-
-#user-admin-buttons {
- float: right;
- margin-left: 0;
- margin-right: 0.5em;
- clear: left;
-}
-
.profile .user-picture {
float: left;
margin: 0 0 1em 1em;
diff --git a/modules/user/user.admin.inc b/modules/user/user.admin.inc
index 58f881010..09fb96463 100644
--- a/modules/user/user.admin.inc
+++ b/modules/user/user.admin.inc
@@ -40,7 +40,7 @@ function user_filter_form() {
$form['filters'] = array(
'#type' => 'fieldset',
'#title' => t('Show only users where'),
- '#theme' => 'user_filters',
+ '#theme' => 'exposed_filters__user',
);
foreach ($session as $filter) {
list($type, $value) = $filter;
@@ -53,18 +53,26 @@ function user_filter_form() {
else {
$value = $filters[$type]['options'][$value];
}
- $params = array('%property' => $filters[$type]['title'] , '%value' => $value);
+ $t_args = array('%property' => $filters[$type]['title'], '%value' => $value);
if ($i++) {
- $form['filters']['current'][] = array('#markup' => t('<em>and</em> where <strong>%property</strong> is <strong>%value</strong>', $params));
+ $form['filters']['current'][] = array('#markup' => t('and where %property is %value', $t_args));
}
else {
- $form['filters']['current'][] = array('#markup' => t('<strong>%property</strong> is <strong>%value</strong>', $params));
+ $form['filters']['current'][] = array('#markup' => t('%property is %value', $t_args));
}
}
+ $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'],
@@ -72,21 +80,20 @@ function user_filter_form() {
);
}
- $form['filters']['actions'] = array(
+ $form['filters']['status']['actions'] = array(
'#type' => 'actions',
- '#id' => 'user-admin-buttons',
'#attributes' => array('class' => array('container-inline')),
);
- $form['filters']['actions']['submit'] = array(
+ $form['filters']['status']['actions']['submit'] = array(
'#type' => 'submit',
'#value' => (count($session) ? t('Refine') : t('Filter')),
);
if (count($session)) {
- $form['filters']['actions']['undo'] = array(
+ $form['filters']['status']['actions']['undo'] = array(
'#type' => 'submit',
'#value' => t('Undo'),
);
- $form['filters']['actions']['reset'] = array(
+ $form['filters']['status']['actions']['reset'] = array(
'#type' => 'submit',
'#value' => t('Reset'),
);
@@ -1017,41 +1024,3 @@ function user_admin_role_delete_confirm_submit($form, &$form_state) {
$form_state['redirect'] = 'admin/people/permissions/roles';
}
-/**
- * Returns HTML for the user administration filter selector.
- *
- * @param $variables
- * An associative array containing:
- * - form: A render element representing the form.
- *
- * @ingroup themeable
- */
-function theme_user_filters($variables) {
- $form = $variables['form'];
-
- $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;
-}
diff --git a/modules/user/user.css b/modules/user/user.css
index 9fd40e0c4..8b891e243 100644
--- a/modules/user/user.css
+++ b/modules/user/user.css
@@ -10,22 +10,6 @@
#permissions tr.even .form-item {
white-space: normal;
}
-/* Override the default multiselect layout in system-behavior.css. */
-#user-filter-form dl.multiselect dd,
-dl.multiselect dd .form-item {
- width: 20em; /* 6em label + 14em select */
-}
-#user-filter-form dl.multiselect dd .form-item label {
- display: block;
- float: left; /* LTR */
- width: 6em;
- font-weight: normal;
-}
-#user-admin-buttons {
- float: left; /* LTR */
- margin-left: 0.5em; /* LTR */
- clear: right; /* LTR */
-}
#user-admin-settings fieldset .fieldset-description {
font-size: 0.85em;
padding-bottom: .5em;
diff --git a/modules/user/user.module b/modules/user/user.module
index 89c0efabf..1895b3fde 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -122,10 +122,6 @@ function user_theme() {
'render element' => 'form',
'file' => 'user.admin.inc',
),
- 'user_filters' => array(
- 'render element' => 'form',
- 'file' => 'user.admin.inc',
- ),
'user_permission_description' => array(
'variables' => array('permission_item' => NULL, 'hide' => NULL),
'file' => 'user.admin.inc',