Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing job in backend allows for multiple types #549

Closed
aheckler opened this issue Oct 27, 2015 · 20 comments
Closed

Editing job in backend allows for multiple types #549

aheckler opened this issue Oct 27, 2015 · 20 comments

Comments

@aheckler
Copy link
Member

... but we enforce a " one type per job" policy on the default submission form:

screen shot 2015-10-27 at 10 02 43 am

This leads to confusion:

https://wordpress.org/support/topic/bug-single-job-listing-page-only-displays-first-type

https://wordpress.org/support/topic/multiple-job-types

https://wordpress.org/support/topic/multiple-job-types-1

We should either allow multiple job types per job or limit the backend meta box in such as way as to enforce the "one type per job" rule.

@aheckler
Copy link
Member Author

In case I end up looking into this myself: http://code.tutsplus.com/articles/how-to-use-radio-buttons-with-taxonomies--wp-24779

@mikejolley
Copy link
Contributor

@donnchawp
Copy link
Contributor

Here's what looks like an extensive class for changing the category/taxonomy box to radio:
https://github.com/WebDevStudios/Taxonomy_Single_Term

I've also come across Javascript that goes through the elements of the box changing each to a radio checkbox, but that seems a bit hacky to me. There's even a plugin that does that here: https://wordpress.org/plugins/change-category-checkbox-to-radio-button/

My preference is to try the class above or use the code @aheckler found.

donnchawp added a commit that referenced this issue Oct 11, 2016
Fixes #549
The post editor metabox uses checkboxes which allows more than one job type, but replacing them with radio buttons only allows one. Code from https://code.tutsplus.com/articles/how-to-use-radio-buttons-with-taxonomies--wp-24779
@donnchawp
Copy link
Contributor

In #781 I used the code from the tutorial @aheckler found to change the checkboxes into radio buttons but I'd appreciate some eyes on it before merging.

@donnchawp
Copy link
Contributor

Also, I wonder if any users are using this functionality to have more than one job type? If we wanted to support more than just jobs in the future this would be limiting, unless we start to support tags.

@spencerfinnell
Copy link
Contributor

I don't see it a lot since the output function only supports one type, however there have been people who requested that functionality. Perhaps a filter to disable for people who have modified or created their own way to output multiple?

@donnchawp
Copy link
Contributor

It would be easy to add a filter that returns true by default so the remove/add metabox calls are executed here.

It's probably best to make single job type the default as it's the default on the public submission page.

@eppul
Copy link

eppul commented Oct 12, 2016

I thinks it is important to have multiple job types for more precise classification. So I would not force single job type but make it optional.

For example I could have Job that is part-time and also summer job at the same time.

I have already changed the front-end submission form to support multiple job types with the "WP Job Manager - Field Editor" and I have changed the front-end templates and some functions to support displaying of multiple job types.

Please don't force single "Job Type". There could be lot of different situations where one would want to use multiple job types.

If wanted I can paste the changes that I made to achieve displaying of multiple job types on the front-end.

@donnchawp
Copy link
Contributor

eppul - thanks for your comment! I'd be very interested in hearing about what changes you made to the front end.

It might be better to allow either multi or single selection of job types since they're the only taxonomy allowed currently. That could be a checkbox setting on the settings page that would change the UI in the backend and frontend.

@eppul
Copy link

eppul commented Oct 12, 2016

I copied couple of functions and changed them to suit my needs.

Here are the modified functions as an attachment because the code pasting did not work properly.
WPJM-show-types.txt

And I just load it inside the head meta (content-single-job-meta.php) and listing template(content-job-listing.php) with this:
<?php output_multiple_job_types();?>

Thank you for you consideration

@donnchawp
Copy link
Contributor

Thanks for that. It's useful!

If we're going down this route, we should extend get_the_job_type() so it returns multiple job types if necessary. The code in the templates will have to be updated (and possibly merged, since the same code is used in several files), and the job submission form will have to be updated too of course.

@davoraltman
Copy link

It might be better to allow either multi or single selection of job types since they're the only taxonomy allowed currently. That could be a checkbox setting on the settings page that would change the UI in the backend and frontend.

@donnchawp Adding it as a setting inside Job Submission sounds great! The default should be one job type but users should also be able to enable multiple job type selection.

donnchawp added a commit that referenced this issue Oct 13, 2016
Fixes #549
Modify the post editor and user facing frontend job submission forms so that the number of job types can be one OR many based on a setting in the "Job Submission" settings page.
@donnchawp
Copy link
Contributor

I updated my PR so it adds a new setting to the Job Submission page. I added a function that checks that setting and then use that function to modify the post editor and front end job submission form.

screen shot 2016-10-13 at 13 54 09

I'm not too happy with the wording of that setting so if anyone has suggestions I'd love to hear them!

@aheckler
Copy link
Member Author

What about this?

Allow each job to have only one job type

@spencerfinnell
Copy link
Contributor

I think it should be off by default (like multiple categories) and then mirror the multiple category text.

@donnchawp
Copy link
Contributor

Not everyone will be happy with this change, and we'll have to make it prominent for users upgrading, but I'd rather stick with the way it is now.

Forcing one job type will inconvenience users who use wp-admin but at least they can find the Settings page and toggle the setting. If we enable multiple job types by default the frontend submission form will be modified, possibly without a site owner noticing until too late when submitted jobs have multiple types. The single setting means the frontend form remains the same so if the form has been modified at the DOM level in the past that hack will still work.

@aheckler - thanks, you got me thinking in the other direction! Since we're putting a limit on what the user can do rather than letting them have free reign over how many types they can use. I think we could call the setting:

Limit Jobs to one job type each

@spencerfinnell
Copy link
Contributor

Sorry, I meant off by default when the setting toggles multiple types on. So the setting would be the opposite of what you have currently.

"Multi-select Types: Enable multiple types for listings"

So with it off by default only the admin will change to what was the expected behavior previously (submit one type on the frontend, select one type on the backend).

Then when you toggle it on the admin "reverts" (to how it is now) and the frontend updates to a multi-select.

Then it's a matter of dealing with the template files.

@donnchawp
Copy link
Contributor

Ah, so we're saying the same thing but the opposite wording for the settings page? I'm inclined to leave it the way it is however (well, except to slightly change the wording as I suggested above). I don't think it makes it any clearer or easier to understand.

@spencerfinnell
Copy link
Contributor

By itself it might not be any clearer but I think in the context of the other settings it makes more sense to match it to the same toggle as categories.

Toggle On: Turn on multiple categories
Toggle On: Turn off multiple types

Those settings really do the same thing but they contradict each other in how they are used.

@donnchawp
Copy link
Contributor

OK, I have you now, and that makes sense. Thanks for persisting!

In fact I think the "job type" setting should probably go under the category settings on the "Job Listings" settings tab, since they are related.

donnchawp added a commit that referenced this issue Oct 14, 2016
Fixes #549
The multiselect category checkbox on the "Job Listings" settings page is similar in functionality to the job types one so I'm moving it to the "Job Listings" settings tab and renaming the single job type chekbox to "Multi-select Listing Types". The forms and related function had to be changed too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants