OSDN Git Service

Refactoring & restyle pagination:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Sat, 6 Apr 2013 19:32:23 +0000 (22:32 +0300)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Sat, 6 Apr 2013 19:32:23 +0000 (22:32 +0300)
- remove admin kaminari theme. Use gitlab theme everywhere
- use bootstrap styled for gitlab admin themes
- dont reload page when change issue filter

24 files changed:
app/assets/javascripts/issues.js
app/assets/stylesheets/gitlab_bootstrap/common.scss
app/assets/stylesheets/sections/issues.scss
app/views/admin/groups/index.html.haml
app/views/admin/projects/index.html.haml
app/views/admin/teams/index.html.haml
app/views/admin/users/index.html.haml
app/views/issues/_issues.html.haml
app/views/issues/index.html.haml
app/views/issues/index.js.haml
app/views/kaminari/admin/_first_page.html.haml [deleted file]
app/views/kaminari/admin/_gap.html.haml [deleted file]
app/views/kaminari/admin/_last_page.html.haml [deleted file]
app/views/kaminari/admin/_next_page.html.haml [deleted file]
app/views/kaminari/admin/_page.html.haml [deleted file]
app/views/kaminari/admin/_paginator.html.haml [deleted file]
app/views/kaminari/admin/_prev_page.html.haml [deleted file]
app/views/kaminari/gitlab/_gap.html.haml
app/views/kaminari/gitlab/_next_page.html.haml
app/views/kaminari/gitlab/_page.html.haml
app/views/kaminari/gitlab/_paginator.html.haml
app/views/kaminari/gitlab/_prev_page.html.haml
app/views/merge_requests/index.html.haml
app/views/public/projects/index.html.haml

index 9ba1a3f..8524022 100644 (file)
@@ -12,7 +12,7 @@ function initIssuesSearch() {
 
       if (terms.length >= 2 || terms.length == 0) {
         $.get(href, { 'status': status, 'terms': terms, 'milestone_id': milestone_id }, function(response) {
-          $('#issues-table').html(response);
+          $('.issues-holder').html(response);
         });
       }
     }
index f061b5d..3ec03b9 100644 (file)
@@ -69,13 +69,6 @@ fieldset legend { font-size: 17px; }
 
 /** PAGINATION **/
 .gitlab_pagination {
-  span a { color: $link_color; }
-  .prev, .next, .current, .page a {
-    padding: 10px;
-  }
-  .current {
-    border-bottom: 2px solid $style_color;
-  }
 }
 
 .tab-content {
index 31d5c56..5a1b476 100644 (file)
@@ -77,7 +77,7 @@ input.check_all_issues {
 @media (min-width: 800px)  { .issues_bulk_update select { width: 120px; }  }
 @media (min-width: 1200px) { .issues_bulk_update select { width: 160px; }  }
 
-#issues-table-holder {
+.issues-holder {
   .issues_filters {
   }
 
index 0029cc7..08d9941 100644 (file)
@@ -34,4 +34,4 @@
       %td.bgred
         = link_to 'Edit', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn btn-small"
         = link_to 'Destroy', [:admin, group], confirm: "REMOVE #{group.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove"
-= paginate @groups, theme: "admin"
+= paginate @groups, theme: "gitlab"
index 82d5fdc..aa006df 100644 (file)
@@ -56,6 +56,4 @@
               = link_to 'Destroy', [project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove"
         - if @projects.blank?
           %p.nothing_here_message 0 projects matches
-        - else
-          %li.bottom
-            = paginate @projects, theme: "gitlab"
+    = paginate @projects, theme: "gitlab"
index 3690d6d..225ad16 100644 (file)
@@ -40,4 +40,4 @@
         = link_to 'Edit', edit_admin_team_path(team), id: "edit_#{dom_id(team)}", class: "btn btn-small"
         = link_to 'Destroy', admin_team_path(team), confirm: "REMOVE #{team.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove"
 
-= paginate @teams, theme: "admin"
+= paginate @teams, theme: "gitlab"
index 9da2871..3657f66 100644 (file)
@@ -58,5 +58,4 @@
                 - else
                   = link_to 'Block', block_admin_user_path(user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn btn-small btn-remove"
                 = link_to 'Destroy', [:admin, user], confirm: "USER #{user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn btn-small btn-remove"
-        %li.bottom
-          = paginate @admin_users, theme: "gitlab"
+      = paginate @admin_users, theme: "gitlab"
index dc7db90..217956d 100644 (file)
@@ -1,12 +1,33 @@
-= render @issues
+.ui-box
+  .title
+    = check_box_tag "check_all_issues", nil, false, class: "check_all_issues left"
+    .clearfix
+      .issues_bulk_update.hide
+        = form_tag bulk_update_project_issues_path(@project), method: :post  do
+          %span.update_issues_text Update selected issues with &nbsp;
+          .left
+            = select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status")
+            = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")
+            = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")
+            = hidden_field_tag 'update[issues_ids]', []
+            = hidden_field_tag :status, params[:status]
+          = button_tag "Save", class: "btn update_selected_issues btn-small btn-save"
+      .issues_filters
+        = form_tag project_issues_path(@project), method: :get, remote: true  do
+          = select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), prompt: "Labels")
+          = select_tag(:assignee_id, options_from_collection_for_select([unassigned_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")
+          = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")
+          = hidden_field_tag :status, params[:status]
+
+  %ul.well-list.issues-list
+    = render @issues
+    - if @issues.blank?
+      %li
+        %h4.nothing_here_message Nothing to show here
 
 - if @issues.present?
-  %li.bottom
-    .left= paginate @issues, remote: true, theme: "gitlab"
-    .pull-right
-      %span.issue_counter #{@issues.total_count}
-      issues for this filter
-- else
-  %li
-    %h4.nothing_here_message Nothing to show here
+  .pull-right
+    %span.issue_counter #{@issues.total_count}
+    issues for this filter
 
+  = paginate @issues, remote: true, theme: "gitlab"
index 2e26ee7..78b6778 100644 (file)
 .row
   .span3
     = render 'filter', entity: 'issue'
-  .span9
-    %div#issues-table-holder.ui-box
-      .title
-        = check_box_tag "check_all_issues", nil, false, class: "check_all_issues left"
-        .clearfix
-          .issues_bulk_update.hide
-            = form_tag bulk_update_project_issues_path(@project), method: :post  do
-              %span.update_issues_text Update selected issues with &nbsp;
-              .left
-                = select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status")
-                = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")
-                = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")
-                = hidden_field_tag 'update[issues_ids]', []
-                = hidden_field_tag :status, params[:status]
-              = button_tag "Save", class: "btn update_selected_issues btn-small btn-save"
-          .issues_filters
-            = form_tag project_issues_path(@project), method: :get  do
-              = select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), prompt: "Labels")
-              = select_tag(:assignee_id, options_from_collection_for_select([unassigned_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")
-              = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")
-              = hidden_field_tag :status, params[:status]
-
-      %ul#issues-table.well-list.issues-list
-        = render "issues"
+  .span9.issues-holder
+    = render "issues"
 
 :javascript
   $(function(){
index 48d7f58..dc77be1 100644 (file)
@@ -1,2 +1,4 @@
 :plain
-  $('#issues-table').html("#{escape_javascript(render('issues'))}");
+  $('.issues-holder').html("#{escape_javascript(render('issues'))}");
+  History.replaceState({path: "#{request.url}"}, document.title, "#{request.url}");
+  issuesPage();
diff --git a/app/views/kaminari/admin/_first_page.html.haml b/app/views/kaminari/admin/_first_page.html.haml
deleted file mode 100644 (file)
index 41c9c0b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
--#  Link to the "First" page
--#  available local variables
--#    url:           url to the first page
--#    current_page:  a page object for the currently displayed page
--#    num_pages:     total number of pages
--#    per_page:      number of items to fetch per page
--#    remote:        data-remote
-%span.first
-  = link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote
diff --git a/app/views/kaminari/admin/_gap.html.haml b/app/views/kaminari/admin/_gap.html.haml
deleted file mode 100644 (file)
index 3ffd12f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
--#  Non-link tag that stands for skipped pages...
--#  available local variables
--#    current_page:  a page object for the currently displayed page
--#    num_pages:     total number of pages
--#    per_page:      number of items to fetch per page
--#    remote:        data-remote
-%li{class: "page"}
-  %span.page.gap
-    = raw(t 'views.pagination.truncate')
diff --git a/app/views/kaminari/admin/_last_page.html.haml b/app/views/kaminari/admin/_last_page.html.haml
deleted file mode 100644 (file)
index b03a206..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
--#  Link to the "Last" page
--#  available local variables
--#    url:           url to the last page
--#    current_page:  a page object for the currently displayed page
--#    num_pages:     total number of pages
--#    per_page:      number of items to fetch per page
--#    remote:        data-remote
-%span.last
-  = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {remote: remote}
diff --git a/app/views/kaminari/admin/_next_page.html.haml b/app/views/kaminari/admin/_next_page.html.haml
deleted file mode 100644 (file)
index 00c5f0b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
--#  Link to the "Next" page
--#  available local variables
--#    url:           url to the next page
--#    current_page:  a page object for the currently displayed page
--#    num_pages:     total number of pages
--#    per_page:      number of items to fetch per page
--#    remote:        data-remote
-%li.next
-  = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote
diff --git a/app/views/kaminari/admin/_page.html.haml b/app/views/kaminari/admin/_page.html.haml
deleted file mode 100644 (file)
index a52d883..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
--#  Link showing page number
--#  available local variables
--#    page:          a page object for "this" page
--#    url:           url to this page
--#    current_page:  a page object for the currently displayed page
--#    num_pages:     total number of pages
--#    per_page:      number of items to fetch per page
--#    remote:        data-remote
-%li{class: "page#{' active' if page.current?}"}
-  = link_to page, url, {remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil}
diff --git a/app/views/kaminari/admin/_paginator.html.haml b/app/views/kaminari/admin/_paginator.html.haml
deleted file mode 100644 (file)
index 6f9fb33..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
--#  The container tag
--#  available local variables
--#    current_page:  a page object for the currently displayed page
--#    num_pages:     total number of pages
--#    per_page:      number of items to fetch per page
--#    remote:        data-remote
--#    paginator:     the paginator that renders the pagination tags inside
-= paginator.render do
-  %div.pagination
-    %ul
-      = prev_page_tag unless current_page.first?
-      - each_page do |page|
-        - if page.left_outer? || page.right_outer? || page.inside_window?
-          = page_tag page
-        - elsif !page.was_truncated?
-          = gap_tag
-      = next_page_tag unless current_page.last?
diff --git a/app/views/kaminari/admin/_prev_page.html.haml b/app/views/kaminari/admin/_prev_page.html.haml
deleted file mode 100644 (file)
index f673abd..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
--#  Link to the "Previous" page
--#  available local variables
--#    url:           url to the previous page
--#    current_page:  a page object for the currently displayed page
--#    num_pages:     total number of pages
--#    per_page:      number of items to fetch per page
--#    remote:        data-remote
-%li{class: "prev" }
-  = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote
index f82f185..3ffd12f 100644 (file)
@@ -4,5 +4,6 @@
 -#    num_pages:     total number of pages
 -#    per_page:      number of items to fetch per page
 -#    remote:        data-remote
-%span.page.gap
-  = raw(t 'views.pagination.truncate')
+%li{class: "page"}
+  %span.page.gap
+    = raw(t 'views.pagination.truncate')
index 296cceb..00c5f0b 100644 (file)
@@ -5,5 +5,5 @@
 -#    num_pages:     total number of pages
 -#    per_page:      number of items to fetch per page
 -#    remote:        data-remote
-%span.next
+%li.next
   = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote
index 19456dc..a52d883 100644 (file)
@@ -6,5 +6,5 @@
 -#    num_pages:     total number of pages
 -#    per_page:      number of items to fetch per page
 -#    remote:        data-remote
-%span{class: "page#{' current' if page.current?}"}
-  = link_to_unless page.current?, page, url, {remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil}
+%li{class: "page#{' active' if page.current?}"}
+  = link_to page, url, {remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil}
index 6dd5a57..6f9fb33 100644 (file)
@@ -6,11 +6,12 @@
 -#    remote:        data-remote
 -#    paginator:     the paginator that renders the pagination tags inside
 = paginator.render do
-  %nav.gitlab_pagination
-    = prev_page_tag
-    - each_page do |page|
-      - if page.left_outer? || page.right_outer? || page.inside_window?
-        = page_tag page
-      - elsif !page.was_truncated?
-        = gap_tag
-    = next_page_tag
+  %div.pagination
+    %ul
+      = prev_page_tag unless current_page.first?
+      - each_page do |page|
+        - if page.left_outer? || page.right_outer? || page.inside_window?
+          = page_tag page
+        - elsif !page.was_truncated?
+          = gap_tag
+      = next_page_tag unless current_page.last?
index 5c20616..f673abd 100644 (file)
@@ -5,5 +5,5 @@
 -#    num_pages:     total number of pages
 -#    per_page:      number of items to fetch per page
 -#    remote:        data-remote
-%span.prev
+%li{class: "prev" }
   = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote
index bf7a82b..b9e9096 100644 (file)
         - if @merge_requests.blank?
           %li
             %h4.nothing_here_message Nothing to show here
-        - if @merge_requests.present?
-          %li.bottom
-            .left= paginate @merge_requests, theme: "gitlab"
-            .pull-right
-              %span.cgray.pull-right #{@merge_requests.total_count} merge requests for this filter
+    - if @merge_requests.present?
+      .pull-right
+        %span.cgray.pull-right #{@merge_requests.total_count} merge requests for this filter
+
+      = paginate @merge_requests, theme: "gitlab"
 
 :javascript
   $(merge_requestsPage);
index b50484f..3d0d793 100644 (file)
@@ -17,4 +17,4 @@
     - unless @projects.present?
       %h3.nothing_here_message No public projects
 
-  = paginate @projects, theme: "admin"
+  = paginate @projects, theme: "gitlab"