[Internal] Add route for widget testing (#199)
This commit is contained in:
13
app/controllers/widget_tests_controller.rb
Normal file
13
app/controllers/widget_tests_controller.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class WidgetTestsController < ActionController::Base
|
||||
before_action :set_web_widget
|
||||
|
||||
def index
|
||||
render
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_web_widget
|
||||
@web_widget = Channel::WebWidget.first
|
||||
end
|
||||
end
|
||||
14
app/views/widget_tests/index.html.erb
Normal file
14
app/views/widget_tests/index.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<script>
|
||||
(function(d,t) {
|
||||
var BASE_URL = '';
|
||||
var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||||
g.src= BASE_URL + "/packs/js/sdk.js";
|
||||
s.parentNode.insertBefore(g,s);
|
||||
g.onload=function(){
|
||||
window.chatwootSDK.run({
|
||||
websiteToken: '<%= @web_widget.website_token %>',
|
||||
baseUrl: BASE_URL
|
||||
})
|
||||
}
|
||||
})(document,"script");
|
||||
</script>
|
||||
Reference in New Issue
Block a user