Commit 9aed44cc authored by merlinofchaos's avatar merlinofchaos

#240510: (by neclimdul) Add "title" attribute to AJAX links. Also some misc cleanup.

parent f8cbfedc
......@@ -746,7 +746,8 @@ function template_preprocess_views_ui_edit_tab(&$vars) {
if (!empty($option['title'])) {
$data['content'] .= $option['title'] . ': ';
}
$data['content'] .= $display->handler->option_link($option['value'], $id);
$data['content'] .= $display->handler->option_link($option['value'], $id, '', empty($option['desc']) ? '' : $option['desc']);
if (!empty($display->display_options['defaults'][$id])) {
$display_id = 'default';
}
......@@ -808,9 +809,9 @@ function template_preprocess_views_ui_edit_item(&$vars) {
$display = $vars['display'];
$types = views_object_types();
$vars['rearrange'] = l('<span>' . t('Rearrange') . '</span>', "admin/build/views/nojs/rearrange/$view->name/$display->id/$type", array('attributes' => array('class' => 'views-button-rearrange views-ajax-link'), 'html' => true));
$vars['rearrange'] = l('<span>' . t('Rearrange') . '</span>', "admin/build/views/nojs/rearrange/$view->name/$display->id/$type", array('attributes' => array('class' => 'views-button-rearrange views-ajax-link', 'title' => t('Rearrange')), 'html' => true));
$vars['add'] = l('<span>' . t('Add') . '</span>', "admin/build/views/nojs/add-item/$view->name/$display->id/$type", array('attributes' => array('class' => 'views-button-add views-ajax-link'), 'html' => true));
$vars['add'] = l('<span>' . t('Add') . '</span>', "admin/build/views/nojs/add-item/$view->name/$display->id/$type", array('attributes' => array('class' => 'views-button-add views-ajax-link', 'title' => t('Add')), 'html' => true));
$vars['overridden'] = (!$display->handler->is_default_display() && empty($display->display_options['defaults'][$types[$type]['plural']]));
......@@ -862,7 +863,7 @@ function template_preprocess_views_ui_edit_item(&$vars) {
$pid = $id . '-style-plugin';
if (!empty($style_plugin['uses options'])) {
$fields[$pid]['links'] = l('<span>' . t('Settings') . '</span>', "admin/build/views/nojs/config-style/$view->name/$display->id/$type/$id", array('attributes' => array('class' => 'views-button-configure views-ajax-link'), 'html' => true));
$fields[$pid]['links'] = l('<span>' . t('Settings') . '</span>', "admin/build/views/nojs/config-style/$view->name/$display->id/$type/$id", array('attributes' => array('class' => 'views-button-configure views-ajax-link', 'title' => t('Settings')), 'html' => true));
}
$fields[$pid]['title'] = t(' &nbsp; Style: !style', array('!style' => l($style_title, "admin/build/views/nojs/change-style/$view->name/$display->id/$type/$id", array('attributes' => array('class' => 'views-ajax-link')))));
......
......@@ -2513,6 +2513,8 @@ class views_handler_argument extends views_handler {
'style plugin' => TRUE,
'breadcrumb' => TRUE, // generate a breadcrumb to here
),
// @todo: There should be a 'default' where a default value
// is filled in if the argument is not present.
);
if ($which) {
......
......@@ -403,7 +403,7 @@ class views_plugin_display extends views_object {
* Because forms may be split up into sections, this provides
* an easy URL to exactly the right section. Don't override this.
*/
function option_link($text, $section, $class = '') {
function option_link($text, $section, $class = '', $title = '') {
if (!empty($class)) {
$text = '<span>' . $text . '</span>';
}
......@@ -412,7 +412,11 @@ class views_plugin_display extends views_object {
$text = t('Broken field');
}
return l($text, 'admin/build/views/nojs/display/' . $this->view->name . '/' . $this->display->id . '/' . $section, array('attributes' => array('class' => 'views-ajax-link ' . $class), 'html' => TRUE));
if (empty($title)) {
$title = $text;
}
return l($text, 'admin/build/views/nojs/display/' . $this->view->name . '/' . $this->display->id . '/' . $section, array('attributes' => array('class' => 'views-ajax-link ' . $class, 'title' => $title), 'html' => TRUE));
}
/**
......@@ -429,6 +433,7 @@ class views_plugin_display extends views_object {
'category' => 'basic',
'title' => t('Name'),
'value' => $this->display->display_title,
'desc' => t('Change the name of this display.'),
);
$title = $this->get_option('title');
......@@ -440,6 +445,7 @@ class views_plugin_display extends views_object {
'category' => 'basic',
'title' => t('Title'),
'value' => $title,
'desc' => t('Change the title that this display will use.'),
);
$style_plugin = views_fetch_plugin_data('style', $this->get_option('style_plugin'));
......@@ -451,6 +457,7 @@ class views_plugin_display extends views_object {
'category' => 'basic',
'title' => t('Style'),
'value' => $style_title,
'desc' => t('Change the style plugin.'),
);
// This adds a 'Settings' link to the style_options setting if the style has options.
......@@ -466,6 +473,7 @@ class views_plugin_display extends views_object {
'category' => 'basic',
'title' => t('Row style'),
'value' => $row_title,
'desc' => t('Change the row plugin.'),
);
// This adds a 'Settings' link to the row_options setting if the row style has options.
if (!empty($row_plugin['uses options'])) {
......@@ -477,6 +485,7 @@ class views_plugin_display extends views_object {
'category' => 'basic',
'title' => t('Use AJAX'),
'value' => $this->get_option('use_ajax') ? t('Yes') : t('No'),
'desc' => t('Change whether or not this display will use AJAX.'),
);
}
......@@ -485,6 +494,7 @@ class views_plugin_display extends views_object {
'category' => 'basic',
'title' => t('Use pager'),
'value' => $this->get_option('use_pager') ? ($this->get_option('use_pager') ? t('Mini') : t('Yes')) : t('No'),
'desc' => t('Change this display\'s pager setting.'),
);
}
......@@ -492,6 +502,7 @@ class views_plugin_display extends views_object {
'category' => 'basic',
'title' => $this->use_pager() ? t('Items per page') : t('Items to display'),
'value' => intval($this->get_option('items_per_page')),
'desc' => t('Change how many items to display.'),
);
if (!empty($this->definition['use more'])) {
......@@ -499,6 +510,7 @@ class views_plugin_display extends views_object {
'category' => 'basic',
'title' => t('More link'),
'value' => $this->get_option('use_more') ? t('Yes') : t('No'),
'desc' => t('Specify whether this display will provide a "more" link.'),
);
}
......@@ -531,6 +543,7 @@ class views_plugin_display extends views_object {
'category' => 'basic',
'title' => t('Access'),
'value' => $access_str,
'desc' => t('Specify access control settings for this display.'),
);
if (!$this->has_path()) {
......@@ -552,6 +565,7 @@ class views_plugin_display extends views_object {
'category' => 'basic',
'title' => t('Link display'),
'value' => $link_display,
'desc' => t('Specify which display this display will link to.'),
);
}
}
......@@ -576,11 +590,12 @@ class views_plugin_display extends views_object {
}
}
$output[] = t('!name: !field', array('!name' => $name, '!field' => $this->option_link($field, $type)));
// $output[] = t('!name: !field', array('!name' => $name, '!field' => $this->option_link($field, $type)));
$options[$type] = array(
'category' => 'basic',
'title' => $name,
'value' => $field,
'desc' => t('Change this display\'s !name.', array('!name' => strtolower($name))),
);
}
}
......
......@@ -115,6 +115,9 @@ function profile_views_fetch_field($field) {
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
);
break;
......@@ -147,6 +150,7 @@ function profile_views_fetch_field($field) {
'filter' => array(
'handler' => 'views_handler_filter_boolean',
),
// @todo there ought to be a boolean argument handler
);
break;
......@@ -181,6 +185,9 @@ function profile_views_fetch_field($field) {
'handler' => 'views_handler_filter_profile_selection',
'fid' => $field->fid,
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
);
break;
......
......@@ -217,12 +217,12 @@ function user_views_data() {
'users' => array(
'left_field' => 'uid',
'field' => 'uid',
),
),
'node' => array(
'table' => 'users',
'left_field' => 'uid',
'field' => 'uid',
),
),
'node_revisions' => array(
'table' => 'users',
'left_field' => 'uid',
......@@ -232,7 +232,7 @@ function user_views_data() {
$data['users_roles']['rid'] = array(
'title' => t('Role'),
'title' => t('Roles'),
'help' => t('Roles that a user belongs to'),
'field' => array(
'handler' => 'views_handler_field_user_roles',
......@@ -241,6 +241,7 @@ function user_views_data() {
'handler' => 'views_handler_filter_user_roles',
'numeric' => TRUE,
),
// @todo: a base many::one argument handler
);
// @todo: tracker default view (in users.default_views.inc -- This really should go in comment)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment