Sha256: b7641f45e4222d4efd9314d725a25b5213201d9c0eb394f852d800342284692d

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

module CurationConcern
  class BaseController < ApplicationController
    before_filter :attach_action_breadcrumb
    def attach_action_breadcrumb
      case action_name
      when 'show'
        add_breadcrumb curation_concern.human_readable_type, request.path
      when 'new', 'create'
        add_breadcrumb "New #{curation_concern.human_readable_type}", request.path
      else
        add_breadcrumb curation_concern.human_readable_type, polymorphic_path([:curation_concern, curation_concern])
        add_breadcrumb action_name.titleize, request.path
      end
    end
    protected :attach_action_breadcrumb

    layout 'curate_nd'
    include Sufia::Noid # for normalize_identifier method

    before_filter :authenticate_user!, :except => [:show]
    before_filter :agreed_to_terms_of_service!
    prepend_before_filter :normalize_identifier, except: [:index, :new, :create]
    before_filter :curation_concern, except: [:index]
    load_and_authorize_resource :curation_concern, except: [:index, :new, :create], class: "ActiveFedora::Base"

    attr_reader :curation_concern
    helper_method :curation_concern

    def contributor_agreement
      @contributor_agreement ||= ContributorAgreement.new(curation_concern, current_user, params)
    end
    helper_method :contributor_agreement

    def save_and_add_related_files_submit_value(override_name = action_name)
      verb_name = ['create', 'new'].include?(override_name) ? 'Create' : 'Update'
      "#{verb_name} and Add Related Files..."
    end
    helper_method :save_and_add_related_files_submit_value

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
curate-0.1.3 app/controllers/curation_concern/base_controller.rb