Skip to content
This repository has been archived by the owner on Mar 24, 2020. It is now read-only.

Commit

Permalink
Update iframe width and height for embed image code
Browse files Browse the repository at this point in the history
  • Loading branch information
VivianChu committed Jan 26, 2019
1 parent 7a5571f commit c213e0a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions app/helpers/dams_objects_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@ def file_data(parameters)
fieldData = @document["#{prefix}files_tesim"]
end

def grabFileSize(parameters={})
file_use(parameters,"quality")
end

#---
# Get the source file id value from the component's 'files_tesim' value.
#
Expand Down
10 changes: 8 additions & 2 deletions app/views/dams_objects/_admin_download.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<%
component_id = (defined?(cmpID)) ? "#{cmpID}" : ''
embed_url = (defined?(embedURL)) ? "#{embedURL}" : ''
component_id = (defined?(cmpID)) ? "#{cmpID}" : nil
embed_url = (defined?(embedURL)) ? "#{embedURL}" : nil
etc_menu_item_class = 'pull-right'
embed_glyph = '<i class="glyphicon glyphicon-share-alt"></i> Embed'.html_safe
adl_glyph = '<i class="glyphicon glyphicon-download-alt"></i> Download File'.html_safe
file_format = (defined?(format)) ? "#{format.capitalize}" : ''
embed_width = (format == 'audio') ? '629' : '560'
embed_height = (format == 'audio') ? '46' : '315'
file_size = (format == 'image') ? grabFileSize(:componentIndex=>component_id) : nil
if file_size
dim = file_size.split("x")
embed_width = dim[0]
embed_height = dim[1]
end
%>

<div class="etc-menu">
Expand Down
2 changes: 1 addition & 1 deletion app/views/dams_objects/_complex_object_viewer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<div data='<%=dataForDynamicLoad%>'></div>
<% end %>
<%= render :partial => 'metadata_component', :locals => {:componentIndex => i} %>
<%= render :partial => 'admin_download', :locals => {:embedURL => embed_url, :downloadFilePath => download_file_path, :downloadDerivativePath => service_file_path, :format => fileType } if access_notice.nil?%>
<%= render :partial => 'admin_download', :locals => {:cmpID => i, :embedURL => embed_url, :downloadFilePath => download_file_path, :downloadDerivativePath => service_file_path, :format => fileType } if access_notice.nil?%>
<% elsif fileType == 'audio' %>
<%= render :partial => 'audio_viewer_complex', :locals => {:access_notice => access_notice, :componentIndex => i, :downloadFilePath => download_file_path, :downloadDerivativePath => nil } %>
Expand Down
2 changes: 0 additions & 2 deletions spec/features/dams_object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,6 @@
expect(page).to have_content('Embed URL')
expect(page).to have_content('Embed Image')
expect(page.body).to match(/embed\/#{@localObj.id}\/2/)
expect(page).to have_selector('textarea', text: 'width="560" height="315"')
end
end
end
Expand Down Expand Up @@ -1667,7 +1666,6 @@
expect(page).to have_content('Embed URL')
expect(page).to have_content('Embed Image')
expect(page.body).to match(/embed\/#{@obj.id}\/0/)
expect(page).to have_selector('textarea', text: 'width="560" height="315"')
end
end
end
Expand Down

0 comments on commit c213e0a

Please sign in to comment.