Commit 9fddd5b440105376caf913e1c09756ec2aaf4431

Authored by Dmitriy Zaporozhets
1 parent 52ad34fd

Refactoring & restyle pagination:

- remove admin kaminari theme. Use gitlab theme everywhere
- use bootstrap styled for gitlab admin themes
- dont reload page when change issue filter
app/assets/javascripts/issues.js
@@ -12,7 +12,7 @@ function initIssuesSearch() { @@ -12,7 +12,7 @@ function initIssuesSearch() {
12 12
13 if (terms.length >= 2 || terms.length == 0) { 13 if (terms.length >= 2 || terms.length == 0) {
14 $.get(href, { 'status': status, 'terms': terms, 'milestone_id': milestone_id }, function(response) { 14 $.get(href, { 'status': status, 'terms': terms, 'milestone_id': milestone_id }, function(response) {
15 - $('#issues-table').html(response); 15 + $('.issues-holder').html(response);
16 }); 16 });
17 } 17 }
18 } 18 }
app/assets/stylesheets/gitlab_bootstrap/common.scss
@@ -69,13 +69,6 @@ fieldset legend { font-size: 17px; } @@ -69,13 +69,6 @@ fieldset legend { font-size: 17px; }
69 69
70 /** PAGINATION **/ 70 /** PAGINATION **/
71 .gitlab_pagination { 71 .gitlab_pagination {
72 - span a { color: $link_color; }  
73 - .prev, .next, .current, .page a {  
74 - padding: 10px;  
75 - }  
76 - .current {  
77 - border-bottom: 2px solid $style_color;  
78 - }  
79 } 72 }
80 73
81 .tab-content { 74 .tab-content {
app/assets/stylesheets/sections/issues.scss
@@ -77,7 +77,7 @@ input.check_all_issues { @@ -77,7 +77,7 @@ input.check_all_issues {
77 @media (min-width: 800px) { .issues_bulk_update select { width: 120px; } } 77 @media (min-width: 800px) { .issues_bulk_update select { width: 120px; } }
78 @media (min-width: 1200px) { .issues_bulk_update select { width: 160px; } } 78 @media (min-width: 1200px) { .issues_bulk_update select { width: 160px; } }
79 79
80 -#issues-table-holder { 80 +.issues-holder {
81 .issues_filters { 81 .issues_filters {
82 } 82 }
83 83
app/views/admin/groups/index.html.haml
@@ -34,4 +34,4 @@ @@ -34,4 +34,4 @@
34 %td.bgred 34 %td.bgred
35 = link_to 'Edit', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn btn-small" 35 = link_to 'Edit', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn btn-small"
36 = link_to 'Destroy', [:admin, group], confirm: "REMOVE #{group.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" 36 = link_to 'Destroy', [:admin, group], confirm: "REMOVE #{group.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove"
37 -= paginate @groups, theme: "admin" 37 += paginate @groups, theme: "gitlab"
app/views/admin/projects/index.html.haml
@@ -56,6 +56,4 @@ @@ -56,6 +56,4 @@
56 = link_to 'Destroy', [project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" 56 = link_to 'Destroy', [project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove"
57 - if @projects.blank? 57 - if @projects.blank?
58 %p.nothing_here_message 0 projects matches 58 %p.nothing_here_message 0 projects matches
59 - - else  
60 - %li.bottom  
61 - = paginate @projects, theme: "gitlab" 59 + = paginate @projects, theme: "gitlab"
app/views/admin/teams/index.html.haml
@@ -40,4 +40,4 @@ @@ -40,4 +40,4 @@
40 = link_to 'Edit', edit_admin_team_path(team), id: "edit_#{dom_id(team)}", class: "btn btn-small" 40 = link_to 'Edit', edit_admin_team_path(team), id: "edit_#{dom_id(team)}", class: "btn btn-small"
41 = link_to 'Destroy', admin_team_path(team), confirm: "REMOVE #{team.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" 41 = link_to 'Destroy', admin_team_path(team), confirm: "REMOVE #{team.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove"
42 42
43 -= paginate @teams, theme: "admin" 43 += paginate @teams, theme: "gitlab"
app/views/admin/users/index.html.haml
@@ -58,5 +58,4 @@ @@ -58,5 +58,4 @@
58 - else 58 - else
59 = link_to 'Block', block_admin_user_path(user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn btn-small btn-remove" 59 = link_to 'Block', block_admin_user_path(user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn btn-small btn-remove"
60 = link_to 'Destroy', [:admin, user], confirm: "USER #{user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn btn-small btn-remove" 60 = link_to 'Destroy', [:admin, user], confirm: "USER #{user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn btn-small btn-remove"
61 - %li.bottom  
62 - = paginate @admin_users, theme: "gitlab" 61 + = paginate @admin_users, theme: "gitlab"
app/views/issues/_issues.html.haml
1 -= render @issues 1 +.ui-box
  2 + .title
  3 + = check_box_tag "check_all_issues", nil, false, class: "check_all_issues left"
  4 + .clearfix
  5 + .issues_bulk_update.hide
  6 + = form_tag bulk_update_project_issues_path(@project), method: :post do
  7 + %span.update_issues_text Update selected issues with  
  8 + .left
  9 + = select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status")
  10 + = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")
  11 + = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")
  12 + = hidden_field_tag 'update[issues_ids]', []
  13 + = hidden_field_tag :status, params[:status]
  14 + = button_tag "Save", class: "btn update_selected_issues btn-small btn-save"
  15 + .issues_filters
  16 + = form_tag project_issues_path(@project), method: :get, remote: true do
  17 + = select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), prompt: "Labels")
  18 + = select_tag(:assignee_id, options_from_collection_for_select([unassigned_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")
  19 + = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")
  20 + = hidden_field_tag :status, params[:status]
  21 +
  22 + %ul.well-list.issues-list
  23 + = render @issues
  24 + - if @issues.blank?
  25 + %li
  26 + %h4.nothing_here_message Nothing to show here
2 27
3 - if @issues.present? 28 - if @issues.present?
4 - %li.bottom  
5 - .left= paginate @issues, remote: true, theme: "gitlab"  
6 - .pull-right  
7 - %span.issue_counter #{@issues.total_count}  
8 - issues for this filter  
9 -- else  
10 - %li  
11 - %h4.nothing_here_message Nothing to show here 29 + .pull-right
  30 + %span.issue_counter #{@issues.total_count}
  31 + issues for this filter
12 32
  33 + = paginate @issues, remote: true, theme: "gitlab"
app/views/issues/index.html.haml
@@ -19,30 +19,8 @@ @@ -19,30 +19,8 @@
19 .row 19 .row
20 .span3 20 .span3
21 = render 'filter', entity: 'issue' 21 = render 'filter', entity: 'issue'
22 - .span9  
23 - %div#issues-table-holder.ui-box  
24 - .title  
25 - = check_box_tag "check_all_issues", nil, false, class: "check_all_issues left"  
26 - .clearfix  
27 - .issues_bulk_update.hide  
28 - = form_tag bulk_update_project_issues_path(@project), method: :post do  
29 - %span.update_issues_text Update selected issues with    
30 - .left  
31 - = select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status")  
32 - = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")  
33 - = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")  
34 - = hidden_field_tag 'update[issues_ids]', []  
35 - = hidden_field_tag :status, params[:status]  
36 - = button_tag "Save", class: "btn update_selected_issues btn-small btn-save"  
37 - .issues_filters  
38 - = form_tag project_issues_path(@project), method: :get do  
39 - = select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), prompt: "Labels")  
40 - = select_tag(:assignee_id, options_from_collection_for_select([unassigned_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")  
41 - = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")  
42 - = hidden_field_tag :status, params[:status]  
43 -  
44 - %ul#issues-table.well-list.issues-list  
45 - = render "issues" 22 + .span9.issues-holder
  23 + = render "issues"
46 24
47 :javascript 25 :javascript
48 $(function(){ 26 $(function(){
app/views/issues/index.js.haml
1 :plain 1 :plain
2 - $('#issues-table').html("#{escape_javascript(render('issues'))}"); 2 + $('.issues-holder').html("#{escape_javascript(render('issues'))}");
  3 + History.replaceState({path: "#{request.url}"}, document.title, "#{request.url}");
  4 + issuesPage();
app/views/kaminari/admin/_first_page.html.haml
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 --# Link to the "First" page  
2 --# available local variables  
3 --# url: url to the first page  
4 --# current_page: a page object for the currently displayed page  
5 --# num_pages: total number of pages  
6 --# per_page: number of items to fetch per page  
7 --# remote: data-remote  
8 -%span.first  
9 - = link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote  
app/views/kaminari/admin/_gap.html.haml
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 --# Non-link tag that stands for skipped pages...  
2 --# available local variables  
3 --# current_page: a page object for the currently displayed page  
4 --# num_pages: total number of pages  
5 --# per_page: number of items to fetch per page  
6 --# remote: data-remote  
7 -%li{class: "page"}  
8 - %span.page.gap  
9 - = raw(t 'views.pagination.truncate')  
app/views/kaminari/admin/_last_page.html.haml
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 --# Link to the "Last" page  
2 --# available local variables  
3 --# url: url to the last page  
4 --# current_page: a page object for the currently displayed page  
5 --# num_pages: total number of pages  
6 --# per_page: number of items to fetch per page  
7 --# remote: data-remote  
8 -%span.last  
9 - = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {remote: remote}  
app/views/kaminari/admin/_next_page.html.haml
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 --# Link to the "Next" page  
2 --# available local variables  
3 --# url: url to the next page  
4 --# current_page: a page object for the currently displayed page  
5 --# num_pages: total number of pages  
6 --# per_page: number of items to fetch per page  
7 --# remote: data-remote  
8 -%li.next  
9 - = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote  
app/views/kaminari/admin/_page.html.haml
@@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
1 --# Link showing page number  
2 --# available local variables  
3 --# page: a page object for "this" page  
4 --# url: url to this page  
5 --# current_page: a page object for the currently displayed page  
6 --# num_pages: total number of pages  
7 --# per_page: number of items to fetch per page  
8 --# remote: data-remote  
9 -%li{class: "page#{' active' if page.current?}"}  
10 - = link_to page, url, {remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil}  
app/views/kaminari/admin/_paginator.html.haml
@@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
1 --# The container tag  
2 --# available local variables  
3 --# current_page: a page object for the currently displayed page  
4 --# num_pages: total number of pages  
5 --# per_page: number of items to fetch per page  
6 --# remote: data-remote  
7 --# paginator: the paginator that renders the pagination tags inside  
8 -= paginator.render do  
9 - %div.pagination  
10 - %ul  
11 - = prev_page_tag unless current_page.first?  
12 - - each_page do |page|  
13 - - if page.left_outer? || page.right_outer? || page.inside_window?  
14 - = page_tag page  
15 - - elsif !page.was_truncated?  
16 - = gap_tag  
17 - = next_page_tag unless current_page.last?  
app/views/kaminari/admin/_prev_page.html.haml
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 --# Link to the "Previous" page  
2 --# available local variables  
3 --# url: url to the previous page  
4 --# current_page: a page object for the currently displayed page  
5 --# num_pages: total number of pages  
6 --# per_page: number of items to fetch per page  
7 --# remote: data-remote  
8 -%li{class: "prev" }  
9 - = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote  
app/views/kaminari/gitlab/_gap.html.haml
@@ -4,5 +4,6 @@ @@ -4,5 +4,6 @@
4 -# num_pages: total number of pages 4 -# num_pages: total number of pages
5 -# per_page: number of items to fetch per page 5 -# per_page: number of items to fetch per page
6 -# remote: data-remote 6 -# remote: data-remote
7 -%span.page.gap  
8 - = raw(t 'views.pagination.truncate') 7 +%li{class: "page"}
  8 + %span.page.gap
  9 + = raw(t 'views.pagination.truncate')
app/views/kaminari/gitlab/_next_page.html.haml
@@ -5,5 +5,5 @@ @@ -5,5 +5,5 @@
5 -# num_pages: total number of pages 5 -# num_pages: total number of pages
6 -# per_page: number of items to fetch per page 6 -# per_page: number of items to fetch per page
7 -# remote: data-remote 7 -# remote: data-remote
8 -%span.next 8 +%li.next
9 = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote 9 = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote
app/views/kaminari/gitlab/_page.html.haml
@@ -6,5 +6,5 @@ @@ -6,5 +6,5 @@
6 -# num_pages: total number of pages 6 -# num_pages: total number of pages
7 -# per_page: number of items to fetch per page 7 -# per_page: number of items to fetch per page
8 -# remote: data-remote 8 -# remote: data-remote
9 -%span{class: "page#{' current' if page.current?}"}  
10 - = link_to_unless page.current?, page, url, {remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil} 9 +%li{class: "page#{' active' if page.current?}"}
  10 + = link_to page, url, {remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil}
app/views/kaminari/gitlab/_paginator.html.haml
@@ -6,11 +6,12 @@ @@ -6,11 +6,12 @@
6 -# remote: data-remote 6 -# remote: data-remote
7 -# paginator: the paginator that renders the pagination tags inside 7 -# paginator: the paginator that renders the pagination tags inside
8 = paginator.render do 8 = paginator.render do
9 - %nav.gitlab_pagination  
10 - = prev_page_tag  
11 - - each_page do |page|  
12 - - if page.left_outer? || page.right_outer? || page.inside_window?  
13 - = page_tag page  
14 - - elsif !page.was_truncated?  
15 - = gap_tag  
16 - = next_page_tag 9 + %div.pagination
  10 + %ul
  11 + = prev_page_tag unless current_page.first?
  12 + - each_page do |page|
  13 + - if page.left_outer? || page.right_outer? || page.inside_window?
  14 + = page_tag page
  15 + - elsif !page.was_truncated?
  16 + = gap_tag
  17 + = next_page_tag unless current_page.last?
app/views/kaminari/gitlab/_prev_page.html.haml
@@ -5,5 +5,5 @@ @@ -5,5 +5,5 @@
5 -# num_pages: total number of pages 5 -# num_pages: total number of pages
6 -# per_page: number of items to fetch per page 6 -# per_page: number of items to fetch per page
7 -# remote: data-remote 7 -# remote: data-remote
8 -%span.prev 8 +%li{class: "prev" }
9 = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote 9 = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote
app/views/merge_requests/index.html.haml
@@ -25,11 +25,11 @@ @@ -25,11 +25,11 @@
25 - if @merge_requests.blank? 25 - if @merge_requests.blank?
26 %li 26 %li
27 %h4.nothing_here_message Nothing to show here 27 %h4.nothing_here_message Nothing to show here
28 - - if @merge_requests.present?  
29 - %li.bottom  
30 - .left= paginate @merge_requests, theme: "gitlab"  
31 - .pull-right  
32 - %span.cgray.pull-right #{@merge_requests.total_count} merge requests for this filter 28 + - if @merge_requests.present?
  29 + .pull-right
  30 + %span.cgray.pull-right #{@merge_requests.total_count} merge requests for this filter
  31 +
  32 + = paginate @merge_requests, theme: "gitlab"
33 33
34 :javascript 34 :javascript
35 $(merge_requestsPage); 35 $(merge_requestsPage);
app/views/public/projects/index.html.haml
@@ -17,4 +17,4 @@ @@ -17,4 +17,4 @@
17 - unless @projects.present? 17 - unless @projects.present?
18 %h3.nothing_here_message No public projects 18 %h3.nothing_here_message No public projects
19 19
20 - = paginate @projects, theme: "admin" 20 + = paginate @projects, theme: "gitlab"