summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--includes/admin.inc7
-rw-r--r--js/views-admin.js5
-rw-r--r--views_ui.module6
3 files changed, 15 insertions, 3 deletions
diff --git a/includes/admin.inc b/includes/admin.inc
index 2f20916..13fd351 100644
--- a/includes/admin.inc
+++ b/includes/admin.inc
@@ -919,7 +919,7 @@ function views_ui_edit_page($view, $display_id = NULL) {
if (!in_array($display_id, array(MENU_ACCESS_DENIED, MENU_NOT_FOUND))) {
$build = array();
$build['edit_form'] = drupal_get_form('views_ui_edit_form', $view, $display_id);
- $build['preview'] = views_ui_build_preview($view, $display_id);
+ $build['preview'] = views_ui_build_preview($view, $display_id, FALSE);
}
else {
$build = $display_id;
@@ -928,7 +928,7 @@ function views_ui_edit_page($view, $display_id = NULL) {
return $build;
}
-function views_ui_build_preview($view, $display_id) {
+function views_ui_build_preview($view, $display_id, $render = TRUE) {
if (isset($_POST['ajax_html_ids'])) {
unset($_POST['ajax_html_ids']);
}
@@ -949,7 +949,7 @@ function views_ui_build_preview($view, $display_id) {
$build['preview'] = array(
'#theme_wrappers' => array('container'),
'#attributes' => array('id' => 'views-live-preview'),
- '#markup' => views_ui_preview($view->clone_view(), $display_id, $args),
+ '#markup' => $render ? views_ui_preview($view->clone_view(), $display_id, $args) : '',
);
return $build;
@@ -1213,6 +1213,7 @@ function views_ui_preview_form($form, &$form_state, $view, $display_id = 'defaul
// we may need to split Preview into a separate form.
'#process' => array_merge(array('views_ui_default_button'), element_info_property('submit', '#process', array())),
);
+ $form['#action'] = url('admin/structure/views/view/' . $view->name .'/preview/' . $display_id);
return $form;
}
diff --git a/js/views-admin.js b/js/views-admin.js
index 3b7489a..104239a 100644
--- a/js/views-admin.js
+++ b/js/views-admin.js
@@ -391,6 +391,11 @@ Drupal.behaviors.viewsUiPreview.attach = function (context, settings) {
else {
$('#preview-args').parent().hide();
}
+
+ // Executes an initial preview.
+ if ($('#edit-displays-live-preview').once('edit-displays-live-preview').is(':checked')) {
+ $('#preview-submit').once('edit-displays-live-preview').click();
+ }
};
diff --git a/views_ui.module b/views_ui.module
index ce39c0d..a4480a9 100644
--- a/views_ui.module
+++ b/views_ui.module
@@ -89,6 +89,12 @@ function views_ui_menu() {
'theme callback' => 'ajax_base_page_theme',
'type' => MENU_CALLBACK,
) + $base;
+ $items['admin/structure/views/view/%views_ui_cache/preview/%'] = array(
+ 'page callback' => 'views_ui_build_preview',
+ 'page arguments' => array(4, 6),
+ 'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
+ 'type' => MENU_VISIBLE_IN_BREADCRUMB,
+ ) + $base;
$items['admin/structure/views/view/%views_ui_cache/preview/%/ajax'] = array(
'page callback' => 'views_ui_build_preview',
'page arguments' => array(4, 6),