-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from basemate/resolving_issue_140
Resolving issue 140
- Loading branch information
Showing
10 changed files
with
292 additions
and
141 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,58 @@ | ||
class Pages::MyApp::InlineEdit < Matestack::Ui::Page | ||
|
||
def prepare | ||
@my_model = DummyModel.last | ||
end | ||
|
||
def response | ||
components { | ||
heading size: 2, text: "Inline Edit" | ||
|
||
partial :show_value | ||
partial :show_form | ||
} | ||
end | ||
|
||
def show_value | ||
partial { | ||
async rerender_on: "item_updated", show_on: "item_updated", hide_on: "update_item", init_show: true do | ||
onclick emit: "update_item" do | ||
plain @my_model.title | ||
plain "(click me)" | ||
end | ||
end | ||
} | ||
end | ||
|
||
def show_form | ||
partial { | ||
async rerender_on: "item_updated", show_on: "update_item", hide_on: "item_updated" do | ||
form some_form_config, :include do | ||
form_input key: :title, type: :text | ||
form_submit do | ||
button text: "save" | ||
end | ||
end | ||
onclick emit: "item_updated" do | ||
button text: "abort" | ||
end | ||
end | ||
} | ||
end | ||
|
||
def some_form_config | ||
{ | ||
for: @my_model, | ||
method: :post, | ||
path: :inline_form_action_path, | ||
params: { | ||
id: @my_model.id | ||
}, | ||
success:{ | ||
emit: "item_updated" | ||
} | ||
} | ||
end | ||
|
||
|
||
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
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
Oops, something went wrong.