Commit 7d7b24fe authored by webchick's avatar webchick

Issue #2152673 by ParisLiakos: Remove duplicate edit route from aggregator and...

Issue #2152673 by ParisLiakos: Remove duplicate edit route from aggregator and make delete/add consistent with rest of core.
parent d80bd85e
......@@ -17,3 +17,7 @@ aggregator.feed_configure:
base_route: aggregator.feed_view
title: 'Configure'
weight: 10
aggregator.feed_delete:
route_name: aggregator.feed_delete
tab_root_id: aggregator.feed_view
title: Delete
......@@ -39,7 +39,7 @@ function aggregator_help($path, $arg) {
$output = '<p>' . t('Thousands of sites (particularly news sites and blogs) publish their latest headlines and posts in feeds, using a number of standardized XML-based formats. Formats supported by the aggregator include <a href="http://cyber.law.harvard.edu/rss/">RSS</a>, <a href="http://www.w3.org/RDF/">RDF</a>, and <a href="http://www.atomenabled.org">Atom</a>.') . '</p>';
$output .= '<p>' . t('Current feeds are listed below, and <a href="!addfeed">new feeds may be added</a>. At the <a href="!block">blocks administration page</a> you can enable for each feed the block <em>Aggregator feed</a> that contains the <em>latest items</em> .', array('!addfeed' => \Drupal::url('aggregator.feed_add'), '!block' => \Drupal::url('block.admin_display'))) . '</p>';
return $output;
case 'admin/config/services/aggregator/add/feed':
case 'aggregator/sources/add':
return '<p>' . t('Add a feed in RSS, RDF or Atom format. A feed may only have one entry.') . '</p>';
case 'admin/config/services/aggregator/add/opml':
return '<p>' . t('<abbr title="Outline Processor Markup Language">OPML</abbr> is an XML format used to exchange multiple feeds between aggregators. A single OPML document may contain a collection of many feeds. Drupal can parse such a file and import all feeds at once, saving you the effort of adding them manually. You may either upload a local file from your computer or enter a URL where Drupal can download it.') . '</p>';
......@@ -108,6 +108,10 @@ function aggregator_menu_link_defaults() {
'link_title' => 'Sources',
'route_name' => 'aggregator.sources',
);
$links['aggregator.feed_add'] = array(
'link_title' => 'Add feed',
'route_name' => 'aggregator.feed_add',
);
return $links;
}
......
......@@ -22,38 +22,6 @@ aggregator.feed_items_delete:
requirements:
_permission: 'administer news feeds'
aggregator.feed_delete:
path: '/admin/config/services/aggregator/delete/feed/{aggregator_feed}'
defaults:
_entity_form: 'aggregator_feed.delete'
_title: 'Delete feed'
requirements:
_permission: 'administer news feeds'
aggregator.feed_add:
path: '/admin/config/services/aggregator/add/feed'
defaults:
_content: '\Drupal\aggregator\Controller\AggregatorController::feedAdd'
_title: 'Add feed'
requirements:
_permission: 'administer news feeds'
aggregator.feed_configure:
path: '/aggregator/sources/{aggregator_feed}/configure'
defaults:
_entity_form: 'aggregator_feed.default'
_title: 'Configure'
requirements:
_permission: 'administer news feeds'
aggregator.feed_edit:
path: '/admin/config/services/aggregator/edit/feed/{aggregator_feed}'
defaults:
_entity_form: 'aggregator_feed.default'
_title: 'Edit feed'
requirements:
_permission: 'administer news feeds'
aggregator.feed_refresh:
path: '/admin/config/services/aggregator/update/{aggregator_feed}'
defaults:
......@@ -71,6 +39,16 @@ aggregator.opml_add:
requirements:
_permission: 'administer news feeds'
aggregator.feed_add:
path: '/aggregator/sources/add'
defaults:
_content: '\Drupal\aggregator\Controller\AggregatorController::feedAdd'
_title: 'Add feed'
requirements:
_permission: 'administer news feeds'
options:
_admin_route: TRUE
aggregator.feed_view:
path: '/aggregator/sources/{aggregator_feed}'
defaults:
......@@ -79,6 +57,26 @@ aggregator.feed_view:
requirements:
_permission: 'access news feeds'
aggregator.feed_configure:
path: '/aggregator/sources/{aggregator_feed}/configure'
defaults:
_entity_form: 'aggregator_feed.default'
_title: 'Configure'
requirements:
_permission: 'administer news feeds'
options:
_admin_route: TRUE
aggregator.feed_delete:
path: '/aggregator/sources/{aggregator_feed}/delete'
defaults:
_entity_form: 'aggregator_feed.delete'
_title: 'Delete feed'
requirements:
_permission: 'administer news feeds'
options:
_admin_route: TRUE
aggregator.page_last:
path: '/aggregator'
defaults:
......
......@@ -146,7 +146,7 @@ public function adminOverview() {
$links = array();
$links['edit'] = array(
'title' => $this->t('Edit'),
'route_name' => 'aggregator.feed_edit',
'route_name' => 'aggregator.feed_configure',
'route_parameters' => array('aggregator_feed' => $feed->fid),
);
$links['delete'] = array(
......@@ -177,7 +177,7 @@ public function adminOverview() {
'#type' => 'table',
'#header' => $header,
'#rows' => $rows,
'#empty' => $this->t('No feeds available. <a href="@link">Add feed</a>.', array('@link' => $this->urlGenerator()->generateFromPath('admin/config/services/aggregator/add/feed'))),
'#empty' => $this->t('No feeds available. <a href="@link">Add feed</a>.', array('@link' => $this->urlGenerator()->generate('aggregator.feed_add'))),
);
return $build;
......
......@@ -26,7 +26,7 @@ function testAddFeed() {
$feed = $this->createFeed();
// Check feed data.
$this->assertEqual($this->getUrl(), url('admin/config/services/aggregator/add/feed', array('absolute' => TRUE)), 'Directed to correct url.');
$this->assertEqual($this->getUrl(), url('aggregator/sources/add', array('absolute' => TRUE)), 'Directed to correct url.');
$this->assertTrue($this->uniqueFeed($feed->label(), $feed->getUrl()), 'The feed is unique.');
// Check feed source.
......
......@@ -38,8 +38,7 @@ function setUp() {
/**
* Creates an aggregator feed.
*
* This method simulates the form submission on path
* admin/config/services/aggregator/add/feed.
* This method simulates the form submission on path aggregator/sources/add.
*
* @param $feed_url
* (optional) If given, feed will be created with this URL, otherwise
......@@ -54,7 +53,7 @@ function setUp() {
*/
function createFeed($feed_url = NULL, array $edit = array()) {
$edit = $this->getFeedEditArray($feed_url, $edit);
$this->drupalPostForm('admin/config/services/aggregator/add/feed', $edit, t('Save'));
$this->drupalPostForm('aggregator/sources/add', $edit, t('Save'));
$this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), format_string('The feed !name has been added.', array('!name' => $edit['title'])));
$fid = db_query("SELECT fid FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $edit['title'], ':url' => $edit['url']))->fetchField();
......@@ -69,7 +68,7 @@ function createFeed($feed_url = NULL, array $edit = array()) {
* Feed object representing the feed.
*/
function deleteFeed(FeedInterface $feed) {
$this->drupalPostForm('admin/config/services/aggregator/delete/feed/' . $feed->id(), array(), t('Delete'));
$this->drupalPostForm('aggregator/sources/' . $feed->id() . '/delete', array(), t('Delete'));
$this->assertRaw(t('The feed %title has been deleted.', array('%title' => $feed->label())), 'Feed deleted successfully.');
}
......
......@@ -44,7 +44,7 @@ function testUpdateFeedItem() {
$this->drupalGet($edit['url']);
$this->assertResponse(array(200), format_string('URL !url is accessible', array('!url' => $edit['url'])));
$this->drupalPostForm('admin/config/services/aggregator/add/feed', $edit, t('Save'));
$this->drupalPostForm('aggregator/sources/add', $edit, t('Save'));
$this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), format_string('The feed !name has been added.', array('!name' => $edit['title'])));
$fid = db_query("SELECT fid FROM {aggregator_feed} WHERE url = :url", array(':url' => $edit['url']))->fetchField();
......
......@@ -33,11 +33,11 @@ function testUpdateFeed() {
if (isset($feed->{$same_field}->value)) {
$edit[$same_field] = $feed->{$same_field}->value;
}
$this->drupalPostForm('admin/config/services/aggregator/edit/feed/' . $feed->id(), $edit, t('Save'));
$this->drupalPostForm('aggregator/sources/' . $feed->id() . '/configure', $edit, t('Save'));
$this->assertRaw(t('The feed %name has been updated.', array('%name' => $edit['title'])), format_string('The feed %name has been updated.', array('%name' => $edit['title'])));
// Check feed data.
$this->assertEqual($this->getUrl(), url('admin/config/services/aggregator', array('absolute' => TRUE)));
$this->assertEqual($this->getUrl(), url('aggregator/sources/' . $feed->id(), array('absolute' => TRUE)));
$this->assertTrue($this->uniqueFeed($edit['title'], $edit['url']), 'The feed is unique.');
// Check feed source.
......
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