Skip to content

Commit

Permalink
Merge pull request #1065 from avalonmediasystem/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
carrickr authored Aug 17, 2016
2 parents c48e9b8 + ef0cd11 commit b7032c4
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 29 deletions.
4 changes: 1 addition & 3 deletions app/assets/javascripts/autocomplete.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@
target.val ""
else if $t.data('matched_val') != typed
mySource.remote.get typed, (matches) ->
if matches.length > 0
target.val matches[0].id
else if !$validate
if !$validate
target.val typed
else
target.val ""
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def search_builder processor_chain = search_params_logic
#
# :show may be set to false if you don't want the facet to be drawn in the
# facet bar
config.add_facet_field 'avalon_resource_type_sim', label: 'Format', limit: 5, collapse: false
config.add_facet_field 'avalon_resource_type_ssim', label: 'Format', limit: 5, collapse: false
# Eventually these need to be merged into a single facet
config.add_facet_field 'creator_ssim', label: 'Main contributor', limit: 5
config.add_facet_field 'date_sim', label: 'Date', limit: 5
Expand Down
22 changes: 11 additions & 11 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright 2011-2015, The Trustees of Indiana University and Northwestern
# University. Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
#
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# --- END LICENSE_HEADER BLOCK ---

Expand All @@ -17,7 +17,7 @@ module ApplicationHelper
def application_name
Avalon::Configuration.lookup('name') || 'Avalon Media System'
end

def release_text
"#{application_name} #{t(:release_label)} #{Avalon::VERSION}"
end
Expand All @@ -38,8 +38,8 @@ def share_link_for(obj)
def image_for(document)
master_file_id = document["section_pid_tesim"].try :first

video_count = document["avalon_resource_type_sim"].count{|m| m.start_with?('moving image') } rescue 0
audio_count = document["avalon_resource_type_sim"].count{|m| m.start_with?('sound recording') } rescue 0
video_count = document["avalon_resource_type_ssim"].count{|m| m.start_with?('moving image'.titleize) } rescue 0
audio_count = document["avalon_resource_type_ssim"].count{|m| m.start_with?('sound recording'.titleize) } rescue 0

if master_file_id
if video_count > 0
Expand Down Expand Up @@ -90,7 +90,7 @@ def search_result_label item
else
label = item.id
end

if item['duration_tesim'].present?
duration = item['duration_tesim'].first
if duration.respond_to?(:to_i) && duration.to_i > 0
Expand Down Expand Up @@ -119,7 +119,7 @@ def user_key
# the mediainfo gem returns duration as milliseconds
# see attr_reader.rb line 48 in the mediainfo source
def milliseconds_to_formatted_time( milliseconds )
total_seconds = milliseconds / 1000
total_seconds = milliseconds / 1000
hours = total_seconds / (60 * 60)
minutes = (total_seconds / 60) % 60
seconds = total_seconds % 60
Expand All @@ -132,7 +132,7 @@ def milliseconds_to_formatted_time( milliseconds )
output += "#{minutes.to_s.rjust(2,'0')}:#{seconds.to_s.rjust(2,'0')}"
output
end

# display millisecond times in HH:MM:SS format
# @param [Float] milliseconds the time to convert
# @return [String] time in HH:MM:SS
Expand Down
2 changes: 1 addition & 1 deletion app/models/media_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def to_solr(solr_doc = Hash.new, opts = {})
solr_doc["creator_ssort"] = Array(self.creator).join(', ')
solr_doc["date_digitized_sim"] = parts.collect {|mf| mf.date_digitized }.compact.map {|t| Time.parse(t).strftime "%F" }
solr_doc["date_ingested_sim"] = Time.parse(self.create_date).strftime "%F"
solr_doc["avalon_resource_type_sim"] = self.avalon_resource_type.map(&:titleize)
solr_doc["avalon_resource_type_ssim"] = self.avalon_resource_type.map(&:titleize)
#include identifiers for parts
solr_doc["other_identifier_sim"] += parts.collect {|mf| mf.DC.identifier }.flatten
#include labels for parts and their structural metadata
Expand Down
3 changes: 3 additions & 0 deletions app/views/bookmarks/update_access_control.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,7 @@ $('.help-block .close').on("click", function(event){
event.preventDefault()
$(this).parent().collapse('toggle')
});
$('.typeahead.from-model').each(function() {
initialize_typeahead($(this));
});
</script>
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
end

module Avalon
VERSION = '5.1.3'
VERSION = '5.1.4'
class MissingUserId < Exception; end

class Application < Rails::Application
Expand Down
24 changes: 12 additions & 12 deletions spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright 2011-2015, The Trustees of Indiana University and Northwestern
# University. Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
#
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# --- END LICENSE_HEADER BLOCK ---

Expand Down Expand Up @@ -74,7 +74,7 @@
expect(helper.truncate_center("", 5)).to eq ""
end
it "should truncate with no end length provided" do
expect(helper.truncate_center("This is my very long test string", 16)).to eq "This is ...tring"
expect(helper.truncate_center("This is my very long test string", 16)).to eq "This is ...tring"
end
it "should truncate with end length" do
expect(helper.truncate_center("This is my very long test string", 20, 6)).to eq "This is my ...string"
Expand Down Expand Up @@ -104,27 +104,27 @@
describe "#image_for" do
# image_for expects hash keys as labels, not strings
it "should return nil" do
doc = {"avalon_resource_type_sim" => [] }
doc = {"avalon_resource_type_ssim" => [] }
expect(helper.image_for(doc)).to eq(nil)
end
it "should return audio icon" do
doc = {"avalon_resource_type_sim" => ['sound recording 2', 'sound recording 1'] }
doc = {"avalon_resource_type_ssim" => ['Sound Recording', 'Sound Recording'] }
expect(helper.image_for(doc)).to eq('/assets/audio_icon.png')
end
it "should return video icon" do
doc = {"avalon_resource_type_sim" => ['moving image 1'] }
doc = {"avalon_resource_type_ssim" => ['Moving Image'] }
expect(helper.image_for(doc)).to eq('/assets/video_icon.png')
end
it "should return hybrid icon" do
doc = {"avalon_resource_type_sim" => ['moving image 1', 'sound recording 1'] }
doc = {"avalon_resource_type_ssim" => ['Moving Image', 'Sound Recording'] }
expect(helper.image_for(doc)).to eq('/assets/hybrid_icon.png')
end
it "should return nil when only unprocessed video" do
doc = {"section_pid_tesim" => ['1'], "avalon_resource_type_sim" => [] }
doc = {"section_pid_tesim" => ['1'], "avalon_resource_type_ssim" => [] }
expect(helper.image_for(doc)).to eq(nil)
end
it "should return thumbnail" do
doc = {"section_pid_tesim" => ['1'], "avalon_resource_type_sim" => ['moving image 1'] }
doc = {"section_pid_tesim" => ['1'], "avalon_resource_type_ssim" => ['Moving Image'] }
expect(helper.image_for(doc)).to eq('/master_files/1/thumbnail')
end
end
Expand Down

0 comments on commit b7032c4

Please sign in to comment.