-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable turbo-rails and refactor BatchConnect::Sessions#index to use turbo_stream partials to send updates instead of the javascript business we used to use.
- Loading branch information
Showing
13 changed files
with
82 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
/* | ||
While we want Turbo enabled at some point, | ||
it doesn't really work well yet. So, we'll provide | ||
this shim until we enable it. | ||
*/ | ||
|
||
export function replaceHTML(id, html) { | ||
const ele = document.getElementById(id); | ||
|
||
if(ele == null){ | ||
return; | ||
} else { | ||
var tmp = document.createElement('div'); | ||
tmp.innerHTML = html; | ||
const newHTML = tmp.querySelector('template').innerHTML; | ||
tmp.remove(); | ||
|
||
ele.innerHTML = newHTML; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
apps/dashboard/app/views/batch_connect/sessions/_panels.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
index.turbo_stream.erb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
apps/dashboard/app/views/batch_connect/sessions/index.js.erb
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
apps/dashboard/app/views/batch_connect/sessions/index.json.jbuilder
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
apps/dashboard/app/views/batch_connect/sessions/index.turbo_stream.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
<turbo-stream action="replace" target="batch_connect_sessions" id="sessions_frame"> | ||
<div class="d-flex justify-content-center"> | ||
<div class="spinner-border" role="status"> | ||
<span class="sr-only">Loading...</span> | ||
</div> | ||
</div> | ||
<template> | ||
<div class="batch-connect sessions"> | ||
<% if @sessions.empty? %> | ||
<div class="ood-appkit markdown"> | ||
<p><%= t('dashboard.batch_connect_no_sessions') %></p> | ||
</div> | ||
<% else %> | ||
<%= render partial: "panel", collection: @sessions, as: :session, formats: [:html] %> | ||
<% end %> | ||
</div> | ||
</template> | ||
</turbo-stream> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters