Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support morph option for childrenOnly #6

Merged
merged 1 commit into from
Oct 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ cable_ready["MyChannel"].dispatch_event(

```ruby
cable_ready["MyChannel"].morph(
selector: "string", # required - string containing one or more CSS selectors separated by commas
focusSelector: "string", # [null] - string containing one or more CSS selectors separated by commas
html: "string" # [null] - the HTML to assign
selector: "string", # required - string containing one or more CSS selectors separated by commas
html: "string" # [null] - the HTML to assign
children_only: true|false # [null] - indicates if only child nodes should be morphed... skipping the parent element
focus_selector: "string", # [null] - string containing one or more CSS selectors separated by commas
)
```

Expand All @@ -103,9 +104,9 @@ Sets the innerHTML of a DOM element.

```ruby
cable_ready["MyChannel"].inner_html(
selector: "string", # required - string containing one or more CSS selectors separated by commas
focusSelector: "string", # [null] - string containing one or more CSS selectors separated by commas
html: "string" # [null] - the HTML to assign
selector: "string", # required - string containing one or more CSS selectors separated by commas
focus_selector: "string", # [null] - string containing one or more CSS selectors separated by commas
html: "string" # [null] - the HTML to assign
)
```

Expand All @@ -127,10 +128,10 @@ Supports behavior akin to prepend & append.

```ruby
cable_ready["MyChannel"].insert_adjacent_html(
selector: "string", # required - string containing one or more CSS selectors separated by commas
focusSelector: "string", # [null] - string containing one or more CSS selectors separated by commas
position: "string", # [beforeend] - the relative position to the DOM element (beforebegin, afterbegin, beforeend, afterend)
html: "string" # [null] - the HTML to insert
selector: "string", # required - string containing one or more CSS selectors separated by commas
focus_selector: "string", # [null] - string containing one or more CSS selectors separated by commas
position: "string", # [beforeend] - the relative position to the DOM element (beforebegin, afterbegin, beforeend, afterend)
html: "string" # [null] - the HTML to insert
)
```

Expand All @@ -153,8 +154,8 @@ Removes an element from the DOM.

```ruby
cable_ready["MyChannel"].remove(
selector: "string", # required - string containing one or more CSS selectors separated by commas
focusSelector: "string" # [null] - string containing one or more CSS selectors separated by commas
selector: "string", # required - string containing one or more CSS selectors separated by commas
focus_selector: "string" # [null] - string containing one or more CSS selectors separated by commas
)
```

Expand All @@ -164,9 +165,9 @@ Replaces a DOM element with new HTML.

```ruby
cable_ready["MyChannel"].replace(
selector: "string", # required - string containing one or more CSS selectors separated by commas
focusSelector: "string", # [null] - string containing one or more CSS selectors separated by commas
html: "string" # [null] - the HTML to use as replacement
selector: "string", # required - string containing one or more CSS selectors separated by commas
focus_selector: "string", # [null] - string containing one or more CSS selectors separated by commas
html: "string" # [null] - the HTML to use as replacement
)
```

Expand Down
11 changes: 6 additions & 5 deletions lib/cable_ready/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ class Channel
#
# morph: [{
# selector: "string",
# focusSelector: "string",
# html: "string"
# children_only: true|false,
# focus_selector: "string",
# }, ...],
#
# inner_html: [{
# selector: "string",
# focusSelector: "string",
# focus_selector: "string",
# html: "string"
# }, ...],
#
Expand All @@ -34,7 +35,7 @@ class Channel
#
# insert_adjacent_html: [{
# selector: "string",
# focusSelector: "string",
# focus_selector: "string",
# position: "string",
# html: "string"
# }, ...],
Expand All @@ -47,12 +48,12 @@ class Channel
#
# remove: [{
# selector: "string",
# focusSelector: "string,
# focus_selector: "string,
# }, ...],
#
# replace: [{
# selector: "string",
# focusSelector: "string",
# focus_selector: "string",
# html: "string"
# }, ...],
#
Expand Down
2 changes: 1 addition & 1 deletion lib/cable_ready/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CableReady
VERSION = "2.0.4"
VERSION = "2.0.5"
end
Loading