Skip to content

Commit

Permalink
Мелкие доработки и исправления
Browse files Browse the repository at this point in the history
  • Loading branch information
deniart committed Mar 29, 2016
1 parent a9a11dc commit 90265e4
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 36 deletions.
2 changes: 1 addition & 1 deletion classes/modules/viewer/plugs/function.cmods.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function smarty_function_cmods($aParams)
}

// Разделитель между названием компонента и мод-ом
$sDelimiter = $aParams['delimiter'] ? $aParams['delimiter'] : Config::Get('view.mod_delimiter');
$sDelimiter = $aParams['delimiter'] ?: Config::Get('view.mod_delimiter');

// Удаляем лишние пробелы
$sMods = trim(preg_replace('/\s+/', ' ', $aParams['mods']));
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/field/field.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
{block 'field_options'}
{* Получение значения атрибута value *}
{if $getValueFromForm && $name && $form}
{$value = {field_get_value form=$form name=$name}}
{$value = {field_get_value form=$form name=$name}|default:$value}
{/if}

{* Escape *}
Expand Down
10 changes: 7 additions & 3 deletions frontend/components/field/js/field.geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
region: '.js-field-geo-region',
city: '.js-field-geo-city'
},
params: {}
params: {},
i18n: {
select_region: '@field.geo.select_region',
select_city: '@field.geo.select_city'
}
},

/**
Expand Down Expand Up @@ -58,7 +62,7 @@
}

this._load( 'regions', { country: this.elements.country.val(), target_type: this.type }, function( response ) {
this.append( this.elements.region, response.aRegions, ls.lang.get( 'field.geo.select_region' ) );
this.append( this.elements.region, response.aRegions, this._i18n( 'select_region' ) );
}.bind( this ));
},

Expand All @@ -72,7 +76,7 @@
}

this._load( 'cities', { region: this.elements.region.val(), target_type: this.type }, function( response ) {
this.append( this.elements.city, response.aCities, ls.lang.get( 'field.geo.select_city' ) );
this.append( this.elements.city, response.aCities, this._i18n( 'select_city' ) );
}.bind( this ));
},

Expand Down
31 changes: 16 additions & 15 deletions frontend/components/more/js/more.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
urls: {
load: null
},
selectors: {
counter: '.js-more-count'
},
classes: {
loading: 'ls-loading',
locked: 'ls-more--locked'
Expand All @@ -35,7 +32,12 @@
// Параметры запроса
params: {},
// Проксирующие параметры
proxy: [ 'next_page' ]
proxy: [ 'next_page' ],
i18n: {
text: '@more.text',
text_count: '@more.text_count',
empty: '@more.empty'
}
},

/**
Expand Down Expand Up @@ -88,14 +90,15 @@
* Получает значение счетчика
*/
getCount: function () {
return this.elements.counter.length && parseInt( this.elements.counter.text(), 10 );
return parseInt( this.element.data('lsmore-count'), 10 );
},

/**
* Устанавливает значение счетчика
*/
setCount: function ( number ) {
this.elements.counter.length && this.elements.counter.text( number );
this.element.data('lsmore-count', number);
this.element.text( this._i18n( 'text_count', number ) );
},

/**
Expand All @@ -111,14 +114,12 @@
this.target[ this.options.append ? 'append' : 'prepend' ]( $.trim( response.html ) );

// Обновляем счетчик
if ( this.elements.counter.length ) {
var countLeft = this.getCount() - response.count_loaded;

if ( countLeft <= 0 ) {
response.hide = true;
} else {
this.setCount( countLeft );
}
var countLeft = this.getCount() - response.count_loaded;

if ( countLeft <= 0 ) {
response.hide = true;
} else {
this.setCount( countLeft || 0 );
}

// Обновляем параметры
Expand All @@ -127,7 +128,7 @@
}.bind( this ));
} else {
// Для блоков без счетчиков
ls.msg.notice( null, ls.lang.get( 'more.empty' ) );
ls.msg.notice( null, this._i18n( 'empty' ) );
}

if ( response.hide ) {
Expand Down
18 changes: 10 additions & 8 deletions frontend/components/more/more.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

{* Название компонента *}
{$component = 'ls-more'}
{component_define_params params=[ 'text', 'target', 'count', 'append', 'mods', 'classes', 'attributes', 'ajaxParams' ]}
{component_define_params params=[ 'text', 'text_count', 'target', 'count', 'append', 'mods', 'classes', 'attributes', 'ajaxParams' ]}

{block 'more_options'}{/block}

Expand All @@ -21,13 +21,15 @@
{cattr list=$attributes}
{cattr list=$ajaxParams prefix='data-param-'}
{if $append}data-lsmore-append="{$append}"{/if}
{if $target}data-lsmore-target="{$target}"{/if}>
{if $target}data-lsmore-target="{$target}"{/if}
{if isset($count)}data-lsmore-count="{$count}"{/if}>

{* Текст *}
{$text|default:{lang 'more.text'}}

{* Счетчик *}
{if $count}
(<span class="js-more-count">{$count}</span>)
{/if}
{block 'more_text'}
{if isset($count)}
{$text_count|default:{lang 'more.text_count' count=$count plural=true}}
{else}
{$text|default:{lang 'more.text'}}
{/if}
{/block}
</div>
7 changes: 6 additions & 1 deletion frontend/components/pagination/js/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
hash: {
next: '',
prev: ''
},

i18n: {
last: '@pagination.notices.last',
first: '@pagination.notices.first'
}
},

Expand All @@ -54,7 +59,7 @@
if ( url ) {
window.location = url + ( this.options.hash[ name ] && useHash ? '#' + this.options.hash[ name ] : '' );
} else {
ls.msg.error( null, name == 'next' ? ls.lang.get('pagination.notices.last') : ls.lang.get('pagination.notices.first') );
ls.msg.error( null, this._i18n( name == 'next' ? 'last' : 'first' ) );
}
}
},
Expand Down
8 changes: 4 additions & 4 deletions frontend/components/pagination/pagination.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@

{if $showPager}
<ul class="{$component}-list {$component}-pager">
{* Следущая страница *}
{pagination_item page=$prev text="&larr; {$aLang.pagination.previous}" linkClasses="js-{$component}-prev"}

{* Предыдущая страница *}
{pagination_item page=$next text="{$aLang.pagination.next} &rarr;" linkClasses="js-{$component}-next"}
{pagination_item page=$prev text="&larr; {$aLang.pagination.previous}" linkClasses="{$component}-prev js-{$component}-prev"}

{* Следущая страница *}
{pagination_item page=$next text="{$aLang.pagination.next} &rarr;" linkClasses="{$component}-next js-{$component}-next"}
</ul>
{/if}

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/tabs/tabs.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"load": "{$tab[ 'url' ]}"
}
}'
{$tab[ 'attributes' ]}>
{cattr list=$tab[ 'attributes' ]}>

{$tab[ 'text' ]}
</li>
Expand Down
5 changes: 3 additions & 2 deletions frontend/i18n/ru.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@
* Подгрузка контента
*/
'more' => array(
'text' => 'Подгрузить еще',
'empty' => 'Больше нечего подгружать'
'text' => 'Подгрузить еще',
'text_count' => 'Подгрузить еще (%%count%%)',
'empty' => 'Больше нечего подгружать'
),
/**
* Дата
Expand Down

0 comments on commit 90265e4

Please sign in to comment.