"dependencies": { "cable_ready": "5.0.0-pre1", "mrujs": "^0.3.0-beta.25" }
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
import ApplicationController from '../application_controller' | |
import SlimSelect from 'slim-select' | |
export default class extends ApplicationController { | |
static values = { | |
limit: Number, | |
placeholder: String, | |
searchText: String, | |
searchingText: String, | |
reflex: String, |
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
class ApplicationController < ActionController::Base | |
include CableReady::Broadcaster | |
include Toastable | |
end |
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
add_flash_types :primary, :secondary, :success, :danger, :warning, :info, :light, :dark |
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
import { Controller } from 'stimulus' | |
export default class extends Controller { | |
static values = { | |
idleTimeoutMs: 30000, | |
currentIdleTimeMs: Number, | |
checkIdleStateRateMs: 250, | |
isUserCurrentlyOnPage: true, | |
isUserCurrentlyIdle: Boolean, | |
currentPageName: 'default', |
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
gem "webpacker", "~> 5.4.0" |
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
# using a predefined hash | |
hash = { field1: "foo", field2: "bar" } | |
HashStruct = Struct.new(*hash.keys, keyword_init: true) | |
hash_struct = HashStruct.new(hash) | |
hash_struct.field1 # => "foo" | |
hash_struct.field2 # => "bar" | |
hash_struct.field3 # => ERROR! | |
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
// partial file | |
// you will need to `yarn add notyf` | |
import CableReady from 'cable_ready' | |
import { Notyf } from 'notyf' | |
import flash from '../shared/notyf' | |
CableReady.DOMOperations.toast = operation => { | |
new Notyf(flash).open(operation) | |
} |
Using Stimulus v2, FontAwesome 5, Bootstrap 5, and Mapbox
You can grab a copy of marker.svg
here - put it in your /public
folder.
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
import CableReady from 'cable_ready' | |
import { dispatch } from 'cable_ready/javascript/utils' | |
CableReady.DOMOperations.removeSubelement = operation => { | |
const { element, subElement } = operation | |
dispatch(element, 'cable-ready:before-remove-subelement', operation) | |
element.contentDocument.querySelector(subElement).remove() | |
dispatch(element, 'cable-ready:after-remove-subelement', operation) | |
} |