/* | |
ERB template chunk from The Feed's display of emails: | |
<section class="postings postings--feed-style" id="postings" | |
data-controller="pagination" data-pagination-root-margin-value="40px"> | |
<%= render partial: "postings/snippet", collection: @page.records, as: :posting, cached: true %> | |
<%= link_to(spinner_tag, url_for(page: @page.next_param), | |
class: "pagination-link", data: { pagination_target: "nextPageLink", preload: @page.first? }) unless @page.last? %> | |
</section> |
# ActiveJob natively captures constructor arguments in an `@arguments` instance variable | |
# which is also exposed as an `arguments` property on each job instance. | |
# | |
# Calls to `perform_now` and `perform_later` both forward arguments to the constructor. | |
# | |
# For example, all of these invocation styles work. | |
# | |
# result = DoStuffJob.new("foobar").perform # sync | |
# result = DoStuffJob.new.perform("foobar") # sync | |
# result = DoStuffJob.perform_now("foobar") # sync |
When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.
Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008
…………………………
<%= form_with(model: product) do |form| %> | |
<div> | |
<%= form.label :name %> | |
<%= form.text_field :name, class: "input" %> | |
</div> | |
<div> | |
<%= form.label :categories %> | |
<%= form.collection_select :category_ids, Category.all, :id, :name, {}, {multiple: true, id: 'category-select', class: "dropdown"} %> | |
</div> |
// DISCLAIMER : You can now probably use `data-turbo-action="advance"` on your frame to perform what this controller is aiming to do | |
// https://turbo.hotwired.dev/handbook/frames#promoting-a-frame-navigation-to-a-page-visit | |
// Note that you probably want to disable turbo cache as well for those page to make popstate work properly | |
import { navigator } from '@hotwired/turbo' | |
import { Controller } from '@hotwired/stimulus' | |
import { useMutation } from 'stimulus-use' | |
export default class extends Controller { | |
connect (): void { |
# config/routes.rb | |
resources :documents do | |
scope module: 'documents' do | |
resources :versions do | |
post :restore, on: :member | |
end | |
resource :lock | |
end | |
end |
https://joshuajohnson.co.uk/Choices/
Soon, this will be published as an NPM package, but there's an absence of documentation right now. It supports almost all functions from the original library; soon it will support 100% of them.
This wrapper adds Ajax pre-fetch search. Happens if controller has a data-search-path
attribute.
Stimulus controller targets use new v2 syntax. Controller attaches a reference to itself on the element so that you can access the internal state from external scripts.