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
Template picker #13905
Template picker #13905
Conversation
Nice solution! But could you remove the css changes from the PR and mark it with 'build required'. The scss changes are enough and don't lead to large merge conflicts. |
@Oetzie
|
You need to rebase this PR with current 3.x branch. Right now there a lot of old code, for example you can't upload image in the root of media source because of old media sources. This will stop many people from test it. |
d083275
to
2a13781
Compare
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.
Few small tweaks needed, but overall this looks like a solid improvement that especially end-users should find useful.
if ($this->modx->hasPermission('new_document')) { | ||
$record = '{context_key: \"' . $this->modx->getOption('default_context') . '\", parent: 0}'; |
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.
Probably safer to turn this into a json_encode
to ensure it's valid JSON.
if ($this->modx->hasPermission('new_weblink')) { | ||
$record = '{class_key: \"modWebLink\", context_key: \"' . $this->modx->getOption('default_context') . '\", parent: 0}'; |
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.
Same as above
if ($this->modx->hasPermission('new_symlink')) { | ||
$record = '{class_key: \"modSymLink\", context_key: \"' . $this->modx->getOption('default_context') . '\", parent: 0}'; |
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.
Same as above
if ($this->modx->hasPermission('new_static_resource')) { | ||
$record = '{class_key: \"modSymLink\", context_key: \"' . $this->modx->getOption('default_context') . '\", parent: 0}'; |
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.
Same as above
fn : function(data, data2) { | ||
console.log('failure'); | ||
console.log(data); | ||
console.log(data2); |
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.
These console.log
statements should be replaced with "proper" error handling. That could be as simple as an alert showing the failure reason or a MODx.Msg
'</tpl>', { | ||
group : null, | ||
label : null, | ||
getGroup : function(label, time) { |
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.
Help me out here - why is this including the time? What's that for?
typeAhead : true, | ||
tpl : new Ext.XTemplate('<tpl for=".">' + | ||
'<tpl if="!Ext.isEmpty(this.getGroup(values.category_name, values.time))">' + | ||
'<div class="x-combo-list-group">{this.label}</div>' + |
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.
As the label
appears to be coming from a remote source , please add htmlEncode
as filter to it to prevent persistent XSS.
typeAhead : true, | ||
tpl : new Ext.XTemplate('<tpl for=".">' + | ||
'<tpl if="!Ext.isEmpty(this.getGroup(values.context_name, values.time))">' + | ||
'<div class="x-combo-list-group">{this.label}</div>' + |
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.
Same as earlier, please add htmlEncode
to this.label
to prevent potential XSS.
Sorry for late response, I will try to fix the feedback from @Mark-H thursday |
Let us know if we can help you @Oetzie |
@Oetzie Is there time to finish the job you have started? |
@Oetzie ping... |
@gpsietzema I know this is something Sterc was really excited about, but it's conflicting massively against latest 3.x, and there has not been movement in 9 months on any of the requested changes. If you're still excited about this feature, can you please work it into your internal planning to keep this moving? For now I'm going to close the PR, but I hope to see a fresh one opened again soon. :) |
What does it do?
The new template picker feature. Before you create a new resource you will get a window where you can choose the 'pagetitle' and preview the 'template' (if screenshot is available). This PR also includes the new 'parent field combo' and 'template field combo'.