Jump to content

adrian

PW-Moderators
  • Posts

    10,898
  • Joined

  • Last visited

  • Days Won

    348

Everything posted by adrian

  1. ACE also comes with a bunch of predefined PHP snippets. This will all be available in the next release of Tracy.
  2. 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.
  3. 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 ?
  4. 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!
  5. 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.
  6. 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.
  7. 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 ?
  8. 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.
  9. @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 ?
  10. 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 ?
  11. Yeah, I actually think that is probably cleanest - thanks! Maybe I should - I have on occasion, but maybe I should more often!
  12. 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.
  13. 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.
  14. 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.
  15. 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.
  16. 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.
  17. @kongondo - just wanted to check to make sure the new "current user" row at the top of the table helps with your initial concern?
  18. Nice ? Typically in the Console, you are better off using d() which dumps to the results panel below. This isn't about permissions in the sense you are talking about. It's just for these page permissions: https://github.com/processwire/processwire/blob/341342dc5b1c58012ae7cb26cffe2c57cd915552/wire/core/Page.php#L88-L107 Maybe it needs to be reimagined, but that was my initial goal for this. What does everyone think?
  19. Hi everyone, Thanks for all the good thoughts and ideas! There is of course the User Switcher panel which I use the all the time to check issues a client is having - that's the best way to see the site the way they are seeing it. I have just added a new row at the top of the table that shows the permissions for the current user (in this case "ajones"), so this is either you, or if you are using the UserSwitcher panel then it will obviously be for that user. Does that help with what you are looking for? It is using the same colors as the other panels. The colors are all now defined as constants. in the main TracyDebugger class. I know it's a bit loud here, but the idea is for form over function in identifying which roles don't have a certain permission. That said, I'd also be ok with this if you guys prefer: The key thing I think is that I know how many permissions there are and they easily fit on the width of the screen. I don't know how many roles there will be. Does anyone else have any thoughts on this? Not sure if I can because the script that handles the dump doesn't actually know how many dumps are coming, but maybe it can be done with JS after the fact - I'll take a look. I'll need to think about this some more - I feel like we are starting to get into the territory of this module: http://modules.processwire.com/modules/process-access-overview/ which is not really the goal here, or at least it wasn't. I'll let you guys chime back in on what you think would actually be most useful. Thanks again for all the feedback - greatly appreciated!
  20. Anyone have any thoughts for this new panel before I publish it? Pretty self-explanatory - it shows the status of the various permissions for the current page for all user roles. This should make it much easier to quickly check things if a client complains they don't have access to do a certain action on a specific page. I'll probably commit tomorrow, but just wondering if you guys have any other ideas for this first. Actually, I am now wondering if perhaps this should just be a new section in the RequestInfo panel, rather than a dedicated panel. Any thoughts on this? Thanks!
  21. No problem at all - it was an easy fix at my end for AdminActions - just a bit of initial confusion ?
  22. Awesome - thanks for your help getting this sorted out!
  23. Interesting - turns out that AOS actually adds AdminThemeDefault to html which is why it was working for me here. @tpr - is this something that can or should be changed? Anyway, thanks for helping to debug this - I have updated the CSS with part of what you provided above, but it had a problem with UiKit, so it's a combined version that seems to work with both themes and with AOS on and off. Please let me know if it looks ok at your end. I think if you save the module settings page it should fix the icons. Can you please confirm.
  24. Surely this is the simplest approach, or maybe I am misunderstanding? foreach($page->fields as $f) { echo $page->$f; }
  25. Also curious why you aren't seeing the icons I recently added to all of the actions - does saving the settings page take care of that?
×
×
  • Create New...