Skip to content

Commit c06816a

Browse files
committed
cleanup based on feedback
1 parent aef4b90 commit c06816a

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

dashboard/app/controllers/levels_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ def embed_blocks
207207
baseUrl: "#{ActionController::Base.asset_host}/blockly/",
208208
blocks: @level.properties[@block_type]
209209
}
210-
puts "blocks: #{@level[@block_type]}, block type=#{@block_type}"
211210
render :embed_blocks, layout: false
212211
end
213212

dashboard/app/helpers/levels_helper.rb

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,24 @@ def string_or_image(prefix, text)
287287
ext = File.extname(path)
288288
base_level = File.basename(path, ext)
289289
level = Level.find_by(name: base_level)
290-
"<iframe src='#{url_for(:controller => :levels, :action => :embed_blocks, :level_id => level.id, :block_type => ext.tap{|x|x.slice!(0)}).strip}' width='#{width ? width.strip : '100%'}' scrolling='no' seamless='seamless' style='border: none;'></iframe>"
290+
content_tag(:iframe, '', {
291+
src: url_for(controller: :levels, action: :embed_blocks, level_id: level.id, block_type: ext.slice(1..-1)).strip,
292+
width: width ? width.strip : '100%',
293+
scrolling: 'no',
294+
seamless: 'seamless',
295+
style: 'border: none;',
296+
})
291297
elsif File.extname(path) == '.level'
292298
base_level = File.basename(path, '.level')
293299
level = Level.find_by(name: base_level)
294-
"<div class='aspect-ratio'><iframe src='#{url_for(:id => level.id, :controller => 'levels', :action => 'show', :embed => true).strip}' width='#{width ? width.strip : '100%'}' scrolling='no' seamless='seamless' style='border: none;'></iframe></div>"
300+
content_tag(:div,
301+
content_tag(:iframe, '', {
302+
src: url_for(id: level.id, controller: :levels, action: :show, embed: true).strip,
303+
width: (width ? width.strip : '100%'),
304+
scrolling: 'no',
305+
seamless: 'seamless',
306+
style: 'border: none;'
307+
}), {class: 'aspect-ratio'})
295308
else
296309
data_t(prefix + '.' + @level.name, text)
297310
end

0 commit comments

Comments
 (0)