{"action":"created","issue":{"url":"https://api.github.com/repos/18F/calc/issues/734","repository_url":"https://api.github.com/repos/18F/calc","labels_url":"https://api.github.com/repos/18F/calc/issues/734/labels{/name}","comments_url":"https://api.github.com/repos/18F/calc/issues/734/comments","events_url":"https://api.github.com/repos/18F/calc/issues/734/events","html_url":"https://github.com/18F/calc/pull/734","id":176632655,"number":734,"title":"[WIP] Make step-based workflows more accessibility-friendly, consolidate step logic","user":{"login":"toolness","id":124687,"avatar_url":"https://avatars.githubusercontent.com/u/124687?v=3","gravatar_id":"","url":"https://api.github.com/users/toolness","html_url":"https://github.com/toolness","followers_url":"https://api.github.com/users/toolness/followers","following_url":"https://api.github.com/users/toolness/following{/other_user}","gists_url":"https://api.github.com/users/toolness/gists{/gist_id}","starred_url":"https://api.github.com/users/toolness/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toolness/subscriptions","organizations_url":"https://api.github.com/users/toolness/orgs","repos_url":"https://api.github.com/users/toolness/repos","events_url":"https://api.github.com/users/toolness/events{/privacy}","received_events_url":"https://api.github.com/users/toolness/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-13T12:54:43Z","updated_at":"2016-09-13T15:37:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/18F/calc/pulls/734","html_url":"https://github.com/18F/calc/pull/734","diff_url":"https://github.com/18F/calc/pull/734.diff","patch_url":"https://github.com/18F/calc/pull/734.patch"},"body":"This supersedes #578 and fixes #413, as it was easier to just start a new PR instead of deal with the merge conflicts.  I'm also taking a slightly different approach that will make it easier to consolidate logic across all step-based workflows (i.e. region 10 bulk upload and price list upload).\r\n\r\nBasically I'm doing this through the creation of a new `Steps` class, which encapsulates all the steps in a particular workflow.  Its main two features are:\r\n\r\n* `Steps.step`, a view decorator that passes in a `StepRenderer` instance to the view, which simplifies view logic.\r\n\r\n  The most unintuitive \"feature\" of this decorator at present is that it expects the view function's name to end with a number that corresponds to the step it represents, e.g. `step_4`, and it uses this number to determine things like what template to use for rendering.  This may or may not be a bit too \"convention over configuration\"-y for our tastes, so we can change it to explicitly take in a step number if we want.\r\n\r\n* `Steps.urls`, which returns a list of URLs that can be `include`'d in a Django URL config.\r\n\r\n    Really this feature was mainly just added as a way to ensure that the `Steps` class was working properly without having to write new unit tests. 😅  (That is, if it wasn't registering the URLs properly, I'd know something was afoot in its core logic!)\r\n\r\nThe API for the `Steps`/`StepRenderer` classes are inspired by Django's [`Paginator` / `Page`](https://docs.djangoproject.com/en/1.9/topics/pagination/) classes.\r\n\r\nIf these new classes seem useful, we can build on them more in future PRs to e.g. automatically render the steps widget for us, among other things.  I tried curbing my inner [architecture astronaut](http://www.joelonsoftware.com/articles/fog0000000018.html) to make this PR as small and non-disruptive as possible, but I'm not sure if I succeeded... Any feedback is appreciated!\r\n\r\n## To Do\r\n\r\n- [ ] Add unit tests.\r\n- [ ] Add documentation (specifically, docstrings for `Steps` and `StepRenderer`).\r\n- [ ] Apply the `Steps` class to Region 10 bulk upload once #694 is merged. (it's currently just applied to price list upload.)\r\n"},"comment":{"url":"https://api.github.com/repos/18F/calc/issues/comments/246723454","html_url":"https://github.com/18F/calc/pull/734#issuecomment-246723454","issue_url":"https://api.github.com/repos/18F/calc/issues/734","id":246723454,"user":{"login":"toolness","id":124687,"avatar_url":"https://avatars.githubusercontent.com/u/124687?v=3","gravatar_id":"","url":"https://api.github.com/users/toolness","html_url":"https://github.com/toolness","followers_url":"https://api.github.com/users/toolness/followers","following_url":"https://api.github.com/users/toolness/following{/other_user}","gists_url":"https://api.github.com/users/toolness/gists{/gist_id}","starred_url":"https://api.github.com/users/toolness/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toolness/subscriptions","organizations_url":"https://api.github.com/users/toolness/orgs","repos_url":"https://api.github.com/users/toolness/repos","events_url":"https://api.github.com/users/toolness/events{/privacy}","received_events_url":"https://api.github.com/users/toolness/received_events","type":"User","site_admin":false},"created_at":"2016-09-13T15:37:47Z","updated_at":"2016-09-13T15:37:47Z","body":"Oh sorry, you answered that question already!  Nevermind...\r\n\r\nI guess we could have the decorator take an *optional* `step_number` so that it pulls it out of the view name by default, but otherwise specific info can be passed-in to override?  I guess that we'd also have to provide information about the specific template to use too or something, blah."}}
{"actor":{"display_login":"toolness"}}