Add an option for certain templates to be read only

This commit is contained in:
Tautvidas Sipavičius
2015-11-30 18:23:43 +02:00
parent 8461c13532
commit d21d9b99b0
4 changed files with 8 additions and 5 deletions

View File

@ -99,7 +99,7 @@ define(
"MailPoet's Guide", "MailPoet's Guide",
description: description:
"This is the standard template that comes with MailPoet.", "This is the standard template that comes with MailPoet.",
readonly: true readonly: "1"
} }
] ]
} }
@ -210,7 +210,7 @@ define(
Preview Preview
</a> </a>
</div> </div>
{ (template.readonly) ? false : deleteLink } { (template.readonly === "1") ? false : deleteLink }
</li> </li>
); );
}.bind(this)); }.bind(this));

View File

@ -99,8 +99,9 @@ class Migrator {
'id mediumint(9) NOT NULL AUTO_INCREMENT,', 'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'name varchar(250) NOT NULL,', 'name varchar(250) NOT NULL,',
'description varchar(250) NOT NULL,', 'description varchar(250) NOT NULL,',
'body longtext,', 'body LONGTEXT,',
'thumbnail longtext,', 'thumbnail LONGTEXT,',
'readonly TINYINT(1) DEFAULT 0',
'created_at TIMESTAMP NOT NULL DEFAULT 0,', 'created_at TIMESTAMP NOT NULL DEFAULT 0,',
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,', 'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
'PRIMARY KEY (id)' 'PRIMARY KEY (id)'
@ -265,4 +266,4 @@ class Migrator {
return implode("\n", $sql); return implode("\n", $sql);
} }
} }

View File

@ -15,6 +15,7 @@ class BlankTemplate {
return array( return array(
'name' => __("A Blank Template"), 'name' => __("A Blank Template"),
'description' => __("A blank canvas ready for you to create something wonderful."), 'description' => __("A blank canvas ready for you to create something wonderful."),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(), 'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()), 'body' => json_encode($this->getBody()),
); );

View File

@ -15,6 +15,7 @@ class FranksRoastHouseTemplate {
return array( return array(
'name' => __("Frank's Roast House"), 'name' => __("Frank's Roast House"),
'description' => __("Think of this as your playground, ready for you to explore. Play around with this example newsletter and get a handle of what MailPoet can do for you."), 'description' => __("Think of this as your playground, ready for you to explore. Play around with this example newsletter and get a handle of what MailPoet can do for you."),
'readonly' => 0,
'thumbnail' => $this->getThumbnail(), 'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()), 'body' => json_encode($this->getBody()),
); );