Jump to content

Robin S

Members
  • Posts

    5,008
  • Joined

  • Days Won

    333

Everything posted by Robin S

  1. This would remain the same under my proposal - the only difference is the way the snippets are saved and retrieved. Instead of reading from and writing to the DB, Tracy would read from and write to a file. You would still be free to modify a snippet in the console. As you say, code changes made in the Console get saved to file when the save icon is clicked (just like they are now to the DB). You're right that changes made to a file would require some kind of reload process in Console (ajax-powered, ideally). Depending on how snippets are loaded, this might only affect the currently visible snippet - if each snippet is a separate file I could imagine that on opening the Console window Tracy would initially just grab the filenames to build the snippet list, and only load a snippet's code from file to Console when a snippet is selected in the list. So changing a snippet that is not currently visible would not result in any sync issue. And for the currently visible snippet, I can't see sync being a big issue - users will tend to prefer either the Console or their code editor and will probably stick to using one or the other rather than both simultaneously (or if they do use both, they will become mindful of the implications of doing that ). Things like this wouldn't be necessary IMO.
  2. Hi @adrian, To date I haven't used the Console panel much, because I prefer to write API snippets in my IDE (API code completion, version control, and having the code saved to disk just feels safer than trusting storage to a module). But I like the way the Console panel shows a handy list of snippets that can be executed by authorised users only (normally just superuser). I see that the Console snippets are stored in the database as part of the module config data. What do you think about using a file for the saved snippets instead, with some scheme for labelling and delimiting the snippets within the file? Some benefits could be: Use an IDE / code editor to write snippets. Version control and file backups become possible. Easily share snippets between projects by copying the file or portions of it. No problems with exceeding the length limit of the config TEXT field in the database. Edit: might be easiest to use one file per snippet, if there's no great performance penalty to that.
  3. For one reason or another, output formatting must be off when the PTE inputfield is rendered. To work around this, try... // media_pagereference.php <?php namespace ProcessWire; $refPage = $page->getFormatted('pageReference'); // value will vary depending on "Page field value type" setting if ($refPage->id) { $img = $refPage->image; echo $img->url; } ...or more reliably (since it will work regardless of the "Page field value type" setting)... // media_pagereference.php <?php namespace ProcessWire; $refPage = $page->getUnformatted('pageReference'); // always a PageArray if ($refPage->count) { $img = $refPage->first->image; echo $img->url; }
  4. You can't enter a Hanna tag via the "Insert link" modal because the href gets entity encoded. But you can use a Hanna tag for generating the whole link: // Hanna tag "year_link", with attributes "url" and "link_text" $year = $pages->get('/settings/')->year; $href = $url . $year; $text = $link_text ?: $href; echo "<a href='$href'>$text</a>"; Usage: Please fill out this [[year_link url="http://www.somewhere.com/form1/" link_text="form"]]
  5. First, I really like this admin theme! So what follows isn't meant to be a full picture of my reaction to it because overall I love it - just a few things that could use tweaking IMHO. Fonts Currently users will see completely different fonts depending on what OS they are using. The font-family rule is: font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif It's become popular lately to use system fonts like this (was it GitHub that started it?) but the problem is that the fonts in this stack are not very similar. It's one thing to fall back to Arial if Helvetica isn't available because they are so similar that the average audience won't be able to tell the difference. But San Francisco, Segoe UI, Roboto and Helvetica Neue are completely different typeface designs. So for instance there will be no consistency with x-height or position of type within the line-height box across platforms, so what looks pixel-perfect on MacOS might look sloppy on Windows or some other OS. If the desire is to move away from the bog-standard Helvetica/Arial then wouldn't it be better to bundle an open-source webfont kit with PW so there is reasonable consistency across platforms? From the blog post screenshot: From the demo site, Windows 8.1: Search box Like the current default admin theme search box styling, I think this is way too subtle: I have 20/20 vision and I can only barely make out the bounds of the search box - imagine what it's like for users with less-than-perfect vision. The search feature is hugely useful for quickly finding a page to edit in a deeply nested tree structure, so we want users to know that it exists. With the current admin default theme, most of my clients had never noticed the search box (until I boosted the contrast in some custom admin CSS). Tab metaphor For a tab metaphor to make sense there has to be some visual connection between the active tab and the content within that tab. Otherwise it isn't clear what content on the screen is controlled by the tab. On this screen... ...not knowing better, I would expect the tabs to control only the Title, Date and Headline fields. Body looks like it is outside of the tabbed content and so the expectation is that it remains on screen when switching to a different tab. Of course you learn how it works once you use it, but every time a thing works differently to how a user expects it to work there is a little bit of mental friction - a bit more effort required to understand it and a bit less satisfaction. I understand that there is a setting for controlling the border style of different fields (although it is disabled in the demo so I couldn't easily try it) - that's great. But I think the default style should be one that lends itself to the tabbed interfaces that are used throughout the PW admin (i.e. a visible border that connects to adjacent fields that are within the same tab). Breadcrumb separator Getting a little nit-picky here, but I think a guillemet › is a better breadcrumb separator than a slash /. The breadcrumb is supposed to indicate a hierarchy of pages. With the slash there is less sense that Posts is within Blog. It looks like a group of items that are all on the same level. Container width My preference is for some max-width to be set for pw-container (1600px maybe?). On my 2560px-wide monitor the interface becomes too wide for comfortable use. But that's an easy override for me to apply if there's no agreement on that.
  6. Not what was asked, but if you ever have a need to get all the field values and properties of the page in an array you can do this: $data = (array) $page->getIterator();
  7. GitHub issue opened here: https://github.com/processwire/processwire-issues/issues/399
  8. No, it doesn't search as a phrase but it does require all of the words to be present in the field, and does not match partial words. So if $q = "red dog" it will match "I have a dog and she loves red frisbees" but it won't match "I have three red dogs". When using the %= operator with multiple words, you will need to explode on spaces and foreach: $q = preg_replace("/\s+/", ' ', trim($q)); // trim and replace multiple spaces with single space $q_words = explode(' ', $q); $selector = "template=product, limit=10"; foreach($q_words as $q_word) { $selector .= ", title|subtitle|summary|body|product_isbn|authors.authors_name%=$q_word"; }
  9. @JoshoB, the problem is in the first line: $q = str_replace(' ', '|', $q); You are replacing the space character with the selector "or" operator, meaning wherever you use $q you will match fields with any of the words. So you want to remove that line. By the way, your way of matching the author title in the repeater is unnecessarily verbose. You can replace... authors=[authors_name=[title%=$q]] ...with... authors.authors_name%=$q ...because in a selector PW will try to match a string to a Page Reference's title by default. This selector should do what you want: $selector = "template=product, limit=10, title|subtitle|summary|body|product_isbn|authors.authors_name~=$q)";
  10. Cool stuff! The profiles you mention: are they a different format from the profiles produced by ProcessExportProfile? Just wondering because you said... ...but site profiles from ProcessExportProfile can include modules, so wasn't sure.
  11. @Ivan Gretsky, if you have Imagick installed you could use this function I wrote a while back for easy ImageMagick effects: It does quite a nice blur. But now that supporting IE is less of an issue you could also try a CSS filter.
  12. When debugging something like this (for a possible bug report) it's best to do it on a new PW installation on your localhost - you don't want to be messing with your actual project installation. It only takes a few minutes to do a fresh install for testing purposes.
  13. Still works for me... You're testing this with no other non-default modules installed apart from FieldsetPage?
  14. No problems here uploading images inside a FieldsetPage, whether the FieldsetPage is inside a FieldsetTab or not.
  15. @webhoes, I haven't used the Multisite module, but the readme you should have defined separate 404 pages for each domain. So this kind of setup is probably not compatible with Process404Search out-of-the-box. But based on this section of the readme... ...you should be able to get the correct links by modifying the search.php adrian refers to above: foreach($viewableMatches as $m) { $url = "{$input->scheme}://{$m->rootParent->name}/{$m->url}"; $content .= "<p><a href='$url'>$m->title</a></p>"; } Not tested. Also note that your page tree... ...is what the Multisite readme says not to do:
  16. I'm adapting a printed manual to an online document, and need to recreate tables like this:
  17. This sounds interesting but I'm not quite getting it. Could you give some examples of what kinds of scenarios this would be useful in? I thought the PagePathHistory module took care of everything automatically so you never need to think about manually creating or editing redirects. Or does this module allow you to also create redirects when there never was a page at a particular URL? e.g. /some-path-where-there-never-was-a-page/ => /some-page-that-exists/
  18. Based on that thumbnail URL I'd be looking closely at ProDrafts. You could try a clean installation with only ProDrafts added and see if the fieldset issue is reproducible.
  19. I think I have things set up the same as you and it's working... Repeater fields (title visibility is set to "hidden"): Hook: $wire->addHookAfter('Pages::saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'repeater_test_repeater') { $title = 'No pages selected'; if($page->test_page->count) $title = $page->test_page->implode(', ', 'title'); $page->title = $title; } }); Result: Tracy Debugger will be helpful in debugging what is going inside your hook.
  20. Looking around, it seems that getting/saving/loading the table metadata like merged cells and comments is not well supported/documented in Handsontable. And I think the merge cells plugin is undergoing an overhaul currently. There are a few hacky examples out there and when I get around to it I'll see what I can come up with and report back. But for my current project I have decided to go with a different solution for tables (tables in CKEditor plus some jQuery manipulation is proving adequate... barely ).
  21. This is an issue with the Process Batcher module so you might want to raise it with the module author over in the support thread. If you're using Batcher in PW3 you'll need my PW3-compatible fork until the pull request is merged.
  22. The first hook in your post works as expected for me - it sets the title field inside the repeater item (assuming there is a title field included in your repeater). But the last hook in your post looks like maybe you are instead trying to do something different - like you have a one "variations" repeater nested inside another "variations" repeater and you are concatenating the titles of the nested repeater to the parent repeater title. Incidentally, you should add a template check in that hook or you will get a PHP error for invalid foreach argument on any page that doesn't include the variations field. Can you explain some more about what the objective is?
  23. You'd think so, but test it and I think you'll find that assets added in renderReady() are always loaded when the inputfield may appear in Page Edit, even if AJAX-loaded. So for example, you can put an inputfield with a JS dependency such as PageAutocomplete in a repeater, and put that repeater inside another repeater (so the PageAutocomplete inputfield is definitely not being rendered initially) and you'll find that the PageAutocomplete JS dependency is included in Page Edit. PW seems to be smart like that.
×
×
  • Create New...