Ver código fonte

Version 1.3.1: Improve Meta-Tabs

trendschau 5 anos atrás
pai
commit
b1fb245b4b

+ 1 - 0
.gitignore

@@ -1,4 +1,5 @@
 cache
+cache/lastCache.txt
 content/index.yaml
 content/00-Welcome/index.yaml
 content/00-Welcome/00-Setup.yaml

+ 1 - 1
cache/lastCache.txt

@@ -1 +1 @@
-1578328271
+1577899842

+ 9 - 2
system/Controllers/SettingsController.php

@@ -301,7 +301,7 @@ class SettingsController extends Controller
 				{
 					/* validate the user-input */
 					$this->validateInput('plugins', $pluginName, $userInput[$pluginName], $validate);
-										
+
 					/* use the input data */
 					$pluginSettings[$pluginName] = $userInput[$pluginName];
 				}
@@ -364,6 +364,13 @@ class SettingsController extends Controller
 				$originalFields['recaptcha_secretkey'] = ['type' => 'text', 'label' => 'Recaptcha Secret Key', 'help' => 'Add the recaptcha secret key here. You can get the key from the recaptcha website.', 'description' => 'The secret key is mandatory if you activate the recaptcha field'];
 			}
 
+			# if plugin is not active, then skip required
+			$skiprequired = false;
+			if($objectType == 'plugins' && !isset($userInput['active']))
+			{
+				$skiprequired = true;
+			}
+			
 			/* take the user input data and iterate over all fields and values */
 			foreach($userInput as $fieldName => $fieldValue)
 			{
@@ -373,7 +380,7 @@ class SettingsController extends Controller
 				if($fieldDefinition)
 				{
 					/* validate user input for this field */
-					$validate->objectField($fieldName, $fieldValue, $objectName, $fieldDefinition);
+					$validate->objectField($fieldName, $fieldValue, $objectName, $fieldDefinition, $skiprequired);
 				}
 				if(!$fieldDefinition && $fieldName != 'active')
 				{

+ 9 - 2
system/Models/Folder.php

@@ -53,8 +53,15 @@ class Folder
 			{
 				if (is_dir($folderPath . DIRECTORY_SEPARATOR . $item))
 				{
-					$subFolder 					= $item;
-					$folderContent[$subFolder] 	= self::scanFolder($folderPath . DIRECTORY_SEPARATOR . $subFolder, $draft);
+
+					$subFolder 		 	= $item;
+					$folderPublished 	= file_exists($folderPath . DIRECTORY_SEPARATOR . $item . DIRECTORY_SEPARATOR . 'index.md');
+
+					# scan that folder only if it is a draft or if the folder is published (contains index.md)
+					if($draft OR $folderPublished)
+					{
+						$folderContent[$subFolder] 	= self::scanFolder($folderPath . DIRECTORY_SEPARATOR . $subFolder, $draft);
+					}
 				}
 				else
 				{

+ 3 - 3
system/Models/Validation.php

@@ -329,11 +329,11 @@ class Validation
 	* @return obj $v the validation object passed to a result method.
 	*/
 	
-	public function objectField($fieldName, $fieldValue, $objectName, $fieldDefinitions)
+	public function objectField($fieldName, $fieldValue, $objectName, $fieldDefinitions, $skiprequired = NULL)
 	{	
 		$v = new Validator(array($fieldName => $fieldValue));
-
-		if(isset($fieldDefinitions['required']))
+		
+		if(isset($fieldDefinitions['required']) && !$skiprequired)
 		{
 			$v->rule('required', $fieldName);
 		}

+ 1 - 1
system/author/auth/welcome.twig

@@ -11,7 +11,7 @@
 				<h1>Hurra!</h1>
 				<p>Your account has been created and you are logged in now.</p>
 				<p><strong>Next step:</strong> Visit the author panel and setup your new website. You can configure the system, choose themes and add plugins.</p>
-				<p><strong>New:</strong>Hurra! Version 1.3.0 is out and now you can edit meta-information like title and description.</p>
+				<p><strong>New:</strong>Hurra! Series 1.3 is out and now you can edit meta-information like title and description.</p>
 				<p><strong>Get help:</strong> If you have any questions, please consult the <a target="_blank" href="https://typemill.net/typemill"><i class="icon-link-ext"></i> docs</a> or open a new issue on <a target="_blank" href="https://github.com/typemill/typemill"><i class="icon-link-ext"></i> github</a>.</p>
 			</div>
 			<a class="button" href="{{ path_for('settings.show') }}">Configure your website</a>

+ 1 - 1
system/author/settings/plugins.twig

@@ -6,7 +6,7 @@
 	
 	<div class="formWrapper">
 
-		<form method="POST" action="{{ path_for('plugins.save') }}">
+		<form method="POST" action="{{ path_for('plugins.save') }}" novalidate>
 
 			<section id="plugins" class="plugins">