Sha256: 06a80e4dad19de8fdbc4e00c4c7522a608b1e2d92918301f69bb0a2bfbe2a9ce

Contents?: true

Size: 1.46 KB

Versions: 12

Compression:

Stored size: 1.46 KB

Contents

Coprl::Presenters.define(:dirtyable_container) do
  content id: :dirtyable_container do
    grid do
      column 6 do
        text_field name: :a_text_field do
          label 'Input'
          value 'initial value'
        end

        button :save, type: :raised do
          event :click do
            snackbar 'Saved!'
            replaces :dirtyable_container, :dirtyable_container
          end
        end
        button :cancel do
          event :click do
            prompt_if_dirty :discard_dialog
            replaces :dirtyable_container, :dirtyable_container
          end
        end
      end
    end
  end
end

Coprl::Presenters.define(:prompt_if_dirty_action) do
  helpers Demo::Helpers::IndentedGrid
  attach :top_nav
  attach :events_drawer
  attach :discard_dialog

  indented_grid do
    heading 'Prompt if dirty'
    body 'Allows you to prompt users to discard changes in fields which have unsaved changes.'
    blank
    body <<~MARKDOWN
      Takes the ID of a dialog to display when one or more fields in the
      closest container has changed.\n
      Optionally takes an `input_tag` which has priority over the closest
      container and can be used if no closest container is present.
    MARKDOWN
    blank
    body <<~MARKDOWN
      If the user dismisses the dialog (via the scrim or cancel button), the
      actions following `prompt_if_dirty` are not executed.
    MARKDOWN

    blank
    attach :dirtyable_container
  end

  attach :code, file: __FILE__
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
coprl-3.0.0.beta.12 app/demo/events/actions/prompt_if_dirty.pom
coprl-3.0.0.beta.11 app/demo/events/actions/prompt_if_dirty.pom
coprl-3.0.0.beta.10 app/demo/events/actions/prompt_if_dirty.pom
coprl-3.0.0.beta.9 app/demo/events/actions/prompt_if_dirty.pom
coprl-3.0.0.beta.8 app/demo/events/actions/prompt_if_dirty.pom
coprl-3.0.0.beta.7 app/demo/events/actions/prompt_if_dirty.pom
coprl-3.0.0.beta.6 app/demo/events/actions/prompt_if_dirty.pom
coprl-3.0.0.beta.5 app/demo/events/actions/prompt_if_dirty.pom
coprl-3.0.0.beta.4 app/demo/events/actions/prompt_if_dirty.pom
coprl-3.0.0.beta.3 app/demo/events/actions/prompt_if_dirty.pom
coprl-3.0.0.beta.2 app/demo/events/actions/prompt_if_dirty.pom
coprl-3.0.0.beta.1 app/demo/events/actions/prompt_if_dirty.pom