Forráskód Böngészése

Version 1.3.7: Finishing

trendschau 5 éve
szülő
commit
b40046eea1

+ 5 - 0
.gitignore

@@ -12,6 +12,11 @@ content/00-welcome/00-setup.yaml
 content/00-welcome/01-write-content.yaml
 content/00-welcome/02-get-help.yaml
 content/00-welcome/03-markdown-test.yaml
+content/01-cyanine-theme/index.yaml
+content/01-cyanine-theme/00-landingpage.yaml
+content/01-cyanine-theme/01-colors-and-fonts.yaml
+content/01-cyanine-theme/02-footer.yaml
+content/01-cyanine-theme/03-content-elements.yaml
 settings/settings.yaml
 settings/users
 system/vendor

+ 0 - 8
content/.yaml

@@ -1,8 +0,0 @@
-meta:
-    title: 'Hidden Folder'
-    description: Content
-    author: 'Sebastian Schürmanns'
-    created: '2020-05-02'
-    time: 12-41-06
-    navtitle: null
-    modified: '2020-05-02'

+ 0 - 0
content/01-cyanine-theme/02-colors-and-fonts.md → content/01-cyanine-theme/01-colors-and-fonts.md


+ 0 - 8
content/01-cyanine-theme/01-footer.yaml

@@ -1,8 +0,0 @@
-meta:
-    title: '3-Column Footer'
-    description: 'Cyanine provides a three column footer at the bottom of each page. You can use markdown for each column. Make sure that you use the correct headline-level (we suggest a headline level 3 or level 4 to keep the logical headline hierarchy in the document). You can, of course, also add link-lists or'
-    author: trendschau
-    created: '2020-06-11'
-    time: 21-00-20
-    navtitle: footer
-    modified: '2020-06-11'

+ 0 - 8
content/01-cyanine-theme/02-colors-and-fonts.yaml

@@ -1,8 +0,0 @@
-meta:
-    title: 'Colors and Fonts'
-    description: 'First of all cyanine supports individual logos. If you want to use our logo, then please upload it in the system settings. Cyanine will automatically replace the title text with your logo. '
-    author: trendschau
-    created: '2020-06-11'
-    time: 20-37-12
-    navtitle: 'colors and fonts'
-    modified: '2020-06-11'

+ 0 - 0
content/01-cyanine-theme/01-footer.md → content/01-cyanine-theme/02-footer.md


+ 6 - 1
content/01-cyanine-theme/index.yaml

@@ -1,8 +1,13 @@
 meta:
     title: 'The Theme Cyanine'
     description: 'Cyanine is the new standard theme for Typemill. It is modern, lightweight and very flexible. You can activate a landingpage, setup different landing-page sections and order them like you want. You can also change the colors, fonts and other details.'
+    heroimage: null
+    heroimagealt: null
     author: trendschau
+    manualdate: null
+    modified: '2020-06-12'
     created: '2020-06-11'
     time: 19-58-04
     navtitle: cyanine
-    modified: '2020-06-11'
+    hide: false
+    contains: pages

+ 12 - 10
cypress/test02-initial-frontend.spec.js

@@ -1,24 +1,26 @@
 describe('Typemill Initial Frontend', function() 
 {
-    it('has startpage with buttons and links', function ()
+    it('has startpage with navigation', function ()
     {
       /* visit homepage */
       cy.visit('/')
 
-      /* has start and setup button */
-      cy.get('.actionLink').find('a').should(($a) => {
-        expect($a).to.have.length(1)
-        expect($a[0].href).to.match(/welcome/)
-      })
+      /* has startpage with headline */
+      cy.get('h1').contains("Typemill")
 
       /* has start and setup button */
-      cy.get('.toc-nav').find('a').should(($a) => {
-        expect($a).to.have.length(5)
+      cy.get('.cy-nav').find('a').should(($a) => {
+        expect($a).to.have.length(10)
         expect($a[0].href).to.match(/welcome/)
         expect($a[1].href).to.match(/welcome\/setup/)
         expect($a[2].href).to.match(/welcome\/write-content/)
         expect($a[3].href).to.match(/welcome\/get-help/)
         expect($a[4].href).to.match(/welcome\/markdown-test/)
+        expect($a[5].href).to.match(/cyanine-theme/)
+        expect($a[6].href).to.match(/cyanine-theme\/landingpage/)
+        expect($a[7].href).to.match(/cyanine-theme\/footer/)
+        expect($a[8].href).to.match(/cyanine-theme\/colors-and-fonts/)
+        expect($a[9].href).to.match(/cyanine-theme\/content-elements/)
       })      
     })
 
@@ -103,8 +105,8 @@ describe('Typemill Initial Frontend', function()
       /* links exists? hard to test, any idea? We need to wrap it in a div... */
 
       /* images */
-      cy.get('img').eq(0).should('have.attr', 'alt', 'alt-text')
-      cy.get('img').eq(0).should('have.attr', 'src', 'media/markdown.png')
+      cy.get('img').eq(0).should('have.attr', 'alt', 'alt')
+      cy.get('img').eq(0).should('have.attr', 'src', 'media/files/markdown.png')
       cy.get('figure').eq(2).should('have.id', 'myid')
         .and('have.class', 'otherclass')
       cy.get('img').eq(2).should('have.attr', 'alt', 'alt-text')

+ 35 - 74
cypress/test04-theme-settings.spec.js

@@ -25,171 +25,132 @@ describe('Typemill Theme Settings', function()
   {
 
     // open the form
-    cy.get('#typemill-toggle')
+    cy.get('#cyanine-toggle')
       .should('contain', 'Settings')
       .click()
 
     // fill out valid data
-    cy.get('input[name="typemill[chapter]"]')
-      .should('have.value', 'Chapter')
+    cy.get('input[name="cyanine[introButtonLink]"]')
       .clear()
-      .type('Kapitel')
-      .should('have.value', 'Kapitel')
+      .type('https://typemill.net')
+      .should('have.value', 'https://typemill.net')
 
     // fill out valid data
-    cy.get('input[name="typemill[start]"]')
-      .should('have.value', 'Start')
+    cy.get('input[name="cyanine[introButtonLabel]"]')
       .clear()
-      .type('Run')
-      .should('have.value', 'Run')
+      .type('Typemill')
+      .should('have.value', 'Typemill')
 
     // fill out valid data
-    cy.get('input[name="typemill[chapnum]"]')
+    cy.get('input[name="cyanine[chapnum]"]')
       .should('not.be.checked')
       .and('not.be.visible')
       .check({ force: true })
       .should('be.checked')
 
     // fill out valid data
-    cy.get('input[name="typemill[authorPosition][top]"]')
+    cy.get('input[name="cyanine[authorPosition][top]"]')
       .should('not.be.checked')
       .and('not.be.visible')
       .check({ force: true })
       .should('be.checked')
 
     // fill out valid data
-    cy.get('input[name="typemill[authorIntro]"]')
-      .should('have.value', 'Author')
+    cy.get('input[name="cyanine[authorIntro]"]')
       .clear()
       .type('Writer')
       .should('have.value', 'Writer')
 
     // fill out valid data
-    cy.get('input[name="typemill[modifiedPosition][bottom]"]')
+    cy.get('input[name="cyanine[datePosition][bottom]"]')
       .should('not.be.checked')
       .and('not.be.visible')
       .check({ force: true })
       .should('be.checked')
 
     // fill out valid data
-    cy.get('input[name="typemill[modifiedText]"]')
-      .should('have.value', 'Last updated')
+    cy.get('input[name="cyanine[dateIntro]"]')
       .clear()
       .type('Final update')
       .should('have.value', 'Final update')
 
-    cy.get('select[name="typemill[modifiedFormat]"]')
-      .should('have.value', 'd.m.Y')
+    cy.get('select[name="cyanine[dateFormat]"]')
+      .should('have.value', 'm/d/Y')
       .select('m/d/Y')
       .should('have.value', 'm/d/Y')
 
-    cy.get('input[name="typemill[socialPosition][bottom]"]')
-      .should('not.be.checked')
-      .and('not.be.visible')
-      .check({ force: true })
-      .should('be.checked')
-
-    cy.get('input[name="typemill[socialButtons][facebook]"]')
-      .should('not.be.checked')
-      .and('not.be.visible')
-      .check({ force: true })
-      .should('be.checked')
-
-    cy.get('input[name="typemill[socialButtons][twitter]"]')
-      .should('not.be.checked')
-      .and('not.be.visible')
-      .check({ force: true })
-      .should('be.checked')
-
-    cy.get('input[name="typemill[socialButtons][xing]"]')
+    cy.get('input[name="cyanine[gitPosition][top]"]')
       .should('not.be.checked')
       .and('not.be.visible')
       .check({ force: true })
       .should('be.checked')
 
-    cy.get('input[name="typemill[gitPosition][top]"]')
-      .should('not.be.checked')
-      .and('not.be.visible')
-      .check({ force: true })
-      .should('be.checked')
-
-    cy.get('input[name="typemill[gitlink]"]')
+    cy.get('input[name="cyanine[gitLink]"]')
       .clear()
       .type('https://github.com/typemill/docs')
       .should('have.value', 'https://github.com/typemill/docs')
 
 
-    cy.get('#theme-typemill').submit()
+    cy.get('#theme-cyanine').submit()
         cy.get('#flash-message').should('contain', 'Settings are stored')
 
 
     // fill out valid data
-    cy.get('input[name="typemill[chapter]"]')
-      .should('have.value', 'Kapitel')
+    cy.get('input[name="cyanine[introButtonLink]"]')
+      .should('have.value', 'https://typemill.net')
 
     // fill out valid data
-    cy.get('input[name="typemill[start]"]')
-      .should('have.value', 'Run')
+    cy.get('input[name="cyanine[introButtonLabel]"]')
+      .should('have.value', 'Typemill')
 
     // fill out valid data
-    cy.get('input[name="typemill[chapnum]"]')
+    cy.get('input[name="cyanine[chapnum]"]')
       .should('be.checked')
 
     // fill out valid data
-    cy.get('input[name="typemill[authorPosition][top]"]')
+    cy.get('input[name="cyanine[authorPosition][top]"]')
       .should('be.checked')
 
     // fill out valid data
-    cy.get('input[name="typemill[authorIntro]"]')
+    cy.get('input[name="cyanine[authorIntro]"]')
       .should('have.value', 'Writer')
 
     // fill out valid data
-    cy.get('input[name="typemill[modifiedPosition][bottom]"]')
+    cy.get('input[name="cyanine[datePosition][bottom]"]')
       .should('be.checked')
 
     // fill out valid data
-    cy.get('input[name="typemill[modifiedText]"]')
+    cy.get('input[name="cyanine[dateIntro]"]')
       .should('have.value', 'Final update')
 
-    cy.get('select[name="typemill[modifiedFormat]"]')
+    cy.get('select[name="cyanine[dateFormat]"]')
       .should('have.value', 'm/d/Y')
 
-    cy.get('input[name="typemill[socialPosition][bottom]"]')
-      .should('be.checked')
-
-    cy.get('input[name="typemill[socialButtons][facebook]"]')
+    cy.get('input[name="cyanine[gitPosition][top]"]')
       .should('be.checked')
 
-    cy.get('input[name="typemill[socialButtons][twitter]"]')
-      .should('be.checked')
-
-    cy.get('input[name="typemill[socialButtons][xing]"]')
-      .should('be.checked')
-
-    cy.get('input[name="typemill[gitPosition][top]"]')
-      .should('be.checked')
-
-    cy.get('input[name="typemill[gitlink]"]')
+    cy.get('input[name="cyanine[gitLink]"]')
       .should('have.value', 'https://github.com/typemill/docs')
+
   })
 
   it('validates input', function()
   {
 
     // open the form
-    cy.get('#typemill-toggle')
+    cy.get('#cyanine-toggle')
       .should('contain', 'Settings')
       .click()
 
-    // fill out valid data
-    cy.get('input[name="typemill[chapter]"]')
-      .should('have.value', 'Kapitel')
+    // fill out invalid data
+    cy.get('input[name="cyanine[introButtonLabel]"]')
+      .should('have.value', 'Typemill')
       .clear()
       .type('Kapitel<?')
       .should('have.value', 'Kapitel<?')
 
       // submit form
-    cy.get('#theme-typemill').submit()
+    cy.get('#theme-cyanine').submit()
     
     cy.get('#flash-message').should('contain', 'Please correct the errors')
 

+ 40 - 0
system/Controllers/PageController.php

@@ -36,6 +36,8 @@ class PageController extends Controller
 		$uri 			= $request->getUri();
 		$base_url		= $uri->getBaseUrl();
 
+		$this->pathToContent = $pathToContent;
+
 		try
 		{
 			# if the cached structure is still valid, use it
@@ -280,6 +282,16 @@ class PageController extends Controller
 		$yaml = new writeYaml();
 		$extended = $yaml->getYaml('cache', 'structure-extended.yaml');
 
+		if(!$extended)
+		{
+			$extended = $this->createExtended($this->pathToContent, $yaml, $structure);
+
+			if(!empty($extended))
+			{
+				$yaml->updateYaml('cache', 'structure-extended.yaml', $extended);
+			}
+		}
+
 		# create an array of object with the whole content of the folder
 		$structure = Folder::getFolderContentDetails($structure, $extended, $uri->getBaseUrl(), $uri->getBasePath());
 
@@ -304,6 +316,34 @@ class PageController extends Controller
 		return 	$this->getCachedStructure($cache);
 	}
 	
+	protected function createExtended($contentPath, $yaml, $structure, $extended = NULL)
+	{
+		if(!$extended)
+		{
+			$extended = [];
+		}
+
+		foreach ($structure as $key => $item)
+		{
+			$filename = ($item->elementType == 'folder') ? DIRECTORY_SEPARATOR . 'index.yaml' : $item->pathWithoutType . '.yaml';
+
+			if(file_exists($contentPath . $filename))
+			{				
+				# read file
+				$meta = $yaml->getYaml('content', $filename);
+
+				$extended[$item->urlRelWoF]['hide'] = isset($meta['meta']['hide']) ? $meta['meta']['hide'] : false;
+				$extended[$item->urlRelWoF]['navtitle'] = isset($meta['meta']['navtitle']) ? $meta['meta']['navtitle'] : '';
+			}
+
+			if ($item->elementType == 'folder')
+			{
+				$extended 	= $this->createExtended($contentPath, $yaml, $item->folderContent, $extended);
+			}
+		}
+		return $extended;
+	}
+
 	protected function containsHiddenPages($extended)
 	{
 		foreach($extended as $element)

+ 0 - 1
system/Models/Folder.php

@@ -587,5 +587,4 @@ class Folder
 		$parts = preg_split('/\./',$fileName);
 		return $parts[0];
 	}
-
 }

+ 1 - 1
themes/cyanine/home/landingpageNavi.twig

@@ -3,7 +3,7 @@
 		<div class="mw7 pv6 ph3 center">
 
 			<h2 class="f2 {{ settings.themes.cyanine.fontheadline|default('tm-sans-serif') }}">{{ settings.themes.cyanine.naviTitle }}</h2>
-			<nav class="f5 f4-l fw3">
+			<nav class="cy-nav f5 f4-l fw3">
 				{% include 'partials/navigationFlat.twig' with {'flatnavi': navigation, 'navidepth': settings.themes.cyanine.naviDepth } %}
 			</nav>