diff --git a/CHANGELOG.md b/CHANGELOG.md index 01440f3..e7690cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ + +# [2.0.0](https://github.com/flextype-plugins/themes-admin/compare/v1.9.1...v2.0.0) (2021-01-15) + +* **core:** add caching for blog collection. key: `blog-collection-` + `blog_id` +* **core:** add actions for automatic blog collection cleanup `onEntries*` events. +* **core:** add random posts template. +* **core:** general performance improvements and code cleanup. +* **settings:** add new setting `blog_id` to define blog route. + +### Bug Fixes + +* **_project:** fix demo fieldsets and entries. +* **core:** fix broken links in layouts. + # [1.9.1](https://github.com/flextype-plugins/themes-admin/compare/v1.9.0...v1.9.1) (2021-01-04) diff --git a/_project/entries/blog/bender-i-didn-t-know-you-liked-cooking/entry.md b/_project/entries/blog/bender-i-didn-t-know-you-liked-cooking/entry.md new file mode 100644 index 0000000..229ab2a --- /dev/null +++ b/_project/entries/blog/bender-i-didn-t-know-you-liked-cooking/entry.md @@ -0,0 +1,16 @@ +--- +title: 'Bender, I didn''t know you liked cooking. That''s so cute.' +fieldset: blog-post +visibility: visible +routable: true +uuid: 87cdfe1b-5e48-4007-83f2-e740528cf286 +published_at: '26-02-2020 17:15' +created_at: '26-05-2020 17:15' +published_by: 8db5ecee-bf60-44d1-b918-866898f9b09d +created_by: ea7432a3-b2d5-4b04-b31d-1c5acc7a55e2 +summary: '

I had more, but you go ahead. Why would I want to know that? I just told you! You''ve killed me! This is the worst part. The calm before the battle. Anyhoo, your net-suits will allow you to experience Fry''s worm infested bowels as if you were actually wriggling through them.

Fry! Stay back! He''s too powerful! This is the worst kind of discrimination: the kind against me! There''s no part of that sentence I didn''t like! These old Doomsday Devices are dangerously unstable. I''ll rest easier not knowing where they are.

' +description: '' +template: blog-post +tags: bender +--- +

Ooh, name it after me!

I had more, but you go ahead. Why would I want to know that? I just told you! You've killed me! This is the worst part. The calm before the battle. Anyhoo, your net-suits will allow you to experience Fry's worm infested bowels as if you were actually wriggling through them.

Fry! Stay back! He's too powerful! This is the worst kind of discrimination: the kind against me! There's no part of that sentence I didn't like! These old Doomsday Devices are dangerously unstable. I'll rest easier not knowing where they are.

THE BIG BRAIN AM WINNING AGAIN! I AM THE GREETEST! NOW I AM LEAVING EARTH, FOR NO RAISEN!

I suppose I could part with 'one' and still be feared… Anyone who laughs is a communist! Oh, how I wish I could believe or understand that! There's only one reasonable course of action now: kill Flexo!

Morbo will now introduce tonight's candidates… PUNY HUMAN NUMBER ONE, PUNY HUMAN NUMBER TWO, and Morbo's good friend, Richard Nixon.

Good news, everyone! There's a report on TV with some very bad news!

Say it in Russian!

Why would I want to know that?

Ok, we'll go deliver this crate like professionals, and then we'll go ride the bumper cars. Yeah, lots of people did. Dr. Zoidberg, that doesn't make sense. But, okay! Dr. Zoidberg, that doesn't make sense. But, okay!

You'll have all the Slurm you can drink when you're partying with Slurms McKenzie!

Guards! Bring me the forms I need to fill out to have her taken away!

Maybe I love you so much I love you no matter who you are pretending to be.

You are the last hope of the universe. Shut up and take my money! I haven't felt much of anything since my guinea pig died. Why would I want to know that? Man, I'm sore all over. I feel like I just went ten rounds with mighty Thor.

Wow, you got that off the Internet? In my day, the Internet was only used to download pornography. Do a flip! Is the Space Pope reptilian!? We don't have a brig. Yes, if you make it look like an electrical fire. When you do things right, people won't be sure you've done anything at all.

And then the battle's not so bad? Pansy. And until then, I can never die? Now what?

\ No newline at end of file diff --git a/_project/entries/blog/entry.md b/_project/entries/blog/entry.md index 81648ec..cdcdf44 100644 --- a/_project/entries/blog/entry.md +++ b/_project/entries/blog/entry.md @@ -8,7 +8,10 @@ published_at: '26-05-2020 14:46' created_at: '26-05-2020 14:46' published_by: ea7432a3-b2d5-4b04-b31d-1c5acc7a55e2 created_by: ea7432a3-b2d5-4b04-b31d-1c5acc7a55e2 -entries_limit: 3 +posts_limit: 5 +posts_random_limit: 5 +posts_recent_limit: 5 +about_me: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' description: '' template: blog menu_item_title: Blog diff --git a/_project/entries/blog/my-god-they-found-me/entry.md b/_project/entries/blog/my-god-they-found-me/entry.md index 808221d..627af00 100644 --- a/_project/entries/blog/my-god-they-found-me/entry.md +++ b/_project/entries/blog/my-god-they-found-me/entry.md @@ -1,8 +1,8 @@ --- title: 'My god, they found me' summary: '

Yeah Mom, we know, you''ve told us this story a million times. You felt sorry for him so you decided to go with him to The Fish Under The Sea Dance. Dear Doctor Brown, on the night that I go back in time, you will be shot by terrorists. Please take whatever precautions are necessary to prevent this terrible disaster. Your friend, Marty. Biff, stop it. Biff, you''re breaking his arm. Biff, stop. My god, they found me. I don''t know how but they found me. Run for it, Marty. My god, they found me. I don''t know how but they found me. Run for it, Marty. Well, because George, nice girls get angry when guys take advantage of them.

' -tag: '' description: '' +tags: 'doctor, future' template: blog-post visibility: visible published_at: '26-02-2020 18:20' diff --git a/_project/entries/blog/remember-fellas-the-future-is-in-your-hands/entry.md b/_project/entries/blog/remember-fellas-the-future-is-in-your-hands/entry.md index c84b5e4..4066955 100644 --- a/_project/entries/blog/remember-fellas-the-future-is-in-your-hands/entry.md +++ b/_project/entries/blog/remember-fellas-the-future-is-in-your-hands/entry.md @@ -1,7 +1,7 @@ --- title: 'Remember, fellas, the future is in your hands' summary: '

Einstein, hey Einstein, where''s the Doc, boy, huh? Doc Yeah, well, how about my homework, McFly? No, no, George, look, it''s just an act, right? Okay, so 9:00 you''re strolling through the parking lot, you see us struggling in the car, you walk up, you open the door and you say, your line, George. Yeah Mom, we know, you''ve told us this story a million times. You felt sorry for him so you decided to go with him to The Fish Under The Sea Dance. It''s information about the future isn''t it. I warned you about this kid. The consequences could be disastrous.

' -tags: 'doc,future' +tags: 'einstein, future' description: '' template: blog-post visibility: visible diff --git a/_project/entries/blog/so-what-s-it-to-you-butthead/entry.md b/_project/entries/blog/so-what-s-it-to-you-butthead/entry.md deleted file mode 100644 index 9eb79eb..0000000 --- a/_project/entries/blog/so-what-s-it-to-you-butthead/entry.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: 'So what''s it to you, butthead.' -fieldset: blog-post -visibility: visible -routable: true -uuid: 87cdfe1b-5e48-4007-83f2-e740528cf286 -published_at: '26-02-2020 17:15' -created_at: '26-05-2020 17:15' -published_by: ea7432a3-b2d5-4b04-b31d-1c5acc7a55e2 -created_by: ea7432a3-b2d5-4b04-b31d-1c5acc7a55e2 -summary: '

So what''s it to you, butthead. You know you''ve been looking for a, since you''re new here, I''m gonna cut you a break, today. So why don''t you make like a tree, and get out of here. Now, of course not, Biff, now, I wouldn''t want that to happen. I''ll be at my grandma''s. Here, let me give you the number. Bye. Uh, well, actually, I figured since it wasn''t due till Monday- What Lorraine, what?

' -tag: '' -description: '' -template: blog-post -tags: 'sd,123' ---- -

So what's it to you, butthead. You know you've been looking for a, since you're new here, I'm gonna cut you a break, today. So why don't you make like a tree, and get out of here. Now, of course not, Biff, now, I wouldn't want that to happen. I'll be at my grandma's. Here, let me give you the number. Bye. Uh, well, actually, I figured since it wasn't due till Monday- What Lorraine, what?


Of course, from a group of Libyan Nationalists. They wanted me to build them a bomb, so I took their plutonium and in turn gave them a shiny bomb case full of used pinball machine parts. Yoo. Look, George, I'm telling you George, if you do not ask Lorraine to that dance, I'm gonna regret it for the rest of my life. Marty, you're beginning to sound just like my mother. No.


Doc, she didn't even look at him. Yeah. Well, this is a radiation suit. We never would have fallen in love. Yeah, he's right here.

\ No newline at end of file diff --git a/_project/fieldsets/blog-post.yaml b/_project/fieldsets/blog-post.yaml index 8cfadf5..3b1c7ed 100644 --- a/_project/fieldsets/blog-post.yaml +++ b/_project/fieldsets/blog-post.yaml @@ -1,18 +1,20 @@ title: 'Blog Post' default_field: title hide: false -sections: - main: - title: Main - form: +icon: + name: file-alt + set: regular +form: + tabs: + main: + title: Main fields: title: { title: admin_title, type: text, size: 12 } summary: { title: admin_summary, type: html, size: 12 } content: { title: admin_content, type: html, size: 12 } tags: { title: admin_tags, type: tags, size: 12 } - settings: - title: admin_settings - form: + settings: + title: admin_settings fields: general_heading: { title: admin_general, type: heading } description: { title: admin_description, type: textarea, size: 12 } diff --git a/_project/fieldsets/blog.yaml b/_project/fieldsets/blog.yaml index c554a06..6ba5739 100644 --- a/_project/fieldsets/blog.yaml +++ b/_project/fieldsets/blog.yaml @@ -1,16 +1,20 @@ title: Blog default_field: title hide: false -sections: - main: - title: Main - form: +icon: + name: newspaper + set: solid +form: + tabs: + main: + title: Main fields: title: { title: admin_title, type: text, size: 12 } - entries_limit: { title: admin_entries_limit, type: text, size: 4/12 } - settings: - title: admin_settings - form: + posts_limit: { title: "Posts limit", type: text, size: 4/12 } + posts_recent_limit: { title: "Recent posts limit", type: text, size: 4/12 } + posts_random_limit: { title: "Random posts limit", type: text, size: 4/12 } + settings: + title: admin_settings fields: general_heading: { title: admin_general, type: heading } description: { title: admin_description, type: textarea, size: 12 } diff --git a/assets/src/css/styles.css b/assets/src/css/styles.css index 5440c3a..72a7592 100644 --- a/assets/src/css/styles.css +++ b/assets/src/css/styles.css @@ -27,7 +27,7 @@ h1, h2, h3, h4, h5, h6 { } .blog-post-meta { - margin-bottom: 1.25rem; + margin-bottom: 2rem; color: #999; display: flex; align-items: center; diff --git a/templates/blog.html b/templates/blog.html index 1713083..539f6b3 100644 --- a/templates/blog.html +++ b/templates/blog.html @@ -6,7 +6,7 @@ {% set tag = request.getQueryParams().tag %} {% set blogID = flextype.registry.get('themes.bootstrap-blog.settings.blog_id') %} - {% set blogCollectionCacheID = strings('collectionCacheID-' ~ blogID).hash().toString() %} + {% set blogCollectionCacheID = strings('blog-collection-' ~ blogID).hash().toString() %} {% if flextype.cache.has(blogCollectionCacheID) %} {% set blog = flextype.cache.get(blogCollectionCacheID) %} {% else %} @@ -14,8 +14,10 @@ {% do flextype.cache.set(blogCollectionCacheID, blog) %} {% endif %} - {% set blogPostsLimit = flextype.entries.fetch(blogID).posts_limit %} - {% if blogPostsLimit == 0 %}{% set blogPostsLimit = 5 %}{% endif %} + {% set blogPostData = flextype.entries.fetch(blogID) %} + {% if blogPostData.posts_limit == 0 %}{% set blogPostsLimit = 5 %}{% else %}{% set blogPostsLimit = blogPostData.posts_limit %}{% endif %} + {% if blogPostData.posts_recent_limit == 0 %}{% set blogPostsRecentLimit = 5 %}{% else %}{% set blogPostsRecentLimit = blogPostData.posts_recent_limit %}{% endif %} + {% if blogPostData.posts_random_limit == 0 %}{% set blogPostsRandomLimit = 5 %}{% else %}{% set blogPostsRandomLimit = blogPostData.posts_random_limit %}{% endif %} {% if tag %} {% set blogPostsLength = blog.copy() @@ -90,6 +92,10 @@ {% include 'themes/' ~ flextype.registry.get('plugins.site.settings.theme') ~ '/templates/partials/blog/about-me.html' %} {# /about-me #} + {# random-posts #} + {% include 'themes/' ~ flextype.registry.get('plugins.site.settings.theme') ~ '/templates/partials/blog/random-posts.html' %} + {# /random-posts #} + {# recent-posts #} {% include 'themes/' ~ flextype.registry.get('plugins.site.settings.theme') ~ '/templates/partials/blog/recent-posts.html' %} {# /recent-posts #} diff --git a/templates/partials/base.html b/templates/partials/base.html index 358a429..fe16eef 100644 --- a/templates/partials/base.html +++ b/templates/partials/base.html @@ -25,9 +25,9 @@ {% set theme = flextype.registry.get('plugins.site.settings.theme') %} - {% do registry.set('assets.site.css.bootstrap-blog', 'project/themes/' ~ theme ~ '/assets/src/css/styles.css') %} + {% do flextype.registry.set('assets.site.css.bootstrap-blog', 'project/themes/' ~ theme ~ '/assets/src/css/styles.css') %} - {% if registry.has('assets.site.css') %} + {% if flextype.registry.has('assets.site.css') %} {% for css in flextype.registry.get('assets.site.css') %} {% endfor %} @@ -76,7 +76,7 @@ - {% if registry.has('assets.site.js') %} + {% if flextype.registry.has('assets.site.js') %} {% for js in flextype.registry.get('assets.site.js') %} {% if js %} diff --git a/templates/partials/blog/random-posts.html b/templates/partials/blog/random-posts.html new file mode 100644 index 0000000..bc3f542 --- /dev/null +++ b/templates/partials/blog/random-posts.html @@ -0,0 +1,8 @@ +

Random Posts

+ diff --git a/templates/partials/blog/recent-posts.html b/templates/partials/blog/recent-posts.html index 587aae8..3ad8626 100644 --- a/templates/partials/blog/recent-posts.html +++ b/templates/partials/blog/recent-posts.html @@ -3,7 +3,7 @@

Recent Posts

{% for post in blog.copy() .where('visibility', 'nin', ['draft', 'hidden']) .sortBy('published_at', 'DESC') - .limit(blogPostsLimit) %} + .limit(blogPostsRecentLimit) %}
  • {{ post.title }}
  • {% endfor %} diff --git a/theme.php b/theme.php index c8e8cab..d78c825 100644 --- a/theme.php +++ b/theme.php @@ -27,8 +27,7 @@ return arrays($result); }); - -$blogCollectionCacheID = strings('collectionCacheID-' . flextype('registry') +$blogCollectionCacheID = strings('blog-collection-' . flextype('registry') ->get('themes.bootstrap-blog.settings.blog_id')) ->hash() ->toString(); @@ -42,6 +41,14 @@ flextype('cache')->delete($blogCollectionCacheID); }); +flextype('emitter')->addListener('onEntriesCopy', function () use ($blogCollectionCacheID) { + flextype('cache')->delete($blogCollectionCacheID); +}); + +flextype('emitter')->addListener('onEntriesMove', function () use ($blogCollectionCacheID) { + flextype('cache')->delete($blogCollectionCacheID); +}); + flextype('emitter')->addListener('onEntriesUpdate', function () use ($blogCollectionCacheID) { flextype('cache')->delete($blogCollectionCacheID); }); diff --git a/theme.yaml b/theme.yaml index 97a450d..5f289e6 100755 --- a/theme.yaml +++ b/theme.yaml @@ -1,15 +1,15 @@ name: Bootstrap Blog -version: 1.9.1 +version: 2.0.0 description: Twitter Bootstrap Blog theme for Flextype. author: name: Sergey Romanenko - email: support@flextype.org + email: sergey.romanenko@flextype.org url: https://flextype.org homepage: https://github.com/flextype-themes/bootstrap-blog bugs: https://github.com/flextype-themes/bootstrap-blog/issues license: MIT dependencies: - flextype: 0.9.15 + flextype: 0.9.16 site: '>=1.0.0' - twig: '>=1.0.0' + twig: '>=2.0.0'