-
Posts
11,097 -
Joined
-
Last visited
-
Days Won
365
Everything posted by adrian
-
Is it possible to update page urls on links automatically?
adrian replied to cosmicsafari's topic in General Support
@cosmicsafari - please check out my fork of the AssistedURL module: https://github.com/adrianbj/processwire-fieldtype-assisted-url It stores links as IDs so links are updated if names are changed.- 3 replies
-
- 1
-
-
- update automatically
- assistedurl
-
(and 1 more)
Tagged with:
-
-
Yeah, already done on my dev copy - all PW variables are automatically added to the autocomplete. Agreed - I am working on this - I don't necessarily want to disable php autocompletions completely, but trying to tweak the triggering so it's not invasive when you don't want it.
-
-
Ok, I have implemented the ability to link to your own custom snippets file: If you're using a Github Gist, make sure you use the https://rawgit.com/ service because the raw file from Github is served without the correct mime type and won't work. The format of the custom snippet file is like this. Note the getCustomCodeSnippets() compared with the core snippets file which uses getCodeSnippets() var getCustomCodeSnippets = function() { return [ { name: "pwfind", content: "d(\\$pages->find(\"template=\${1:basic-page}\")->each(\"\${2:title}\"));", tabTrigger: "pwfind" }, { name: "pwforeach", content: "foreach(\\$pages->find(\"template=\${1:basic-page}\") as \\$p) {\n\td(\\$p);\n}", tabTrigger: "pwforeach" } ] }; At the moment the custom snippets file is PHP only. I don't think we will ever need other languages for this. I have also added in the ACE core snippet files for other web related languages so if you use the File Editor panel for JS, CSS, etc, there will now be a bunch of useful snippets for those languages as well. If you want to peruse the available ACE core snippets, the best way is probably here: https://github.com/ajaxorg/ace/blob/master/lib/ace/snippets/php.snippets You can also check out the snippets for other languages in the parent folder of that file.
-
I'd need to look into this a little more to figure out how to get the label if you have defined a manual value, but if you don't define a value, then it automatically returns the label: Would this work for you, or do you need to specify a value for each option? Got to sleep here, but this shows that you could parse this yourself by grabbing the field's colnoptions setting. Not exactly elegant, but it'll work..
-
I was actually thinking along those lines as well, but I do want to encourage PRs to main file that comes with Tracy as well. But yeah if you want to add support for pointing to a Github gist URL, or any other URL I suppose, I think that would be a nice addition.
-
OK, just released a major new version: 4.12.0 1) New Title/View link in Dump tabs, so ID is edit link and title/name is view link 2) New PagePermissions section added to PW Info panel: 3) New PHP and custom PW autocomplete snippets added to the Console and File Editor panels. Here's one example, but there are others in the posts prior to this one showing general PHP snippets. Currently there are two custom PW snippets: pwforeach and pwfind - I'd love to hear what you guys want to see here. If you have new snippet ideas, please take a look at: https://github.com/adrianbj/TracyDebugger/blob/master/scripts/code-snippets.js and feel free to send PRs with new additions. 4) Ability to dynamically resize the font in the Console and File Editor panels with: Increase: CTRL + +/= Decrease: CTRL + -/_ Reset: CTRL + 0 5) Changes to the way the Console panel divs are structured and resized - please let me know if you see any issues with the results panel protruding beyond the bottom of the panel or any other issues. It's still not perfect, but it's breaking my brain ? 6) Some minor Tracy core updates and also general cleanup of many of the custom panels. Please let me know if you have any problems with this new version, or ideas for improvements!
-
Hey @bernhard - sorry I forgot to respond to this before. This is certainly a possibility if there is demand. The advantage of course is that panel authors can maintain the codebase for their panel completely without relying on me to handle PRs etc. The downside is that new Tracy users needs to hunt around to find third-party panels so if we take this approach we'll want to make sure to list them all on a dedicated page on the docs site. Let me know if anyone out there is interested in this.
-
ACE also comes with a bunch of predefined PHP snippets. This will all be available in the next release of Tracy.
-
Sorry, not sure I understand how this makes things cross editor compatible. Honestly I think that all these should probably be in the core. After-all we have the actual snippets panel for you to define and use your own custom ones that others may not find useful.
-
OT again! just in case anyone is interested, I have started working on this: https://processwire.com/talk/topic/12208-tracy-debugger/?do=findComment&comment=174121 Would appreciate any and all input of those of you who love autocompletion snippets ?
- 246 replies
-
- 2
-
-
- visual studio code
- vsc
-
(and 2 more)
Tagged with:
-
Hey @bernhard and anyone else who might be interested. Following up on my thoughts over here: Here's my first test: This comes from a new file which currently contains: var getCodeSnippets = function() { return [ { content: 'd(\\$pages->find("template=\${1:basic-page}")->each("\${2:title}"));', name: 'find-pages', tabTrigger: 'pwfind' } ] }; I feel like there needs to be some thought put into how these should work and what the tabTrigger text should be. As you can see this one is about directly d() 'ing, but I am not sure whether it would be more versatile without that wrapping d(). Perhaps we could have both versions? Maybe we also want something that simply returns: foreach($pages->find("template=basic-page") as $p) { d($p); } I am really not sure what approach to take here. Also, do you guys want to contribute snippets to the Tracy core, or would you prefer being able to define your own in a file or in the config settings? Any thoughts? Thanks!
-
I would certainly welcome this functionality in Tracy, but I am not super excited on building this at the moment, but if you're feeling motivated, I am sure with the code from LK's module and the quick guide I just put together you should have a decent starting point. Of course it will need to be updated to support the new access functionality that Ryan added fairly recently.
-
Haha - no, errant keyboard shortcut saved the post ? It's been "completed" now, although it really needs some work and should be moved to the docs site as I mentioned.
-
I'd love some help ? If people have ideas for other panels that would be brilliant. It's really very simple to get a panel working and what you do with it is up to you. Maybe I'll add this to the docs site (https://adrianbj.github.io/TracyDebugger/#/) at some point, or maybe someone could do that for me, but here are the really quick basics. Create a new file under the panels subdirectory named to match the name of your new panel, eg: MyNewPanel.php In that file have a class MyNewPanel that extends BasePanel, eg: class MyNewPanel extends BasePanel { Add getTab() method optional isAdditionalBar() method to check if the current call to the panel is from an AJAX or Redirect debug bar. Some panels are not relevant for these bars, so you can check that and return if you wish. timer() method to check how long it takes to generate this panel. return a span with title tag (for mouseover of the panel icon in the debug bar) with the SVG for the icon and a label. It's up to you to assign the SVG to that $this->icon variable. public function getTab() { if(\TracyDebugger::isAdditionalBar()) { return; } \Tracy\Debugger::timer('myNew'); return ' <span title="My Panel"> ' . $this->icon . (\TracyDebugger::getDataValue('showPanelLabels') ? ' My Panel' : '') . ' </span>'; } Add getPanel() method if this panel does work with additional bars, then check for this and add the name of the bar in parentheses in the <h1> title output should all be contained in a tracy-inner div use generatePanelFooter to create the ms/kb values in the footer of the panel. The last parameter (optional) is for a hash link to the docs website return - parent::loadResources() actually currently returns nothing but it's in the BasePanel class and may be used again at some point, so should be included in the return. The minify() method is not mandatory but I use it in some panels with a lot of embedded JS / HTML. Note that it's very rudimentary and currently is broken by inline comments in $out so be careful. public function getPanel() { $isAdditionalBar = \TracyDebugger::isAdditionalBar(); $out = ' <h1> <a title="My New"> ' . $this->icon . ' My New </a>' . ($isAdditionalBar ? ' ('.$isAdditionalBar.')' : '') . ' </h1> $out = '<div class="tracy-inner">'; $out .= 'whatever you want output in the panel'; $out .= \TracyDebugger::generatePanelFooter('myNew', \Tracy\Debugger::timer('myNew'), strlen($out), 'myNew'); $out .= '</div>'; return parent::loadResources() . \TracyDebugger::minify($out); } You have access to these color constants from the main \TracyDebugger class: const COLOR_LIGHTGREY = '#999999'; const COLOR_GREEN = '#009900'; const COLOR_NORMAL = '#354B60'; const COLOR_WARN = '#ff8309'; const COLOR_ALERT = '#cd1818'; You can access module config settings with: \TracyDebugger::getDataValue('settingName'); Once the panel is built, you can add it to Tracy here: https://github.com/adrianbj/TracyDebugger/blob/dd617b8ca8f450b8891ecacaef2b3949698fc126/TracyDebugger.module#L139-L169 That's a very rough first draft of what needs to happen. I think the best place to start is probably the MethodsInfoPanel.php file because it's so simple. This process has reminded me of just how messy some things are ?
-
We have PHP function completion, but not completion for PW objects / functions etc. I could create a file to handle this but would need to script something up so that the completion file is built automatically from the PW codebase. Sounds good. I have actually been thinking about including a few default "code snippets" in the Snippets panel. Maybe this would actually be better as a "completion snippet". Sorry, trying to distinguish the two different things ? Obviously getting OT, so let's continue this in the Tracy thread, but I'd certainly like your input on this if you're interested. I don't have completion snippets turned on in the Console panel at the moment, but I'll take a look at this later and figure out the format required for snippets and then maybe you could put together a few useful ones.
- 246 replies
-
- visual studio code
- vsc
-
(and 2 more)
Tagged with:
-
@bernhard - you've got me thinking that many of these could be great additions to the Tracy Console and File Editor panels using ACE Editor's snippets functionality. Just to clarify - I am talking about code completion features of ACE and not the snippets list panel that I have added to the Console panel. Two totally different things ?
- 246 replies
-
- visual studio code
- vsc
-
(and 2 more)
Tagged with:
-
Sure - don't think I'll bother with the title attribute here though - it should be obvious enough. I also changed the order so the more important/relevant ones are on the left, although I am not really sure where "list" belongs ?
-
Yeah, I actually think that is probably cleanest - thanks! Maybe I should - I have on occasion, but maybe I should more often!
-
Honestly I don't know. I am actually pretty happy with the clean and simple I have now. I don't actually see using this for trying to get an overview of who can do what, but rather as a way to check that a certain user or role can do what I want them to be able to do. Given this, I actually think the striped rows is the most important visual distinction - find the role you're interested in and follow it across. But you're right, let's see what others think before we do anything. I might actually just commit things shortly and those interested can test and can provide better feedback.
-
You know you've just signed up to add your magic to this don't you ? PM on the way if you are actually interested in giving it a go.
-
Glad you found it useful - thanks for the kudos! Not sure if it's what you used, but pasting directly from Excel (using the tab delimiter) works great.
-
Ok, I have added this functionality to the RequestInfo panel like I suggested. This keeps things simple and always available. I got rid of all the background coloring - it's really not needed and I prefer the striped rows for clarity of info for each row. Current user is on the first row (and bolded to stand out) so if you're using the User Switcher panel you can quickly get all the details for that current user. I have a few other things in the works, but will commit this shortly.
-
I strongly vote against using the red color at all. IMHO having "no access" colored red is wrong, if you want the role not to have access! So it would be indicating a problem where everything is actually fine. I think this is a good point. Maybe it really is just cross vs tick and no background colors at all? This panel is just page permissions for the currently viewed / edited page. I don't want to get into a roles/permissions matrix. I think this is why it probably does belong as a section in the RequestInfo panel. It's not meant to be a big "all knowing" overview of permissions and roles.