{"action":"created","issue":{"url":"https://api.github.com/repos/consul/consul/issues/2584","repository_url":"https://api.github.com/repos/consul/consul","labels_url":"https://api.github.com/repos/consul/consul/issues/2584/labels{/name}","comments_url":"https://api.github.com/repos/consul/consul/issues/2584/comments","events_url":"https://api.github.com/repos/consul/consul/issues/2584/events","html_url":"https://github.com/consul/consul/issues/2584","id":312864498,"node_id":"MDU6SXNzdWUzMTI4NjQ0OTg=","number":2584,"title":"Configure max number & size of attached documents per resource","user":{"login":"bertocq","id":983242,"node_id":"MDQ6VXNlcjk4MzI0Mg==","avatar_url":"https://avatars1.githubusercontent.com/u/983242?v=4","gravatar_id":"","url":"https://api.github.com/users/bertocq","html_url":"https://github.com/bertocq","followers_url":"https://api.github.com/users/bertocq/followers","following_url":"https://api.github.com/users/bertocq/following{/other_user}","gists_url":"https://api.github.com/users/bertocq/gists{/gist_id}","starred_url":"https://api.github.com/users/bertocq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bertocq/subscriptions","organizations_url":"https://api.github.com/users/bertocq/orgs","repos_url":"https://api.github.com/users/bertocq/repos","events_url":"https://api.github.com/users/bertocq/events{/privacy}","received_events_url":"https://api.github.com/users/bertocq/received_events","type":"User","site_admin":false},"labels":[{"id":242431640,"node_id":"MDU6TGFiZWwyNDI0MzE2NDA=","url":"https://api.github.com/repos/consul/consul/labels/Admin","name":"Admin","color":"008baa","default":false},{"id":799644329,"node_id":"MDU6TGFiZWw3OTk2NDQzMjk=","url":"https://api.github.com/repos/consul/consul/labels/Good%20first%20issue","name":"Good first issue","color":"1ca651","default":false},{"id":236685761,"node_id":"MDU6TGFiZWwyMzY2ODU3NjE=","url":"https://api.github.com/repos/consul/consul/labels/PRs-welcome","name":"PRs-welcome","color":"1ca651","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-04-10T10:31:48Z","updated_at":"2018-06-13T12:02:13Z","closed_at":null,"author_association":"MEMBER","body":"Context\r\n====\r\nAdmins should be able to configure the maximum number of attached documents that a user can add to each \"Documentable\" resource, as well as the maximum size in MB.\r\n\r\nRight now we have 4 resources that can have Documents attached\r\n\r\nWhat\r\n===\r\n\r\n### 1- Setting entries for the 8 values:\r\nThere should be 8 new setting entries like:\r\n```ruby\r\nSetting['documents.proposal.max_size'] = '3'\r\nSetting['documents.proposal.max_number'] = '3'\r\nSetting['documents.budget_investment.max_size'] = '3'\r\nSetting['documents.budget_investment.max_number'] = '3'\r\nSetting['documents.budget_investment_milestone.max_size'] = '3'\r\nSetting['documents.budget_investment_milestone.max_number'] = '3'\r\nSetting['documents.legislation_process.max_size'] = '3'\r\nSetting['documents.legislation_process.max_number'] = '3'\r\n```\r\nAdded to both [`db/seeds.rb`](https://github.com/AyuntamientoMadrid/consul/blob/master/db/seeds.rb) & [`db/dev_seeds.rb`](https://github.com/AyuntamientoMadrid/consul/blob/master/db/dev_seeds.rb)\r\n\r\nThose setting should be used to replace hardcoded values on the 4 models (and possible other parts of the code... please do some research):\r\n- [Proposal](https://github.com/ayuntamientomadrid/consul/blob/master/app/models/proposal.rb#L19-L21)\r\n- [Budget::Investment](https://github.com/ayuntamientomadrid/consul/blob/master/app/models/budget/investment.rb#L18-L19)\r\n- [Budget::Investment::Milestone](https://github.com/ayuntamientomadrid/consul/blob/master/app/models/budget/investment/milestone.rb#L6-L8)\r\n- [Legislation::Process](https://github.com/AyuntamientoMadrid/consul/blob/master/app/models/legislation/process.rb#L5-L7)\r\n\r\nKeep in mind Setting can only store strings, so both values will have to be converted from string to integer, and additionally the `max_size` will need a trailing `.megabytes` call.\r\n \r\n### 2- Admin panel settings table\r\nAt `/admin/settings` route (admin settings panel section) there should be table containing the 4 documentable resources, offering to configure both max size and max number values for each of them. _[See screenshot]_\r\n\r\n### 3- Rake task to initialize the 8 values\r\nAdd a rake task to initialize the values for these settings\r\nMention in the PR Notes section that this rake task has been added\r\n\r\n[Here](https://github.com/AyuntamientoMadrid/consul/pull/1410/files#diff-953f1ebf089a24bb2d60e96c0c9fe2e7R11) is a good example on how to implement the rake task \r\nAnd [here](https://github.com/AyuntamientoMadrid/consul/pull/1410) an example for the the PR Release Notes\r\n\r\n## Screenshots\r\n\r\n![documents_admin_settings](https://user-images.githubusercontent.com/631897/38821000-a726d71c-419f-11e8-87c2-f6fd6cd7e242.png)\r\n"},"comment":{"url":"https://api.github.com/repos/consul/consul/issues/comments/396913189","html_url":"https://github.com/consul/consul/issues/2584#issuecomment-396913189","issue_url":"https://api.github.com/repos/consul/consul/issues/2584","id":396913189,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjkxMzE4OQ==","user":{"login":"voodoorai2000","id":4169,"node_id":"MDQ6VXNlcjQxNjk=","avatar_url":"https://avatars3.githubusercontent.com/u/4169?v=4","gravatar_id":"","url":"https://api.github.com/users/voodoorai2000","html_url":"https://github.com/voodoorai2000","followers_url":"https://api.github.com/users/voodoorai2000/followers","following_url":"https://api.github.com/users/voodoorai2000/following{/other_user}","gists_url":"https://api.github.com/users/voodoorai2000/gists{/gist_id}","starred_url":"https://api.github.com/users/voodoorai2000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voodoorai2000/subscriptions","organizations_url":"https://api.github.com/users/voodoorai2000/orgs","repos_url":"https://api.github.com/users/voodoorai2000/repos","events_url":"https://api.github.com/users/voodoorai2000/events{/privacy}","received_events_url":"https://api.github.com/users/voodoorai2000/received_events","type":"User","site_admin":false},"created_at":"2018-06-13T12:02:13Z","updated_at":"2018-06-13T12:02:13Z","author_association":"MEMBER","body":"Hey @cheneyshreve!\r\n\r\nAwesome! Yes go ahead 🎉\r\n\r\n+1 to adding the new settings in `dev_seeds/settings.rb` and `db/seeds.rb`\r\n\r\nThe rake task looks good too, I would probaly go for a single rake task for all the new settings 👌 "}}
{"actor":{"display_login":"voodoorai2000"}}