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

Edit Subscription form (front-end) lets you clear the value of required fields #195

Closed
raamdev opened this Issue Dec 26, 2015 · 17 comments

Comments

Projects
None yet
3 participants
@raamdev
Contributor

raamdev commented Dec 26, 2015

When editing a subscription on the front-end, the Status and Deliver fields have a little "X" in them that allows you to clear the value of that field. This doesn't make sense, since those fields are required and there is no reason to empty them.

2015-12-26_18-14-05

2015-12-26_18-15-56

Note that this is purely a UI issue--if you clear the fields and try to update the subscription, you are properly informed that you must select a value for those fields.

@jaswrks

This comment has been minimized.

Member

jaswrks commented Dec 29, 2015

👍

@kristineds

This comment has been minimized.

Contributor

kristineds commented Jan 2, 2016

@raamdev @jaswsinc If you could create an outline for this, I'll be happy to work on it. :)

@jaswrks

This comment has been minimized.

Member

jaswrks commented Jan 6, 2016

Next Actions

  • In these lines replace chosenOps w/ the following:

    $.extend({}, chosenOps, {allow_single_deselect: false})
  • Repeat in the type-a templates folder also.

  • Repeat both steps in the pro version.

@jaswrks

This comment has been minimized.

Member

jaswrks commented Jan 6, 2016

Referencing: http://alxlit.name/bootstrap-chosen/
~ The Bootstrap JS plugin that powers those select menus.

@kristineds

This comment has been minimized.

Contributor

kristineds commented Jan 7, 2016

@jaswsinc Is the code supposed to look like this? I tried testing it on my site but nothing was changed. :( What am I missing?

$('.manage-sub-form form tr.manage-sub-form-status select').chosen($.extend({}, chosenOps, {allow_single_deselect: false}));
$('.manage-sub-form form tr.manage-sub-form-deliver select').chosen($.extend({}, chosenOps, {allow_single_deselect: false}));

Also, I'm not seeing any type-a template folder on the comment-mail repo

@raamdev

This comment has been minimized.

Contributor

raamdev commented Jan 8, 2016

Also, I'm not seeing any type-a template folder on the comment-mail repo

The type-a directory is for Advanced Templates, which are only available with Comment Mail Pro.

@jaswrks

This comment has been minimized.

Member

jaswrks commented Jan 8, 2016

Is the code supposed to look like this?

Looks great, yes.

I tried testing it on my site but nothing was changed. :(

Whenever you tested did you have the Simple Templates enabled in Comment Mail? Or the Advanced Templates? If you haven't updated the Advanced Templates yet, you might not see the changes.

Also, keep in mind that I haven't tested this change myself yet. I'm outlining, and it should work; well, because I want it to (code is forced to do as I wish, LOL). However, there are times when my magic powers are not working right. So if that's the case (i.e., just not working), give me another shout :-)

@kristineds

This comment has been minimized.

Contributor

kristineds commented Jan 12, 2016

Whenever you tested did you have the Simple Templates enabled in Comment Mail? Or the Advanced Templates? If you haven't updated the Advanced Templates yet, you might not see the changes.

I tested this just now for Comment Mail Pro:

  • File uploaded for both type-s & type-a folder
  • Tried enabling Simple Templates, and checked "Edit subscriptions" to see if anything was changed, got nothing.
  • Did the same for Advanced Templates, still nothing
  • Turned Safeguard Data off, and run the test again, still nothing.

Not sure what I'm missing

@jaswrks

This comment has been minimized.

Member

jaswrks commented Jan 12, 2016

Thanks Kristine! :-)

Hmm, it looks like this option may not do what I thought. I suppose I should have thought about the name of this option some more. Now that I'm looking at it again, I think what this controls is the behavior associated with only single option; i.e., if there were only one option in the dropdown, it would allow you to enable/disable the close icon for that specific scenario. If that's the case, then that explains why it is not working for you like I thought it would.

Still, it's good that you made that change, because we don't want it enabled for that case either.


Now, to get this resolved, let's just use some CSS.

  • In this file add the following, compress it into the .min.css variation and experiment.
.chosen-container-single-nosearch .search-choice-close {
  display: none !important;
}

kristineds added a commit to websharks/comment-mail-pro that referenced this issue Jan 15, 2016

@kristineds

This comment has been minimized.

Contributor

kristineds commented Jan 15, 2016

In this file add the following, compress it into the .min.css variation and experiment.

I did this but it's not hiding the x clearing option on those fields.

However, if I try to disable it for .chosen-container-single .chosen-single abbr on th chosen.min.css file, it works.

@jaswrks

This comment has been minimized.

Member

jaswrks commented Jan 18, 2016

Cool! :-) Nice work. If that's what works then let's go with it. If you can update the PR here and make this change in the lite version also, then we can merge this enhancement in. websharks/comment-mail-pro#45

@kristineds

This comment has been minimized.

Contributor

kristineds commented Jan 18, 2016

If that's what works then let's go with it.

Problem is I can't find the chosen.min.css file. :( Where is it located? I tried adding it on bootstrap-chosen.min.css file but it doesn't work either.

screen shot 2016-01-19 at 5 08 06 am

@kristineds

This comment has been minimized.

Contributor

kristineds commented Jan 22, 2016

@jaswsinc Can you help me with this please? :) #195 (comment) cc @raamdev

@jaswrks

This comment has been minimized.

Member

jaswrks commented Jan 25, 2016

Problem is I can't find the chosen.min.css file. :( Where is it located?

That CSS file is loaded from a CDN and so you cannot edit it directly.
See: https://github.com/websharks/comment-mail-pro/blob/151224/comment-mail-pro/includes/templates/type-a/site/header-styles.php#L24

I tried adding it on bootstrap-chosen.min.css file but it doesn't work either.

It should work in that file, because that file is loaded after the base copy from the CDN.
See: https://github.com/websharks/comment-mail-pro/blob/151224/comment-mail-pro/includes/templates/type-a/site/header-styles.php#L25

You might need to use !important to override something from the base though. Or just work at making the rule have a higher precedence. See: https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity

@raamdev

This comment has been minimized.

Contributor

raamdev commented Feb 1, 2016

Next Lite Release Changelog:

  • Enhancement: Improved the front-end Edit Subscription form and removed the "x" in on the Status and Deliver fields that allowed clearing those fields, which did not make sense since both of those fields are required. Props @kristineds. See Issue #195.
@raamdev

This comment has been minimized.

Contributor

raamdev commented Feb 1, 2016

Next Pro Release Changelog:

  • Enhancement: Improved the front-end Edit Subscription form and removed the "x" in on the Status and Deliver fields that allowed clearing those fields, which did not make sense since both of those fields are required. Props @kristineds. See Issue #195.

@raamdev raamdev closed this Feb 1, 2016

@raamdev

This comment has been minimized.

Contributor

raamdev commented Feb 13, 2016

Comment Mail v160213 has been released and includes changes from this GitHub Issue. See the release announcement for further details.


This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#195).

@websharks websharks locked and limited conversation to collaborators Feb 13, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.