-
Notifications
You must be signed in to change notification settings - Fork 437
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 #9512 from danidoni/in-place-editing-for-basic-pac…
…kage-information Implement the in-place package editing
- Loading branch information
Showing
17 changed files
with
233 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.basic-info.mb-3{ class: flipper_responsive? ? 'in-place-editing' : '' } | ||
%h3#package-title | ||
= package.title.presence || package.name | ||
- if package.url.present? | ||
= link_to(package.url, package.url, class: 'mb-3 d-block') | ||
#description-text | ||
- if package.description.blank? | ||
%i No description set | ||
- else | ||
= render partial: 'webui/shared/collapsible_text', locals: { text: package.description } |
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,17 @@ | ||
= form_for([project, package], as: :package_details, url: package_update_url, method: :patch, remote: true) do |form| | ||
%h5 Edit Package #{package} | ||
= hidden_field_tag(:id, package.id) | ||
= hidden_field_tag(:project, project) | ||
= hidden_field_tag(:package, package.name) | ||
.form-group | ||
= form.label(:title, 'Title:') | ||
= form.text_field(:title, class: 'form-control', autofocus: true) | ||
.form-group | ||
= form.label(:url, 'URL:') | ||
= form.text_field(:url, class: 'form-control') | ||
.form-group | ||
= form.label(:description, 'Description:') | ||
= form.text_area(:description, rows: 8, class: 'form-control') | ||
.form-group.text-right | ||
= link_to 'Cancel', package_show_path(project, package), class: 'cancel btn btn-outline-danger px-4', remote: true | ||
= submit_tag('Update', class: 'btn btn-primary px-4') |
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,10 @@ | ||
$('#flash').empty(); | ||
$('.in-place-editing').animate({ | ||
opacity: 0.25 | ||
}, 400, function() { | ||
scrollToInPlace(); | ||
$('.in-place-editing').html("<%= escape_javascript(render(partial: 'webui/package/edit', locals: { project: @project, package: @package })) %>"); | ||
$('.in-place-editing').animate({ opacity: 1 }, 400, function() { | ||
$("form *[autofocus='autofocus']").focus(); | ||
}); | ||
}); |
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
4 changes: 4 additions & 0 deletions
4
src/api/app/views/webui/package/responsive_ux/actions/_edit_package.html.haml
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,4 @@ | ||
%li.nav-item | ||
= link_to(edit_package_path(project, package), class: 'nav-link', remote: true) do | ||
%i.fas.fa-edit.fa-lg.mr-1 | ||
Edit Package |
4 changes: 0 additions & 4 deletions
4
src/api/app/views/webui/package/responsive_ux/show_actions/_edit_description.html.haml
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
$('.in-place-editing').animate({ | ||
opacity: 0.25 | ||
}, 400, function() { | ||
scrollToInPlace(); | ||
$('.in-place-editing').html("<%= escape_javascript(render(partial: 'webui/package/basic_info', locals: { package: @package })) %>"); | ||
setCollapsible(); | ||
$('.in-place-editing').animate({ opacity: 1 }, 400); | ||
}); |
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,17 @@ | ||
resetFormValidation(); | ||
- if @package.errors.any? | ||
- @package.errors.messages.each do |field, messages| | ||
element = $("##{@package.class.name.underscore}_details_#{field}"); // Create strings like "package_title" | ||
setFormValidation(element, "#{messages.to_sentence}"); | ||
- else | ||
:plain | ||
$('.in-place-editing').animate({ | ||
opacity: 0.25 | ||
}, 400, function() { | ||
scrollToInPlace(); | ||
$('.in-place-editing').html("#{escape_javascript(render(partial: 'webui/package/basic_info', locals: { package: @package }))}"); | ||
setCollapsible(); | ||
$('.in-place-editing').animate({ opacity: 1 }, 400, function() { | ||
$('#flash').html("#{escape_javascript(render(layout: false, partial: 'layouts/webui/flash', object: flash))}"); | ||
}); | ||
}); |
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,16 @@ | ||
# See https://thoughtbot.com/blog/automatically-wait-for-ajax-with-capybara | ||
module WaitForAjax | ||
def wait_for_ajax | ||
Timeout.timeout(Capybara.default_max_wait_time) do | ||
loop until finished_all_ajax_requests? | ||
end | ||
end | ||
|
||
def finished_all_ajax_requests? | ||
page.evaluate_script('jQuery.active').zero? | ||
end | ||
end | ||
|
||
RSpec.configure do |config| | ||
config.include WaitForAjax, type: :feature | ||
end |