-
Notifications
You must be signed in to change notification settings - Fork 333
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
FIX for #1312 to ensure preview pain state is properly maintained when editing page URL segment. #1449
Conversation
@patricknelson is this suffix being set properly in the right places? |
You're right. I'm also realizing there's no nice clean, normalized and centralized way to properly maintain state just yet (per se). That is, there's a On top of that, the link that this is associated with (for the URL segment) once updated doesn't yet point to a valid URL. That is, if my URL segment is currently So I'd actually propose eliminating this completely, actually. That is, the use of the Thoughts? |
Here's a rough comp of what I'm referring to. If you ever edit the field, it will show this first message. If you have a URL segment that differs from draft vs. published, the second message (or something similar) would have to be displayed. Visually the link is updated, but it would technically still point to either |
@@ -30,7 +30,7 @@ public function getAttributes() { | |||
parent::getAttributes(), | |||
array( | |||
'data-prefix' => $this->getURLPrefix(), | |||
'data-suffix' => '?stage=Stage', | |||
'data-suffix' => '?stage=' . $this->getURLSuffix(), |
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.
The suffix should include the ?stage=
in it; See SiteTreeURLSegmentField::getURL(), which joins this value on as though it was a full querystring.
setURLSuffix is never set anywhere, so this change would currently break. You'll need to make sure this method defaults to ?stage=Stage
if it's not set.
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.
Noted. Please see the conversation here for a suggestion on divergence from this implementation: #1449
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.
Huh where? This thread? Sorry I didn't get that from the conversation above... I guess I'm just slow today. :D
I think it makes sense to show a warning message when there is an unsaved or unpublished URL change. I think that the visual representation you've mocked up is a bit on the large side; I'm not sure if @clarkepaul has ideas for how we could indicate to the user that the URL has been:
I also wonder why URL would be the only field where we indicated at a field-specific level that there are unsaved changes. |
Right @sminnee think of the mock-up more as a wireframe than an actual mock-up, then. It's too easy to get caught up in that, but more important is the concept and verbiage to hash out first rather than appearances. I do agree that it's pretty big! Maybe a bit too much for sure. Also re:
It's because this is the only field that links directly to the front-end, which is confusing because the UI there (the Side note: Then there's the preview mode... this disambiguation helps to resolve that. Should also take into account current preview mode (i.e. Also, to make sure we're covering all scenarios properly, maybe it's best to think through each situation. The variables are the page status (published vs. unpublished) and changes (saved or unsaved). Spelled out, that creates this list of 6 possible current states:
So we should walk through each one and say "Does this solution fit this scenario? Yes/No" and then I think we can move forward. For example, looking at state 6 tells me already there's a third thing we would need to do: Maybe a little flag/warning indicating that this URL will not be available for preview until after you save it. Also thinking about what the user see is their current preview mode is |
Here's a further breakdown of what could happen in each scenario for your review. IMPORTANT: This table assumes that the URL differs between published/draft! The notes below are not relevant, otherwise. Link 1 is the most recent link (either unsaved or current draft, if it differs from published) and link 2 is the link that would exist in any sort of warning message.
Let me know if you want a plaintext version of the markdown for this table so you can tweak yourself without having to recreate it (tedious). |
I'm still waiting for a response to my query... it was responded to with a link straight back to this same PR? |
@tractorcow Could you provide more context to what you're saying here? Which query? What response? |
66a7972
to
f869fb9
Compare
Thanks @dhensby but I'm not sure that comment has any query per se, so I'm still confused. I don't think there's anything for me to do here as I believe the ball is in your court to help me decide on what you'd prefer to do in this situation. Please see my comments above (the big ones with the fancy tables) which I believe should be taken into account before we make any real changes per se. Specifically #1449 (comment) and the one immediately after that. We should take a moment to think through all of the implications of how this field should link to the front-end page, since, in this case, one solution here may not fit all situations that would arise. |
@patricknelson what I meant was, the code should look as below 'data-suffix' => $this->getURLSuffix(), Not 'data-suffix' => '?stage=' . $this->getURLSuffix(), Sorry if I wasn't making this clear. |
…intained when editing page URL segment.
f869fb9
to
0c7ef84
Compare
Holy dooley @tractorcow! I see what you mean now, that makes more sense. Do you have the power (or patience) to read through and make a call on the outstanding question I had? |
My rushed answer is that I don't think it would help to have a second link... it would just make things confusing. If a link is changed but would result in a 404 if clicked (i.e. unsaved) then I could see adding a css visibility change (maybe make it red) with a small note. E.g. Regarding this pull request; #1312 is addressed by this issue, but you now break the functionality, as there is no default assigment for this field. You could put a |
Addresses #1312. Should help ensure state in the preview pane is properly maintained when user is NOT in draft mode (aka internally as "Stage").