mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-18 13:38:24 -04:00
pending approval crops appear on crops wrangle page
This commit is contained in:
@@ -32,7 +32,8 @@ class CropsController < ApplicationController
|
||||
|
||||
# GET /crops/wrangle
|
||||
def wrangle
|
||||
@crops = Crop.recent.paginate(:page => params[:page])
|
||||
@recent_crops = Crop.recent.paginate(:page => params[:page])
|
||||
@pending_approval = Crop.pending_approval
|
||||
@crop_wranglers = Role.crop_wranglers
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
||||
@@ -26,6 +26,7 @@ class Crop < ActiveRecord::Base
|
||||
scope :toplevel, -> { where(:parent_id => nil) }
|
||||
scope :popular, -> { reorder("plantings_count desc, lower(name) asc") }
|
||||
scope :randomized, -> { reorder('random()') } # ok on sqlite and psql, but not on mysql
|
||||
scope :pending_approval, -> { where(:approved => false) }
|
||||
|
||||
validates :en_wikipedia_url,
|
||||
:format => {
|
||||
|
||||
@@ -15,11 +15,35 @@
|
||||
%li.crop_wrangler
|
||||
= link_to crop_wrangler.login_name, crop_wrangler
|
||||
|
||||
%h2 Requested crops
|
||||
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th System name
|
||||
%th English Wikipedia URL
|
||||
%th Scientific names
|
||||
%th Requested by
|
||||
%th When requested
|
||||
%tbody
|
||||
- @pending_approval.each do |c|
|
||||
%tr
|
||||
%td= link_to c.name, c
|
||||
%td= link_to c.en_wikipedia_url, c.en_wikipedia_url
|
||||
%td
|
||||
- c.scientific_names.each do |s|
|
||||
= link_to s.scientific_name, s
|
||||
%br/
|
||||
%td= link_to c.requester, c.requester
|
||||
%td
|
||||
= distance_of_time_in_words(c.created_at, Time.zone.now)
|
||||
ago.
|
||||
|
||||
%h2 Recently added crops
|
||||
|
||||
%div.pagination
|
||||
= page_entries_info @crops, :model => "crops"
|
||||
= will_paginate @crops
|
||||
= page_entries_info @recent_crops, :model => "crops"
|
||||
= will_paginate @recent_crops
|
||||
|
||||
%table.table.table-striped
|
||||
%tr
|
||||
@@ -28,7 +52,7 @@
|
||||
%th Scientific names
|
||||
%th Added by
|
||||
%th When
|
||||
- @crops.each do |c|
|
||||
- @recent_crops.each do |c|
|
||||
%tr
|
||||
%td= link_to c.name, c
|
||||
%td= link_to c.en_wikipedia_url, c.en_wikipedia_url
|
||||
@@ -42,5 +66,5 @@
|
||||
ago.
|
||||
|
||||
%div.pagination
|
||||
= page_entries_info @crops, :model => "crops"
|
||||
= will_paginate @crops
|
||||
= page_entries_info @recent_crops, :model => "crops"
|
||||
= will_paginate @recent_crops
|
||||
|
||||
Reference in New Issue
Block a user