{"action":"created","issue":{"url":"https://api.github.com/repos/CartoDB/cartodb/issues/3277","labels_url":"https://api.github.com/repos/CartoDB/cartodb/issues/3277/labels{/name}","comments_url":"https://api.github.com/repos/CartoDB/cartodb/issues/3277/comments","events_url":"https://api.github.com/repos/CartoDB/cartodb/issues/3277/events","html_url":"https://github.com/CartoDB/cartodb/pull/3277","id":69548631,"number":3277,"title":"New add layer modal","user":{"login":"viddo","id":978461,"avatar_url":"https://avatars.githubusercontent.com/u/978461?v=3","gravatar_id":"","url":"https://api.github.com/users/viddo","html_url":"https://github.com/viddo","followers_url":"https://api.github.com/users/viddo/followers","following_url":"https://api.github.com/users/viddo/following{/other_user}","gists_url":"https://api.github.com/users/viddo/gists{/gist_id}","starred_url":"https://api.github.com/users/viddo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viddo/subscriptions","organizations_url":"https://api.github.com/users/viddo/orgs","repos_url":"https://api.github.com/users/viddo/repos","events_url":"https://api.github.com/users/viddo/events{/privacy}","received_events_url":"https://api.github.com/users/viddo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-20T09:39:30Z","updated_at":"2015-04-20T10:44:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CartoDB/cartodb/pulls/3277","html_url":"https://github.com/CartoDB/cartodb/pull/3277","diff_url":"https://github.com/CartoDB/cartodb/pull/3277.diff","patch_url":"https://github.com/CartoDB/cartodb/pull/3277.patch"},"body":"Fixes #3161 since this modal is rather big it will only support adding a single layer in this first iteration.\r\n\r\nThis PR became rather big, but it was necessary to accommodate existing code to work with this new use-case context.\r\n\r\nBasically, the reused part is this: ![screen shot 2015-04-20 at 11 22 00](https://cloud.githubusercontent.com/assets/978461/7227305/03b613ec-e750-11e4-9091-6833112307d1.png) and it's underlying views/models. The header and footer differed so much it made no sense to reuse them.\r\n\r\n- While working on this I observed that most of the **views do too much**. I had to spend a lot time to understand what was going on, and **extract non-view logic** that do not belong in a view **to appropriate models**. In many cases some logic are only relevant for a certain use-case, why I used view-models to place that logic, instead of resorting to a bunch of if-ifelse-else cases which only would have complicated things even further.\r\n- Background importer process is another part of the system that was necessary to change for this feature, followed same approach as explained above there too.\r\n- All code related to the background-importer was moved to `new_common/background_importer` to keep things more tidy and now being shared for both editor and dashboard.\r\n\r\nI'll add inline comments with the code changes, to further explain details in-context."},"comment":{"url":"https://api.github.com/repos/CartoDB/cartodb/issues/comments/94419530","html_url":"https://github.com/CartoDB/cartodb/pull/3277#issuecomment-94419530","issue_url":"https://api.github.com/repos/CartoDB/cartodb/issues/3277","id":94419530,"user":{"login":"Cartofante","id":5066482,"avatar_url":"https://avatars.githubusercontent.com/u/5066482?v=3","gravatar_id":"","url":"https://api.github.com/users/Cartofante","html_url":"https://github.com/Cartofante","followers_url":"https://api.github.com/users/Cartofante/followers","following_url":"https://api.github.com/users/Cartofante/following{/other_user}","gists_url":"https://api.github.com/users/Cartofante/gists{/gist_id}","starred_url":"https://api.github.com/users/Cartofante/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cartofante/subscriptions","organizations_url":"https://api.github.com/users/Cartofante/orgs","repos_url":"https://api.github.com/users/Cartofante/repos","events_url":"https://api.github.com/users/Cartofante/events{/privacy}","received_events_url":"https://api.github.com/users/Cartofante/received_events","type":"User","site_admin":false},"created_at":"2015-04-20T10:44:43Z","updated_at":"2015-04-20T10:44:43Z","body":"Frontend tests were OK :+1: ([details](http://clinker.cartodb.net/jenkins/job/CartoDB-PR-testing/3111/))"}}