Skip to content

Commit

Permalink
adjusted title tag for work show page, a bit more css, changed generi…
Browse files Browse the repository at this point in the history
…c to general on the modal where you choose work type
  • Loading branch information
Christy Karpinski authored and Christy Karpinski committed Jun 6, 2023
1 parent 2e938ea commit 187f44a
Show file tree
Hide file tree
Showing 12 changed files with 503 additions and 8 deletions.
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
*= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
*= require bootstrap-datepicker
*= require_self
*= require atla-overrides
*/
33 changes: 33 additions & 0 deletions app/assets/stylesheets/atla-overrides.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
html, body {
font-family: 'Muli', Helvetica, sans-serif;
font-size:1em;
}

img {max-width:100%;}


/* Work show metadata layout */
.works-show p.work_description {margin-top:1em;}
.works-show dl.work-show {margin-top: 1em;}
.work-show ul.tabular, .scholarly_show .work-show ul.tabular{padding-inline-start: 0px;}
.work-show dt {padding-bottom:0;}

/* hide work type on work show pages */
.works-show .work-type-tag {display:none;}

/* Collection show layout */
.hyc-banner .hyc-title h1, .hyc-banner .hyc-bugs div{
color:rgb(51, 51, 51);
text-shadow:none;
}

.hyc-banner .hyc-title .label {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}

.hyc-banner {min-height:95px;}

/* admin dashboard available works ETD all caps*/
.dashboard label[for="input-Etd"] {text-transform: uppercase;}
128 changes: 128 additions & 0 deletions app/presenters/hyrax/file_set_presenter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# frozen_string_literal: true
module Hyrax
class FileSetPresenter
include ModelProxy
include PresentsAttributes
include CharacterizationBehavior
include WithEvents
include DisplaysImage

attr_accessor :solr_document, :current_ability, :request

# @param [SolrDocument] solr_document
# @param [Ability] current_ability
# @param [ActionDispatch::Request] request the http request context
def initialize(solr_document, current_ability, request = nil)
@solr_document = solr_document
@current_ability = current_ability
@request = request
end

# CurationConcern methods
delegate :stringify_keys, :human_readable_type, :collection?, :image?, :video?,
:audio?, :pdf?, :office_document?, :representative_id, :to_s, to: :solr_document

# Methods used by blacklight helpers
delegate :has?, :first, :fetch, to: :solr_document

# Metadata Methods
delegate :title, :label, :description, :creator, :contributor, :subject,
:publisher, :language, :date_uploaded,
:embargo_release_date, :lease_expiration_date,
:depositor, :keyword, :title_or_label, :keyword,
:date_created, :date_modified, :itemtype,
:original_file_id,
to: :solr_document

delegate :member_of_collection_ids, to: :parent

def workflow
nil
end

def single_use_links
@single_use_links ||= SingleUseLink.where(item_id: id).map { |link| link_presenter_class.new(link) }
end

# The title of the webpage that shows this FileSet.
def page_title
"#{title.first} | #{I18n.t('hyrax.product_name')} | ID: #{id}"
end

# The first title assertion
def first_title
title.first
end

# The link text when linking to the show page of this FileSet
def link_name
current_ability.can?(:read, id) ? first_title : 'File'
end

##
# @deprecated use `::Ability.can?(:edit, presenter)`. Hyrax views calling
# presenter {#editor} methods will continue to call them until Hyrax
# 4.0.0. The deprecation time horizon for the presenter methods themselves
# is 5.0.0.
def editor?
current_ability.can?(:edit, self)
end

def tweeter
TwitterPresenter.twitter_handle_for(user_key: depositor)
end

def license
return if solr_document.license.nil?
solr_document.license.first
end

def stats_path
Hyrax::Engine.routes.url_helpers.stats_file_path(self, locale: I18n.locale)
end

def events(size = 100)
super(size)
end

# This overrides the method in WithEvents
def event_class
solr_document.to_model.model_name.name
end

def fixity_check_status
Hyrax::FixityStatusPresenter.new(id).render_file_set_status
end

##
# @return [WorkShowPresenter, nil] +nil+ if no parent can be found
def parent
@parent_presenter ||= fetch_parent_presenter
end

def user_can_perform_any_action?
Deprecation.warn("We're removing Hyrax::FileSetPresenter.user_can_perform_any_action? in Hyrax 4.0.0; Instead use can? in view contexts.")
current_ability.can?(:edit, id) || current_ability.can?(:destroy, id) || current_ability.can?(:download, id)
end

private

def link_presenter_class
SingleUseLinkPresenter
end

def fetch_parent_presenter
ids = Hyrax::SolrService.query("{!field f=member_ids_ssim}#{id}", fl: Hyrax.config.id_field)
.map { |x| x.fetch(Hyrax.config.id_field) }
Hyrax.logger.warn("Couldn't find a parent work for FileSet: #{id}.") if ids.empty?
ids.each do |id|
doc = ::SolrDocument.find(id)
next if current_ability.can?(:edit, doc)
raise WorkflowAuthorizationException if doc.suppressed? && current_ability.can?(:read, doc)
end
Hyrax::PresenterFactory.build_for(ids: ids,
presenter_class: WorkShowPresenter,
presenter_args: current_ability).first
end
end
end
Loading

0 comments on commit 187f44a

Please sign in to comment.