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

Commit c213e0a

Browse files
committed
Update iframe width and height for embed image code
1 parent 7a5571f commit c213e0a

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

app/helpers/dams_objects_helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,10 @@ def file_data(parameters)
410410
fieldData = @document["#{prefix}files_tesim"]
411411
end
412412

413+
def grabFileSize(parameters={})
414+
file_use(parameters,"quality")
415+
end
416+
413417
#---
414418
# Get the source file id value from the component's 'files_tesim' value.
415419
#

app/views/dams_objects/_admin_download.html.erb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
<%
2-
component_id = (defined?(cmpID)) ? "#{cmpID}" : ''
3-
embed_url = (defined?(embedURL)) ? "#{embedURL}" : ''
2+
component_id = (defined?(cmpID)) ? "#{cmpID}" : nil
3+
embed_url = (defined?(embedURL)) ? "#{embedURL}" : nil
44
etc_menu_item_class = 'pull-right'
55
embed_glyph = '<i class="glyphicon glyphicon-share-alt"></i> Embed'.html_safe
66
adl_glyph = '<i class="glyphicon glyphicon-download-alt"></i> Download File'.html_safe
77
file_format = (defined?(format)) ? "#{format.capitalize}" : ''
88
embed_width = (format == 'audio') ? '629' : '560'
99
embed_height = (format == 'audio') ? '46' : '315'
10+
file_size = (format == 'image') ? grabFileSize(:componentIndex=>component_id) : nil
11+
if file_size
12+
dim = file_size.split("x")
13+
embed_width = dim[0]
14+
embed_height = dim[1]
15+
end
1016
%>
1117

1218
<div class="etc-menu">

app/views/dams_objects/_complex_object_viewer.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<div data='<%=dataForDynamicLoad%>'></div>
7171
<% end %>
7272
<%= render :partial => 'metadata_component', :locals => {:componentIndex => i} %>
73-
<%= render :partial => 'admin_download', :locals => {:embedURL => embed_url, :downloadFilePath => download_file_path, :downloadDerivativePath => service_file_path, :format => fileType } if access_notice.nil?%>
73+
<%= render :partial => 'admin_download', :locals => {:cmpID => i, :embedURL => embed_url, :downloadFilePath => download_file_path, :downloadDerivativePath => service_file_path, :format => fileType } if access_notice.nil?%>
7474

7575
<% elsif fileType == 'audio' %>
7676
<%= render :partial => 'audio_viewer_complex', :locals => {:access_notice => access_notice, :componentIndex => i, :downloadFilePath => download_file_path, :downloadDerivativePath => nil } %>

spec/features/dams_object_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,6 @@
14101410
expect(page).to have_content('Embed URL')
14111411
expect(page).to have_content('Embed Image')
14121412
expect(page.body).to match(/embed\/#{@localObj.id}\/2/)
1413-
expect(page).to have_selector('textarea', text: 'width="560" height="315"')
14141413
end
14151414
end
14161415
end
@@ -1667,7 +1666,6 @@
16671666
expect(page).to have_content('Embed URL')
16681667
expect(page).to have_content('Embed Image')
16691668
expect(page.body).to match(/embed\/#{@obj.id}\/0/)
1670-
expect(page).to have_selector('textarea', text: 'width="560" height="315"')
16711669
end
16721670
end
16731671
end

0 commit comments

Comments
 (0)