Listing & Form & Refactoring
- finished implementing forms - fixed form reset when clicking on new - fixed responsive for select all checkbox and toggle item details - refactored listing items' actions - added Trash action - cleaned up validations on models - fixed syntax - fixed tests
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace MailPoet\Models;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
class Newsletter extends Model {
|
||||
public static $_table = MP_NEWSLETTERS_TABLE;
|
||||
@ -10,12 +10,7 @@ class Newsletter extends Model {
|
||||
parent::__construct();
|
||||
|
||||
$this->addValidations('subject', array(
|
||||
'required' => 'subject_is_blank',
|
||||
'isString' => 'subject_is_not_string'
|
||||
));
|
||||
$this->addValidations('body', array(
|
||||
'required' => 'body_is_blank',
|
||||
'isString' => 'body_is_not_string'
|
||||
'required' => __('You need to specify a subject.')
|
||||
));
|
||||
}
|
||||
|
||||
@ -36,7 +31,7 @@ class Newsletter extends Model {
|
||||
static function group($orm, $group = null) {
|
||||
}
|
||||
|
||||
public static function createOrUpdate($data = array()) {
|
||||
static function createOrUpdate($data = array()) {
|
||||
$newsletter = false;
|
||||
|
||||
if(isset($data['id']) && (int)$data['id'] > 0) {
|
||||
|
@ -4,18 +4,17 @@ namespace MailPoet\Models;
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
class Segment extends Model {
|
||||
public static $_table = MP_SEGMENTS_TABLE;
|
||||
static $_table = MP_SEGMENTS_TABLE;
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
$this->addValidations('name', array(
|
||||
'required' => 'name_is_blank',
|
||||
'isString' => 'name_is_not_string'
|
||||
'required' => __('You need to specify a name.')
|
||||
));
|
||||
}
|
||||
|
||||
public function subscribers() {
|
||||
function subscribers() {
|
||||
return $this->has_many_through(
|
||||
__NAMESPACE__.'\Subscriber',
|
||||
__NAMESPACE__.'\SubscriberSegment',
|
||||
@ -41,7 +40,7 @@ class Segment extends Model {
|
||||
static function group($orm, $group = null) {
|
||||
}
|
||||
|
||||
public static function createOrUpdate($data = array()) {
|
||||
static function createOrUpdate($data = array()) {
|
||||
$segment = false;
|
||||
|
||||
if(isset($data['id']) && (int)$data['id'] > 0) {
|
||||
|
@ -62,7 +62,7 @@ class Subscriber extends Model {
|
||||
return $orm->where('status', $group);
|
||||
}
|
||||
|
||||
public function segments() {
|
||||
function segments() {
|
||||
return $this->has_many_through(
|
||||
__NAMESPACE__.'\Segment',
|
||||
__NAMESPACE__.'\SubscriberSegment',
|
||||
@ -71,7 +71,7 @@ class Subscriber extends Model {
|
||||
);
|
||||
}
|
||||
|
||||
public static function createOrUpdate($data = array()) {
|
||||
static function createOrUpdate($data = array()) {
|
||||
$subscriber = false;
|
||||
|
||||
if(isset($data['id']) && (int)$data['id'] > 0) {
|
||||
|
Reference in New Issue
Block a user