Commits

heliostatic  committed 6d9a08a

added a bulk edit view

  • Participants
  • Parent commits 4712b6b

Comments (0)

Files changed (4)

File app/assets/javascripts/books.js.coffee

     filler(link_type, field_val, id)
 
   $('.name_toggle').on "click", ->
+    # TODO: Iterate over array of books, flip by class of TR instead of assuming one book
     fullpath = $(@).parents('table').children('tbody').children('tr').children('td.path').data('fullpath')
     filename = $(@).parents('table').children('tbody').children('tr').children('td.path').text()
     $(@).parents('table').children('tbody').children('tr').children('td.path').data('fullpath', filename)

File app/controllers/books_controller.rb

   end
 
   def review
-    @books = Book.to_review.page(params[:page]).per(50)
+    @books = Book.to_review.order(:updated_at).page(params[:page]).per(50)
     @book_count = Book.to_review.count
+    logger.info params
+    if params[:layout] == 'bulk'
+      render :bulk
+    end
   end
 
   def runcheck

File app/views/books/bulk.html.haml

+%h1 Welcome Ben!
+- if @books.empty?
+  Congratulations, you have no books to review!
+  = form_tag runcheck_books_path, method: :get do
+    = submit_tag "Run Check", class: 'btn', name: nil
+- else
+  You have #{@book_count} to review.
+  %h2 Books!
+  = link_to 'regular view', review_books_path
+  |
+  = link_to 'bulk view', { layout: 'bulk'}
+  %table.table.table-bordered.table-hover.table-striped
+    %thead
+      %tr
+        %th Author
+        %th Title
+        %th File Name (toggle #{ link_to 'full path', 'Javascript: void(0);', class: 'name_toggle'} )
+        %th File Type
+        %th Correct?
+    %tbody
+      - @books.each do |book|
+        %tr{class: book.id}
+          %td= best_in_place book, :author, :data => { field: book.author }
+          %td= best_in_place book, :title, :data => { field: book.title }
+          %td.path{:data => { fullpath: book.fullpath }}= book.partial_path
+          %td= book.file_type
+          %td= best_in_place book, :for_review, :type => :checkbox, :collection => ["Looks good", "Not good"]
+  = paginate @books

File app/views/books/review.html.haml

 - else
   You have #{@book_count} to review.
   %h2 Books!
+  = link_to 'regular view', review_books_path
+  |
+  = link_to 'bulk view', { layout: 'bulk'}
   - @books.each do |book|
     = render book, :fields => book.best_guess_fields
   = paginate @books