• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

boston-library / bpluser / 62

02 Dec 2025 03:31PM UTC coverage: 38.898%. First build
62

Pull #33

travis-pro

web-flow
Merge ab6db6e27 into e08c61e69
Pull Request #33: Vlr engine updates

31 of 47 new or added lines in 9 files covered. (65.96%)

240 of 617 relevant lines covered (38.9%)

0.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

69.23
/app/controllers/folder_items_actions_controller.rb
1
# frozen_string_literal: true
2

3
# use to share folder item actions (email, cite, delete) between folders and bookmarks
4
class FolderItemsActionsController < ApplicationController
1✔
5
  def folder_item_actions
1✔
6
    @folder = Bpluser::Folder.find(params[:id]) if params[:origin] == 'folders'
4✔
7
    @user = current_or_guest_user
4✔
8

9
    unless params[:selected]
4✔
10
      flash[:error] = t('blacklight.folders.update_items.remove.no_items')
×
NEW
11
      redirect_back_or_to(root_path)
×
12
    end
13

14
    items = params[:selected]
4✔
15
    case params[:commit]
4✔
16
    # email
17
    when t('blacklight.tools.email')
18
      redirect_to email_solr_document_path(id: items)
1✔
19
    # cite
20
    when t('blacklight.tools.citation')
21
      redirect_to citation_solr_document_path(id: items)
1✔
22
    # remove
23
    when t('blacklight.tools.remove')
24
      if params[:origin] == 'folders'
1✔
25
        if @folder.folder_items.destroy_by(document_id: items)
1✔
26
          flash[:notice] = t('blacklight.folders.update_items.remove.success')
1✔
27
        else
28
          flash[:error] = t('blacklight.folders.update_items.remove.failure')
×
29
        end
30
        redirect_to folder_path(@folder, view_params)
1✔
31
      else
32
        if current_or_guest_user.bookmarks.destroy_by(document_id: items)
×
33
          flash[:notice] = t('blacklight.folders.update_items.remove.success')
×
34
        else
35
          flash[:error] = t('blacklight.folders.update_items.remove.failure')
×
36
        end
37
        redirect_to bookmarks_path(view_params)
×
38
      end
39
    # copy
40
    when /#{t('blacklight.tools.copy_to')}/
41
      destination = params[:commit].split("#{t('blacklight.tools.copy_to')} ")[1]
1✔
42
      if destination == t('blacklight.bookmarks.title')
1✔
43
        success = items.all? do |item_id|
×
44
          next true if current_or_guest_user.bookmarks.exists?(document_id: item_id)
×
45

46
          current_or_guest_user.bookmarks.create(document_id: item_id)
×
47
        end
48
      else
49
        folder_to_update = current_user.folders.find(destination)
1✔
50
        success = items.all? do |item_id|
1✔
51
          next true if folder_to_update.folder_item?(item_id)
2✔
52

53
          begin
54
            folder_to_update.folder_items.create!(document_id: item_id)
2✔
55
            next true
2✔
56
          rescue ActiveRecord::RecordInvalid
57
            break false
×
58
          end
59
        end
60
      end
61

62
      if success
1✔
63
        folder_display_name = destination == t('blacklight.bookmarks.title') ? t('blacklight.bookmarks.title') : folder_to_update.title
1✔
64
        flash[:notice] = t('blacklight.folders.update_items.copy.success', folder_name: folder_display_name)
1✔
65
      else
66
        flash[:error] = t('blacklight.folders.update_items.copy.failure')
×
67
      end
68
      redirect_back_or_to(root_path)
1✔
69
    end
70
  end
71

72
  private
1✔
73

74
  def view_params
1✔
75
    params.permit(:sort, :per_page, :view)
1✔
76
  end
77
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc