Просмотр исходного кода

#26 - new gallery view for notes browsing

Alex Trofimov 12 лет назад
Родитель
Сommit
9682755e21

+ 1 - 1
install/sql/system.sql

@@ -256,7 +256,7 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex
 (@iCategoryId, 'sys_site_logo', '', '0', 'digit', '', '', '', 20),
 (@iCategoryId, 'sys_site_logo_alt', '_adm_dsg_txt_alt_text', '0', 'text', '', '', '', 21),
 (@iCategoryId, 'sys_site_icon', '', '0', 'digit', '', '', '', 22),
-(@iCategoryId, 'main_div_width', '', '998px', 'digit', '', '', '', 25),
+(@iCategoryId, 'main_div_width', '', '1000px', 'digit', '', '', '', 25),
 
 (@iCategoryId, 'sys_template_cache_image_enable', '', '', 'checkbox', '', '', '', 30),
 (@iCategoryId, 'sys_template_cache_image_max_size', '', '5', 'digit', '', '', '', 31),

+ 2 - 1
modules/boonex/notes/classes/BxNotesSearchResult.php

@@ -43,6 +43,7 @@ class BxNotesSearchResult extends BxTemplSearchResult {
 
     function __construct($sMode = '', $aParams) {
 
+        $this->sUnitTemplate = 'unit_gallery.html';
         $oProfileAuthor = null;
         $oModuleMain = $this->getMain();
 
@@ -118,7 +119,7 @@ class BxNotesSearchResult extends BxTemplSearchResult {
 
     function displayResultBlock () {
         $s = parent::displayResultBlock ();
-        $s = '<div class="bx-notes-wrapper">' . $s . '</div>';
+        $s = '<div class="bx-notes-wrapper ' . ('unit_gallery.html' == $this->sUnitTemplate ? 'bx-def-margin-neg bx-clearfix' : '') . '">' . $s . '</div>';
         return $s;
     }
 

+ 12 - 1
modules/boonex/notes/classes/BxNotesTemplate.php

@@ -66,6 +66,8 @@ class BxNotesTemplate extends BxDolModuleTemplate {
             $sSummary = htmlspecialchars_adv($sSummary) . $sLinkMore;
         }
 
+        $sSummaryPlain = BxTemplFunctions::getInstance()->getStringWithLimitedLength(strip_tags($sSummary), 380);
+
         // generate html
         $aVars = array (
             'id' => $aData['id'],            
@@ -79,7 +81,16 @@ class BxNotesTemplate extends BxDolModuleTemplate {
                 'condition' => $sPhotoThumb,
                 'content' => array (
                     'title' => bx_process_output($aData['title']),
-                    'thumb_url' => $sPhotoThumb ? $sPhotoThumb : '',
+                    'summary_attr' => bx_html_attribute($sSummaryPlain),
+                    'content_url' => $sUrl,
+                    'thumb_url' => $sPhotoThumb ? $sPhotoThumb : '',                    
+                ),
+            ),
+            'bx_if:no_thumb' => array (
+                'condition' => !$sPhotoThumb,
+                'content' => array (
+                    'content_url' => $sUrl,
+                    'summary_plain' => $sSummaryPlain,
                 ),
             ),
         );

+ 1 - 1
modules/boonex/notes/install/sql/enable.sql

@@ -27,7 +27,7 @@ INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source
 ('bx_notes_preview', 'bx_notes_photos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_notes_photos";}', 'no', '1', '2592000', '0');
 
 INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES 
-('bx_notes_preview', 'Resize', 'a:4:{s:1:"w";s:3:"200";s:1:"h";s:3:"150";s:11:"crop_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
+('bx_notes_preview', 'Resize', 'a:4:{s:1:"w";s:3:"300";s:1:"h";s:3:"200";s:11:"crop_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
 
 
 -- PAGES

+ 39 - 4
modules/boonex/notes/template/css/main.css

@@ -13,18 +13,53 @@
     vertical-align:middle;
 }
 
+.bx-notes-unit-no-thumb,
 .bx-notes-unit-thumb {
+    display:block;
     float:right;
-    max-height:150px;
-    max-height:9.4rem;
-    max-width:200px;
-    max-width:12.5rem;
+    height:200px;
+    height:12.5rem;
+    width:300px;
+    width:18.75rem;
+    overflow:hidden;
+}
+
+.bx-notes-unit-no-thumb {
+    overflow:hidden;
 }
 
 .bx-notes-unit-summary p {
     margin:0;
 }
 
+.bx-notes-unit-info {
+    white-space:nowrap;
+    overflow:hidden;
+    text-overflow:ellipsis;
+}
+
+.bx-notes-unit-gallery {
+    height:288px;
+    height:18rem;
+    width:300px;
+    width:18.75rem;
+    float:left;
+}
+
+.bx-notes-unit-gallery .bx-notes-unit-no-thumb,
+.bx-notes-unit-gallery .bx-notes-unit-thumb {
+    float:none;
+}
+
+.bx-notes-unit-gallery h2 {
+    max-height:2.5em; 
+    overflow:hidden; 
+}
+
+.bx-notes-wrapper {
+    margin-bottom:0;
+}
+
 /* view page */
 .bx-notes-entity-content h1:first-child {
     margin-top:0;

+ 21 - 0
modules/boonex/notes/template/unit_gallery.html

@@ -0,0 +1,21 @@
+
+<div class="bx-notes-unit bx-notes-unit-gallery bx-def-margin">
+
+    <bx_if:thumb>
+        <a href="__content_url__"><img class="bx-notes-unit-thumb bx-def-round-corners bx-def-color-bg-sec bx-def-font-middle" alt="__summary_attr__" src="__thumb_url__" /></a>
+    </bx_if:thumb>
+
+    <bx_if:no_thumb>
+        <div class="bx-notes-unit-no-thumb bx-def-round-corners bx-def-color-bg-sec bx-def-font-middle bx-def-padding-sec bx-def-box-sizing">__summary_plain__</div>
+    </bx_if:no_thumb>
+
+    <h2 class="bx-def-margin-sec-topbottom"><a href="__content_url__">__title__</a></h2>
+
+    <div class="bx-notes-unit-info">
+        <span class="bx-def-font-grayed">__entry_posting_date__</span>
+        <span class="bx-notes-unit-info-div bx-def-font-grayed">&#183;</span>
+        <a href="__author_url__">__author__</a>
+    </div>
+
+</div>
+

+ 7 - 0
template/css/default.less

@@ -5,10 +5,17 @@
     width:@bx-page-width;
 }
 
+.bx-def-box-sizing {
+    .box-sizing(border-box);
+}
+
 /* margins */
 .bx-def-margin { 
     .margin(@bx-margin);
 }
+.bx-def-margin-neg { 
+    .margin(-@bx-margin);
+}
 .bx-def-margin-rightbottomleft {
     .margin-right(@bx-margin);
     .margin-bottom(@bx-margin);

+ 1 - 1
template/scripts/BxBaseConfig.php

@@ -14,7 +14,7 @@ class BxBaseConfig extends BxDol implements iBxDolSingleton {
         'iTagsMaxFontSize' => 30, // maximal font size of tag
         'bAllowUnicodeInPreg' => false, // allow unicode in regular expressions
         'aLessConfig' => array (
-            'bx-page-width' => '998px',
+            'bx-page-width' => '1000px',
 
 			'bx-margin' => '20px',
 			'bx-margin-sec' => '10px',