Skip to content

Commit

Permalink
Merge 33f29c9 into f06adfb
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoviola authored Jun 10, 2020
2 parents f06adfb + 33f29c9 commit 3883b78
Show file tree
Hide file tree
Showing 31 changed files with 584 additions and 279 deletions.
10 changes: 5 additions & 5 deletions app/controllers/collection_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def update
end

if @collection.save!
flash[:notice] = 'Collection has been updated'
flash[:notice] = t('.notice')
redirect_to action: 'edit', collection_id: @collection.id
else
render action: 'edit'
Expand All @@ -246,7 +246,7 @@ def create
end
end
if @collection.save
flash[:notice] = 'Collection has been created'
flash[:notice] = t('.notice')
if request.referrer.include?('sc_collections')
session[:iiif_collection] = @collection.id
ajax_redirect_to(request.referrer)
Expand Down Expand Up @@ -469,7 +469,7 @@ def needs_review_pages
def start_transcribing
page = find_untranscribed_page
if page.nil?
flash[:notice] = "Sorry, but there are no qualifying pages in this collection."
flash[:notice] = t('.notice')
redirect_to collection_path(@collection.owner, @collection)
else
if !user_signed_in?
Expand All @@ -482,13 +482,13 @@ def start_transcribing

def enable_ocr
@collection.enable_ocr
flash[:notice] = "OCR correction has been enabled for all works."
flash[:notice] = t('.notice')
redirect_to edit_collection_path(@collection.owner, @collection)
end

def disable_ocr
@collection.disable_ocr
flash[:notice] = "OCR correction has been disabled for all works."
flash[:notice] = t('.notice')
redirect_to edit_collection_path(@collection.owner, @collection)
end

Expand Down
32 changes: 13 additions & 19 deletions app/controllers/transcribe_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def display_page

if @page.edit_started_by_user_id != current_user.id &&
@page.edit_started_at > Time.now - 1.minute
flash.now[:alert] = "This page is being edited by another user!"
flash.now[:alert] = t('.alert')
@current_user_alerted = true
end unless @page.edit_started_at.nil?
end
Expand All @@ -55,15 +55,15 @@ def mark_page_blank(options = { redirect: 'display' })
@page.save
record_deed(DeedType::PAGE_MARKED_BLANK)
@work.work_statistic.recalculate({type: 'blank'}) if @work.work_statistic
flash[:notice] = "Saved"
flash[:notice] = t('.saved_notice')
redirect_to redirect_path
return false
elsif @page.status == Page::STATUS_BLANK && params[:page]['mark_blank'] == '0'
@page.status = nil
@page.translation_status = nil
@page.save
@work.work_statistic.recalculate({type: 'blank'}) if @work.work_statistic
flash[:notice] = "Saved"
flash[:notice] = t('.saved_notice')
redirect_to redirect_path
return false
else
Expand Down Expand Up @@ -126,7 +126,7 @@ def save_transcription
begin
if @page.save
log_transcript_success
flash[:notice] = "Saved"
flash[:notice] = t('.saved_notice')
if @page.work.ocr_correction
record_deed(DeedType::OCR_CORRECTED)
else
Expand All @@ -153,7 +153,7 @@ def save_transcription
if current_user.guest?
deeds = Deed.where(user_id: current_user.id).count
if deeds < GUEST_DEED_COUNT
flash[:notice] = "You may save up to #{GUEST_DEED_COUNT} transcriptions as a guest."
flash[:notice] = t('.you_may_save_notice', guest_deed_count: GUEST_DEED_COUNT)
else
session[:user_return_to]=collection_transcribe_page_path(@collection.owner, @collection, @work, @page.id)
redirect_to new_user_registration_path, :resource => current_user
Expand All @@ -167,10 +167,7 @@ def save_transcription
end
rescue REXML::ParseException => ex
log_transcript_exception(ex, message)
flash[:error] =
"There was an error parsing the mark-up in your transcript.
This kind of error often occurs if an angle bracket is missing or if an HTML tag is left open.
Check any instances of < or > symbols in your text. (The parser error was: #{ex.message})"
flash[:error] = t('.error_message', error_message: ex.message)
logger.fatal "\n\n#{ex.class} (#{ex.message}):\n"
render :action => 'display_page'
flash.clear
Expand Down Expand Up @@ -270,7 +267,7 @@ def save_translation
if current_user.guest?
deeds = Deed.where(user_id: current_user.id).count
if deeds < GUEST_DEED_COUNT
flash[:notice] = "You may save up to #{GUEST_DEED_COUNT} transcriptions as a guest."
flash[:notice] = t('.notice', guest_deed_count: GUEST_DEED_COUNT)
else
session[:user_return_to]=collection_translate_page_path(@collection.owner, @collection, @work, @page.id)
redirect_to new_user_registration_path, :resource => current_user
Expand All @@ -285,10 +282,7 @@ def save_translation
end
rescue REXML::ParseException => ex
log_translation_exception(ex, message)
flash[:error] =
"There was an error parsing the mark-up in your translation.
This kind of error often occurs if an angle bracket is missing or if an HTML tag is left open.
Check any instances of < or > symbols in your text. (The parser error was: #{ex.message})"
flash[:error] = t('.error_message', error_message: ex.message)
logger.fatal "\n\n#{ex.class} (#{ex.message}):\n"
render :action => 'translate'
flash.clear
Expand Down Expand Up @@ -325,28 +319,28 @@ def still_editing
def goto_next_untranscribed_page

next_page_path = user_profile_path(@work.collection.owner)
flash[:notice] = "There are no more pages to transcribe in this collection."
flash[:notice] = t('.notice')

if @work.next_untranscribed_page
flash[:notice] = "Here's another page in this work."
flash[:notice] = t('.another_page_notice')
next_page_path = collection_transcribe_page_path(@work.collection.owner, @work.collection, @work, @work.next_untranscribed_page)
elsif @collection.class == DocumentSet
docset = @collection
next_page = docset.find_next_untranscribed_page_for_user(current_user)
if !next_page.nil?
flash[:notice] = "There are no more pages to transcribe in this work. Here's another page in this collection."
flash[:notice] = t('.no_more_pages_notice')
next_page_path = collection_transcribe_page_path(docset.owner, docset, next_page.work, next_page)
else # Docset has no more Untranscribed works, bump up to collection level
next_page = docset.collection.find_next_untranscribed_page_for_user(current_user)
unless next_page.nil?
flash[:notice] = "There are no more pages to transcribe in this work. Here's another page in this collection."
flash[:notice] = t('.no_more_pages_notice')
next_page_path = collection_transcribe_page_path(docset.collection.owner, docset.collection, next_page.work, next_page)
end
end
else
next_page = @collection.find_next_untranscribed_page_for_user(current_user)
unless next_page.nil?
flash[:notice] = "There are no more pages to transcribe in this work. Here's another page in this collection."
flash[:notice] = t('.no_more_pages_notice')
next_page_path = collection_transcribe_page_path(@collection.owner, @collection, next_page.work, next_page)
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/views/collection/_collection_works.html.slim
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

ul.collection-work-stats
li
span Work title
span Progress
span =t('.work_title')
span =t('.progress')
span.progress_bar
-@works.each do |w|
-work_stats(w)
Expand Down
20 changes: 10 additions & 10 deletions app/views/collection/_contributor_activity.html.slim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-mailer = local_assigns.has_key?(:mailer) ? true : false

-unless @recent_transcriptions.empty?
h4.nomargin Recent Transcriptions
h4.nomargin =t('.recent_transcriptions')
p
-@recent_transcriptions.each do |d|
.deed-short
Expand All @@ -10,7 +10,7 @@
=render(:partial => 'deed/deed', :locals => { :deed => d, :mailer => mailer, :long_view => true })

-unless @recent_ocr.empty?
h4.nomargin Recent OCR correction
h4.nomargin =t('.recent_ocr_correction')
p
-@recent_ocr.each do |d|
.deed-short
Expand All @@ -19,7 +19,7 @@
=render(:partial => 'deed/deed', :locals => { :deed => d, :mailer => mailer, :long_view => true })

-unless @recent_review.empty?
h4.nomargin Recent Pages Needing Review
h4.nomargin =t('.recent_pages_needing_review')
p
-@recent_review.each do |d|
.deed-short
Expand All @@ -28,7 +28,7 @@
=render(:partial => 'deed/deed', :locals => { :deed => d, :mailer => mailer, :long_view => true })

-unless @recent_translations.empty?
h4.nomargin Recent Translations
h4.nomargin =t('.recent_translations')
p
-@recent_translations.each do |d|
.deed-short
Expand All @@ -37,7 +37,7 @@
=render(:partial => 'deed/deed', :locals => { :deed => d, :mailer => mailer, :long_view => true })

-unless @recent_xlat_review.empty?
h4.nomargin Recent Translations Needing Review
h4.nomargin =t('.recent_translations_needing_review')
p
-@recent_xlat_review.each do |d|
.deed-short
Expand All @@ -46,7 +46,7 @@
=render(:partial => 'deed/deed', :locals => { :deed => d, :mailer => mailer, :long_view => true })

-unless @recent_notes.empty?
h4.nomargin Recent Notes
h4.nomargin =t('.recent_notes')
p
-@recent_notes.each do |note|
-user = link_to note.user.display_name, user_profile_path(:user_id => note.user.id)
Expand All @@ -58,7 +58,7 @@

-unless @collection.subjects_disabled
-unless @recent_articles.empty?
h4.nomargin Recent Subjects
h4.nomargin =t('.recent_subjects')
p
-@recent_articles.each do |art|
.deed-short
Expand All @@ -67,7 +67,7 @@
=render(:partial => 'deed/deed', :locals => { :deed => art, :mailer => mailer, :long_view => true })

-unless @recent_index.empty?
h4.nomargin Recent Subject Indexing
h4.nomargin =t('.recent_subject_indexing')
p
-@recent_index.each do |d|
.deed-short
Expand All @@ -76,7 +76,7 @@
=render(:partial => 'deed/deed', :locals => { :deed => d, :mailer => mailer, :long_view => true })

-unless @recent_xlat_index.empty?
h4.nomargin Recent Translation Subject Indexing
h4.nomargin =t('.recent_translation_subject_indexing')
p
-@recent_xlat_index.each do |d|
.deed-short
Expand All @@ -85,7 +85,7 @@
=render(:partial => 'deed/deed', :locals => { :deed => d, :mailer => mailer, :long_view => true })

-unless @recent_work_add.empty?
h4.nomargin Recent Works Added
h4.nomargin =t('.recent_works_added')
p
-@recent_work_add.each do |d|
.deed-short
Expand Down
28 changes: 14 additions & 14 deletions app/views/collection/_contributors_body.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,54 @@
-unless @collection_deeds.empty?

-unless @new_transcribers.empty?
h3.nomargin New Collaborators
h3.nomargin =t('.new_collaborators')
p
- @new_transcribers.each do |t|
=link_to t.display_name, user_profile_path(:user_id => t.id, only_path: false)
|
=t.email
| <br>

h4.legend.fglight Collaborator Stats #{@start_deed} through #{@end_deed}
h4.legend.fglight =t('.collaborator_stats', start_deed: @start_deed, end_deed: @end_deed)
=render({ :partial => 'statistics/recent_statistics',
:locals => { :stats => @stats, :subjects_disabled => @collection.subjects_disabled }})

=link_to('View Activity ', deed_list_path(:collection_id => @collection.id, :start_date => @start_deed, :end_date => @end_deed), :class => 'button btnExport')
=link_to(t('.view_activity'), deed_list_path(:collection_id => @collection.id, :start_date => @start_deed, :end_date => @end_deed), :class => 'button btnExport')
| &nbsp;
=link_to(collection_activity_download_path(:collection_id => @collection.id, :start_date => @start_deed, :end_date => @end_deed), :class => 'button btnExport')
=svg_symbol '#icon-export', class: 'icon'
span Export Activity as CSV
span =t('.export_activity_as_csv')

-else
h3 No activity in this time frame
h3 =t('.no_activity_this_time_frame')

.contributor-users
h3 Active Collaborators
h3 =t('.active_collaborators')

-unless @active_transcribers.empty?
p
-@active_transcribers.each do |user|
=link_to user.display_name, user_profile_path(:user_id => user.id, only_path: false)
=" (Collection: #{(@user_time_proportional[user.id] / 60 + 1).floor} minutes | Total: #{(@user_time[user.id] / 60 + 1).floor} minutes)" if @user_time[user.id]
=t('.collection', collection_time: (@user_time_proportional[user.id] / 60 + 1).floor, total_time: (@user_time[user.id] / 60 + 1).floor) if @user_time[user.id]
| <br>
p
-total_minutes = (@user_time.values.sum / 60).floor + 1
="Total time: #{(total_minutes / 60)} hours, #{(total_minutes % 60)} minutes."
=t('.total_time', hours: (total_minutes / 60), minutes: (total_minutes % 60))
p
=link_to(collection_contributors_download_path(:collection_id => @collection.id, :start_date => @start_deed, :end_date => @end_deed), :class => 'button btnExport')
=svg_symbol '#icon-export', class: 'icon'
span Export as CSV
span =t('.export_as_csv')
-else
h3 Collaborators
p No Collaborators
p A detailed spreadsheet export of all collaborators is available on your owner dashboard.
h3 =t('.collaborators')
p =t('.no_collaborators')
p =t('.detailed_spreadsheet_export')

h3 All Collaborator Emails
h3 =t('.all_collaborator_emails')
p#collaborators
-unless @all_collaborators.empty?
=@all_collaborators
-else
|No collaborators
=t('.no_collaborators')

-content_for :javascript
javascript:
Expand Down
10 changes: 5 additions & 5 deletions app/views/collection/contributors.html.slim
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
=render({ :partial => '/shared/collection_tabs', :locals => { :selected => 4, :collection_id => @collection }})


h2.nomargin ="Contributions Between #{@start_deed} and #{@end_deed}"
h2.nomargin =t('.contributions', start_deed: @start_deed, end_deed: @end_deed)

h4.normargin Select a new date range
h4.normargin =t('.select_new_date')

=form_tag(contributors_collection_path(@collection.owner, @collection), method: "get") do
=hidden_field_tag(:collection_id, @collection)
=label_tag(:start_date, "Start date")
=label_tag(:start_date, t('.start_date'))
|
=text_field_tag(:start_date, @start_deed, style: "width:30%")
|
=label_tag(:end_date, "End date")
=label_tag(:end_date, t('.end_date'))
|
=text_field_tag(:end_date, @end_deed, style: "width:30%")
|
=submit_tag("Update")
=submit_tag(t('.update'))
br/

=render "contributors_body"
Expand Down
Loading

0 comments on commit 3883b78

Please sign in to comment.