diff --git a/assets/js/src/listing/listing.jsx b/assets/js/src/listing/listing.jsx index 9964ef1fac..001768e15e 100644 --- a/assets/js/src/listing/listing.jsx +++ b/assets/js/src/listing/listing.jsx @@ -348,15 +348,15 @@ const Listing = React.createClass({ this.getItems(); }.bind(this)); }, - getExtraParams: function() { + getParams: function() { // get all route parameters (without the "splat") - let extras = _.omit(this.props.params, 'splat'); + let params = _.omit(this.props.params, 'splat'); // TO REFACTOR: - // set the "tab" in the routes definition - if (this.props.tab) { - extras.tab = this.props.tab; + // find a way to set the "type" in the routes definition + if (this.props.type) { + params.type = this.props.type; } - return extras; + return params; }, setParams: function() { if (this.props.location) { @@ -409,10 +409,10 @@ const Listing = React.createClass({ } }, setBaseUrlParams: function(base_url) { - if (base_url.contains(':') === true) { - const params = this.getExtraParams(); + if (base_url.indexOf(':') !== -1) { + const params = this.getParams(); Object.keys(params).map((key) => { - if (base_url.contains(':'+key)) { + if (base_url.indexOf(':'+key) !== -1) { base_url = base_url.replace(':'+key, params[key]); } }); @@ -446,7 +446,7 @@ const Listing = React.createClass({ endpoint: this.props.endpoint, action: 'listing', data: { - params: this.getExtraParams(), + params: this.getParams(), offset: (this.state.page - 1) * this.state.limit, limit: this.state.limit, group: this.state.group, @@ -561,7 +561,7 @@ const Listing = React.createClass({ var data = params || {}; data.listing = { - params: this.getExtraParams(), + params: this.getParams(), offset: 0, limit: 0, filter: this.state.filter, diff --git a/assets/js/src/newsletters/listings/notification.jsx b/assets/js/src/newsletters/listings/notification.jsx index 56948384e8..aaa83c2959 100644 --- a/assets/js/src/newsletters/listings/notification.jsx +++ b/assets/js/src/newsletters/listings/notification.jsx @@ -301,7 +301,7 @@ const NewsletterListNotification = React.createClass({ location={ this.props.location } params={ this.props.params } endpoint="newsletters" - tab="notification" + type="notification" base_url="notification" onRenderItem={ this.renderItem } columns={ columns } diff --git a/assets/js/src/newsletters/listings/notification_history.jsx b/assets/js/src/newsletters/listings/notification_history.jsx index df9f5be705..a5b6f2380a 100644 --- a/assets/js/src/newsletters/listings/notification_history.jsx +++ b/assets/js/src/newsletters/listings/notification_history.jsx @@ -234,7 +234,7 @@ const NewsletterListNotificationHistory = React.createClass({ location={ this.props.location } params={ this.props.params } endpoint="newsletters" - tab="notification_history" + type="notification_history" base_url="notification/history/:parent_id" onRenderItem={ this.renderItem } columns={columns} diff --git a/assets/js/src/newsletters/listings/standard.jsx b/assets/js/src/newsletters/listings/standard.jsx index 384a8148ef..59006bde0b 100644 --- a/assets/js/src/newsletters/listings/standard.jsx +++ b/assets/js/src/newsletters/listings/standard.jsx @@ -321,7 +321,7 @@ const NewsletterListStandard = React.createClass({ location={ this.props.location } params={ this.props.params } endpoint="newsletters" - tab="standard" + type="standard" base_url="standard" onRenderItem={this.renderItem} columns={columns} diff --git a/assets/js/src/newsletters/listings/welcome.jsx b/assets/js/src/newsletters/listings/welcome.jsx index 857e520bc5..a1ae2047c0 100644 --- a/assets/js/src/newsletters/listings/welcome.jsx +++ b/assets/js/src/newsletters/listings/welcome.jsx @@ -343,7 +343,7 @@ const NewsletterListWelcome = React.createClass({ location={ this.props.location } params={ this.props.params } endpoint="newsletters" - tab="welcome" + type="welcome" base_url="welcome" onRenderItem={ this.renderItem } columns={ columns } diff --git a/lib/Models/Newsletter.php b/lib/Models/Newsletter.php index b8752698a6..d04c750bcc 100644 --- a/lib/Models/Newsletter.php +++ b/lib/Models/Newsletter.php @@ -219,8 +219,6 @@ class Newsletter extends Model { ->where('queues.newsletter_id', $this->id) ->where('queues.status', SendingQueue::STATUS_COMPLETED) ->findOne(); - break; - default: if($this->queue === false) { return false; @@ -259,7 +257,7 @@ class Newsletter extends Model { } static function filters($data = array()) { - $type = isset($data['params']['tab']) ? $data['params']['tab'] : null; + $type = isset($data['params']['type']) ? $data['params']['type'] : null; // newsletter types without filters if(in_array($type, array( @@ -311,7 +309,7 @@ class Newsletter extends Model { } // filter by type - $type = isset($data['params']['tab']) ? $data['params']['tab'] : null; + $type = isset($data['params']['type']) ? $data['params']['type'] : null; if($type !== null) { $orm->filter('filterType', $type); } @@ -358,7 +356,7 @@ class Newsletter extends Model { } static function groups($data = array()) { - $type = isset($data['params']['tab']) ? $data['params']['tab'] : null; + $type = isset($data['params']['type']) ? $data['params']['type'] : null; // newsletter types without groups if(in_array($type, array(