Merge pull request #2421 from Growstuff/dev

production release
This commit is contained in:
Brenda Wallace
2020-02-10 14:57:35 +13:00
committed by GitHub
14 changed files with 93 additions and 103 deletions

13
.editorconfig Normal file
View File

@@ -0,0 +1,13 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

View File

@@ -221,7 +221,7 @@ GEM
haml (>= 4.0.6, < 6.0)
html2haml (>= 1.0.1)
railties (>= 5.1)
haml_lint (0.34.1)
haml_lint (0.34.2)
haml (>= 4.0, < 5.2)
rainbow
rubocop (>= 0.50.0)

View File

@@ -54,6 +54,8 @@ class PostsController < ApplicationController
@author.posts
else
Post
end.order(created_at: :desc).includes(:author, comments: :author).paginate(page: params[:page], per_page: 12)
end.order(created_at: :desc)
.includes(:author, :crop_posts, :crops, comments: :author)
.paginate(page: params[:page], per_page: 12)
end
end

View File

@@ -16,7 +16,7 @@
.index-cards
- @posts.each do |post|
= render 'posts/preview', post: post
.card.card-double= render 'posts/preview', post: post
= will_paginate @posts

View File

@@ -6,16 +6,13 @@
%li.breadcrumb-item.active= link_to "#{@owner}'s harvests", harvests_path(owner: @owner)
- else
%li.breadcrumb-item.active= link_to "Harvests", harvests_path
%h1.display-2.text-center
= harvest_icon
= title('harvests', @owner, @crop, @planting)
%p.text-center
#{ENV['GROWSTUFF_SITE_NAME']} helps you track what you're
harvesting from your home garden and see how productive it is.
.row
.col-md-2
%h1
= harvest_icon
= title('harvests', @owner, @crop, @planting)
= render 'layouts/nav', model: Harvest
%hr/
- if @owner
= render @owner
%section.open-data
@@ -29,7 +26,7 @@
.badge.badge-success= link_to 'API Methods', '/api-docs'
.col-md-10
%section
%h2= page_entries_info @harvests
%h2= title('harvests', @owner, @crop, @planting)
= will_paginate @harvests
.index-cards
- @harvests.each do |h|

View File

@@ -3,25 +3,7 @@
.row
- Post.includes(:author, :crop_posts, :crops).order(created_at: :desc).limit(3).each do |post|
.col-lg-4.col-md-12.mb-4
.view
= link_to post do
= image_tag post_image_path(post), class: 'img img-cover'
%h4.font-weight-bold.mb-3
%strong
= link_to post do
= post.subject
%p
by
= succeed "," do
%a.font-weight-bold= post.author
%p= post_stripped_tags(post, length: 300)
%h6.font-weight-bold.mb-3
- post.crops.each do |crop|
= link_to crop do
= crop_icon(crop)
= crop.name.pluralize
/ = image_tag avatar_uri(post.author, 50), class: 'avatar'
= link_to 'Read more', post, class: 'btn btn-pink btn-rounded btn-md'
= render 'posts/preview', post: post
%p.text-right
= link_to "#{t('.view_all')} »", posts_path, class: 'btn btn-block'

View File

@@ -1,14 +1,17 @@
- if current_member.present?
.card.button-bar
.card-header
%h2.card-title #{model} links
= link_to url_for([current_member, model]), class: 'btn' do
.flex-column.nav-pills.layout-nav
/ %h2.card-title #{model} links
= link_to url_for([current_member, model]), class: 'nav-link' do
My #{model.model_name.human.pluralize}
= link_to model, class: 'btn' do
= link_to model, class: 'nav-link' do
Everyone's #{model.model_name.human.pluralize}
- if can?(:create, model)
= link_to url_for([model, action: :new]), class: 'btn' do
Add a #{model.model_name.human}
- else
= render 'shared/signin_signup', to: "record your #{model.to_s.pluralize.downcase}"
%hr/
%p.text-center
#{ENV['GROWSTUFF_SITE_NAME']} helps you track what you're
harvesting from your home garden and see how productive it is.

View File

@@ -7,13 +7,12 @@
- else
%li.breadcrumb-item.active= link_to 'Plantings', plantings_path
%h1.display-2.text-center
= planting_icon
= title('plantings', @owner, @crop, @planting)
.row
.col-md-2
%h1
= planting_icon
= title('plantings', @owner, @crop, @planting)
= render 'layouts/nav', model: Planting
%hr/
= link_to show_inactive_tickbox_path('plantings', owner: @owner, crop: @crop, show_all: @show_all) do
= check_box_tag 'active', 'all', @show_all
include finished plantings
@@ -36,7 +35,7 @@
.col-md-10
%section
%h2= page_entries_info @plantings
%h2= title('plantings', @owner, @crop, @planting)
= will_paginate @plantings
.index-cards
- @plantings.each do |p|

View File

@@ -1,6 +1,20 @@
.card.card-cascade
.card-header
%h3= link_to post.subject, post
= render 'members/tiny', member: post.author
.card-body
%p= truncate(strip_tags(post.body), length: 200)
.view
= link_to post do
= image_tag post_image_path(post), class: 'img img-cover'
%h4.font-weight-bold.mb-3
%strong
= link_to post do
= post.subject
%p
by
= succeed "," do
%a.font-weight-bold= post.author
%p.post-body= post_stripped_tags(post, length: 300)
%h6.font-weight-bold.mb-3
- post.crops.each do |crop|
= link_to crop do
= crop_icon(crop)
= crop.name.pluralize
/ = image_tag avatar_uri(post.author, 50), class: 'avatar'
= link_to 'Read more', post, class: 'btn btn-rounded btn-md'

View File

@@ -8,50 +8,29 @@
%h1= @author ? t('.title.author_posts', author: @author) : t('.title.default')
= render 'layouts/nav', model: Post
.row
.col-2
.col-8= will_paginate @posts
.row
.col-2
= render 'layouts/nav', model: Post
%hr/
%p
- if @author
= render @author
Subscribe to
= succeed "." do
= link_to "#{@author}'s posts RSS feed", member_posts_path(@author, format: 'rss')
= will_paginate @posts
- @posts.each do |post|
.card.post
.card-body
%h5.card-title
= link_to strip_tags(post.subject), post
- if post.comments.size.positive?
%span.badge.badge-pill.badge-info.float-right
= icon 'fas', 'comment'
&nbsp;
= post.comments.size
%p.text-muted
Posted by
- if post.author
= link_to post.author.login_name, member_path(post.author)
- else
Member Deleted
- if post.forum
in #{link_to post.forum, post.forum}
on #{post.created_at}"
- if post.updated_at > post.created_at
and edited at #{post.updated_at}
= render 'members/tiny', member: post.author
.card-body
.post-body= display_post_truncated(post)
- post.crops.each do |crop|
= render 'crops/tiny', crop: crop
= will_paginate @posts
%p
- if @author
Subscribe to
= succeed "." do
= link_to "#{@author}'s posts RSS feed", member_posts_path(@author, format: 'rss')
- else
Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']}
= link_to "posts RSS feed", posts_path(format: 'rss')
or
= succeed "." do
= link_to "comments RSS feed", comments_path(format: 'rss')
- else
Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']}
= link_to "posts RSS feed", posts_path(format: 'rss')
or
= succeed "." do
= link_to "comments RSS feed", comments_path(format: 'rss')
.col-10
.row.posts
- @posts.each do |post|
.col-lg-3.col-md-6.mb-3.post
= render 'posts/preview', post: post
= will_paginate @posts

View File

@@ -6,14 +6,13 @@
%li.breadcrumb-item.active= link_to 'Seeds', seeds_path
- content_for :title, title('seeds', @owner, @crop, @planting)
%h1.display-2.text-center
= seed_icon
= title('seeds', @owner, @crop, @planting)
.row
.col-md-2
%h1
= seed_icon
= title('seeds', @owner, @crop, @planting)
= render 'layouts/nav', model: Seed
%hr/
= link_to show_inactive_tickbox_path('seeds', owner: @owner, crop: @crop, show_all: @show_all) do
= check_box_tag 'active', 'all', @show_all
include finished
@@ -34,7 +33,7 @@
.badge.badge-success= link_to 'API Methods', '/api-docs'
.col-md-10
%section
%h2= page_entries_info @seeds
%h2= title('seeds', @owner, @crop, @planting)
= will_paginate @seeds
.index-cards

View File

@@ -293,7 +293,7 @@ en:
title:
crop_plantings: Everyone's %{crop} plantings
default: Everyone's plantings
owner_plantings: "%{owner} plantings"
owner_plantings: "%{owner}'s plantings"
view_owners_profile: View %{owner}'s profile >>
string: "%{crop} planting in %{garden} by %{owner}"
progress:

View File

@@ -14,7 +14,7 @@ describe "Gardens" do
describe '#index' do
shared_examples "has buttons bar at top" do
it "has buttons bar at top" do
within '.button-bar' do
within '.layout-nav' do
expect(subject).to have_link 'Add a garden'
expect(subject).to have_link 'My gardens'
expect(subject).to have_link "Everyone's gardens"

View File

@@ -23,12 +23,14 @@ describe "posts/index" do
it "renders a list of posts" do
assert_select "div.post", count: 2
assert_select "h5", text: "A Post", count: 2
assert_select "div.post-body", text: "This is some text.".to_s, count: 2
assert_select "h4", text: "A Post", count: 2
assert_select "p.post-body", text: "This is some text.", count: 2
end
it "contains two gravatar icons" do
assert_select "img", src: %r{gravatar\.com/avatar}, count: 2
within '.posts' do
assert_select "img", src: %r{gravatar\.com/avatar}, count: 2
end
end
it "contains RSS feed links for posts and comments" do