1 parent
a977c0ceb3
commit
1ded44610b
16 files changed
+38
-14
No files matched your search
@@ -28,4 +28,14 @@ module ApplicationHelper
|
||||
%w(Coder live_code)
|
||||
], selected: (val.blank? ? '' : val))
|
||||
end
|
||||
|
||||
# include javascript only once
|
||||
# Allows the safe loading of js dependencies in partials multiple times.
|
||||
def content_for_javascript_once code_label, &block
|
||||
@js_blocks ||= []
|
||||
return if @js_blocks.include? code_label
|
||||
|
||||
@js_blocks << code_label
|
||||
content_for :custom_javascipt, &block
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user