Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2018-04-03 22:03:01

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: glz_custom_fields v2 beta for Textpattern v4.7

I’ve made some updates to this one too to accommodate your feedback. They’re in the dev branch for the moment pending your testing.

Changes

  • Relaxed the table widths as per your suggestion and made the drag script try and fix the widths better when dragging.
  • List options. Thanks for your suggestion Philippe but I opted instead to disable them entirely. They didn’t originally appear (see original screenshot), only in more recent dev updates. With the couple of columns we have here, it’s usefulness is limited and it can interfere with the drag-sorting.
  • Fewer unnecessary privs (keeps rah_privs cleaner :-) Some of them were already behind identical system privs. I don’t think I broke anything here.
  • File paths are no longer checked on every prefs page load. Although no-one else has reported pageload slowdowns, it is conceivable that it will affect more people. I’ve added a “check paths” button to do the test on-demand. Clicking “check paths” causes the check to be performed (the page load will then be slower, of course, while it does that) and reports success or fail. If the timepicker or datepicker won’t load on the write tab, the link in the error message takes you straight to “check paths”.

If these prove okay with you lot, I’ll merge them back into the main branch.

Updating

Grab the new installer and update glz_custom_fields.min.css too.


TXP Builders – finely-crafted code, design and txp

Offline

#26 2018-04-03 23:49:45

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: glz_custom_fields v2 beta for Textpattern v4.7

I’ve added a “check paths” button to do the test on-demand.

Could that button be inserted after the headline; if feels weird to see it there.

<h2>Custom fields preferences</h2>
<p>insert button here</p>
<div class="txp-form-field">rest of stuff

Relaxed the table widths as per your suggestion and made the drag script try and fix the widths better when dragging.

Thank you for that.

Regarding the top part of the custom fields panel. Agree that the list options button isn’t strictly needed (when I tried to use, I could’t hide the sort column). But I’d still argue for matching the Core layout as I mentioned in the Github issue; e.g. a plugin could do “something” with (all) the list tables and add a button in the same location as the list-options button.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#27 2018-04-04 09:47:12

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: glz_custom_fields v2 beta for Textpattern v4.7

phiw13 wrote #310599:

Could that button be inserted after the headline; if feels weird to see it there.

Hmm, maybe. What could be done easily is to simply force it to be on a new line (or perhaps ranged right) with css.

The thing is the preferences table is mighty clever: it basically creates itself from a list of preferences assigned to a particular prefs group. The header is automatically created from the prefs group language string, the prefs labels from the language strings matching the pref, the subheadings likewise from prefs subgroup. The only bit you can adapt to each situation is the input method by creating a custom function for it.

As far as I can tell – though I may be mistaken – the only way to add a button at another position is to create a “blind” preference record and a function for the button, which seems a bit extreme for a single link. I kind of fudged it by putting the button in the language string – which is probably poor coding style – but works.

Stef did point me to an arguably better way of doing the check using an ajaxified button that performs the checks, picks up the results and then adds the success/error messages but for the moment I failed in my attempts to do it that way, plus I can’t work out how that can be called from another page (I think it’s useful if the link from the “datepicker -> go fix it” error on the write tab automatically performs the check paths routine). Currently, these things exceed my programming skills/knowledge level, but a PR would be very welcome if someone else can fix this for me.

Regarding the top part of the custom fields panel. Agree that the list options button isn’t strictly needed (when I tried to use, I couldn’t hide the sort column). But I’d still argue for matching the Core layout as I mentioned in the Github issue; e.g. a plugin could do “something” with (all) the list tables and add a button in the same location as the list-options button.

I’m still not sure. As far as I’ve been able to discern, the list options now get added automatically to any table with class="txp-list" and it’s options are determined by what column headers are generated by textpattern. I just suppressed it by assigning class="txp-list--no-options" (cudos to the devs for making it so easy).

With the drag-and-drop sort option activated, the position column is hidden and the sort column is added with jquery after the table has already been generated. Hence it can’t be hidden in the list options because no option was generated for it when the page layout was created. You can, however, activate the “position” column when using drag-sort which is just begging for confusion because it won’t automatically update when you drag and drop.

If you would rather not have the sort options, switch it off in the preferences altogether and you won’t see it at all. You’ll need to assign position manually as before, though.

One option might be to show the list options when drag-and-drop is set to off. Might that be a help?

Incidentally, drag-and-drop sort is also the reason why I haven’t included any paging options (you can’t drag-sort across pages). My thinking was that most sites will have a handful or two of custom fields and that most people would prefer to use drag-and-drop than manual entry. For long lists of custom fields, it’s not optimal. I could activate pagination when drag-and-drop is switched off. It does mean, though, that you will have to use the long-winded manual entering of position numbers. Switching drag-and-drop on or off happens in the preferences so can’t be changed on the fly.


TXP Builders – finely-crafted code, design and txp

Offline

#28 2018-04-05 06:06:34

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: glz_custom_fields v2 beta for Textpattern v4.7

jakob wrote #310608:

Hmm, maybe. What could be done easily is to simply force it to be on a new line (or perhaps ranged right) with css.

The thing is the preferences table is mighty clever: it basically creates itself from a list of preferences assigned to a particular prefs group. The header is automatically created from the prefs group language string, the prefs labels from the language strings matching the pref, the subheadings likewise from prefs subgroup. The only bit you can adapt to each situation is the input method by creating a custom function for it. (…)

Dang. I was afraid that it was more than complicated :-(. Ok. I am not really comfortable with having that as part of the headline (accessibility, semantics…). But if any other solution is currently out of reach, how about the following: instead of a button, just make it a plain link, floated to the end of the line (on larger screens) – and remove all the other stuff you have for that block):

.check-path {
  float: right;
  font-size: .7em; /* the font-size then matches normal text with both Hive and Sandspace) */
  font-weight: 400;
}
[dir=rtl] .check-path { float: left; }

One other thing I noticed while looking at the glz_custom_fields.js towards the end.

$glz_select_instructions.html("<a href=\"http://"+window.location.host+window.location.pathname+"?event=prefs#prefs_group_glz_custom_f\">" + GLZ_CF.messages['configure'] + "</a>");

You are forcing the use of http. That is not nice, some people do use https, and what more, with strict Content Security Policies.

This ought to work fine:

<a href=\"//"+window.location.host+window.location.pathname+

Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#29 2018-04-05 08:35:37

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: glz_custom_fields v2 beta for Textpattern v4.7

Thanks for checking so diligently and thinking of edge cases that I’d not taken into account. I’ve incorporated your various suggestions, updated and expanded the help infos a little, and uploaded new css/js + zip files and recompiled plugins.


TXP Builders – finely-crafted code, design and txp

Offline

#30 2018-04-05 12:00:28

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: glz_custom_fields v2 beta for Textpattern v4.7

jakob wrote #310629:

Thanks for checking so diligently and thinking of edge cases that I’d not taken into account. I’ve incorporated your various suggestions, updated and expanded the help infos a little, and uploaded new css/js + zip files and recompiled plugins.

Works nicely and looks better!

(Some this little niggle I found while working on a French textpack – work in progress here)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#31 2018-04-07 17:03:57

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

Re: glz_custom_fields v2 beta for Textpattern v4.7

Testing latest glz_cf beta on 4.7 beta3.
Can’t change order of custom fields. When trying to access “options” on plugins page i get “Restricted area”.


A hole turned upside down is a dome, when there’s also gravity.

Offline

#32 2018-04-07 17:16:07

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

Re: glz_custom_fields v2 beta for Textpattern v4.7

And Jakob, may i ask if it is possible to implement changing the delimiter type (without using an extra rah_replace script or similar), when displaying content of custom fields with multiple entries?
That | kind of ern sucks :) Mostly needed would be , i guess.

Last edited by jayrope (2018-04-07 17:37:08)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#33 2018-04-07 19:30:33

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: glz_custom_fields v2 beta for Textpattern v4.7

jayrope wrote #310738:

Testing latest glz_cf beta on 4.7 beta3. When trying to access “options” on plugins page i get “Restricted area”.

Not sure which version you tried, but try downloading again (link below). I’ve been working on it intermittently today and just verified that it works on a fresh site.

Can’t change order of custom fields.

Make sure you’ve uploaded the plugins folder too. There’s a zip file in the folder linked above with all the necessary files that I just used for my test installation. Unpack it in your base textpattern folder and the paths should be correct right away. If you decide to move the files, adjusted your paths accordingly to match – there’s a button “Check paths” that will give you feedback on whether there is a problem or not. If you still cannot access the plugin options, simply go to Admin › Preferences › Custom fields settings. That’s where they are now.

If it’s still not working, can you provide any further infos? (Browser, console messages?) I’ve just tried in firefox, chrome and safari and had no problems (I have no internet explorer / edge to hand).

jayrope wrote #310739:

And Jakob, may i ask if it is possible to implement changing the delimiter type … That | kind of ern sucks :) Mostly needed would be , i guess.

I think back when Gerhard made the plugin he deliberately chose the pipe | as a delimiter because it allows you to have option values that might contain a comma. My guess is he thought it was more likely that people might have a comma in their option string than a pipe … in German you could quite easily have 2,5%, 3,5%, 5,5% etc. as options. A method whereby those would be escaped on saving, then deslashed again on output is of little help to you, because it will still be a stumbling point when you come to iterate over them yourself.
The other reason for not changing (now at least) is that it has been like that for nigh-on ten years, so changing it would break people’s sites.

Is it a problem to use rah_replace or rah_repeat (where you can set the delimeter you want to use to iterate with)? Put another way: what output would you like to have, and how are you intending to use it?


TXP Builders – finely-crafted code, design and txp

Offline

#34 2018-04-07 19:34:02

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: glz_custom_fields v2 beta for Textpattern v4.7

A new update is now available on GitHub – with a few more updates and fixes.

Changes:

  • German Textpack (thanks Uli!)
  • Error message produced when checkbox custom field is created without options.
  • Error message produced when radio button or multi-select custom field is created without at least two options.
  • Fix plugin malfunction when main css/js paths are incorrect:
    • Inject main glz_cf css and js files directly into page head and not from file.
    • Hide corresponding prefs fields (but not removed, see next item).
    • Set $debug = true; at the top of the plugin if you want to load from files (e.g. for debugging or your own styling).
  • Fix rollover on clipboard icon when no custom field title is provided.
  • Allow date format translation.
  • Simplified messages and more obvious link items in write tab error messages.

I’ll fold this back into the main branch soon. Now done.


TXP Builders – finely-crafted code, design and txp

Offline

#35 2018-04-08 00:35:33

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: glz_custom_fields v2 beta for Textpattern v4.7

With your latest build, the order of the values for radio and checkbox fields are changed upon save. The {default} always end up last.

If I create a checkbox set with values:

ringo
{biwa}
mikan

after saving, the order of the values is

ringo
mikan
{biwa}

I’m not sure now, maybe that was already the case with previous builds, but it jumped out this morning.

Edit: Scrap that. My mistake. While playing with the Prefs, I had set the order to Descending, of course this made a mess of my expectations (possibly due to me misunderstanding what the pref does).

Last edited by phiw13 (2018-04-08 08:40:25)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#36 2018-04-08 12:11:56

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: glz_custom_fields v2 beta for Textpattern v4.7

French textpack now also added courtesy of Philippe. Thank you!

The plugin files are updated and the master branch is also now up to date.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB