forked from OpenNeo/impress
i18n for will_paginate, including dynamically in outfits#edit
This commit is contained in:
parent
34e99bba72
commit
3b1ffe71a9
3 changed files with 59 additions and 26 deletions
|
@ -121,14 +121,19 @@
|
||||||
= t '.search.no_results_html', :query => content_tag(:span)
|
= t '.search.no_results_html', :query => content_tag(:span)
|
||||||
%ul
|
%ul
|
||||||
#no-assets-full-message= t '.sidebar.closet.no_data.description'
|
#no-assets-full-message= t '.sidebar.closet.no_data.description'
|
||||||
|
|
||||||
%script#sharing-html-image-template{:type => 'text/x-jquery-tmpl'}
|
%script#sharing-html-image-template{:type => 'text/x-jquery-tmpl'}
|
||||||
= link_to image_tag('${image_url}'), '${permalink}'
|
= link_to image_tag('${image_url}'), '${permalink}'
|
||||||
|
|
||||||
%script#sharing-html-text-template{:type => 'text/x-jquery-tmpl'}
|
%script#sharing-html-text-template{:type => 'text/x-jquery-tmpl'}
|
||||||
= link_to t('app_name'), '${permalink}'
|
= link_to t('app_name'), '${permalink}'
|
||||||
|
|
||||||
%script#sharing-bbcode-image-template{:type => 'text/x-jquery-tmpl'}
|
%script#sharing-bbcode-image-template{:type => 'text/x-jquery-tmpl'}
|
||||||
[URL=${permalink}][IMG]${image_url}[/IMG][/URL]
|
[URL=${permalink}][IMG]${image_url}[/IMG][/URL]
|
||||||
|
|
||||||
%script#sharing-bbcode-text-template{:type => 'text/x-jquery-tmpl'}
|
%script#sharing-bbcode-text-template{:type => 'text/x-jquery-tmpl'}
|
||||||
[URL=${permalink}]#{t('app_name')}[/URL]
|
[URL=${permalink}]#{t('app_name')}[/URL]
|
||||||
|
|
||||||
%script#outfit-template{:type => 'text/x-jquery-tmpl'}
|
%script#outfit-template{:type => 'text/x-jquery-tmpl'}
|
||||||
<li class="outfit-${id}{{if starred}} starred{{/if}}">
|
<li class="outfit-${id}{{if starred}} starred{{/if}}">
|
||||||
%header
|
%header
|
||||||
|
@ -151,6 +156,7 @@
|
||||||
%a.outfit-delete-confirmation-no{:href => '#'}
|
%a.outfit-delete-confirmation-no{:href => '#'}
|
||||||
= t '.sidebar.outfits.outfit.delete_confirmation.cancel'
|
= t '.sidebar.outfits.outfit.delete_confirmation.cancel'
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
%script#item-template{:type => 'text/x-jquery-tmpl'}
|
%script#item-template{:type => 'text/x-jquery-tmpl'}
|
||||||
%li{:class => 'object object-${id}'}
|
%li{:class => 'object object-${id}'}
|
||||||
%img{:src => '${thumbnail_url}', :title => '${description}', :alt => ''}
|
%img{:src => '${thumbnail_url}', :title => '${description}', :alt => ''}
|
||||||
|
@ -171,6 +177,27 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
%span.no-assets-message= t '.sidebar.closet.no_data.summary'
|
%span.no-assets-message= t '.sidebar.closet.no_data.summary'
|
||||||
|
|
||||||
|
%script#pagination-template{:type => 'text/x-jquery-tmpl'}
|
||||||
|
{{if current_page > 1}}
|
||||||
|
= link_to t('will_paginate.previous_label').html_safe, '#', :rel => 'prev',
|
||||||
|
'data-page' => '${current_page - 1}'
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{each pages}}
|
||||||
|
{{if $value == 'gap'}}
|
||||||
|
%span.gap= t('will_paginate.page_gap').html_safe
|
||||||
|
{{else $value == current_page}}
|
||||||
|
%em.current ${$value}
|
||||||
|
{{else}}
|
||||||
|
= link_to '${$value}', '#', 'data-page' => '${$value}'
|
||||||
|
{{/if}}
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
{{if current_page < total_pages}}
|
||||||
|
= link_to t('will_paginate.next_label').html_safe, '#', :rel => 'next',
|
||||||
|
'data-page' => '${current_page + 1}'
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
%span#userbar-session-message
|
%span#userbar-session-message
|
||||||
- if user_signed_in?
|
- if user_signed_in?
|
||||||
|
|
18
config/locales/will_paginate.en-meep.yml
Normal file
18
config/locales/will_paginate.en-meep.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
en-meep:
|
||||||
|
will_paginate:
|
||||||
|
previous_label: "← Preevious"
|
||||||
|
next_label: "Neext →"
|
||||||
|
page_gap: "…!"
|
||||||
|
|
||||||
|
page_entries_info:
|
||||||
|
single_page:
|
||||||
|
zero: "No %{model} meeped"
|
||||||
|
one: "Meeping 1 %{model}"
|
||||||
|
other: "Meeping all %{count} %{model}"
|
||||||
|
single_page_html:
|
||||||
|
zero: "No %{model} meeped"
|
||||||
|
one: "Meeping <b>1</b> %{model}"
|
||||||
|
other: "Meeping <b>all %{count}</b> %{model}"
|
||||||
|
|
||||||
|
multi_page: "Meeping %{model} %{from} - %{to} of %{count} in total"
|
||||||
|
multi_page_html: "Meeping %{model} <b>%{from} - %{to}</b> of <b>%{count}</b> in total"
|
|
@ -1086,19 +1086,12 @@ View.Search = function (wardrobe) {
|
||||||
PAGINATION = {
|
PAGINATION = {
|
||||||
INNER_WINDOW: 4,
|
INNER_WINDOW: 4,
|
||||||
OUTER_WINDOW: 1,
|
OUTER_WINDOW: 1,
|
||||||
GAP_TEXT: '…',
|
|
||||||
PREV_TEXT: '← Previous',
|
|
||||||
NEXT_TEXT: 'Next →',
|
|
||||||
PAGE_EL: $('<a/>', {href: '#'}),
|
|
||||||
CURRENT_EL: $('<span/>', {'class': 'current'}),
|
|
||||||
EL_ID: '#preview-search-form-pagination',
|
EL_ID: '#preview-search-form-pagination',
|
||||||
PER_PAGE: 21
|
PER_PAGE: 21,
|
||||||
|
TEMPLATE: $('#pagination-template')
|
||||||
}, object_width = 112, last_request;
|
}, object_width = 112, last_request;
|
||||||
|
|
||||||
PAGINATION.EL = $(PAGINATION.EL_ID);
|
PAGINATION.EL = $(PAGINATION.EL_ID);
|
||||||
PAGINATION.GAP_EL = $('<span/>', {'class': 'gap', html: PAGINATION.GAP_TEXT})
|
|
||||||
PAGINATION.PREV_EL = $('<a/>', {href: '#', rel: 'prev', html: PAGINATION.PREV_TEXT});
|
|
||||||
PAGINATION.NEXT_EL = $('<a/>', {href: '#', rel: 'next', html: PAGINATION.NEXT_TEXT});
|
|
||||||
|
|
||||||
$(PAGINATION.EL_ID + ' a').live('click', function (e) {
|
$(PAGINATION.EL_ID + ' a').live('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -1205,33 +1198,28 @@ View.Search = function (wardrobe) {
|
||||||
|
|
||||||
subtract_left = (left_gap[1] - left_gap[0]) > 1;
|
subtract_left = (left_gap[1] - left_gap[0]) > 1;
|
||||||
subtract_right = (right_gap[1] - right_gap[0]) > 1;
|
subtract_right = (right_gap[1] - right_gap[0]) > 1;
|
||||||
|
|
||||||
PAGINATION.EL.children().remove();
|
var pages = [];
|
||||||
|
|
||||||
if(current_page > 1) {
|
|
||||||
PAGINATION.PREV_EL.clone().data('page', current_page - 1).appendTo(PAGINATION.EL);
|
|
||||||
}
|
|
||||||
|
|
||||||
while(i <= total_pages) {
|
while(i <= total_pages) {
|
||||||
if(subtract_left && i >= left_gap[0] && i < left_gap[1]) {
|
if(subtract_left && i >= left_gap[0] && i < left_gap[1]) {
|
||||||
PAGINATION.GAP_EL.clone().appendTo(PAGINATION.EL);
|
pages.push('gap');
|
||||||
i = left_gap[1];
|
i = left_gap[1];
|
||||||
} else if(subtract_right && i >= right_gap[0] && i < right_gap[1]) {
|
} else if(subtract_right && i >= right_gap[0] && i < right_gap[1]) {
|
||||||
PAGINATION.GAP_EL.clone().appendTo(PAGINATION.EL);
|
pages.push('gap');
|
||||||
i = right_gap[1];
|
i = right_gap[1];
|
||||||
} else {
|
} else {
|
||||||
if(i == current_page) {
|
pages.push(i);
|
||||||
PAGINATION.CURRENT_EL.clone().text(i).appendTo(PAGINATION.EL);
|
|
||||||
} else {
|
|
||||||
PAGINATION.PAGE_EL.clone().text(i).data('page', i).appendTo(PAGINATION.EL);
|
|
||||||
}
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(current_page < total_pages) {
|
PAGINATION.EL.empty();
|
||||||
PAGINATION.NEXT_EL.clone().data('page', current_page + 1).appendTo(PAGINATION.EL);
|
PAGINATION.TEMPLATE.tmpl({
|
||||||
}
|
current_page: current_page,
|
||||||
|
total_pages: total_pages,
|
||||||
|
pages: pages
|
||||||
|
}).appendTo(PAGINATION.EL);
|
||||||
});
|
});
|
||||||
|
|
||||||
wardrobe.search.bind('error', function (error) {
|
wardrobe.search.bind('error', function (error) {
|
||||||
|
|
Loading…
Reference in a new issue