Jhernandez has uploaded a new change for review.
https://gerrit.wikimedia.org/r/190252
Change subject: Hygiene: Remove suffix from view names
......................................................................
Hygiene: Remove suffix from view names
Since they are properly namespaced now
Change-Id: I654331d5f0f8acc8c2bb1d833ef75908fe8bae15
---
M Gather.php
M includes/specials/SpecialGather.php
R includes/views/Collection.php
R includes/views/CollectionItemCard.php
R includes/views/CollectionsList.php
R includes/views/CollectionsListItemCard.php
R includes/views/ItemImage.php
R includes/views/UserNotFound.php
8 files changed, 41 insertions(+), 42 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather
refs/changes/52/190252/1
diff --git a/Gather.php b/Gather.php
index 501d3a7..6bfdc4b 100644
--- a/Gather.php
+++ b/Gather.php
@@ -53,12 +53,12 @@
'Gather\stores\ItemImages' => 'stores/ItemImages',
'Gather\views\View' => 'views/View',
- 'Gather\views\UserNotFoundView' => 'views/UserNotFoundView',
- 'Gather\views\CollectionView' => 'views/CollectionView',
- 'Gather\views\CollectionItemCardView' => 'views/CollectionItemCardView',
- 'Gather\views\ItemImageView' => 'views/ItemImageView',
- 'Gather\views\CollectionsListView' => 'views/CollectionsListView',
- 'Gather\views\CollectionsListItemCardView' =>
'views/CollectionsListItemCardView',
+ 'Gather\views\UserNotFound' => 'views/UserNotFound',
+ 'Gather\views\Collection' => 'views/Collection',
+ 'Gather\views\CollectionItemCard' => 'views/CollectionItemCard',
+ 'Gather\views\ItemImage' => 'views/ItemImage',
+ 'Gather\views\CollectionsList' => 'views/CollectionsList',
+ 'Gather\views\CollectionsListItemCard' =>
'views/CollectionsListItemCard',
'Gather\views\helpers\CSS' => 'views/helpers/CSS',
diff --git a/includes/specials/SpecialGather.php
b/includes/specials/SpecialGather.php
index b519467..7e56a37 100644
--- a/includes/specials/SpecialGather.php
+++ b/includes/specials/SpecialGather.php
@@ -60,7 +60,7 @@
* Render an error when the user was not found
*/
public function renderUserNotFoundError() {
- $this->render( new views\UserNotFoundView() );
+ $this->render( new views\UserNotFound() );
}
/**
@@ -85,7 +85,7 @@
}
// FIXME: For empty-collection and not-allowed-to-see-this we
are doing the
// same thing right now.
- $this->render( new views\CollectionView( $collection ) );
+ $this->render( new views\Collection( $collection ) );
}
/**
@@ -98,7 +98,7 @@
$collectionsListStore = new
stores\DumbWatchlistOnlyCollectionsList(
$user, $this->isOwner( $user )
);
- $this->render( new views\CollectionsListView(
$collectionsListStore->getLists() ) );
+ $this->render( new views\CollectionsList(
$collectionsListStore->getLists() ) );
}
/**
diff --git a/includes/views/CollectionView.php b/includes/views/Collection.php
similarity index 85%
rename from includes/views/CollectionView.php
rename to includes/views/Collection.php
index ccdbeb4..d13a134 100644
--- a/includes/views/CollectionView.php
+++ b/includes/views/Collection.php
@@ -1,6 +1,6 @@
<?php
/**
- * CollectionView.php
+ * Collection.php
*/
namespace Gather\views;
@@ -9,21 +9,21 @@
use \User;
use \SpecialPage;
use Gather\views\helpers\CSS;
-use Gather\models\Collection;
+use Gather\models;
/**
* Render a mobile card.
*/
-class CollectionView extends View {
+class Collection extends View {
/**
* @var Collection
*/
protected $collection;
/**
- * @param Collection $collection
+ * @param models\Collection $collection
*/
- public function __construct( Collection $collection ) {
+ public function __construct( models\Collection $collection ) {
$this->collection = $collection;
}
@@ -33,7 +33,7 @@
*
* @return string Html
*/
- private function getHeaderHtml( Collection $collection ) {
+ private function getHeaderHtml( models\Collection $collection ) {
$collection = $this->collection;
$description = $collection->getDescription();
$owner = $collection->getOwner();
@@ -67,7 +67,7 @@
* @return string HTML
*/
private function getEmptyCollectionMessage() {
- // FIXME: i18n this messagesinclude 'CollectionView.php';
+ // FIXME: i18n this messagesinclude 'Collection.php';
return Html::openElement( 'div', array( 'class' =>
'collection-empty' ) ) .
Html::element( 'h3', array(), wfMessage( 'gather-empty'
) ) .
Html::element( 'div', array(),
@@ -86,16 +86,15 @@
/**
* Returns the html for the items of a collection
- *
- * @param Collection
+ * @param models\Collection
*
* @return string HTML
*/
- public function getCollectionItems( Collection $collection ) {
+ public function getCollectionItems( models\Collection $collection ) {
$html = Html::openElement( 'div', array( 'class' =>
'collection-items' ) );
foreach ( $collection as $item ) {
if ( $item->getTitle()->getNamespace() === NS_MAIN ) {
- $view = new CollectionItemCardView( $item );
+ $view = new CollectionItemCard( $item );
$html .= $view->getHtml();
}
}
diff --git a/includes/views/CollectionItemCardView.php
b/includes/views/CollectionItemCard.php
similarity index 83%
rename from includes/views/CollectionItemCardView.php
rename to includes/views/CollectionItemCard.php
index 5f7d198..2f16308 100644
--- a/includes/views/CollectionItemCardView.php
+++ b/includes/views/CollectionItemCard.php
@@ -1,32 +1,32 @@
<?php
/**
- * CollectionItemCardView.php
+ * CollectionItemCard.php
*/
namespace Gather\views;
-use Gather\models\CollectionItem;
+use Gather\models;
use Gather\views\helpers\CSS;
use \Html;
/**
* View for an item card in a mobile collection.
*/
-class CollectionItemCardView extends View {
+class CollectionItemCard extends View {
protected $item;
/**
- * @var ItemImageView view for the item image
+ * @var ItemImage view for the item image
*/
protected $image;
/**
* Constructor
- * @param CollectionItem $item
+ * @param models\CollectionItem $item
*/
- public function __construct( CollectionItem $item ) {
+ public function __construct( models\CollectionItem $item ) {
$this->item = $item;
- $this->image = new ItemImageView( $item );
+ $this->image = new ItemImage( $item );
}
/**
diff --git a/includes/views/CollectionsListView.php
b/includes/views/CollectionsList.php
similarity index 89%
rename from includes/views/CollectionsListView.php
rename to includes/views/CollectionsList.php
index ead99a1..afbbb10 100644
--- a/includes/views/CollectionsListView.php
+++ b/includes/views/CollectionsList.php
@@ -1,6 +1,6 @@
<?php
/**
- * CollectionsListView.php
+ * CollectionsList.php
*/
namespace Gather\views;
@@ -10,7 +10,7 @@
/**
* Renders a mobile collection card list
*/
-class CollectionsListView extends View {
+class CollectionsList extends View {
/**
* @param Collection[] $collectionsList
*/
@@ -28,7 +28,7 @@
public static function getListItemsHtml( $collectionsList ) {
$html = Html::openElement( 'div', array( 'class' =>
'collection-cards' ) );
foreach ( $collectionsList as $item ) {
- $view = new CollectionsListItemCardView( $item );
+ $view = new CollectionsListItemCard( $item );
$html .= $view->getHtml();
}
// FIXME: Pagination
diff --git a/includes/views/CollectionsListItemCardView.php
b/includes/views/CollectionsListItemCard.php
similarity index 86%
rename from includes/views/CollectionsListItemCardView.php
rename to includes/views/CollectionsListItemCard.php
index a15deeb..3215308 100644
--- a/includes/views/CollectionsListItemCardView.php
+++ b/includes/views/CollectionsListItemCard.php
@@ -1,22 +1,22 @@
<?php
/**
- * CollectionsListItemCardView.php
+ * CollectionsListItemCard.php
*/
namespace Gather\views;
-use Gather\models\Collection;
+use Gather\models;
use \Html;
/**
* View for an item card in a mobile collection.
*/
-class CollectionsListItemCardView extends View {
+class CollectionsListItemCard extends View {
/**
- * @param Collection $collection
+ * @param models\Collection $collection
*/
- public function __construct( Collection $collection ) {
+ public function __construct( models\Collection $collection ) {
$this->collection = $collection;
}
diff --git a/includes/views/ItemImageView.php b/includes/views/ItemImage.php
similarity index 90%
rename from includes/views/ItemImageView.php
rename to includes/views/ItemImage.php
index fecdae3..7da357c 100644
--- a/includes/views/ItemImageView.php
+++ b/includes/views/ItemImage.php
@@ -1,25 +1,25 @@
<?php
/**
- * ItemImageView.php
+ * ItemImage.php
*/
namespace Gather\views;
-use Gather\models\CollectionItem;
+use Gather\models;
use Gather\views\helpers\CSS;
use \Html;
/**
* View for the image of an item card.
*/
-class ItemImageView {
+class ItemImage {
protected $item;
/**
* Constructor
- * @param CollectionItem $item
+ * @param models\CollectionItem $item
*/
- public function __construct( CollectionItem $item ) {
+ public function __construct( models\CollectionItem $item ) {
$this->item = $item;
}
diff --git a/includes/views/UserNotFoundView.php
b/includes/views/UserNotFound.php
similarity index 91%
rename from includes/views/UserNotFoundView.php
rename to includes/views/UserNotFound.php
index 404aa8e..7ffb616 100644
--- a/includes/views/UserNotFoundView.php
+++ b/includes/views/UserNotFound.php
@@ -1,6 +1,6 @@
<?php
/**
- * UserNotFoundView.php
+ * UserNotFound.php
*/
namespace Gather\views;
@@ -10,7 +10,7 @@
/**
* Renders an error when the user wasn't found
*/
-class UserNotFoundView extends View {
+class UserNotFound extends View {
/**
* @inheritdoc
--
To view, visit https://gerrit.wikimedia.org/r/190252
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I654331d5f0f8acc8c2bb1d833ef75908fe8bae15
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits