Commit 96c82a29 authored by alexpott's avatar alexpott
Browse files

Issue #1921748 by damiankloip: Fixed Views UI gives no indication that you are...

Issue #1921748 by damiankloip: Fixed Views UI gives no indication that you are editing a disabled view.
parent bd1f226e
......@@ -81,6 +81,14 @@ public function testPageResponses() {
$subrequest = Request::create('/test_page_display_200', 'GET');
$response = $this->container->get('http_kernel')->handle($subrequest, HttpKernelInterface::SUB_REQUEST);
$this->assertEqual($response->getStatusCode(), 200);
// Test accessing a disabled page for a view.
$view = views_get_view('test_page_display');
// Disable the view, rebuild menu, and request the page again.
$view->storage->disable()->save();
$subrequest = Request::create('/test_page_display_200', 'GET');
$response = $this->container->get('http_kernel')->handle($subrequest, HttpKernelInterface::SUB_REQUEST);
$this->assertEqual($response->getStatusCode(), 404);
}
/**
......
......@@ -307,4 +307,24 @@ public function testPageContextualLinks() {
$this->assertIdentical($json[$id], '<ul class="contextual-links"><li class="views-ui-edit odd first last"><a href="' . base_path() . 'admin/structure/views/view/test_display/edit/page_1?destination=test-display">Edit view</a></li></ul>');
}
/**
* Tests that the view status is correctly reflected on the edit form.
*/
public function testViewStatus() {
$view = $this->randomView();
$id = $view['id'];
// The view should initially have the enabled class on it's form wrapper.
$this->drupalGet('admin/structure/views/view/' . $id);
$elements = $this->xpath('//div[contains(@class, :edit) and contains(@class, :status)]', array(':edit' => 'views-edit-view', ':status' => 'enabled'));
$this->assertTrue($elements, 'The enabled class was found on the form wrapper');
$view = views_get_view($id);
$view->storage->disable()->save();
$this->drupalGet('admin/structure/views/view/' . $id);
$elements = $this->xpath('//div[contains(@class, :edit) and contains(@class, :status)]', array(':edit' => 'views-edit-view', ':status' => 'disabled'));
$this->assertTrue($elements, 'The disabled class was found on the form wrapper.');
}
}
......@@ -114,7 +114,9 @@ public function form(array $form, array &$form_state) {
'#prefix' => '',
'#suffix' => '',
);
$form['#prefix'] .= '<div class="views-edit-view views-admin clearfix">';
$view_status = $view->status() ? 'enabled' : 'disabled';
$form['#prefix'] .= '<div class="views-edit-view views-admin ' . $view_status . ' clearfix">';
$form['#suffix'] = '</div>' . $form['#suffix'];
$form['#attributes']['class'] = array('form-edit');
......
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