diff --git a/Gemfile.lock b/Gemfile.lock index 8f7585851..e19af5749 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -51,7 +51,7 @@ GEM public_suffix (>= 2.0.2, < 4.0) arel (6.0.4) ast (2.4.0) - autoprefixer-rails (8.2.0) + autoprefixer-rails (8.3.0) execjs bcrypt (3.1.11) better_errors (2.2.0) @@ -76,7 +76,7 @@ GEM activesupport (>= 3.0.0) uniform_notifier (~> 1.11.0) byebug (10.0.2) - cancancan (2.1.3) + cancancan (2.2.0) capybara (2.18.0) addressable mini_mime (>= 0.1.3) @@ -84,13 +84,13 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (>= 2.0, < 4.0) - capybara-email (2.5.0) - capybara (~> 2.4) + capybara-email (3.0.1) + capybara (>= 2.4, < 4.0) mail - capybara-screenshot (1.0.18) - capybara (>= 1.0, < 3) + capybara-screenshot (1.0.19) + capybara (>= 1.0, < 4) launchy - chartkick (2.3.3) + chartkick (2.3.4) childprocess (0.9.0) ffi (~> 1.0, >= 1.0.11) climate_control (0.2.0) @@ -130,11 +130,11 @@ GEM term-ansicolor (~> 1.3) thor (~> 0.19.1) tins (~> 1.6) - crass (1.0.3) + crass (1.0.4) csv_shaper (1.3.0) activesupport (>= 3.0.0) - dalli (2.7.7) - database_cleaner (1.6.2) + dalli (2.7.8) + database_cleaner (1.7.0) debug_inspector (0.0.3) devise (4.4.3) bcrypt (~> 3.0) @@ -251,7 +251,7 @@ GEM parser (>= 2.2.3.0) term-ansicolor (>= 1.3.2) terminal-table (>= 1.5.1) - jquery-rails (4.3.1) + jquery-rails (4.3.3) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -326,7 +326,7 @@ GEM omniauth (1.8.1) hashie (>= 3.4.6, < 3.6.0) rack (>= 1.6.2, < 3) - omniauth-facebook (4.0.0) + omniauth-facebook (5.0.0) omniauth-oauth2 (~> 1.2) omniauth-flickr (0.0.19) multi_json (~> 1.11.0) @@ -348,7 +348,7 @@ GEM mimemagic (~> 0.3.0) terrapin (~> 0.6.0) parallel (1.12.1) - parser (2.5.0.5) + parser (2.5.1.0) ast (~> 2.4.0) pg (0.21.0) platform-api (2.1.0) @@ -469,9 +469,9 @@ GEM selenium-webdriver (3.11.0) childprocess (~> 0.5) rubyzip (~> 1.2) - sexp_processor (4.10.1) + sexp_processor (4.11.0) shellany (0.0.1) - sidekiq (5.1.2) + sidekiq (5.1.3) concurrent-ruby (~> 1.0) connection_pool (~> 2.2, >= 2.2.0) rack-protection (>= 1.5.0) @@ -481,8 +481,8 @@ GEM json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - sparkpost_rails (1.5.0) - rails (>= 4.0, < 5.2) + sparkpost_rails (1.5.1) + rails (>= 4.0, < 5.3) sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -507,9 +507,9 @@ GEM trollop (1.16.2) tzinfo (1.2.5) thread_safe (~> 0.1) - uglifier (4.1.8) + uglifier (4.1.9) execjs (>= 0.3.0, < 3) - unicode-display_width (1.3.0) + unicode-display_width (1.3.2) unicorn (5.4.0) kgio (~> 2.6) raindrops (~> 0.7) diff --git a/app/assets/stylesheets/overrides.sass b/app/assets/stylesheets/overrides.sass index 5bde11d05..920dbd5d4 100644 --- a/app/assets/stylesheets/overrides.sass +++ b/app/assets/stylesheets/overrides.sass @@ -12,6 +12,10 @@ body .list-inline > li.first padding-left: 0px +.activity-list + list-style-type: none + padding: 0 + h2 font-size: 150% @@ -34,6 +38,21 @@ h3 max-width: 100% height: auto +.profile-sidebar + margin-top: -5rem + .avatar + border-radius: 50% + border-radius: 50% + z-index: 2 + position: relative + +.profile-activity + background: white + padding: 2em + margin-top: 2em + .container + width: 100% + .sidebar border-left: 1px solid darken($beige, 10%) margin-left: -1px @@ -74,7 +93,7 @@ p.stats flex: none flex-wrap: wrap -.seeds-row +.card-row display: grid grid-template-columns: 50% 50% grid-gap: 25px @@ -125,11 +144,15 @@ p.stats dd margin-left: auto +.layout-actions + width: 100% + #placesmap, #cropmap height: 500px #membermap height: 250px + z-index: 0 .location-not-set height: 250px diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index c346eb8e3..ae720e57b 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -20,6 +20,7 @@ class MembersController < ApplicationController @facebook_auth = @member.auth('facebook') @posts = @member.posts @gardens = @member.gardens.active.order(:name) + @harvests = @member.harvests # The garden form partial is called from the "New Garden" tab; # it requires a garden to be passed in @garden. diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 639d27686..7ef7bc02f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -86,11 +86,15 @@ module ApplicationHelper def show_inactive_tickbox_path(type, owner, show_all) all = show_all ? '' : 1 if owner - plantings_by_owner_path(owner: owner.slug, all: all) if type == 'plantings' - gardens_by_owner_path(owner: owner.slug, all: all) if type == 'gardens' - else - plantings_path(all: all) if type == 'plantings' - gardens_path(all: all) if type == 'gardens' + if type == 'plantings' + plantings_by_owner_path(owner: owner.slug, all: all) + elsif type == 'gardens' + gardens_by_owner_path(owner: owner.slug, all: all) + end + elsif type == 'plantings' + plantings_path(all: all) + elsif type == 'gardens' + gardens_path(all: all) end end diff --git a/app/views/harvests/_card.html.haml b/app/views/harvests/_card.html.haml index 52cfb3627..02ad5d3e0 100644 --- a/app/views/harvests/_card.html.haml +++ b/app/views/harvests/_card.html.haml @@ -21,8 +21,8 @@ %dd= display_quantity(harvest) %dt Harvest date : %dd= harvest.harvested_at - %dd Notes: - %dt=display_harvest_description(harvest) + %dt Notes: + %dd= display_harvest_description(harvest) - if harvest.planting.present? %dt Harvested from %dd= link_to(harvest.planting, planting_path(harvest.planting)) diff --git a/app/views/members/_gardens.html.haml b/app/views/members/_gardens.html.haml index 7e1bc61ca..5872f4926 100644 --- a/app/views/members/_gardens.html.haml +++ b/app/views/members/_gardens.html.haml @@ -1,4 +1,3 @@ -%h2 #{member.login_name}'s gardens .tabbable %ul.nav.nav-tabs - first_garden = true @@ -45,10 +44,10 @@ = link_to "Add photo", new_photo_path(type: "garden", id: g.id), class: 'btn btn-primary' %h3 What's planted here? - .row + .card-row - unless g.featured_plantings.empty? - g.featured_plantings.each.with_index do |planting| - .col-xs-12.col-lg-6 + .card = render partial: "plantings/card", locals: { planting: planting } %p diff --git a/app/views/members/_harvests.html.haml b/app/views/members/_harvests.html.haml new file mode 100644 index 000000000..248510c27 --- /dev/null +++ b/app/views/members/_harvests.html.haml @@ -0,0 +1,6 @@ +.card-row-short + - harvests.each do |harvest| + .card + = render partial: "harvests/card", locals: { harvest: harvest } +- if !harvests.any? + #{member.login_name} hasn't harvested anything yet. diff --git a/app/views/members/_map.html.haml b/app/views/members/_map.html.haml index 253f3b3ec..711e4d9e0 100644 --- a/app/views/members/_map.html.haml +++ b/app/views/members/_map.html.haml @@ -1,6 +1,6 @@ - if member.latitude && member.longitude #membermap - %p + %p.pull-right See other members, plantings, seeds and more near = link_to member.location, place_path(member.location, anchor: "members") - else diff --git a/app/views/members/_stats.html.haml b/app/views/members/_stats.html.haml index a2ebab47d..2db447d4c 100644 --- a/app/views/members/_stats.html.haml +++ b/app/views/members/_stats.html.haml @@ -7,7 +7,7 @@ %h3 Activity -%ul.list-inline +%ul.activity-list %li - if !member.plantings.empty? = link_to localize_plural(member.plantings, Planting), plantings_by_owner_path(owner: member) diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index 478574b3b..621f35c51 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -9,31 +9,40 @@ = tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME']) - content_for :buttonbar do - if can? :update, @member - = link_to 'Edit profile', edit_member_registration_path, class: 'btn btn-default' + = link_to 'Edit profile', edit_member_registration_path, class: 'btn btn-default pull-right' - if can?(:create, Notification) && current_member != @member - = link_to 'Send message', new_notification_path(recipient_id: @member.id), class: 'btn btn-default' + = link_to 'Send message', new_notification_path(recipient_id: @member.id), class: 'btn btn-default pull-right' - if current_member && current_member != @member # must be logged in, can't follow yourself - follow = current_member.get_follow(@member) - if !follow && can?(:create, Follow) # not already following - = link_to 'Follow', follows_path(followed_id: @member.id), method: :post, class: 'btn btn-default' + = link_to 'Follow', follows_path(followed_id: @member.id), method: :post, class: 'btn btn-default pull-right' - if follow && can?(:destroy, follow) # already following - = link_to 'Unfollow', follow_path(follow), method: :delete, class: 'btn btn-default' + = link_to 'Unfollow', follow_path(follow), method: :delete, class: 'btn btn-default pull-right' - content_for :member_rss_login_name, @member.login_name - content_for :member_rss_slug, @member.slug .row - - .col-md-9 - = render partial: "map", locals: { member: @member } - = render partial: "bio", locals: { member: @member } - = render partial: "gardens", locals: { member: @member, gardens: @gardens } - .col-md-3 + = render partial: "map", locals: { member: @member } + .col-md-2.profile-sidebar = render partial: "avatar", locals: { member: @member } + = render partial: "bio", locals: { member: @member } = render partial: "roles", locals: { member: @member } = render partial: "stats", locals: { member: @member } = render partial: "contact", locals: { member: @member, twitter_auth: @twitter_auth, flickr_auth: @flickr_auth, facebook_auth: @facebook_auth } + + .col-md-10 + %ul.nav.nav-pills.nav-justified + %li.active + %a{ "data-toggle" => "tab", href: "#gardens" } Gardens + %li + %a{ "data-toggle" => "tab", href: "#harvests" } Harvests + .tab-content.profile-activity + .tab-pane.active#gardens + = render partial: "gardens", locals: { member: @member, gardens: @gardens } + .tab-pane#harvests + = render partial: "harvests", locals: { member: @member, harvests: @harvests } diff --git a/app/views/plantings/_nav.haml b/app/views/plantings/_nav.haml index bb81da701..396d6e021 100644 --- a/app/views/plantings/_nav.haml +++ b/app/views/plantings/_nav.haml @@ -15,4 +15,3 @@ = link_to 'Plant something', new_planting_path, class: 'btn btn-primary' - else = render partial: 'shared/signin_signup', locals: { to: "track what you've planted" } - diff --git a/app/views/plantings/index.html.haml b/app/views/plantings/index.html.haml index 8ad0277d2..3302bdacb 100644 --- a/app/views/plantings/index.html.haml +++ b/app/views/plantings/index.html.haml @@ -9,10 +9,10 @@ = page_entries_info @plantings = will_paginate @plantings -.row +.card-row - unless @plantings.empty? - @plantings.each.with_index do |planting| - .col-xs-12.col-lg-6 + .card = render partial: "plantings/card", locals: { planting: planting } .pagination diff --git a/app/views/seeds/index.html.haml b/app/views/seeds/index.html.haml index 0be394edf..5e2eabece 100644 --- a/app/views/seeds/index.html.haml +++ b/app/views/seeds/index.html.haml @@ -24,7 +24,7 @@ = page_entries_info @seeds = will_paginate @seeds -.seeds-row +.card-row - unless @seeds.empty? - @seeds.each do |seed| .seedcard diff --git a/spec/features/member_profile_spec.rb b/spec/features/member_profile_spec.rb index 9f1005894..db7d4f595 100644 --- a/spec/features/member_profile_spec.rb +++ b/spec/features/member_profile_spec.rb @@ -9,7 +9,6 @@ feature "member profile", js: true do expect(page).to have_css("h1", text: member.login_name) expect(page).to have_content member.bio expect(page).to have_content "Member since: #{member.created_at.to_s(:date)}" - expect(page).to have_content "#{member.login_name}'s gardens" expect(page).to have_link "More about this garden...", href: garden_path(member.gardens.first) end