-
Notifications
You must be signed in to change notification settings - Fork 691
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
Css: Delete confirmation with css-only modal #2946
Changes from 4 commits
1849529
1ed2ec3
05ad785
51e8472
1e64f36
6ed9a86
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,32 +61,6 @@ $(function () { | |
} | ||
}); | ||
|
||
$("#delete-collection").submit(function () { | ||
return confirm(get_string("collection-delete-confirm-string")); | ||
}); | ||
|
||
$("#delete-collections").click(function () { | ||
var checked = $(".panel ul#cols li :checkbox").filter(":visible").filter(function(index) { | ||
return $(this).prop('checked'); | ||
}); | ||
if (checked.length > 0) { | ||
return confirm(get_string("collection-multi-delete-confirm-string").supplant({ size: checked.length })); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All get_string must also be revomved from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved this. |
||
} | ||
// Don't submit the form if no collections are selected | ||
return false; | ||
}); | ||
|
||
$("#delete-selected").click(function () { | ||
var checked = $(".panel ul#submissions li :checkbox").filter(function() { | ||
return $(this).prop('checked') | ||
}); | ||
if (checked.length > 0) { | ||
return confirm(get_string('submission-multi-delete-confirm-string').supplant({ size: checked.length })); | ||
} | ||
// Don't submit the form if no submissions are selected | ||
return false; | ||
}); | ||
|
||
$("#unread a").click(function(){ | ||
$("#unread").html("unread: 0"); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,60 +75,90 @@ def _journalist_visits_col(self): | |
def _journalist_selects_first_doc(self): | ||
self.driver.find_elements_by_name('doc_names_selected')[0].click() | ||
|
||
def _journalist_clicks_delete_selected_javascript(self): | ||
self.driver.find_element_by_id('delete-selected').click() | ||
self._alert_wait() | ||
def _journalist_clicks_delete_collections_cancel_on_modal(self): | ||
self.driver.find_element_by_id('cancel-collections-deletions').click() | ||
|
||
def _journalist_clicks_delete_selected_cancel_on_modal(self): | ||
self.driver.find_element_by_id('cancel-selected-deletions').click() | ||
|
||
def _journalist_clicks_delete_collections_javascript(self): | ||
def _journalist_clicks_delete_collection_cancel_on_modal(self): | ||
self.driver.find_element_by_id('cancel-collection-deletions').click() | ||
|
||
def _journalist_clicks_delete_collections_on_modal(self): | ||
self.driver.find_element_by_id('delete-collections').click() | ||
self._alert_wait() | ||
|
||
def _journalist_clicks_delete_collection_javascript(self): | ||
def _journalist_clicks_delete_selected_on_modal(self): | ||
self.driver.find_element_by_id('delete-selected').click() | ||
|
||
def _journalist_clicks_delete_collection_on_modal(self): | ||
self.driver.find_element_by_id('delete-collection-button').click() | ||
self._alert_wait() | ||
|
||
def _journalist_uses_delete_selected_button_javascript(self): | ||
def _journalist_sees_delete_collections_confirmation(self): | ||
assert self.driver.find_element_by_id( | ||
'delete-confirmation-modal').is_displayed() | ||
|
||
def _journalist_sees_delete_selected_confirmation(self): | ||
assert self.driver.find_element_by_id( | ||
'delete-selected-confirmation-modal').is_displayed() | ||
|
||
def _journalist_sees_delete_collection_confirmation(self): | ||
assert self.driver.find_element_by_id( | ||
'delete-collection-confirmation-modal').is_displayed() | ||
|
||
def _journalist_clicks_delete_selected_link(self): | ||
self.driver.find_element_by_id('delete-selected-link').click() | ||
self._journalist_sees_delete_selected_confirmation() | ||
|
||
def _journalist_clicks_delete_collections_link(self): | ||
self.driver.find_element_by_id('delete-collections-link').click() | ||
self._journalist_sees_delete_collections_confirmation() | ||
|
||
def _journalist_clicks_delete_collection_link(self): | ||
self.driver.find_element_by_id('delete-collection-link').click() | ||
self._journalist_sees_delete_collection_confirmation() | ||
|
||
def _journalist_uses_delete_selected_button_confirmation(self): | ||
self._journalist_selects_first_doc() | ||
self._journalist_clicks_delete_selected_javascript() | ||
self._alert_dismiss() | ||
self._journalist_clicks_delete_selected_link() | ||
self._journalist_clicks_delete_selected_cancel_on_modal() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These should be after assert select_count > 0 because this assert verifies there are selected docs to work with. And after self._journalist_clicks_delete_selected_cancel_on_modal() there should be an assert like assert selected_count == len(self.driver.find_elements_by_name('doc_names_selected')) to verify no deletion took place. |
||
|
||
selected_count = len(self.driver.find_elements_by_name( | ||
'doc_names_selected')) | ||
assert selected_count > 0 | ||
|
||
self._journalist_clicks_delete_selected_javascript() | ||
self._alert_accept() | ||
self._journalist_clicks_delete_selected_link() | ||
self._journalist_clicks_delete_selected_on_modal() | ||
assert selected_count > len(self.driver.find_elements_by_name( | ||
'doc_names_selected')) | ||
|
||
def _journalist_uses_delete_collection_button_javascript(self): | ||
self._journalist_clicks_delete_collection_javascript() | ||
self._alert_dismiss() | ||
def _journalist_uses_delete_collection_button_confirmation(self): | ||
self._journalist_clicks_delete_collection_link() | ||
self._journalist_clicks_delete_collection_cancel_on_modal() | ||
|
||
# After deletion the button will redirect us. Let's ensure we still | ||
# see the delete collection button. | ||
assert self.driver.find_element_by_id( | ||
'delete-collection-button').is_displayed() | ||
'delete-collection-link').is_displayed() | ||
|
||
self._journalist_clicks_delete_collection_javascript() | ||
self._alert_accept() | ||
self._journalist_clicks_delete_collection_link() | ||
self._journalist_clicks_delete_collection_on_modal() | ||
|
||
# Now we should be redirected to the index. | ||
if not hasattr(self, 'accept-languages'): | ||
assert "Sources" in self.driver.find_element_by_tag_name('h1').text | ||
|
||
def _journalist_uses_delete_collections_button_javascript(self): | ||
def _journalist_uses_delete_collections_button_confirmation(self): | ||
self.driver.find_element_by_id('select_all').click() | ||
|
||
self._journalist_clicks_delete_collections_javascript() | ||
self._alert_dismiss() | ||
self._journalist_clicks_delete_collections_link() | ||
self._journalist_clicks_delete_collections_cancel_on_modal() | ||
|
||
self.driver.find_element_by_id('select_all').click() | ||
sources = self.driver.find_elements_by_class_name("code-name") | ||
assert len(sources) > 0 | ||
|
||
self._journalist_clicks_delete_collections_javascript() | ||
self._alert_accept() | ||
self._journalist_clicks_delete_collections_link() | ||
self._journalist_clicks_delete_collections_on_modal() | ||
|
||
# We should be redirected to the index without those boxes selected. | ||
sources = self.driver.find_elements_by_class_name("code-name") | ||
|
@@ -664,12 +694,12 @@ def _journalist_delete_all(self): | |
for checkbox in self.driver.find_elements_by_name( | ||
'doc_names_selected'): | ||
checkbox.click() | ||
self.driver.find_element_by_id('delete-selected').click() | ||
self.driver.find_element_by_id('delete-selected-link').click() | ||
|
||
def _journalist_confirm_delete_all(self): | ||
self.wait_for( | ||
lambda: self.driver.find_element_by_id('confirm-delete')) | ||
confirm_btn = self.driver.find_element_by_id('confirm-delete') | ||
lambda: self.driver.find_element_by_id('delete-selected')) | ||
confirm_btn = self.driver.find_element_by_id('delete-selected') | ||
confirm_btn.click() | ||
|
||
def _source_delete_key(self): | ||
|
@@ -682,14 +712,13 @@ def _journalist_continues_after_flagging(self): | |
def _journalist_delete_none(self): | ||
self.driver.find_element_by_id('delete-selected').click() | ||
|
||
def _journalist_delete_all_javascript(self): | ||
def _journalist_delete_all_confirmation(self): | ||
self.driver.find_element_by_id('select_all').click() | ||
self.driver.find_element_by_id('delete-selected').click() | ||
self._alert_wait() | ||
self.driver.find_element_by_id('delete-selected-link').click() | ||
|
||
def _journalist_delete_one(self): | ||
self.driver.find_elements_by_name('doc_names_selected')[0].click() | ||
self.driver.find_element_by_id('delete-selected').click() | ||
self.driver.find_element_by_id('delete-selected-link').click() | ||
|
||
def _journalist_flags_source(self): | ||
self.driver.find_element_by_id('flag-button').click() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about moving this to
modules/_modal.sass
or a similar name which would then be included in_base.sass
? Do you envision problems if doing that ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will check on this.