Robin S Posted November 22, 2018 Share Posted November 22, 2018 emplate Field Widths Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template. Since v0.2.0 the module also adds a similar field to the settings of Edit Field for Repeater, FieldsetPage and Repeater Matrix allowing you to quickly set the widths of inputfields within the Repeater/FieldsetPage field, or within each Repeater Matrix type. Note: widths are only saved if the edit form is submitted with the "Field widths" field in an open (non-collapsed) state. Edit template Edit Field: Repeater Edit Field: Repeater Matrix Why? When setting up a new template/repeater or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process. Config options You can set the default presentation of the "Field widths" field to collapsed or open. Widths entered into the "Field widths" field are only applied if the edit form is submitted with the field in an open (non-collapsed) state. "Collapsed" is the recommended setting if you think you might also use core inputs for setting field widths in a template context. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width. https://github.com/Toutouwai/TemplateFieldWidthshttps://modules.processwire.com/modules/template-field-widths/ 25 2 Link to comment Share on other sites More sharing options...
matjazp Posted November 22, 2018 Share Posted November 22, 2018 Cool! Add an arrows-h icon to the InputfieldMarkup? Make the widths with the slider instead of text input? Dynamically show the width of fields as they change? 2 Link to comment Share on other sites More sharing options...
Robin S Posted November 22, 2018 Author Share Posted November 22, 2018 @matjazp, thanks for the suggestions. 42 minutes ago, matjazp said: Add an arrows-h icon to the InputfieldMarkup? Yes, done in v0.1.2 42 minutes ago, matjazp said: Make the widths with the slider instead of text input? Sorry, no, if I'm wanting numbers to sum to exactly 100 then I much prefer a number input than a slider. Just tab from field to field and it's very quick. 42 minutes ago, matjazp said: Dynamically show the width of fields as they change? Great idea, done in v0.1.2 2 Link to comment Share on other sites More sharing options...
BitPoet Posted November 22, 2018 Share Posted November 22, 2018 6 hours ago, Robin S said: Another little admin helper module... ...with a not so little impact when building complex sites. I already know I'm going to use this a lot ? Thank you! 3 Link to comment Share on other sites More sharing options...
Klenkes Posted November 22, 2018 Share Posted November 22, 2018 Very nice ? I used to have a separate template and output everything in a HTML table. Just to get an overview of it. But this is much better! How about putting the original with in a light gray somewhere? I am always interesetd wether I changed the value in template context or not. 2 Link to comment Share on other sites More sharing options...
adrian Posted November 22, 2018 Share Posted November 22, 2018 Seriously brilliant @Robin S - this is going to be an absolutely huge timesaver! I think this deserves a screencast in the first post showing the layout change dynamically as percentages are adjusted - so cool! 2 Link to comment Share on other sites More sharing options...
adrian Posted November 22, 2018 Share Posted November 22, 2018 What do you think about having fieldsetTabs actually separated out into tabs in the editing interface - I think this would be a really helpful addition. 1 Link to comment Share on other sites More sharing options...
Robin S Posted November 23, 2018 Author Share Posted November 23, 2018 On 11/22/2018 at 9:11 PM, Klenkes said: How about putting the original with in a light gray somewhere? I am always interesetd wether I changed the value in template context or not. Personally I would find that more distracting than useful, but will look at adding it as a configurable option. On 11/23/2018 at 7:48 AM, adrian said: What do you think about having fieldsetTabs actually separated out into tabs in the editing interface - I think this would be a really helpful addition. I can see why this would be good, but I wouldn't want to lose the ability to use the tab key to move through all fields in the template. Will do some experimenting and see if it's possible to keep the tab key navigation in a tabbed interface - I have a feeling that hidden inputs may not be focusable with tab. Link to comment Share on other sites More sharing options...
adrian Posted November 23, 2018 Share Posted November 23, 2018 2 minutes ago, Robin S said: I have a feeling that hidden inputs may not be focusable with tab. Tabbing works find in the PW admin when editing a page - you can use the tab key to move between fields in any of the WireTabs - Content, Custom tabs, Settings, etc. Maybe I am not understanding the issue you are referring though ? Link to comment Share on other sites More sharing options...
Robin S Posted November 23, 2018 Author Share Posted November 23, 2018 1 minute ago, adrian said: Tabbing works find in the PW admin when editing a page - you can use the tab key to move between fields in any of the WireTabs - Content, Custom tabs, Settings, etc. Maybe I am not understanding the issue you are referring though ? My objective is to avoid needing to mouse to and click anything in the "Field widths" field. Right now I can use the tab key to move through all the fields, but if some fields are inside a hidden tab content div then I suspect it may be quite difficult to keep this functionality. If it were just a matter of showing the tab content with the focused field that would be fairly simple, but I suspect the browser will refuse to focus an input inside a hidden div (I haven't checked yet). In the PageEdit/WireTab example, PW will not move focus from the last field in Tab A to the first field of Tab B using the tab key. 1 Link to comment Share on other sites More sharing options...
adrian Posted November 23, 2018 Share Posted November 23, 2018 1 minute ago, Robin S said: In the PageEdit/WireTab example, PW will not move focus from the last field in Tab A to the first field of Tab B using the tab key. Of course - sorry, I didn't realize that was a goal. I guess I thought it would be ok to use the mouse to activate the other tab. Perhaps an alternative would be to just separate out other tabs below the main Content tab so they are separate. I just think this would help with visualizing the layout better, because at the moment it looks like the fields in other tabs are all part of the one form, which of course they are not, visually speaking. Anyway, not a big deal ? Link to comment Share on other sites More sharing options...
Robin S Posted November 24, 2018 Author Share Posted November 24, 2018 v0.1.3 adds a tabbed interface for fieldset tabs, and there is a new config option to show the original field width alongside the template context field width. 1 Link to comment Share on other sites More sharing options...
adrian Posted November 24, 2018 Share Posted November 24, 2018 7 hours ago, Robin S said: v0.1.3 adds a tabbed interface for fieldset tabs, and there is a new config option to show the original field width alongside the template context field width. Thanks @Robin S - I see that adding the tabbed interface was a significant amount of work - I think it's awesome though so thank you ? One small thing - it needs a fallback to tab_name if there is no label set. This should be an unlikely scenario, but without it, you can't get to the other tabs. $markup .= "<li class='tfw-tab{$active}' data-tab='tfw-{$tab_name}'>" . ($tab_data['label'] ?: $tab_name) . "</li>"; 1 Link to comment Share on other sites More sharing options...
Robin S Posted November 24, 2018 Author Share Posted November 24, 2018 6 hours ago, adrian said: One small thing - it needs a fallback to tab_name if there is no label set. Thanks, fixed in the latest version. 1 Link to comment Share on other sites More sharing options...
tpr Posted November 24, 2018 Share Posted November 24, 2018 Great idea and implementation, even though I could live with a mouse dragging - I know it would be a tough task, so it's NOT a feature request ? I played with it and left-aligning the inputs would disable the "jump" when the width value is changed via mouse (after each click on the number input spinner you have to move the mouse a bit). Also note that the inputs and names are in one line that makes the "editor" more compact. Unfortunately the module is not compatible with aos_column_break, but I don't expect the module to support it as it would be really hard. For example, the corresponding page looks like this with the above template: In theory it would be not that hard to support the "main" tab but additional aos columns can set inside tabs which would be a nightmare to deal with ? 2 Link to comment Share on other sites More sharing options...
Robin S Posted November 24, 2018 Author Share Posted November 24, 2018 33 minutes ago, tpr said: I played with it and left-aligning the inputs would disable the "jump" when the width value is changed via mouse That's a good point, thanks. Have changed to left alignment in v0.1.5. 34 minutes ago, tpr said: Also note that the inputs and names are in one line that makes the "editor" more compact. Not sure I want to make this change as if the show original field width config option is enabled it makes the label a bit disconnected from the input, and for longer field names in narrower columns (esp. on narrower screens) it increases the likelihood of the field name not fitting within the column width. Having the field label break to underneath the input wouldn't be great. So I'm thinking the costs aren't worth the benefit of slightly more efficient use of vertical space. But if others would prefer everything on a single line I'm willing to reconsider. 38 minutes ago, tpr said: In theory it would be not that hard to support the "main" tab but additional aos columns can set inside tabs which would be a nightmare to deal with ? Yeah, not sure I'm up for tackling that, but if you're tinkering around some time and find a solution that would be cool. ? 1 Link to comment Share on other sites More sharing options...
matjazp Posted November 25, 2018 Share Posted November 25, 2018 9 hours ago, Robin S said: Not sure I want to make this change as if the show original field width config option is enabled it makes the label a bit disconnected from the input, and for longer field names in narrower columns (esp. on narrower screens) it increases the likelihood of the field name not fitting within the column width. Having the field label break to underneath the input wouldn't be great. So I'm thinking the costs aren't worth the benefit of slightly more efficient use of vertical space. Yep, that's true. How about making this as an option? Most of the time work on templates is done on wide screen. Also, some might prefer to have fieldsets on the main screen, not on separate tabs, so I would make this configurable too. Just an idea, not a feature request. Link to comment Share on other sites More sharing options...
tpr Posted November 25, 2018 Share Posted November 25, 2018 Maybe enabled only on larger screens with @media queries? Link to comment Share on other sites More sharing options...
breezer Posted November 26, 2018 Share Posted November 26, 2018 (edited) Thanks for this helper module, it works great. The only issue I see in my case is that the total percentage width of the rows only equals: 2 items per row - 92%. 3 items per row - 86% Any more than that and the field falls back down. Other than that its awesome, many thanks. Running v0.1.5 , Processwire 3.0.1.1.8, Firefox browser, wamp on windows 7 Edited November 26, 2018 by breezer added more description to the issue Link to comment Share on other sites More sharing options...
Robin S Posted November 26, 2018 Author Share Posted November 26, 2018 4 hours ago, breezer said: The only issue I see in my case is that the total percentage width of the rows only equals: 2 items per row - 92%. 3 items per row - 86% Any more than that and the field falls back down. Sounds like a CSS box-sizing issue. Are you using an unmodified core admin theme? All three core admin themes apply box-sizing: border-box to all elements so I'm puzzled why that wouldn't be working in your case. Maybe you can use your browser dev tools to investigate? 1 Link to comment Share on other sites More sharing options...
breezer Posted November 26, 2018 Share Posted November 26, 2018 My setup is non modified PW dev and uikit admin theme. I basically just edited the existing user template, and moved the role tab last in the sort since it doesn't show during profile edit. Then go to edit my profile to check the fields. All the items are pushed far left and there is a space on the right of the column: | [ Field One ] [Field Two] | | [ Field One ] [ Field Two ] [ Field Three ] | What am I looking for when I use the dev tools, css issues are pretty much out of my realm lol Link to comment Share on other sites More sharing options...
Robin S Posted November 26, 2018 Author Share Posted November 26, 2018 5 minutes ago, breezer said: Then go to edit my profile to check the fields. All the items are pushed far left and there is a space on the right of the column Are we talking about layout issues in the "Field widths" field that TemplateFieldWidths adds to the Edit Template screen... ...or layout issues when you are editing a page/profile? Because TemplateFieldWidths doesn't have anything to do with the latter - the module just adds a quicker way to define field widths. You can check by uninstalling TemplateFieldWidths and seeing if you still have layout issues when editing a page/profile. If it's the latter problem you could ask a question one of the main support forums, but also check this loooong GitHub issue about column widths in AdminThemeUikit: https://github.com/processwire/processwire-issues/issues/480 Personally I recommend the following config option: Modules > Core > AdminThemeUikit > Layout + interface > Inputfield column widths > Percentage-based widths Link to comment Share on other sites More sharing options...
breezer Posted November 26, 2018 Share Posted November 26, 2018 Quote Personally I recommend the following config option: Modules > Core > AdminThemeUikit > Layout + interface > Inputfield column widths > Percentage-based widths Yes that feature is enabled. Here is what I get from the following setup: Link to comment Share on other sites More sharing options...
Robin S Posted November 26, 2018 Author Share Posted November 26, 2018 @breezer, like I said, your issue is not related to this module and you can confirm this by uninstalling TemplateFieldWidths. But your admin layout looks non-standard - compare with my screenshot above which does not have the grey background or space between inputfields. Maybe this is caused by some non-default option in AdminThemeUikit or you have interference from some non-core CSS somewhere. Link to comment Share on other sites More sharing options...
breezer Posted November 26, 2018 Share Posted November 26, 2018 I'll uninstall and see what happens, thanks for looking into it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now