Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

[uib-rating] disable reset to zero (feature) #5532

Closed
startswithaj opened this issue Feb 24, 2016 · 18 comments
Closed

[uib-rating] disable reset to zero (feature) #5532

startswithaj opened this issue Feb 24, 2016 · 18 comments

Comments

@startswithaj
Copy link

Bug description:

When using the uib-rating directive if you click the star of the current value (i.e 3rd star selected. click 3rd star again) it sets the current value to 0 essentially resetting the rating.

The code that does this:

ngModelCtrl.$setViewValue(ngModelCtrl.$viewValue === value ? 0 : value);

Version of Angular, UIBS, and Bootstrap: Current

My current use case:

Rating defaults to 3/5 and should not be able to be set to zero.

Proposed fixes:

  1. attr.disableClear

If set to true then when clicking the current value would just set the value again.

  1. attr.min (minimum)

The uib-control would not allow a rating less than the given int. ie In the use case above i would set min=1. If the user click 3 rating while already selected it would reset back to 1 rather than zero.

I would be happy to code and submit a pull request for this feature if it would likely be merged.

@icfantv
Copy link
Contributor

icfantv commented Feb 24, 2016

@startswithaj, while at first glance, this appears to be well written, is there any particular reason you did not use our issue template? In the future, please do not remove it unless absolutely appropriate. The template makes our job significantly easier and thus, allows us to help you faster.

@wesleycho
Copy link
Contributor

Maybe we could have a configuration value like rating-default where that is what it resets to - PRs welcome

@startswithaj
Copy link
Author

Why does it have to reset at all?

@icfantv I didn't use it because I don't have a repro, because its the standard use. And its not a bug its a feature. but ill add it back in for you.

@wesleycho
Copy link
Contributor

Otherwise there is no way to clear it without having to add additional controls - this is also how most rating systems work in the UI.

@wesleycho
Copy link
Contributor

You could use the readonly attribute if you want to disable modifications dynamically.

@startswithaj
Copy link
Author

Ok no worries, I hadn't seen this behaviour before but TBH I haven't used many rating systems. I don't want to disable modifications. I think my feature request makes that pretty clear. Once a user rates something I don't want them to be able to reset it to zero. This seems like a pretty logical use case.

In reality rating-default is achievable without and code changes, you can just get the ng-model value in your ng-change function and if its 0 just change it back to your default. The point of my change request is not to have it reset/default at all.

@wesleycho
Copy link
Contributor

Wouldn't using the documented readonly binding work then? If the rating has a value, then you can toggle it to true and it should remain unmodified.

@startswithaj
Copy link
Author

No the readonly attribute stops all modifications. I would like the user to be able can change the value, from 1-5 they just cannot reset it to 0.

@wesleycho
Copy link
Contributor

That sounds like a strange UX...why would you prevent resetting it?

@startswithaj
Copy link
Author

How is it strange mate? You have a survey. The survey has answers between 1-5 that default to 3. 3 being neutral.

How is this strange. Show me an example of a resetting rating? I can't find one. IMDB for instance? 1-5 stars.

Why are you in the first place setting an element that represents a y to z value to x?

On 25 Feb 2016, at 12:42 AM, Wesley Cho notifications@github.com wrote:

That sounds like a strange UX...why would you prevent resetting it?


Reply to this email directly or view it on GitHub.

@startswithaj
Copy link
Author

Why wouldn't I prevent resetting it? Why have a min and max value on any user input? How longs a piece of string?

On 25 Feb 2016, at 12:42 AM, Wesley Cho notifications@github.com wrote:

That sounds like a strange UX...why would you prevent resetting it?


Reply to this email directly or view it on GitHub.

@wesleycho
Copy link
Contributor

It is strange because it forces on the user a disabling of an action they may want to take - for example a lot of people like to clear certain form values because it helps them think clearer before filling it in, especially for things that require thought like ratings.

As for an example of a rating that clears, Amazon product reviews.

@startswithaj
Copy link
Author

Why keep suggesting readonly when it has absolutely nothing todo with what I'm talking about. Honestly.

On 25 Feb 2016, at 12:42 AM, Wesley Cho notifications@github.com wrote:

That sounds like a strange UX...why would you prevent resetting it?


Reply to this email directly or view it on GitHub.

@wesleycho
Copy link
Contributor

Stick to purely the issue here - if I see a comment that attempts to steer conversation away or only tries to inflame/disrespect/etc., I will lock the issue and ban from filing issues.

@startswithaj
Copy link
Author

That's why it's a feature mate, I'm not saying everyone should be forced to use it. It would default to the normal behaviour it's not a BC change.

As the designer of the workflow I decide what the user can or can't do. Not Ng bootstrap contributors.

Why make a non bc breaking change so difficult this is why I didn't go to the trouble of making the pr because in repos like this small non breaking changes are meet with such epic resistance for NO REASON except someone's sore feelings and attachment to arbitrary bits of code.

Just because Amazon allow a non rating doesn't mean every other use of rating is nullable.

On 25 Feb 2016, at 1:16 AM, Wesley Cho notifications@github.com wrote:

It is strange because it forces on the user a disabling of an action they may want to take - for example a lot of people like to clear certain form values because it helps them think clearer before filling it in, especially for things that require thought like ratings.

As for an example of a rating that clears, Amazon product reviews.


Reply to this email directly or view it on GitHub.

@angular-ui angular-ui locked and limited conversation to collaborators Feb 24, 2016
@wesleycho
Copy link
Contributor

Going to leave a comment and close this issue for now since you are refusing to follow the Code of Conduct due to being in a highly charged emotional state & are throwing out unhelpful attacks.

The reason why we, and any major open source maintainer, are careful in what we add is because we are stuck with the maintenance burdens, and we are responsible for making sure the library isn't bloated or encouraging bad patterns. Little bloat adds up, and it often trades off increased size & hurts most users of the library for undesired features.

Your behavior in this issue is completely unacceptable, and nothing I have said has warranted these attacks. If you cannot remain professional, then we as a team will not be held back wasting our time trying to help figure out the best course of action. This is one of the major plagues when it comes to stalling progress in open source, and everyone suffers.

@angular-ui angular-ui unlocked this conversation Feb 24, 2016
@wesleycho
Copy link
Contributor

Re-opening as per email conversation

@IdanCo
Copy link

IdanCo commented Feb 24, 2016

I know it's not a real solution, but you can always do something like this -

      $scope.$watch('rating', function(newValue, oldValue) {
        if (newValue === 0) {
          $scope.rating = oldValue;
        }
      });

If i'll have time i'll create a PR this weekend

@wesleycho wesleycho added this to the 1.2.5 milestone Mar 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants