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

benwbrum / fromthepage / 13402333050

18 Feb 2025 11:48PM UTC coverage: 61.822% (+1.0%) from 60.846%
13402333050

push

github

web-flow
Merge pull request #4532 from benwbrum/4528-add-linebreak-after-table

4528 - Add linebreak after table

1543 of 2994 branches covered (51.54%)

Branch coverage included in aggregate %.

2 of 16 new or added lines in 1 file covered. (12.5%)

3 existing lines in 2 files now uncovered.

6994 of 10815 relevant lines covered (64.67%)

81.79 hits per line

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

49.17
/app/controllers/display_controller.rb
1
class DisplayController < ApplicationController
1✔
2
  public :render_to_string
1✔
3

4
  protect_from_forgery :except => [:set_note_body]
1✔
5

6
  PAGES_PER_SCREEN = 5
1✔
7

8
  def read_work
1✔
9
    if params.has_key?(:work_id)
61✔
10
      @work = Work.friendly.find(params[:work_id])
61!
11
    elsif params.has_key?(:id)
×
12
      @work = Work.friendly.find(params[:id])
×
13
    elsif params.has_key?(:url)
×
14
      @work = Work.find_by_id(params[:url][:work_id])
×
15
    end
16
    if params.has_key?(:needs_review)
61✔
17
      @review = params[:needs_review]
9✔
18
    end
19
    @total = @work.pages.count
61✔
20
    if @article
61✔
21
      # restrict to pages that include that subject
×
22
      redirect_to :action => 'read_all_works', :article_id => @article.id, :page => 1 and return
×
23
    else
61✔
24
      if @review == 'review'
61✔
25
        @pages = @work.pages.review.order('position').paginate(page: params[:page], per_page: PAGES_PER_SCREEN)
2✔
26
        @count = @pages.count
2✔
27
        @heading = t('.pages_need_review')
2✔
28
      elsif @review == 'incomplete'
59!
29
        @pages = @work.pages.incomplete.order('position').paginate(page: params[:page], per_page: PAGES_PER_SCREEN)
×
30
        @count = @pages.count
×
31
        @heading = t('.pages_need_completion')
✔
32
      elsif @review == 'transcription'
59✔
33
        @pages = @work.pages.needs_transcription.order('position').paginate(page: params[:page], per_page: PAGES_PER_SCREEN)
1✔
34
        @count = @pages.count
1✔
35
        @incomplete_pages = @work.pages.needs_completion.order('position').paginate(page: params[:page], per_page: PAGES_PER_SCREEN)
1✔
36
        @incomplete_count = @incomplete_pages.count
1✔
37
        @heading = t('.pages_need_transcription')
1✔
38
      elsif @review == 'index'
58!
39
        @pages = @work.pages.needs_index.order('position').paginate(page: params[:page], per_page: PAGES_PER_SCREEN)
×
40
        @count = @pages.count
×
41
        @heading = t('.pages_need_indexing')
✔
42
      elsif @review == 'translation'
58✔
43
        @pages = @work.pages.needs_translation.order('position').paginate(page: params[:page], per_page: PAGES_PER_SCREEN)
1✔
44
        @count = @pages.count
1✔
45
        @heading = t('.pages_need_translation')
1✔
46
      elsif @review == 'translation_review'
57✔
47
        @pages = @work.pages.translation_review.paginate(page: params[:page], per_page: PAGES_PER_SCREEN)
2✔
48
        @count = @pages.count
2✔
49
        @heading = t('.translations_need_review')
2✔
50
      elsif @review == 'translation_index'
55!
51
        @pages = @work.pages.needs_translation_index.paginate(page: params[:page], per_page: PAGES_PER_SCREEN)
×
52
        @count = @pages.count
×
53
        @heading = t('.translations_need_indexing')
×
54
      else
55✔
55
        @pages = @work.pages.paginate(page: params[:page], per_page: PAGES_PER_SCREEN)
55✔
56
        @count = @pages.count
55✔
57
        @heading = t('.pages')
55✔
58
      end
59
    end
60
    session[:col_id] = @collection.slug
61✔
61
  end
62

63
  def read_all_works
1✔
64
    if @article
2✔
65
      # restrict to pages that include that subject
2✔
66
      @pages = Page.order('work_id, position').joins('INNER JOIN page_article_links pal ON pages.id = pal.page_id').where([ 'pal.article_id = ?', @article.id ]).where(work_id: @collection.works.ids).paginate(page: params[:page], per_page: PAGES_PER_SCREEN)
2✔
67
      @pages.distinct!
2✔
68
      @heading = t('.pages_that_mention', article: @article.title)
2✔
69
    else
×
70
      @pages = Page.paginate :all, :page => params[:page],
×
71
                                        :order => 'work_id, position',
72
                                        :per_page => 5
73
      @heading = t('.pages')
×
74
    end
75
    session[:col_id] = @collection.slug
2✔
76
  end
77

78
  def paged_search
1✔
79
    if @article
×
80
      render plain: "This functionality has been disabled.  Please contact support@frothepage.com if you need it."
×
81
      return
×
82

83
      session[:col_id] = @collection.slug
×
84
      # get the unique search terms
85
      terms = []
×
86
      @search_string = ""
×
87
      @article.page_article_links.each do |link|
×
88
        terms << link.display_text.gsub(/\s+/, ' ')
×
89
      end
90
      terms.uniq!
×
91
      # process them for display and search
92
      terms.each do |term|
×
93
        # don't add required text
94
        if term.match(/ /)
×
95
          @search_string += "\"#{term}\" "
×
96
        else
×
97
          @search_string += term + "* "
×
98
        end
99
      end
100
      if params[:unlinked_only]
×
101
        conditions =
102
          ["MATCH(search_text) AGAINST(? IN BOOLEAN MODE)"+
×
103
          " AND pages.id not in "+
104
          "    (SELECT page_id FROM page_article_links WHERE article_id = ?)",
105
          @search_string,
106
          @article.id]
107

108
      else
×
109
        conditions =
110
          ["MATCH(search_text) AGAINST(? IN BOOLEAN MODE)",
×
111
          @search_string]
112
      end
113
      @pages = Page.order('work_id, position').joins(:work).where(work_id: @collection.works.ids).where(conditions).paginate(page: params[:page])
×
114
    else
×
115
      @search_attempt = SearchAttempt.find_by(slug: params[:id])
×
116
      session[:search_attempt_id] = @search_attempt.id if session[:search_attempt_id] != @search_attempt.id
×
117

118
      # restrict to pages that include that subject
UNCOV
119
      @collection = @search_attempt.collection || @search_attempt.document_set || @search_attempt.work.collection
×
120
      @work = @search_attempt&.work
×
121
      pages = @search_attempt.query_results
×
122
      @pages = pages.paginate(page: params[:page])
×
123
      @search_string = params[:id].split('-')[0...-1].join(' ')
×
124
    end
UNCOV
125
    logger.debug "DEBUG #{@search_string}"
×
126
  end
127
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