From 4f099ca263da1d11a306ba796e96268cd61ec343 Mon Sep 17 00:00:00 2001 From: merdan Date: Sun, 14 Mar 2021 18:53:00 +0500 Subject: [PATCH] Post page --- .../smallcontactform/models/Message.php | 21 ++- .../smallcontactform/updates/version.yaml | 4 +- .../smallcontactform/vendor/autoload.php | 2 +- .../vendor/composer/autoload_real.php | 8 +- .../vendor/composer/autoload_static.php | 6 +- .../vendor/composer/installed.json | 8 +- .../vendor/composer/installers/README.md | 1 + .../src/Composer/Installers/Installer.php | 3 +- plugins/rainlab/blog/components/Post.php | 8 +- plugins/rainlab/blog/models/Post.php | 4 +- plugins/rainlab/blog/models/post/fields.yaml | 19 ++- .../blog/updates/posts_add_featured_image.php | 31 ++++ plugins/rainlab/blog/updates/version.yaml | 3 + themes/modern/config/lang.yaml | 4 + themes/modern/layouts/cms.htm | 34 ++++ themes/modern/pages/category.htm | 64 +++++++- themes/modern/pages/post.htm | 146 +++++++++++++++++- themes/modern/partials/calendar.htm | 6 + themes/modern/partials/latest_news.htm | 43 ++++++ themes/modern/partials/post_card_item.htm | 29 ++++ themes/modern/partials/post_list_item.htm | 49 ++++++ themes/modern/partials/tags.htm | 61 ++++++++ 22 files changed, 527 insertions(+), 27 deletions(-) create mode 100644 plugins/rainlab/blog/updates/posts_add_featured_image.php create mode 100644 themes/modern/layouts/cms.htm create mode 100644 themes/modern/partials/calendar.htm create mode 100644 themes/modern/partials/latest_news.htm create mode 100644 themes/modern/partials/post_card_item.htm create mode 100644 themes/modern/partials/post_list_item.htm create mode 100644 themes/modern/partials/tags.htm diff --git a/plugins/janvince/smallcontactform/models/Message.php b/plugins/janvince/smallcontactform/models/Message.php index 0e8f02288..46782ec94 100644 --- a/plugins/janvince/smallcontactform/models/Message.php +++ b/plugins/janvince/smallcontactform/models/Message.php @@ -258,7 +258,16 @@ class Message extends Model Log::error('SMALL CONTACT FORM: Missing defined email template: ' . $componentProperties[ ('autoreply_template_'.App::getLocale())] . '. ' . $template . ' template will be used!'); } - Mail::{$method}($template, ['messageObject' => $messageObject, 'uploads' => $messageObject->uploads, 'fields' => $output, 'fieldsDetails' => $outputFull, 'url' => url()->full()], function($message) use($sendTo, $componentProperties, $output){ + if(!empty($messageObject->uploads)) + { + $uploads = $messageObject->uploads; + } + else + { + $uploads = []; + } + + Mail::{$method}($template, ['messageObject' => $messageObject, 'uploads' => $uploads, 'fields' => $output, 'fieldsDetails' => $outputFull, 'url' => url()->full()], function($message) use($sendTo, $componentProperties, $output){ $message->to($sendTo); if (!empty($componentProperties['autoreply_subject'])) { @@ -446,8 +455,16 @@ class Message extends Model Log::error('SMALL CONTACT FORM: Missing defined email template: ' . $componentProperties[ ('notification_template_'.App::getLocale())] . '. ' . $template . ' template will be used!'); } + if(!empty($messageObject->uploads)) + { + $uploads = $messageObject->uploads; + } + else + { + $uploads = []; + } - Mail::{$method}($template, ['messageObject' => $messageObject, 'uploads' => $messageObject->uploads, 'fields' => $output, 'fieldsDetails' => $outputFull, 'url' => url()->full()], function($message) use($sendToAddressesValidated, $replyToAddress, $replyToName, $componentProperties, $output){ + Mail::{$method}($template, ['messageObject' => $messageObject, 'uploads' => $uploads, 'fields' => $output, 'fieldsDetails' => $outputFull, 'url' => url()->full()], function($message) use($sendToAddressesValidated, $replyToAddress, $replyToName, $componentProperties, $output){ if( count($sendToAddressesValidated)>1 ) { diff --git a/plugins/janvince/smallcontactform/updates/version.yaml b/plugins/janvince/smallcontactform/updates/version.yaml index 65e2b4082..79ab122f3 100644 --- a/plugins/janvince/smallcontactform/updates/version.yaml +++ b/plugins/janvince/smallcontactform/updates/version.yaml @@ -230,4 +230,6 @@ - Fixed AJAX validation - Updated README 1.51.1: - - Removed uploads array from default fields sent to autoreply template \ No newline at end of file + - Removed uploads array from default fields sent to autoreply template +1.51.2: + - Fixed uploads field in email messages \ No newline at end of file diff --git a/plugins/janvince/smallcontactform/vendor/autoload.php b/plugins/janvince/smallcontactform/vendor/autoload.php index 4a06a75ed..300a694c3 100644 --- a/plugins/janvince/smallcontactform/vendor/autoload.php +++ b/plugins/janvince/smallcontactform/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit72036f1eda87e289ce9c6a3db2183e92::getLoader(); +return ComposerAutoloaderInit09b213e01e94cc60dfc52fd1d9c7122e::getLoader(); diff --git a/plugins/janvince/smallcontactform/vendor/composer/autoload_real.php b/plugins/janvince/smallcontactform/vendor/composer/autoload_real.php index d677f5ac7..546c1989c 100644 --- a/plugins/janvince/smallcontactform/vendor/composer/autoload_real.php +++ b/plugins/janvince/smallcontactform/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit72036f1eda87e289ce9c6a3db2183e92 +class ComposerAutoloaderInit09b213e01e94cc60dfc52fd1d9c7122e { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInit72036f1eda87e289ce9c6a3db2183e92 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit72036f1eda87e289ce9c6a3db2183e92', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit09b213e01e94cc60dfc52fd1d9c7122e', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit72036f1eda87e289ce9c6a3db2183e92', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit09b213e01e94cc60dfc52fd1d9c7122e', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit72036f1eda87e289ce9c6a3db2183e92::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit09b213e01e94cc60dfc52fd1d9c7122e::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { diff --git a/plugins/janvince/smallcontactform/vendor/composer/autoload_static.php b/plugins/janvince/smallcontactform/vendor/composer/autoload_static.php index d464c5619..1cfc83aa3 100644 --- a/plugins/janvince/smallcontactform/vendor/composer/autoload_static.php +++ b/plugins/janvince/smallcontactform/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit72036f1eda87e289ce9c6a3db2183e92 +class ComposerStaticInit09b213e01e94cc60dfc52fd1d9c7122e { public static $prefixLengthsPsr4 = array ( 'C' => @@ -23,8 +23,8 @@ class ComposerStaticInit72036f1eda87e289ce9c6a3db2183e92 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit72036f1eda87e289ce9c6a3db2183e92::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit72036f1eda87e289ce9c6a3db2183e92::$prefixDirsPsr4; + $loader->prefixLengthsPsr4 = ComposerStaticInit09b213e01e94cc60dfc52fd1d9c7122e::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit09b213e01e94cc60dfc52fd1d9c7122e::$prefixDirsPsr4; }, null, ClassLoader::class); } diff --git a/plugins/janvince/smallcontactform/vendor/composer/installed.json b/plugins/janvince/smallcontactform/vendor/composer/installed.json index 7ff52ad67..5412a899d 100644 --- a/plugins/janvince/smallcontactform/vendor/composer/installed.json +++ b/plugins/janvince/smallcontactform/vendor/composer/installed.json @@ -6,12 +6,12 @@ "source": { "type": "git", "url": "https://github.com/composer/installers.git", - "reference": "98b34f8ab3558bee5caa7c07efbab3f5bd7663ab" + "reference": "1b94b414035400a8be5c694048a0e711a86b1080" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/installers/zipball/98b34f8ab3558bee5caa7c07efbab3f5bd7663ab", - "reference": "98b34f8ab3558bee5caa7c07efbab3f5bd7663ab", + "url": "https://api.github.com/repos/composer/installers/zipball/1b94b414035400a8be5c694048a0e711a86b1080", + "reference": "1b94b414035400a8be5c694048a0e711a86b1080", "shasum": "" }, "require": { @@ -29,7 +29,7 @@ "symfony/phpunit-bridge": "^4.2 || ^5", "symfony/process": "^2.3" }, - "time": "2021-02-02T15:00:11+00:00", + "time": "2021-03-08T12:02:54+00:00", "type": "composer-plugin", "extra": { "class": "Composer\\Installers\\Plugin", diff --git a/plugins/janvince/smallcontactform/vendor/composer/installers/README.md b/plugins/janvince/smallcontactform/vendor/composer/installers/README.md index 1065bda05..8da100f26 100644 --- a/plugins/janvince/smallcontactform/vendor/composer/installers/README.md +++ b/plugins/janvince/smallcontactform/vendor/composer/installers/README.md @@ -123,6 +123,7 @@ is not needed to install packages with these frameworks: | Vanilla | `vanilla-plugin`
`vanilla-theme` | Vgmcp | `vgmcp-bundle`
`vgmcp-theme` | WHMCS | `whmcs-addons`
`whmcs-fraud`
`whmcs-gateways`
`whmcs-notifications`
`whmcs-registrars`
`whmcs-reports`
`whmcs-security`
`whmcs-servers`
`whmcs-social`
`whmcs-support`
`whmcs-templates`
`whmcs-includes` +| Winter CMS | **`winter-module`
`winter-plugin`
`winter-theme`** | Wolf CMS | `wolfcms-plugin` | WordPress | `wordpress-plugin`
`wordpress-theme`

`wordpress-muplugin`
`wordpress-dropin` | YAWIK | `yawik-module` diff --git a/plugins/janvince/smallcontactform/vendor/composer/installers/src/Composer/Installers/Installer.php b/plugins/janvince/smallcontactform/vendor/composer/installers/src/Composer/Installers/Installer.php index cf3a09ac1..82e7236bc 100644 --- a/plugins/janvince/smallcontactform/vendor/composer/installers/src/Composer/Installers/Installer.php +++ b/plugins/janvince/smallcontactform/vendor/composer/installers/src/Composer/Installers/Installer.php @@ -78,7 +78,7 @@ class Installer extends LibraryInstaller 'october' => 'OctoberInstaller', 'ontowiki' => 'OntoWikiInstaller', 'oxid' => 'OxidInstaller', - 'osclass' => 'OsclassInstaller', + 'osclass' => 'OsclassInstaller', 'pxcms' => 'PxcmsInstaller', 'phpbb' => 'PhpBBInstaller', 'pimcore' => 'PimcoreInstaller', @@ -110,6 +110,7 @@ class Installer extends LibraryInstaller 'userfrosting' => 'UserFrostingInstaller', 'vanilla' => 'VanillaInstaller', 'whmcs' => 'WHMCSInstaller', + 'winter' => 'WinterInstaller', 'wolfcms' => 'WolfCMSInstaller', 'wordpress' => 'WordPressInstaller', 'yawik' => 'YawikInstaller', diff --git a/plugins/rainlab/blog/components/Post.php b/plugins/rainlab/blog/components/Post.php index b1628970b..636e6aca2 100644 --- a/plugins/rainlab/blog/components/Post.php +++ b/plugins/rainlab/blog/components/Post.php @@ -35,6 +35,12 @@ class Post extends ComponentBase 'default' => '{{ :slug }}', 'type' => 'string', ], + 'id' => [ + 'title' => 'ID', + 'description' => 'Post id', + 'default' => '{{ :id }}', + 'type' => 'string' + ], 'categoryPage' => [ 'title' => 'rainlab.blog::lang.settings.post_category', 'description' => 'rainlab.blog::lang.settings.post_category_description', @@ -99,7 +105,7 @@ class Post extends ComponentBase if (!$this->checkEditor()) { $query->isPublished(); } - + $post = $query->first(); /* diff --git a/plugins/rainlab/blog/models/Post.php b/plugins/rainlab/blog/models/Post.php index 7d8288ffc..57df9cef1 100644 --- a/plugins/rainlab/blog/models/Post.php +++ b/plugins/rainlab/blog/models/Post.php @@ -25,7 +25,7 @@ class Post extends Model use \October\Rain\Database\Traits\Validation; public $table = 'rainlab_blog_posts'; - public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; +// public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; /* * Validation @@ -92,7 +92,7 @@ class Post extends Model ]; public $attachMany = [ - 'featured_images' => ['System\Models\File', 'order' => 'sort_order'], +// 'featured_images' => ['System\Models\File', 'order' => 'sort_order'], 'content_images' => ['System\Models\File'] ]; diff --git a/plugins/rainlab/blog/models/post/fields.yaml b/plugins/rainlab/blog/models/post/fields.yaml index e105cc4fe..a283c52a9 100644 --- a/plugins/rainlab/blog/models/post/fields.yaml +++ b/plugins/rainlab/blog/models/post/fields.yaml @@ -70,10 +70,19 @@ secondaryTabs: type: textarea size: small - featured_images: +# featured_images: +# tab: rainlab.blog::lang.post.tab_manage +# label: rainlab.blog::lang.post.featured_images +# type: fileupload +# mode: image +# imageWidth: 200 +# imageHeight: 200 + featured_image: + label: Featured image tab: rainlab.blog::lang.post.tab_manage - label: rainlab.blog::lang.post.featured_images - type: fileupload + type: mediafinder mode: image - imageWidth: 200 - imageHeight: 200 + span: storm + cssClass: col-xs-12 + imageWidth: 300 + imageHeight: 300 diff --git a/plugins/rainlab/blog/updates/posts_add_featured_image.php b/plugins/rainlab/blog/updates/posts_add_featured_image.php new file mode 100644 index 000000000..4e264eab7 --- /dev/null +++ b/plugins/rainlab/blog/updates/posts_add_featured_image.php @@ -0,0 +1,31 @@ +string('featured_image')->nullable(); + }); + } + + public function down() + { + if (Schema::hasColumn('rainlab_blog_posts', 'metadata')) { + Schema::table('rainlab_blog_posts', function ($table) { + $table->dropColumn('featured_image'); + }); + } + } + +} diff --git a/plugins/rainlab/blog/updates/version.yaml b/plugins/rainlab/blog/updates/version.yaml index 7cdc9b0ee..7651e71c5 100644 --- a/plugins/rainlab/blog/updates/version.yaml +++ b/plugins/rainlab/blog/updates/version.yaml @@ -57,3 +57,6 @@ 1.4.1: Fixes potential security issue with unsafe Markdown. Allow blog bylines to be translated. 1.4.2: Fix 404 redirects for missing blog posts. Assign current category to the listed posts when using the Posts component on a page with the category parameter available. 1.4.3: Fixes incompatibility with locale switching when plugin is used in conjunction with the Translate plugin. Fixes undefined category error. +1.5.0: + - Added featured_image column for for choosing from media finder + - posts_add_featured_image.php diff --git a/themes/modern/config/lang.yaml b/themes/modern/config/lang.yaml index 9a49890a9..c5aacfba6 100644 --- a/themes/modern/config/lang.yaml +++ b/themes/modern/config/lang.yaml @@ -4,6 +4,8 @@ en: nav.home: 'Home' nav.city: 'Ashgabat' page.latest_news: 'Latest news' + page.tags: 'TAGS' + page.calendar: 'NEWS CALENDAR' page.more: 'More' page.search: 'Search' page.search_result: 'The search results found: :number articles' @@ -17,6 +19,8 @@ ru: site.slogan: 'Наш ориентир то, что сближает людей' nav.home: 'Главная' nav.city: 'Ашхабад' + page.tags: 'ТЭГИ' + page.calendar: 'КАЛЕНДАРЬ НОВОСТЕЙ' page.latest_news: 'Последние новости' page.more: 'Ещё' page.search: 'Поиск' diff --git a/themes/modern/layouts/cms.htm b/themes/modern/layouts/cms.htm new file mode 100644 index 000000000..042d585df --- /dev/null +++ b/themes/modern/layouts/cms.htm @@ -0,0 +1,34 @@ +[localePicker] +forceUrl = 1 + +[SeoCmsPage] +== + + + + {% component 'SeoCmsPage' %} + {% partial 'head' %} + + +{% partial 'header' %} + +
+
+
+ {% page %} +
+
+
+ +{% partial 'footer' %} + + +{% framework extras %} +{% scripts %} + + + + diff --git a/themes/modern/pages/category.htm b/themes/modern/pages/category.htm index b048566e9..9a449f2ab 100644 --- a/themes/modern/pages/category.htm +++ b/themes/modern/pages/category.htm @@ -1,6 +1,6 @@ title = "Рубрика" url = "/category/:slug" -layout = "master" +layout = "cms" is_hidden = 0 robot_index = "index" robot_follow = "follow" @@ -13,4 +13,64 @@ noPostsMessage = "No posts found" sortOrder = "published_at desc" categoryPage = "category" postPage = "post" -== \ No newline at end of file +== +
+
+
+ {{category.name}} +
+ {% for item in posts %} + {% partial 'post_list_item' post = item %} + {% endfor %} + +
+
+
+ {% partial 'calendar' %} + {% partial 'tags' %} +
+{% put scripts %} + + +{% endput %} diff --git a/themes/modern/pages/post.htm b/themes/modern/pages/post.htm index 48b873093..79215ad52 100644 --- a/themes/modern/pages/post.htm +++ b/themes/modern/pages/post.htm @@ -2,6 +2,8 @@ title = "Пост" url = "/post/:id/:slug" layout = "master" is_hidden = 0 +robot_index = "index" +robot_follow = "follow" [viewBag] localeTitle[en] = "Post" @@ -9,4 +11,146 @@ localeTitle[en] = "Post" [blogPost] slug = "{{ :slug }}" categoryPage = "blog/category" -== \ No newline at end of file + +[SeoBlogPost] +post = "post" + +[views] +slug = "{{ :slug }}" + +[registerVisit] +== +
+ +
+ +

+ {{post.title}}} +

+ {% if post.image %} + + {{post.title}} + + {% endif %} +
+
+ {{post.content}} +
+ +
+
+{% partial 'latest_news'%} +
diff --git a/themes/modern/partials/calendar.htm b/themes/modern/partials/calendar.htm new file mode 100644 index 000000000..dc05daaec --- /dev/null +++ b/themes/modern/partials/calendar.htm @@ -0,0 +1,6 @@ +
+ {{'page.calendar'|_}} +
+
+ +
diff --git a/themes/modern/partials/latest_news.htm b/themes/modern/partials/latest_news.htm new file mode 100644 index 000000000..76e71aa94 --- /dev/null +++ b/themes/modern/partials/latest_news.htm @@ -0,0 +1,43 @@ +[blogPosts] +pageNumber = "{{ :page }}" +postsPerPage = 6 +noPostsMessage = "No posts found" +sortOrder = "published_at desc" +categoryPage = "category" +postPage = "category" +exceptPost = "{{ :id }}" + +[viewBag] +== +
+ {{'page.latest_news'|_}} +
+{% for post in posts %}} +
+
+ +
+ + + + + + + {{post.views}} +
+
+ +

{{post.title}}

+
+
+{% endfor %} \ No newline at end of file diff --git a/themes/modern/partials/post_card_item.htm b/themes/modern/partials/post_card_item.htm new file mode 100644 index 000000000..50c3e83a7 --- /dev/null +++ b/themes/modern/partials/post_card_item.htm @@ -0,0 +1,29 @@ +
+
+ +
+ + + + + + + + 480 + +
+
+ +

{{post.title}}

+
+
diff --git a/themes/modern/partials/post_list_item.htm b/themes/modern/partials/post_list_item.htm new file mode 100644 index 000000000..bd8fe3cf0 --- /dev/null +++ b/themes/modern/partials/post_list_item.htm @@ -0,0 +1,49 @@ +
+ + + +
+
+
+ + {{post.published_at|date('d.m.Y')}} + + + + + + {{post.published_at|date('HH:mm')}} + +
+
+ + + + + + + + 480 + +
+
+
+ + От нефтепродуктов до солодки — что покупали на туркменской бирже за неделю + +
+ Итог экспортных сделок Государственной товарно-сырьевой биржи Туркменистана за + первую неделю февраля вышел в сумму более 33,4 миллиона долларов США и 91,2 + миллиона манатов. +
+
+
+
diff --git a/themes/modern/partials/tags.htm b/themes/modern/partials/tags.htm new file mode 100644 index 000000000..9efa9beba --- /dev/null +++ b/themes/modern/partials/tags.htm @@ -0,0 +1,61 @@ +
+ {{'page.tags'|_}} +
+
+ + COVID-19 + + + АЗЕРБАЙДЖАН + + + АФГАНИСТАН + + + КАСПИЙ + + + COVID-19 + + + КИТАЙ + + + ИРАН + + + АЗЕРБАЙДЖАН + + + + COVID-19 + + + АЗЕРБАЙДЖАН + + + COVID-19 + + + СПОРТ + + + COVID-19 + + + ТУРИЗМ + + + COVID-19 + + + УЗБЕКИСТАН + + + COVID-19 + + + УЗБЕКИСТАН + + +