From 9243daa2bb05d6b1497e992da99af239ecf0aebc Mon Sep 17 00:00:00 2001 From: Luiz Armesto Date: Wed, 4 Jun 2014 18:37:23 -0700 Subject: [PATCH 01/12] start list views --- app/assets/stylesheets/_settings.css.scss | 4 ++- app/assets/stylesheets/application.css.scss | 1 + .../stylesheets/shared/_counters.css.scss | 25 ++++++++++++-- app/assets/stylesheets/shared/_lists.css.scss | 34 +++++++++++++++++++ app/helpers/application_helper.rb | 10 ++++++ app/views/shared/_counters.html.erb | 13 +++++-- .../shared/lists/_contributions.html.erb | 5 +++ app/views/shared/lists/_item_small.html.erb | 14 ++++++++ app/views/users/show.html.erb | 2 +- 9 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 app/assets/stylesheets/shared/_lists.css.scss create mode 100644 app/views/shared/lists/_contributions.html.erb create mode 100644 app/views/shared/lists/_item_small.html.erb diff --git a/app/assets/stylesheets/_settings.css.scss b/app/assets/stylesheets/_settings.css.scss index e2279b2..50afb43 100644 --- a/app/assets/stylesheets/_settings.css.scss +++ b/app/assets/stylesheets/_settings.css.scss @@ -77,10 +77,12 @@ $text-link-visited-color: #004047; $stick-color-bg: $white; $stick-color-shadow: $meppit-blue; +$list-item-separator-color: $soft-grey; + // Typography $main-font: Calibri, Candara, Segoe, "Segoe UI", Optima, Arial, sans-serif; $highlight-font: Cambria, Georgia, serif; -$base-font-size: 14px; +$base-font-size: 13px; $secondary-content-font-size: 0.85em; diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 3eee0fa..f87a7b9 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -34,6 +34,7 @@ @import "shared/stick"; @import "shared/tabs"; @import "shared/counters"; +@import "shared/lists"; @import "sessions/sign_in"; diff --git a/app/assets/stylesheets/shared/_counters.css.scss b/app/assets/stylesheets/shared/_counters.css.scss index 040bb24..c8b6544 100644 --- a/app/assets/stylesheets/shared/_counters.css.scss +++ b/app/assets/stylesheets/shared/_counters.css.scss @@ -25,22 +25,41 @@ display: inline-block; margin: 0 5px 0 0; vertical-align: middle; - font-size: 1.7em; + font-size: 1.8em; } .counter-value { display: inline-block; vertical-align: middle; text-align: center; - font-size: 0.8em; + font-size: 0.9em; line-height: 1em; em { display: block; color: $text-color; font-weight: bold; - font-size: 1.2em; + font-size: 1.3em; } } + + &.small { + margin: 0 0 0 5px; + font-size: 0.9em; + + a { + padding: 5px; + } + + i { + font-size: 1em; + } + + .counter-value { + min-width: 1.5em; + text-align: inherit; + } + } + } } diff --git a/app/assets/stylesheets/shared/_lists.css.scss b/app/assets/stylesheets/shared/_lists.css.scss new file mode 100644 index 0000000..1549455 --- /dev/null +++ b/app/assets/stylesheets/shared/_lists.css.scss @@ -0,0 +1,34 @@ +.list-item { + clear: both; + padding: 10px 0; + border-bottom: 1px solid $list-item-separator-color; + + .item-avatar { + display: block; + float: left; + margin: 0 10px 0 0; + background: red; //FIXME + width: 32px; + height: 32px; + border-radius: 5px; + } + + .item { + float: left; + + .item-title { + font-family: inherit; + font-size: 1.15em; + } + + .item-excerpt { + color: $text-color; + } + } + + .item-controls { + .counters { + margin: 10px 0; + } + } +} diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5f09062..b103461 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -79,4 +79,14 @@ def counters_list(obj, only=:all) available_counters = counters.select {|key, counter| obj.respond_to? counter[:method] } only == :all ? available_counters.values() : only.map {|name| available_counters[name] } end + + def contributions_list(obj) + #TODO: get real objects + require 'ostruct' + [ + OpenStruct.new(:title => "Fake item", :excerpt => "Lorem ipsum", :maps_count => 5, :followers_count => 23), + OpenStruct.new(:title => "Another fake item", :excerpt => "Lorem ipsum", :data_count => 43, :followers_count => 133, :contributors_count => 21 ), + OpenStruct.new(:title => "More fakes", :excerpt => "Lorem ipsum", :maps_count => 0, :followers_count => 0, :contributors_count => 1) + ] + end end diff --git a/app/views/shared/_counters.html.erb b/app/views/shared/_counters.html.erb index 1dec5b0..c756000 100644 --- a/app/views/shared/_counters.html.erb +++ b/app/views/shared/_counters.html.erb @@ -1,8 +1,15 @@
- Contributions Placeholder + <%= render 'shared/lists/contributions', :object => @user, :user => @user %>
Activity Placeholder From 1afc6e3680a5bdd80d9a8f6248028a06ea588d98 Mon Sep 17 00:00:00 2001 From: Luiz Armesto Date: Thu, 5 Jun 2014 07:22:46 -0700 Subject: [PATCH 02/12] define list item styles --- app/assets/stylesheets/shared/_lists.css.scss | 25 +++++++++++++------ .../stylesheets/users/_profile.css.scss | 2 +- app/helpers/application_helper.rb | 10 +++++--- app/views/shared/lists/_item_small.html.erb | 6 ++--- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/app/assets/stylesheets/shared/_lists.css.scss b/app/assets/stylesheets/shared/_lists.css.scss index 1549455..01bf781 100644 --- a/app/assets/stylesheets/shared/_lists.css.scss +++ b/app/assets/stylesheets/shared/_lists.css.scss @@ -1,13 +1,13 @@ .list-item { clear: both; - padding: 10px 0; + padding: 15px 0; border-bottom: 1px solid $list-item-separator-color; .item-avatar { display: block; float: left; margin: 0 10px 0 0; - background: red; //FIXME + background: $soft-grey; width: 32px; height: 32px; border-radius: 5px; @@ -19,16 +19,25 @@ .item-title { font-family: inherit; font-size: 1.15em; - } - .item-excerpt { - color: $text-color; } + + .item-excerpt { color: $text-color; } + + a { color: $text-link-color; } + + } + + &.map { + .item-avatar { background: $meppit-maps-color; } + .item a { color: $meppit-maps-color; } + } + &.data { + .item-avatar { background: $meppit-data-color; } + .item a { color: $meppit-data-color; } } .item-controls { - .counters { - margin: 10px 0; - } + .counters { margin: 8px 0; } } } diff --git a/app/assets/stylesheets/users/_profile.css.scss b/app/assets/stylesheets/users/_profile.css.scss index 0e198cb..9ca2779 100644 --- a/app/assets/stylesheets/users/_profile.css.scss +++ b/app/assets/stylesheets/users/_profile.css.scss @@ -27,7 +27,7 @@ // Central pane .main-title { float:left; - max-width: 435px; + max-width: 425px; } .location { diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b103461..23f7fd8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -84,9 +84,13 @@ def contributions_list(obj) #TODO: get real objects require 'ostruct' [ - OpenStruct.new(:title => "Fake item", :excerpt => "Lorem ipsum", :maps_count => 5, :followers_count => 23), - OpenStruct.new(:title => "Another fake item", :excerpt => "Lorem ipsum", :data_count => 43, :followers_count => 133, :contributors_count => 21 ), - OpenStruct.new(:title => "More fakes", :excerpt => "Lorem ipsum", :maps_count => 0, :followers_count => 0, :contributors_count => 1) + OpenStruct.new(:title => "Fake item", :type => :user, :description => "Lorem ipsum", :maps_count => 5, :followers_count => 23), + OpenStruct.new(:title => "Another fake item", :type => :map, :description => "Lorem ipsum", :data_count => 43, :followers_count => 133, :contributors_count => 21 ), + OpenStruct.new(:title => "More fakes", :type => :data, :description => "Lorem ipsum", :maps_count => 0, :followers_count => 0, :contributors_count => 1), + OpenStruct.new(:title => "More fakes", :type => :data, :description => "Lorem ipsum", :maps_count => 0, :followers_count => 0, :contributors_count => 1), + OpenStruct.new(:title => "More fakes", :type => :data, :description => "Lorem ipsum", :maps_count => 0, :followers_count => 0, :contributors_count => 1), + OpenStruct.new(:title => "Another fake item", :type => :map, :description => "Lorem ipsum", :data_count => 43, :followers_count => 133, :contributors_count => 21 ), + OpenStruct.new(:title => "More fakes", :type => :data, :description => "Lorem ipsum", :maps_count => 0, :followers_count => 0, :contributors_count => 1) ] end end diff --git a/app/views/shared/lists/_item_small.html.erb b/app/views/shared/lists/_item_small.html.erb index afbe110..fce8280 100644 --- a/app/views/shared/lists/_item_small.html.erb +++ b/app/views/shared/lists/_item_small.html.erb @@ -1,9 +1,9 @@ -
  • +
  • -

    <%= item.title %>

    -

    <%= item.excerpt %>

    +

    <%= truncate(item.title, length: 40) %>

    +

    <%= truncate(item.description) %>

    <% if local_assigns[:control] == :counters %> From 9eeadc3b2a9846bd758304bf7101311bdce72bab Mon Sep 17 00:00:00 2001 From: Luiz Armesto Date: Thu, 5 Jun 2014 12:55:53 -0700 Subject: [PATCH 03/12] finish list item views --- .../stylesheets/shared/_counters.css.scss | 6 ++- app/assets/stylesheets/shared/_lists.css.scss | 46 +++++++++++++++---- .../stylesheets/shared/_toolbar.css.scss | 1 + app/views/shared/_counters.html.erb | 5 +- .../shared/lists/_contributions.html.erb | 2 +- app/views/shared/lists/_item_big.html.erb | 30 ++++++++++++ app/views/shared/lists/_item_small.html.erb | 30 +++++++++--- app/views/users/show.html.erb | 4 +- 8 files changed, 102 insertions(+), 22 deletions(-) create mode 100644 app/views/shared/lists/_item_big.html.erb diff --git a/app/assets/stylesheets/shared/_counters.css.scss b/app/assets/stylesheets/shared/_counters.css.scss index c8b6544..64af88a 100644 --- a/app/assets/stylesheets/shared/_counters.css.scss +++ b/app/assets/stylesheets/shared/_counters.css.scss @@ -43,7 +43,7 @@ } } - &.small { + &.small, &.medium { margin: 0 0 0 5px; font-size: 0.9em; @@ -61,5 +61,9 @@ } } + &.medium { + font-size: 1.15em; + } + } } diff --git a/app/assets/stylesheets/shared/_lists.css.scss b/app/assets/stylesheets/shared/_lists.css.scss index 01bf781..22fe112 100644 --- a/app/assets/stylesheets/shared/_lists.css.scss +++ b/app/assets/stylesheets/shared/_lists.css.scss @@ -8,9 +8,39 @@ float: left; margin: 0 10px 0 0; background: $soft-grey; - width: 32px; - height: 32px; - border-radius: 5px; + color: #fff; + text-align: center; + + i { margin: 2px 0; } + } + + &.small { + .item-avatar, img { + font-size: 30px; + width: 32px; + height: 32px; + border-radius: 5px; + } + + .item { + width: 400px; + } + + .item-excerpt { font-size: 0.95em; } + } + + &.big { + .item-avatar, img { + font-size: 54px; + width: 64px; + height: 64px; + border-radius: 7px; + } + + .item { + min-height: 64px; + width: 620px; + } } .item { @@ -19,22 +49,20 @@ .item-title { font-family: inherit; font-size: 1.15em; - + color: $text-link-color; + margin: 0 0 2px; } .item-excerpt { color: $text-color; } - - a { color: $text-link-color; } - } &.map { .item-avatar { background: $meppit-maps-color; } - .item a { color: $meppit-maps-color; } + .item .item-title { color: $meppit-maps-color; } } &.data { .item-avatar { background: $meppit-data-color; } - .item a { color: $meppit-data-color; } + .item .item-title { color: $meppit-data-color; } } .item-controls { diff --git a/app/assets/stylesheets/shared/_toolbar.css.scss b/app/assets/stylesheets/shared/_toolbar.css.scss index 8ebc775..eeb635c 100644 --- a/app/assets/stylesheets/shared/_toolbar.css.scss +++ b/app/assets/stylesheets/shared/_toolbar.css.scss @@ -3,6 +3,7 @@ .toolbar-buttons { background: url('imgs/toolbar-bg.png') no-repeat right top; + padding: 0 5px; min-height: 430px; float: left; } diff --git a/app/views/shared/_counters.html.erb b/app/views/shared/_counters.html.erb index c756000..947f668 100644 --- a/app/views/shared/_counters.html.erb +++ b/app/views/shared/_counters.html.erb @@ -1,10 +1,11 @@ +<% size = local_assigns[:size] || :medium %>
    - <%= render 'shared/counters', :object => @user, :user => @user %> + <%= render 'shared/counters', :object => @user, :size => :big %>
    <% if @user.location %> @@ -48,7 +48,7 @@
  • <%= icon "star", t('users.profile.following') %>
  • - <%= render 'shared/lists/contributions', :object => @user, :user => @user %> + <%= render 'shared/lists/contributions', :object => @user %>
    Activity Placeholder From 43dea0848e66398d95d82a2f7181e7f35f6c4cb2 Mon Sep 17 00:00:00 2001 From: Luiz Armesto Date: Mon, 9 Jun 2014 12:20:31 -0700 Subject: [PATCH 04/12] minor improvement --- app/helpers/application_helper.rb | 25 +++++++++++++------ app/models/user.rb | 4 +-- app/views/geo_data/show.html.erb | 2 +- .../shared/lists/_contributions.html.erb | 2 +- app/views/shared/lists/_item_small.html.erb | 21 ++++++++-------- 5 files changed, 33 insertions(+), 21 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 23f7fd8..5bf4c16 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -84,13 +84,24 @@ def contributions_list(obj) #TODO: get real objects require 'ostruct' [ - OpenStruct.new(:title => "Fake item", :type => :user, :description => "Lorem ipsum", :maps_count => 5, :followers_count => 23), - OpenStruct.new(:title => "Another fake item", :type => :map, :description => "Lorem ipsum", :data_count => 43, :followers_count => 133, :contributors_count => 21 ), - OpenStruct.new(:title => "More fakes", :type => :data, :description => "Lorem ipsum", :maps_count => 0, :followers_count => 0, :contributors_count => 1), - OpenStruct.new(:title => "More fakes", :type => :data, :description => "Lorem ipsum", :maps_count => 0, :followers_count => 0, :contributors_count => 1), - OpenStruct.new(:title => "More fakes", :type => :data, :description => "Lorem ipsum", :maps_count => 0, :followers_count => 0, :contributors_count => 1), - OpenStruct.new(:title => "Another fake item", :type => :map, :description => "Lorem ipsum", :data_count => 43, :followers_count => 133, :contributors_count => 21 ), - OpenStruct.new(:title => "More fakes", :type => :data, :description => "Lorem ipsum", :maps_count => 0, :followers_count => 0, :contributors_count => 1) + GeoData.find(1), + GeoData.find(1), + User.find(2), + GeoData.find(1), + GeoData.find(1), + GeoData.find(1) ] end + + def object_type(obj) + if obj.kind_of? User + :user + elsif obj.kind_of? GeoData + :data + #elsif obj.kind_of? Map + #:map + else + :unknown + end + end end diff --git a/app/models/user.rb b/app/models/user.rb index 2215abf..375b300 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -40,12 +40,12 @@ def geojson_properties end def followers_count - # TODO + #TODO refactor to concern 0 end def maps_count - # TODO + #TODO refactor to concern 0 end end diff --git a/app/views/geo_data/show.html.erb b/app/views/geo_data/show.html.erb index a8aba4f..a50710a 100644 --- a/app/views/geo_data/show.html.erb +++ b/app/views/geo_data/show.html.erb @@ -8,7 +8,7 @@

    <%= @data.name %>

    - <%= render 'shared/counters', :object => @data %> + <%= render 'shared/counters', :object => @data, :size => :big %>
    <%= t 'geo_data.last_updated', date: time_ago_in_words(@data.updated_at) %>
    diff --git a/app/views/shared/lists/_contributions.html.erb b/app/views/shared/lists/_contributions.html.erb index 3e02a36..5e7234b 100644 --- a/app/views/shared/lists/_contributions.html.erb +++ b/app/views/shared/lists/_contributions.html.erb @@ -1,5 +1,5 @@
      <% contributions_list(object).each do |item| %> - <%= render 'shared/lists/item_small', :item => item, :control => :counters %> + <%= render 'shared/lists/item_small', :object => item, :control => :counters %> <% end %>
    diff --git a/app/views/shared/lists/_item_small.html.erb b/app/views/shared/lists/_item_small.html.erb index 96fd051..ea3e99d 100644 --- a/app/views/shared/lists/_item_small.html.erb +++ b/app/views/shared/lists/_item_small.html.erb @@ -1,15 +1,16 @@ -
  • +<% type = object_type object %> +
  • From d04bed4e338df0592f1c94b93fc9a843dc37dc1d Mon Sep 17 00:00:00 2001 From: Luiz Armesto Date: Mon, 9 Jun 2014 13:39:31 -0700 Subject: [PATCH 05/12] add geo_data list view --- app/assets/stylesheets/shared/_lists.css.scss | 8 +++++ app/assets/stylesheets/shared/_page.css.scss | 16 +++++++++ app/controllers/geo_data_controller.rb | 4 +++ app/views/geo_data/index.html.erb | 10 ++++++ app/views/shared/header/_menu.html.erb | 2 +- app/views/shared/lists/_item_big.html.erb | 33 ++++++++++++------- app/views/shared/lists/_item_small.html.erb | 4 +-- config/locales/en/geo_data.yml | 3 ++ config/locales/pt-BR/geo_data.yml | 3 ++ config/routes.rb | 2 +- 10 files changed, 69 insertions(+), 16 deletions(-) create mode 100644 app/views/geo_data/index.html.erb diff --git a/app/assets/stylesheets/shared/_lists.css.scss b/app/assets/stylesheets/shared/_lists.css.scss index 22fe112..9376328 100644 --- a/app/assets/stylesheets/shared/_lists.css.scss +++ b/app/assets/stylesheets/shared/_lists.css.scss @@ -3,6 +3,12 @@ padding: 15px 0; border-bottom: 1px solid $list-item-separator-color; + &:hover { background: $dark-white; } + + a, a:hover { text-decoration: none; } + + .item-checkbox { float: left; } + .item-avatar { display: block; float: left; @@ -30,6 +36,8 @@ } &.big { + .item-checkbox { margin: 22px 15px; } + .item-avatar, img { font-size: 54px; width: 64px; diff --git a/app/assets/stylesheets/shared/_page.css.scss b/app/assets/stylesheets/shared/_page.css.scss index 5d91492..fa73e49 100644 --- a/app/assets/stylesheets/shared/_page.css.scss +++ b/app/assets/stylesheets/shared/_page.css.scss @@ -13,4 +13,20 @@ font-size: 1.6em; letter-spacing: -0.02em; } + &.full { + @include span-columns(12); + + .side-pane { + @include span-columns(3 of 12); + } + + .central-pane { + @include span-columns(9 of 12); + } + + h1.name { + font-size: 1.6em; + letter-spacing: -0.02em; + } +} } diff --git a/app/controllers/geo_data_controller.rb b/app/controllers/geo_data_controller.rb index 66288ab..1eaab51 100644 --- a/app/controllers/geo_data_controller.rb +++ b/app/controllers/geo_data_controller.rb @@ -3,6 +3,10 @@ class GeoDataController < ApplicationController before_action :require_login, :only => [:edit, :update] before_action :find_data, :only => [:show, :edit, :update] + def index + @data = GeoData.all + end + def show end diff --git a/app/views/geo_data/index.html.erb b/app/views/geo_data/index.html.erb new file mode 100644 index 0000000..bcf3229 --- /dev/null +++ b/app/views/geo_data/index.html.erb @@ -0,0 +1,10 @@ +
    +
    +

    <%= raw t('geo_data.list.title', :count => "#{local_assigns[:count]}") %>

    +
      + <% @data.each do |item| %> + <%= render 'shared/lists/item_big', :object => item, :checkbox => true, :control => :counters %> + <% end %> +
    +
    +
    diff --git a/app/views/shared/header/_menu.html.erb b/app/views/shared/header/_menu.html.erb index 149982d..f60e3fb 100644 --- a/app/views/shared/header/_menu.html.erb +++ b/app/views/shared/header/_menu.html.erb @@ -5,7 +5,7 @@
  • diff --git a/app/views/shared/lists/_item_big.html.erb b/app/views/shared/lists/_item_big.html.erb index d938920..0d958af 100644 --- a/app/views/shared/lists/_item_big.html.erb +++ b/app/views/shared/lists/_item_big.html.erb @@ -1,29 +1,38 @@ -
  • +<% type = object_type object %> +
  • diff --git a/app/views/shared/lists/_item_small.html.erb b/app/views/shared/lists/_item_small.html.erb index ea3e99d..84ef38a 100644 --- a/app/views/shared/lists/_item_small.html.erb +++ b/app/views/shared/lists/_item_small.html.erb @@ -1,7 +1,7 @@ <% type = object_type object %>
  • - +
    <% if object[:avatar] %> <%= image_tag object[:avatar].thumb.url %> @@ -18,7 +18,7 @@ <% end %>
    -

    <%= truncate object[:title], length: 55 %>

    +

    <%= truncate object[:name], length: 55 %>

    <%= truncate(object[:description] || object[:about_me], length: 130) %>

    diff --git a/config/locales/en/geo_data.yml b/config/locales/en/geo_data.yml index 2c03f10..e5dc624 100644 --- a/config/locales/en/geo_data.yml +++ b/config/locales/en/geo_data.yml @@ -16,5 +16,8 @@ en: add_to_map: "Add to a Map" + list: + title: '%{count} objects' + flash: updated: 'Data successfully updated' diff --git a/config/locales/pt-BR/geo_data.yml b/config/locales/pt-BR/geo_data.yml index f9f5979..4553dd0 100644 --- a/config/locales/pt-BR/geo_data.yml +++ b/config/locales/pt-BR/geo_data.yml @@ -16,5 +16,8 @@ pt-BR: add_to_map: "Adicone a um Mapa" + list: + title: '%{count} objetos' + flash: updated: 'Dados atualizados com sucesso' diff --git a/config/routes.rb b/config/routes.rb index 48ab700..e778db1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -25,7 +25,7 @@ end end - resources :geo_data, :only => [:show, :edit, :update] + resources :geo_data, :only => [:index, :show, :edit, :update] if Rails.env.development? mount LetterOpenerWeb::Engine, :at => "/letter_opener" From 8358a7355626cc99ed8112a5865cf47bef0c84f2 Mon Sep 17 00:00:00 2001 From: Luiz Armesto Date: Mon, 9 Jun 2014 14:10:23 -0700 Subject: [PATCH 06/12] add kaminari gem --- Gemfile | 1 + Gemfile.lock | 4 ++++ app/assets/stylesheets/geo_data.css.scss | 2 +- app/assets/stylesheets/shared/_page.css.scss | 2 +- app/assets/stylesheets/users/_profile.css.scss | 2 +- app/controllers/geo_data_controller.rb | 2 +- app/views/geo_data/edit.html.erb | 2 +- app/views/geo_data/index.html.erb | 7 ++++--- app/views/geo_data/show.html.erb | 2 +- app/views/users/edit.html.erb | 2 +- app/views/users/show.html.erb | 2 +- db/seeds/development/geo_data.seeds.rb | 7 +++++++ 12 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index 669fe74..8de2e0a 100644 --- a/Gemfile +++ b/Gemfile @@ -38,6 +38,7 @@ gem 'carrierwave_backgrounder' # delegate uploads to background jobs gem 'mini_magick' # image processing for uploaders gem 'fog' # upload images to amazon S3 gem 'remotipart' # enable ajax file uploads on remote forms +gem 'kaminari' # paginator group :doc do gem 'sdoc', :require => false diff --git a/Gemfile.lock b/Gemfile.lock index 4b43449..a9e8cd1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -160,6 +160,9 @@ GEM json (1.8.1) jwt (0.1.11) multi_json (>= 1.5) + kaminari (0.16.0) + actionpack (>= 3.0.0) + activesupport (>= 3.0.0) konacha (3.2.0) actionpack (>= 3.1, < 5) capybara @@ -372,6 +375,7 @@ DEPENDENCIES jquery-fileupload-rails jquery-rails jquery-ui-rails + kaminari konacha letter_opener letter_opener_web diff --git a/app/assets/stylesheets/geo_data.css.scss b/app/assets/stylesheets/geo_data.css.scss index c38d653..089efa2 100644 --- a/app/assets/stylesheets/geo_data.css.scss +++ b/app/assets/stylesheets/geo_data.css.scss @@ -1,4 +1,4 @@ -.page.data-view { +.site-page.data-view { .data-logo { width: 50px; height:50px; diff --git a/app/assets/stylesheets/shared/_page.css.scss b/app/assets/stylesheets/shared/_page.css.scss index fa73e49..e4bbda8 100644 --- a/app/assets/stylesheets/shared/_page.css.scss +++ b/app/assets/stylesheets/shared/_page.css.scss @@ -1,4 +1,4 @@ -.page { +.site-page { @include span-columns($page-columns); .side-pane { diff --git a/app/assets/stylesheets/users/_profile.css.scss b/app/assets/stylesheets/users/_profile.css.scss index 68c39e1..860505d 100644 --- a/app/assets/stylesheets/users/_profile.css.scss +++ b/app/assets/stylesheets/users/_profile.css.scss @@ -1,4 +1,4 @@ -.page.user-profile { +.site-page.user-profile { // left pane .avatar { diff --git a/app/controllers/geo_data_controller.rb b/app/controllers/geo_data_controller.rb index 1eaab51..1e14794 100644 --- a/app/controllers/geo_data_controller.rb +++ b/app/controllers/geo_data_controller.rb @@ -4,7 +4,7 @@ class GeoDataController < ApplicationController before_action :find_data, :only => [:show, :edit, :update] def index - @data = GeoData.all + @list = GeoData.page(params[:page]).per(params[:per]) end def show diff --git a/app/views/geo_data/edit.html.erb b/app/views/geo_data/edit.html.erb index 4adb411..22c4791 100644 --- a/app/views/geo_data/edit.html.erb +++ b/app/views/geo_data/edit.html.erb @@ -1,6 +1,6 @@ <%= render 'shared/toolbar', :object => @data, :only => data_tools(@data) %> -
    +
    <%= remote_form_for @data do |f| %>
    diff --git a/app/views/geo_data/index.html.erb b/app/views/geo_data/index.html.erb index bcf3229..e877c5b 100644 --- a/app/views/geo_data/index.html.erb +++ b/app/views/geo_data/index.html.erb @@ -1,8 +1,9 @@ -
    +
    -

    <%= raw t('geo_data.list.title', :count => "#{local_assigns[:count]}") %>

    +

    <%= raw t('geo_data.list.title', :count => "#{@list.total_count}") %>

    + <%= paginate @list %>
      - <% @data.each do |item| %> + <% @list.each do |item| %> <%= render 'shared/lists/item_big', :object => item, :checkbox => true, :control => :counters %> <% end %>
    diff --git a/app/views/geo_data/show.html.erb b/app/views/geo_data/show.html.erb index a50710a..2a04f6f 100644 --- a/app/views/geo_data/show.html.erb +++ b/app/views/geo_data/show.html.erb @@ -1,6 +1,6 @@ <%= render 'shared/toolbar', :object => @data, :only => data_tools(@data) %> -
    +