User tests: Successful: Unsuccessful:
Pull Request for Issue #14562
and
#14816
Implementing an alert to remind the user to save the Target when using the Close button.
Change "Default" to "Undefined" when the Target is not saved when using Copy Reference to Target (I.e. displaying 'Undefined" in the same way as when one deletes a content language and some items were tagged to that language.)
After patch, you should get:
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_associations Language & Strings Layout JavaScript |
And now you have a content item with a language of undefined which is just as useless as one of default.
This PR is a possible solution until someone finds a way to save2copy AND port the Target language to the item created.
We must not describe the issue as heavier than it is really. It certainly is not a release blocker:
If closing without save, one just has created an item which is useless and not associated, and existing associations are not touched.
Obviously, if one has a better solution, I will be happy to close this.
I have tested this item
Applied the pr
Selected copy reference to target and then it got stuck in a loop of repeatedly trying to copy the article and never completing
No loop here. It works fine although it is slow on my machine.
Maybe you did not patch as should?
Tested in two browser with debug on and off (to load the uncompressed js)
I click on the unassociated language icon for an item
the item opens unbelievably slowly and then just keeps refreshing
strange - just reverted the patch and still have the loop - must be something else. will do a clean install and recheck
@infograf768 what is the real problem here?
The form shouldn't submit if the language is not selected in the right pane?
Let's fix the root problem, instead of trying to mess the UX here.
I think the solution is to get a modal asking what language the new association when pressing the copy reference button. Then do the magic in the controller so that the cancel button won't have any weird effect. This is similar to batch functionality
The problem is this
You select a language that is not associated to an article from the component list view
You now have the origin on the left and an empty editor on the right with the NEW language preselected
You click on the Copy Reference to Target
After a while you get a message that the article is saved
You look and you see that the Target is set to the intended language
You dont need to make any more changes to the article (you are just doing a quick prototype) so you click close.
Then go to the article manager
You epxect to see the original article in the original language and a copy of the article in the language you selected before associated to it
You actually have the original article in the original language and a copy of the article in a language called Default and there is no association
To prevent this with the current code you have to Select Save Target even though it has already told you it has been saved and it is showing the correct language and you have not made any changes
@dgt41
When one choose Copy to Reference, the js uses save2copy.
But, and its good, as we wanted, the language of the created item is the language chosen for the Target in the form.
The issue is that Save2Copy has not yet tagged the copy to that language. The target exists with an id, its content, but no language yet as the language field is not used when we save2copy
The Target HAS to be saved to get its correct language. Close may only be used after save.
even though it has already told you it has been saved
No, it tells you the reference is saved in its Iframe (in fact it is a draft save preparing the recording of the association) which will become effective only when a full Target with its language is saved.
@infograf768 So the iframe needs to fire automatically a save
event in the parent?
Did I ever told you how much I hate iframes?
And I insist once more: Using Save Target is not difficult to learn, and is 99% of the time necessary as many things in the Target created by Copy Reference have to be modified to fit.
Once the alert is displayed, one has no excuse to use Close without thinking...
maybe we can try to set new language before call "submit Save2Copy" by javascript, hm
append it to the url and catch it in the controller... (just an idea)
the language input already in the form, so it will override URL var during POST request,
but cannot test currently
OK sorry about that the loop issue was something local not related.
However please consider this
Once the alert is displayed, one has no excuse to use Close without thinking...
then let' get rid of copy reference. easy enough. until someone finds a solution. no p for me.
Labels |
Added:
?
?
|
Category | Administration com_associations Language & Strings Layout JavaScript | ⇒ | Administration com_associations Language & Strings JavaScript |
I have made some test, and we can set language by javascript before submit 'save2copy':
else if(task == 'copy')
{
var reference = document.getElementById('reference-association');
var target = document.getElementById('target-association');
var referenceLang = reference.getAttribute('data-language');
var targetLang = target.getAttribute('data-language');
var referlangInput = window.frames['reference-association'].document.getElementById('jform_language');
referlangInput.value = targetLang;
window.frames['reference-association'].Joomla.submitbutton(document.getElementById('adminForm').getAttribute('data-associatedview') + '.save2copy');
}
also need to comment out (for test)
// Disable language field.
reference.find('#jform_language_chzn').remove();
reference.find('#jform_language').attr('disabled', true).chosen();
But still, the copied article will stay after push the cancel button.
So no idea.
Maybe we just remove "Copy Reference to Target" button for now ?
@Fedik i've tested your snippet and i think in this way we solve the "issue"
that when we push "Copy Reference to Target" without pushing "Save Target"
the target lanuguage is not correctly handled
infact now the copyed item is saved with the correct languge
i've copyied from IT to EN
so i will go with your patch,
But still, the copied article will stay after push the cancel button.
we should solve one issue at time ;)
Will test.
The Close button is only a Cancel button when some editing has already been done on existing items and Save has not been used. As save2copy has created the item already in db, it does not delete the copy from db.
@Fedik
It works for the save2copy.
One aspect to solve is to re-instate
// Disable language field.
reference.find('#jform_language_chzn').remove();
reference.find('#jform_language').attr('disabled', true).chosen();
after Copy Reference to Target, as the language field in the reference item is now changeable.
As save2copy has created the item already in db, it does not delete the copy from db.
I thought would be good if save2copy also add the association. Then there will not exist a "ghost" articles, after push the Cancel.
@Fedik
We would be in the same situation when manually creating a Target, then save it.
In that case the association is created, but one can still clear the target and choose another item to associate. The item formerly created is still existing in the db.
Therefore I would not worry about that.
More important imho is to re-instate disabling language field after save2copy
@Fedik
Please keep me posted on your progress to take a decision about this feature.
If we keep it, I have another patch ready to check if the component is using save2copy (in the component associations helper) as some 3rd party components may not be implementing this.
@infograf768 I will ping you when will do PR, but I think it will be not faster than weekend
No p.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-03-25 16:46:07 |
Closed_By | ⇒ | infograf768 |
This doesn't really resolve the problem. Yes it displays a message if you press the close button but if you were to close the browser or the session was to time out you still have the problem. The UI said it was saved but it hasn't been saved in the target language even though the language had been selected