You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create the functionality to add laws to a portfolio #30
This can be done with jQuery. When triggered by a user action, execute localStorage.setItem(this.law,'saved') or localStorage.removeItem(this.law), or something like that. Each law's page can reflect whether or not the law has been saved by the person, and then the portfolio page can just iterate through all of the laws in the user's portfolio and display the list.
It really would be helpful if, at the time that this function was triggered, we also made a call to the server to simply report that somebody (anonymously) has added this law to their portfolio. If we can know that an individual is tracking a particular collection of laws, then we can know that those laws are in some way related. That's really useful. It's great to do this client-side, but don't lose the really useful data that comes of having some knowledge about who's tracking what.
I don't want to let this go. At a minimum, I want to add the functionality without server-side tracking. At that point, it's just a handful of lines of JavaScript and a bit of CSS. It might not even need its own page—it could just be an overlay.
Keep in mind something like this needs a lot of UX to be done right. It's not just an add-to-cart, it's also remove-from-cart, organize-my-cart, etc - and all of that needs to be designed.
And of course the legalese at the bottom has to get an update because of cookie Local Storage use (privacy policy), and on any european installations we'll need a theme with a popup to tell them cookies local storage is in use. Disregard, localStorage has pretty decent browser support. Disregard my disregarding, the laws that cover cookie usage also cover localStorage. Huh.
Nah, no need for cookies—it's all in local storage. And I'm not worried about Europe—I don't have the faintest idea of how their legal codes work, but it's way out of the scope of this project now. And I don't see any need for organizing as a 1.0 feature. Really, it's just add and remove, and remove can just be a toggled display on the law page (e.g., "Add" becomes "Remove").
The legalese will need to be updated though. If we're putting anything on user's computers, we need some sort of privacy policy by default. Our localities won't be cool with it otherwise. (To be fair, we probably need one for Google Analytics as well though. Oops.)
The legalese is really just isn't our problem. It's up to everybody installing this to determine what laws matter in their state and locality and provide the appropriate TOS, privacy policy, etc. Just as with WordPress, Drupal, etc.
As people who also implement this software, legalese is our problem, but that's wearing a different hat. :)
@waldoj Not to beat a dead horse here, but what's the point of this feature? How is it not just duplicating the native bookmarks in-browser? Or is this for offline reading?
This has been an often-requested feature. People researching laws often find multiple relevant ones, and they want to mark the ones that seem relevant, as they go. Like a shopping cart, but for laws. This is especially for citizens who are doing their own legal research, not attorneys or lawmakers (that's who keeps requesting this).
Almost nobody bookmarks things, and those who do regard it not as a place for temporary collections (ie, "laws that might potentially be the one I'm looking for over ten minutes of research") but instead permanent ("now that I've signed up for online banking, I should bookmark the site"). Bookmark management is built to encourage this behavior.
I'm reading more on localstorage and it sounds like it's just as impermanent as cookies:
I can't speak for other platforms, but on my 4.1 Android device, I'm using localStorage to store some data locally with jQuery Mobile, and I've found that Android will clear my cache every week or so without my knowledge.
I'm not sure this is a good way to implement this feature if it's so ephemeral. Cookies have similar problems - we can try and make them "permanent", but it's not going to stick. We really will have to document this if we're going to do it, because it's going to be losing people's data constantly.
Yup. If people delete their local storage (not something people generally do accidentally) then, yes, they will lose their local storage. Short of an entire login and password system, there is nothing that will survive people deleting their cookies or their local storage. :) I bet we could set an expiry date of 30 days, and it would still work great for just about everybody. The traffic patterns that I see are people engaging in short bursts of research—anywhere from an hour to a week—and then they don't come back.
Activity
waldoj commentedon Aug 29, 2013
Use local storage for this and skip all the PHP.
waldoj commentedon Sep 5, 2013
This can be done with jQuery. When triggered by a user action, execute
localStorage.setItem(this.law,'saved')orlocalStorage.removeItem(this.law), or something like that. Each law's page can reflect whether or not the law has been saved by the person, and then the portfolio page can just iterate through all of the laws in the user's portfolio and display the list.waldoj commentedon Sep 15, 2013
It really would be helpful if, at the time that this function was triggered, we also made a call to the server to simply report that somebody (anonymously) has added this law to their portfolio. If we can know that an individual is tracking a particular collection of laws, then we can know that those laws are in some way related. That's really useful. It's great to do this client-side, but don't lose the really useful data that comes of having some knowledge about who's tracking what.
krusynth commentedon Nov 5, 2014
Propose moving Milestone to
Future.waldoj commentedon Nov 5, 2014
I don't want to let this go. At a minimum, I want to add the functionality without server-side tracking. At that point, it's just a handful of lines of JavaScript and a bit of CSS. It might not even need its own page—it could just be an overlay.
krusynth commentedon Nov 5, 2014
Keep in mind something like this needs a lot of UX to be done right. It's not just an add-to-cart, it's also remove-from-cart, organize-my-cart, etc - and all of that needs to be designed.
And of course the legalese at the bottom has to get an update because of
cookieLocal Storage use (privacy policy), and on any european installations we'll need a theme with a popup to tell themcookieslocal storage is in use.Disregard, localStorage has pretty decent browser support.Disregard my disregarding, the laws that cover cookie usage also cover localStorage. Huh.waldoj commentedon Nov 5, 2014
Nah, no need for cookies—it's all in local storage. And I'm not worried about Europe—I don't have the faintest idea of how their legal codes work, but it's way out of the scope of this project now. And I don't see any need for organizing as a 1.0 feature. Really, it's just add and remove, and remove can just be a toggled display on the law page (e.g., "Add" becomes "Remove").
Ain't no harm in trying. I'll enjoy it.
krusynth commentedon Nov 5, 2014
Ok, but please at least try to get a few minutes of @boboroshi 's time on this. ;) Modals suck.
krusynth commentedon Nov 5, 2014
The legalese will need to be updated though. If we're putting anything on user's computers, we need some sort of privacy policy by default. Our localities won't be cool with it otherwise. (To be fair, we probably need one for Google Analytics as well though. Oops.)
waldoj commentedon Nov 5, 2014
The legalese is really just isn't our problem. It's up to everybody installing this to determine what laws matter in their state and locality and provide the appropriate TOS, privacy policy, etc. Just as with WordPress, Drupal, etc.
As people who also implement this software, legalese is our problem, but that's wearing a different hat. :)
krusynth commentedon Nov 5, 2014
My hat is very complicated and dapper. 🎩
krusynth commentedon Nov 6, 2014
@waldoj Not to beat a dead horse here, but what's the point of this feature? How is it not just duplicating the native bookmarks in-browser? Or is this for offline reading?
waldoj commentedon Nov 6, 2014
This has been an often-requested feature. People researching laws often find multiple relevant ones, and they want to mark the ones that seem relevant, as they go. Like a shopping cart, but for laws. This is especially for citizens who are doing their own legal research, not attorneys or lawmakers (that's who keeps requesting this).
krusynth commentedon Nov 6, 2014
Do they not know how to bookmark things? ¯(°_o)/¯
waldoj commentedon Nov 6, 2014
Almost nobody bookmarks things, and those who do regard it not as a place for temporary collections (ie, "laws that might potentially be the one I'm looking for over ten minutes of research") but instead permanent ("now that I've signed up for online banking, I should bookmark the site"). Bookmark management is built to encourage this behavior.
krusynth commentedon May 13, 2015
I'm reading more on localstorage and it sounds like it's just as impermanent as cookies:
http://stackoverflow.com/questions/7750857/how-permanent-is-local-storage-on-android-and-ios
I'm not sure this is a good way to implement this feature if it's so ephemeral. Cookies have similar problems - we can try and make them "permanent", but it's not going to stick. We really will have to document this if we're going to do it, because it's going to be losing people's data constantly.
waldoj commentedon May 13, 2015
Yup. If people delete their local storage (not something people generally do accidentally) then, yes, they will lose their local storage. Short of an entire login and password system, there is nothing that will survive people deleting their cookies or their local storage. :) I bet we could set an expiry date of 30 days, and it would still work great for just about everybody. The traffic patterns that I see are people engaging in short bursts of research—anywhere from an hour to a week—and then they don't come back.
Adding ability to pin laws. Fixes #30.
krusynth commentedon Jan 18, 2017
waldoj commentedon Jan 18, 2017
Oooh, very nice! The pinned metaphor works well, too.
Merge pull request #682 from statedecoded/issue-30
Fix pinned laws for multiple laws per section. #686 #30