Commit 327f5f46c36e0eca48ff23cb5d39aaf3e52b2c68
1 parent
e3351cad
Exists in
master
and in
2 other branches
Pagination
Showing
6 changed files
with
66 additions
and
31 deletions
Show diff stats
Gemfile
Gemfile.lock
@@ -216,6 +216,9 @@ GEM | @@ -216,6 +216,9 @@ GEM | ||
216 | kaminari (0.15.1) | 216 | kaminari (0.15.1) |
217 | actionpack (>= 3.0.0) | 217 | actionpack (>= 3.0.0) |
218 | activesupport (>= 3.0.0) | 218 | activesupport (>= 3.0.0) |
219 | + kaminari-bootstrap (0.1.3) | ||
220 | + kaminari (>= 0.13.0) | ||
221 | + rails | ||
219 | launchy (2.4.2) | 222 | launchy (2.4.2) |
220 | addressable (~> 2.3) | 223 | addressable (~> 2.3) |
221 | less (2.5.0) | 224 | less (2.5.0) |
@@ -444,6 +447,8 @@ DEPENDENCIES | @@ -444,6 +447,8 @@ DEPENDENCIES | ||
444 | httmultiparty | 447 | httmultiparty |
445 | inherited_resources | 448 | inherited_resources |
446 | jquery-rails | 449 | jquery-rails |
450 | + kaminari | ||
451 | + kaminari-bootstrap (~> 0.1.3) | ||
447 | launchy | 452 | launchy |
448 | less-rails | 453 | less-rails |
449 | mysql2 | 454 | mysql2 |
app/assets/stylesheets/v_libras/videos.css.scss
app/controllers/v_libras/videos_controller.rb
@@ -7,7 +7,7 @@ class VLibras::VideosController < InheritedResources::Base | @@ -7,7 +7,7 @@ class VLibras::VideosController < InheritedResources::Base | ||
7 | before_filter :mark_as_seen!, :only => [ :show ] | 7 | before_filter :mark_as_seen!, :only => [ :show ] |
8 | 8 | ||
9 | def index | 9 | def index |
10 | - @videos = current_user.videos | 10 | + @videos = current_user.videos.page(params[:page]).per(9) |
11 | @requests = current_user.requests.limit(6) | 11 | @requests = current_user.requests.limit(6) |
12 | end | 12 | end |
13 | 13 |
app/views/v_libras/videos/index.haml
@@ -6,45 +6,52 @@ | @@ -6,45 +6,52 @@ | ||
6 | .breadcrumb | 6 | .breadcrumb |
7 | %h3= t('videos.list') | 7 | %h3= t('videos.list') |
8 | 8 | ||
9 | -- @videos.in_groups_of(3, false) do |group| | ||
10 | - .row-fluid.text-center | ||
11 | - - for video in group | ||
12 | - .span4 | ||
13 | - .ribbon-wrapper-green | ||
14 | - .ribbon-content | ||
15 | - = link_to image_tag(video.thumb), video | ||
16 | - - unless video.seen | ||
17 | - .ribbon-green Novo | 9 | +.well |
10 | + - @videos.in_groups_of(3, false) do |group| | ||
11 | + .row-fluid.text-center.videos-row | ||
12 | + - for video in group | ||
13 | + .span4 | ||
14 | + .ribbon-wrapper-green | ||
15 | + .ribbon-content | ||
16 | + = link_to image_tag(video.thumb), video | ||
17 | + - unless video.seen | ||
18 | + .ribbon-green Novo | ||
18 | 19 | ||
19 | - %div | ||
20 | - %span | ||
21 | - = link_to video.url_mp4, class: "btn btn-success" do | ||
22 | - = content_tag(:span, '', :class => 'icon-download icon-white') | ||
23 | - Baixar | 20 | + %div |
21 | + %span | ||
22 | + = link_to video.url_mp4, class: "btn btn-success" do | ||
23 | + = content_tag(:span, '', :class => 'icon-download icon-white') | ||
24 | + Baixar | ||
24 | 25 | ||
25 | - %span | ||
26 | - = link_to content_tag(:span, '', :class => 'icon-trash icon-white'), v_libras_video_path(video), method: :delete, | ||
27 | - class: "btn btn-danger", data: { confirm: t('shared.confirm_delete') } | 26 | + %span |
27 | + = link_to content_tag(:span, '', :class => 'icon-trash icon-white'), v_libras_video_path(video), method: :delete, | ||
28 | + class: "btn btn-danger", data: { confirm: t('shared.confirm_delete') } | ||
29 | + | ||
30 | + | ||
31 | + .row-fluid.text-center.pagination | ||
32 | + .row12 | ||
33 | + = paginate @videos | ||
28 | 34 | ||
29 | 35 | ||
30 | - if @requests.any? | 36 | - if @requests.any? |
31 | .breadcrumb.requests | 37 | .breadcrumb.requests |
32 | %h4= t('requests.list') | 38 | %h4= t('requests.list') |
33 | 39 | ||
34 | - .row-fluid | ||
35 | - .span8.offset2 | ||
36 | - %table.table.table-hover.table-striped.table-requests | ||
37 | - %thead | ||
38 | - %tr | ||
39 | - %th Situação | ||
40 | - %th Vídeo | ||
41 | - %th Criado há | 40 | + .well |
41 | + .row-fluid | ||
42 | + .span8.offset2 | ||
43 | + %table.table.table-hover.table-striped.table-requests | ||
44 | + %thead | ||
45 | + %tr | ||
46 | + %th Situação | ||
47 | + %th Vídeo | ||
48 | + %th Criado há | ||
42 | 49 | ||
43 | - - @requests.each do |request| | ||
44 | - %tr | ||
45 | - %td.span2= request_status_label(request) | ||
46 | - %td.span5= request.video_filename | ||
47 | - %td.span5= time_ago_in_words(request.created_at) | 50 | + - @requests.each do |request| |
51 | + %tr | ||
52 | + %td.span2= request_status_label(request) | ||
53 | + %td.span5= request.video_filename | ||
54 | + %td.span5= time_ago_in_words(request.created_at) | ||
48 | 55 | ||
49 | 56 | ||
50 | - if params['video-wait'] | 57 | - if params['video-wait'] |
@@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
1 | +pt-BR: | ||
2 | + views: | ||
3 | + pagination: | ||
4 | + first: "« Primeiro" | ||
5 | + last: "Último »" | ||
6 | + previous: "‹ Anterior" | ||
7 | + next: "Próximo ›" | ||
8 | + truncate: "…" | ||
9 | + helpers: | ||
10 | + page_entries_info: | ||
11 | + one_page: | ||
12 | + display_entries: | ||
13 | + zero: "Nenhum %{entry_name} encontrado" | ||
14 | + one: "Mostrando <b>1</b> %{entry_name}" | ||
15 | + other: "Mostrando <b>todos os %{count}</b> %{entry_name}" | ||
16 | + more_pages: | ||
17 | + display_entries: "Mostrando %{entry_name} <b>%{first} - %{last}</b> de <b>%{total}</b> no total" | ||
0 | \ No newline at end of file | 18 | \ No newline at end of file |