{"action":"created","comment":{"url":"https://api.github.com/repos/zfrenchee/Bluemoon/pulls/comments/27770684","id":27770684,"diff_hunk":"@@ -0,0 +1,157 @@\n+\n+class AddEventView extends Backbone.View\n+\t# receives an el and a model from parent\n+\n+\tevents: null # TODO\n+\n+\tinitialize: => # add listeners to @model\n+\t\t@model.on 'groups.changed', @constructGroupsList\n+\n+\trender: =>\n+\t\t$('.tl-addEvent-from').timepicker()\n+\t\t$('.tl-addEvent-to').timepicker()\n+\n+\t\t@Calendar = new CalendarView \n+\t\t\tel: $('.tl-addEvent-calendar')\n+\t\t\tcb: (date) -> null\n+\n+\t\t$('.tl-addEvent-submit-btn').click => @submitForm()\n+\t\t@constructGroupsList()\n+\t\n+\tconstructGroupsList: =>\n+\t\t$('.tl-addEvent-group').html('')\n+\t\tfor group in @model.get('groups')\n+\t\t\t$('.tl-addEvent-group').append(\"<option>#{group.name}</option>\")\n+\n+\tsubmitForm: ->\n+\t\tEvent = new EventModel\n+\t\t\t'group': $('.tl-addEvent-group').val()\n+\t\t\t'name': $('.tl-addEvent-name').val()\n+\t\t\t'description': $('.tl-addEvent-desc').val()\n+\t\t\t'place': $('.tl-addEvent-place').val()\n+\n+\t\tstartTime = $('.tl-addEvent-from').val().split(/\\s|:/)\n+\t\tendTime = $('.tl-addEvent-to').val().split(/\\s|:/)\n+\n+\t\tstartTime = moment(\"#{startTime[0]}:#{startTime[1]} #{startTime[2]}\", \"hh:mm A\").diff(moment().startOf('day'))       \n+\t\tendTime = moment(\"#{endTime[0]}:#{endTime[1]} #{endTime[2]}\", \"hh:mm A\").diff(moment().startOf('day'))\n+\n+\t\tstartTime = moment(@Calendar.date()).add(startTime)\n+\t\tendTime   = moment(@Calendar.date()).add(endTime)\n+\n+\t\tif endTime.isBefore(startTime) then endTime.add(1, 'days')\n+\n+\t\tEvent.set 'startTime', startTime.toDate()\n+\t\tEvent.set 'endTime', endTime.toDate()\n+\n+\t\t@model.createEvent Event.toJSON(), (res) => \n+\t\t\t$('.tl-addEventModal').modal('hide')\n+\t\t\t$('.tl-addEventModal').find('input,textarea').val('')\n+\t\t\t# notice says \"event successfuly created\"\n+\t\tEvent.destroy() #this might be a bad idea in the future","path":"tuftslife/assets/js/EventCRUDViews.coffee","position":51,"original_position":51,"commit_id":"3ddb5d20aab49d031e8ae0f7ddcabf469d8145f1","original_commit_id":"3ddb5d20aab49d031e8ae0f7ddcabf469d8145f1","user":{"login":"zfrenchee","id":2761597,"avatar_url":"https://avatars.githubusercontent.com/u/2761597?v=3","gravatar_id":"","url":"https://api.github.com/users/zfrenchee","html_url":"https://github.com/zfrenchee","followers_url":"https://api.github.com/users/zfrenchee/followers","following_url":"https://api.github.com/users/zfrenchee/following{/other_user}","gists_url":"https://api.github.com/users/zfrenchee/gists{/gist_id}","starred_url":"https://api.github.com/users/zfrenchee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zfrenchee/subscriptions","organizations_url":"https://api.github.com/users/zfrenchee/orgs","repos_url":"https://api.github.com/users/zfrenchee/repos","events_url":"https://api.github.com/users/zfrenchee/events{/privacy}","received_events_url":"https://api.github.com/users/zfrenchee/received_events","type":"User","site_admin":false},"body":"I left myself a flag here forevers ago. Do you mind resolving this before we merge? If creating a new EventModel, serializing it, and destroying it is actually the appropriate action we want to take, then that's fine. I have no idea how this is done in real life...","created_at":"2015-04-04T17:54:29Z","updated_at":"2015-04-04T17:54:29Z","html_url":"https://github.com/zfrenchee/Bluemoon/pull/25#discussion_r27770684","pull_request_url":"https://api.github.com/repos/zfrenchee/Bluemoon/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/zfrenchee/Bluemoon/pulls/comments/27770684"},"html":{"href":"https://github.com/zfrenchee/Bluemoon/pull/25#discussion_r27770684"},"pull_request":{"href":"https://api.github.com/repos/zfrenchee/Bluemoon/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/zfrenchee/Bluemoon/pulls/25","id":32607202,"html_url":"https://github.com/zfrenchee/Bluemoon/pull/25","diff_url":"https://github.com/zfrenchee/Bluemoon/pull/25.diff","patch_url":"https://github.com/zfrenchee/Bluemoon/pull/25.patch","issue_url":"https://api.github.com/repos/zfrenchee/Bluemoon/issues/25","number":25,"state":"open","locked":false,"title":"Organized Backbone Views. Edit Group works. Autopopulate works. Group lists in sync","user":{"login":"BSteephenson","id":7459695,"avatar_url":"https://avatars.githubusercontent.com/u/7459695?v=3","gravatar_id":"","url":"https://api.github.com/users/BSteephenson","html_url":"https://github.com/BSteephenson","followers_url":"https://api.github.com/users/BSteephenson/followers","following_url":"https://api.github.com/users/BSteephenson/following{/other_user}","gists_url":"https://api.github.com/users/BSteephenson/gists{/gist_id}","starred_url":"https://api.github.com/users/BSteephenson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BSteephenson/subscriptions","organizations_url":"https://api.github.com/users/BSteephenson/orgs","repos_url":"https://api.github.com/users/BSteephenson/repos","events_url":"https://api.github.com/users/BSteephenson/events{/privacy}","received_events_url":"https://api.github.com/users/BSteephenson/received_events","type":"User","site_admin":false},"body":"This is a realllly big PR.\r\n** This does NOT break anything (anything that wasn't broken before)\r\n\r\n# Aims\r\n- Organize front end so it's somewhat more manageable\r\n- Have things sync across the page\r\n\r\n# New Organization\r\n- Renamed EventsView to EventsPageView, which better explains what that thing is doing\r\n- EventsPageView has a UserView (represents the top bar thing)\r\n- UserView has the buttons and the respective modals (contained in GroupViews.coffee and EventCRUDViews.coffee)\r\n- GroupViews.coffee currently has AddGroupView and EditGroupView\r\n- EventCRUDViews.coffee currently has AddEventView, EditEventView, and DeleteEventView\r\n\r\nTo picture it as an hierarchy \r\n- EventsPageView\r\n    - UserView\r\n        - AddGroupView\r\n        - EditGroupView\r\n        - AddEventView\r\n        - EditEventView\r\n        - DeleteGroupView\r\n        - ( more to come as we do ChangeAdmins and DeleteGroup)\r\n\r\n# Keeping Things In Sync\r\n- EventsPageView has a UserModel\r\n- EventsPageView passes this UserModel down to UserView\r\n- UserView passes this UserModel down to the modals\r\n- Since JS is pass by pointer for objects, everyone has a pointer to a singleton UserModel\r\n- Each view can listen to events triggered by the UserModel and do the necessary DOM changes (example: @model.on 'groups.changed', @rerenderListOrSomething\r\n- Each view makes form submissions through the UserModel\r\n\r\nAddViewModel submits a form => UserModel makes the API call => UserModel refreshes => UserModel triggers 'groups.changed' => Everything on the page that has a list of groups makes the necessary updates\r\n\r\n# What Works?\r\n- Logging in and signing up\r\n- Adding a group\r\n- Adding an event\r\n- Editing a group (plus auto-populate and the list is in sync) *this didn't work before*\r\n- The Events listing stays in sync with edits to a group *this didn't work before*\r\n\r\n# What Doesn't Work?\r\n- Admin and Deleting a group (laziness, do it later,  I think Lenail is doing the admin part)\r\n- Changing and Deleting an event (right now there's no straightforward way to get a user's group's events.. Need some API developments)\r\n\r\nThis isn't the perfect way to approach this, but I think this is a good base for making incremental fixes and changes in the future. ","created_at":"2015-04-03T18:36:36Z","updated_at":"2015-04-04T17:54:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d17448d6beb7034e454f4e9c67e747dfea00a975","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zfrenchee/Bluemoon/pulls/25/commits","review_comments_url":"https://api.github.com/repos/zfrenchee/Bluemoon/pulls/25/comments","review_comment_url":"https://api.github.com/repos/zfrenchee/Bluemoon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zfrenchee/Bluemoon/issues/25/comments","statuses_url":"https://api.github.com/repos/zfrenchee/Bluemoon/statuses/3ddb5d20aab49d031e8ae0f7ddcabf469d8145f1","head":{"label":"zfrenchee:ben","ref":"ben","sha":"3ddb5d20aab49d031e8ae0f7ddcabf469d8145f1","user":{"login":"zfrenchee","id":2761597,"avatar_url":"https://avatars.githubusercontent.com/u/2761597?v=3","gravatar_id":"","url":"https://api.github.com/users/zfrenchee","html_url":"https://github.com/zfrenchee","followers_url":"https://api.github.com/users/zfrenchee/followers","following_url":"https://api.github.com/users/zfrenchee/following{/other_user}","gists_url":"https://api.github.com/users/zfrenchee/gists{/gist_id}","starred_url":"https://api.github.com/users/zfrenchee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zfrenchee/subscriptions","organizations_url":"https://api.github.com/users/zfrenchee/orgs","repos_url":"https://api.github.com/users/zfrenchee/repos","events_url":"https://api.github.com/users/zfrenchee/events{/privacy}","received_events_url":"https://api.github.com/users/zfrenchee/received_events","type":"User","site_admin":false},"repo":{"id":22853922,"name":"Bluemoon","full_name":"zfrenchee/Bluemoon","owner":{"login":"zfrenchee","id":2761597,"avatar_url":"https://avatars.githubusercontent.com/u/2761597?v=3","gravatar_id":"","url":"https://api.github.com/users/zfrenchee","html_url":"https://github.com/zfrenchee","followers_url":"https://api.github.com/users/zfrenchee/followers","following_url":"https://api.github.com/users/zfrenchee/following{/other_user}","gists_url":"https://api.github.com/users/zfrenchee/gists{/gist_id}","starred_url":"https://api.github.com/users/zfrenchee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zfrenchee/subscriptions","organizations_url":"https://api.github.com/users/zfrenchee/orgs","repos_url":"https://api.github.com/users/zfrenchee/repos","events_url":"https://api.github.com/users/zfrenchee/events{/privacy}","received_events_url":"https://api.github.com/users/zfrenchee/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zfrenchee/Bluemoon","description":"To be transferred somewhere else later. ","fork":false,"url":"https://api.github.com/repos/zfrenchee/Bluemoon","forks_url":"https://api.github.com/repos/zfrenchee/Bluemoon/forks","keys_url":"https://api.github.com/repos/zfrenchee/Bluemoon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zfrenchee/Bluemoon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zfrenchee/Bluemoon/teams","hooks_url":"https://api.github.com/repos/zfrenchee/Bluemoon/hooks","issue_events_url":"https://api.github.com/repos/zfrenchee/Bluemoon/issues/events{/number}","events_url":"https://api.github.com/repos/zfrenchee/Bluemoon/events","assignees_url":"https://api.github.com/repos/zfrenchee/Bluemoon/assignees{/user}","branches_url":"https://api.github.com/repos/zfrenchee/Bluemoon/branches{/branch}","tags_url":"https://api.github.com/repos/zfrenchee/Bluemoon/tags","blobs_url":"https://api.github.com/repos/zfrenchee/Bluemoon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zfrenchee/Bluemoon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zfrenchee/Bluemoon/git/refs{/sha}","trees_url":"https://api.github.com/repos/zfrenchee/Bluemoon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zfrenchee/Bluemoon/statuses/{sha}","languages_url":"https://api.github.com/repos/zfrenchee/Bluemoon/languages","stargazers_url":"https://api.github.com/repos/zfrenchee/Bluemoon/stargazers","contributors_url":"https://api.github.com/repos/zfrenchee/Bluemoon/contributors","subscribers_url":"https://api.github.com/repos/zfrenchee/Bluemoon/subscribers","subscription_url":"https://api.github.com/repos/zfrenchee/Bluemoon/subscription","commits_url":"https://api.github.com/repos/zfrenchee/Bluemoon/commits{/sha}","git_commits_url":"https://api.github.com/repos/zfrenchee/Bluemoon/git/commits{/sha}","comments_url":"https://api.github.com/repos/zfrenchee/Bluemoon/comments{/number}","issue_comment_url":"https://api.github.com/repos/zfrenchee/Bluemoon/issues/comments{/number}","contents_url":"https://api.github.com/repos/zfrenchee/Bluemoon/contents/{+path}","compare_url":"https://api.github.com/repos/zfrenchee/Bluemoon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zfrenchee/Bluemoon/merges","archive_url":"https://api.github.com/repos/zfrenchee/Bluemoon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zfrenchee/Bluemoon/downloads","issues_url":"https://api.github.com/repos/zfrenchee/Bluemoon/issues{/number}","pulls_url":"https://api.github.com/repos/zfrenchee/Bluemoon/pulls{/number}","milestones_url":"https://api.github.com/repos/zfrenchee/Bluemoon/milestones{/number}","notifications_url":"https://api.github.com/repos/zfrenchee/Bluemoon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zfrenchee/Bluemoon/labels{/name}","releases_url":"https://api.github.com/repos/zfrenchee/Bluemoon/releases{/id}","created_at":"2014-08-11T20:34:51Z","updated_at":"2015-04-02T22:26:51Z","pushed_at":"2015-04-03T18:36:36Z","git_url":"git://github.com/zfrenchee/Bluemoon.git","ssh_url":"git@github.com:zfrenchee/Bluemoon.git","clone_url":"https://github.com/zfrenchee/Bluemoon.git","svn_url":"https://github.com/zfrenchee/Bluemoon","homepage":"","size":1817,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"zfrenchee:master","ref":"master","sha":"de086b793b2ca7c228dc99ef1ead3764cae6faee","user":{"login":"zfrenchee","id":2761597,"avatar_url":"https://avatars.githubusercontent.com/u/2761597?v=3","gravatar_id":"","url":"https://api.github.com/users/zfrenchee","html_url":"https://github.com/zfrenchee","followers_url":"https://api.github.com/users/zfrenchee/followers","following_url":"https://api.github.com/users/zfrenchee/following{/other_user}","gists_url":"https://api.github.com/users/zfrenchee/gists{/gist_id}","starred_url":"https://api.github.com/users/zfrenchee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zfrenchee/subscriptions","organizations_url":"https://api.github.com/users/zfrenchee/orgs","repos_url":"https://api.github.com/users/zfrenchee/repos","events_url":"https://api.github.com/users/zfrenchee/events{/privacy}","received_events_url":"https://api.github.com/users/zfrenchee/received_events","type":"User","site_admin":false},"repo":{"id":22853922,"name":"Bluemoon","full_name":"zfrenchee/Bluemoon","owner":{"login":"zfrenchee","id":2761597,"avatar_url":"https://avatars.githubusercontent.com/u/2761597?v=3","gravatar_id":"","url":"https://api.github.com/users/zfrenchee","html_url":"https://github.com/zfrenchee","followers_url":"https://api.github.com/users/zfrenchee/followers","following_url":"https://api.github.com/users/zfrenchee/following{/other_user}","gists_url":"https://api.github.com/users/zfrenchee/gists{/gist_id}","starred_url":"https://api.github.com/users/zfrenchee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zfrenchee/subscriptions","organizations_url":"https://api.github.com/users/zfrenchee/orgs","repos_url":"https://api.github.com/users/zfrenchee/repos","events_url":"https://api.github.com/users/zfrenchee/events{/privacy}","received_events_url":"https://api.github.com/users/zfrenchee/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zfrenchee/Bluemoon","description":"To be transferred somewhere else later. ","fork":false,"url":"https://api.github.com/repos/zfrenchee/Bluemoon","forks_url":"https://api.github.com/repos/zfrenchee/Bluemoon/forks","keys_url":"https://api.github.com/repos/zfrenchee/Bluemoon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zfrenchee/Bluemoon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zfrenchee/Bluemoon/teams","hooks_url":"https://api.github.com/repos/zfrenchee/Bluemoon/hooks","issue_events_url":"https://api.github.com/repos/zfrenchee/Bluemoon/issues/events{/number}","events_url":"https://api.github.com/repos/zfrenchee/Bluemoon/events","assignees_url":"https://api.github.com/repos/zfrenchee/Bluemoon/assignees{/user}","branches_url":"https://api.github.com/repos/zfrenchee/Bluemoon/branches{/branch}","tags_url":"https://api.github.com/repos/zfrenchee/Bluemoon/tags","blobs_url":"https://api.github.com/repos/zfrenchee/Bluemoon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zfrenchee/Bluemoon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zfrenchee/Bluemoon/git/refs{/sha}","trees_url":"https://api.github.com/repos/zfrenchee/Bluemoon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zfrenchee/Bluemoon/statuses/{sha}","languages_url":"https://api.github.com/repos/zfrenchee/Bluemoon/languages","stargazers_url":"https://api.github.com/repos/zfrenchee/Bluemoon/stargazers","contributors_url":"https://api.github.com/repos/zfrenchee/Bluemoon/contributors","subscribers_url":"https://api.github.com/repos/zfrenchee/Bluemoon/subscribers","subscription_url":"https://api.github.com/repos/zfrenchee/Bluemoon/subscription","commits_url":"https://api.github.com/repos/zfrenchee/Bluemoon/commits{/sha}","git_commits_url":"https://api.github.com/repos/zfrenchee/Bluemoon/git/commits{/sha}","comments_url":"https://api.github.com/repos/zfrenchee/Bluemoon/comments{/number}","issue_comment_url":"https://api.github.com/repos/zfrenchee/Bluemoon/issues/comments{/number}","contents_url":"https://api.github.com/repos/zfrenchee/Bluemoon/contents/{+path}","compare_url":"https://api.github.com/repos/zfrenchee/Bluemoon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zfrenchee/Bluemoon/merges","archive_url":"https://api.github.com/repos/zfrenchee/Bluemoon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zfrenchee/Bluemoon/downloads","issues_url":"https://api.github.com/repos/zfrenchee/Bluemoon/issues{/number}","pulls_url":"https://api.github.com/repos/zfrenchee/Bluemoon/pulls{/number}","milestones_url":"https://api.github.com/repos/zfrenchee/Bluemoon/milestones{/number}","notifications_url":"https://api.github.com/repos/zfrenchee/Bluemoon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zfrenchee/Bluemoon/labels{/name}","releases_url":"https://api.github.com/repos/zfrenchee/Bluemoon/releases{/id}","created_at":"2014-08-11T20:34:51Z","updated_at":"2015-04-02T22:26:51Z","pushed_at":"2015-04-03T18:36:36Z","git_url":"git://github.com/zfrenchee/Bluemoon.git","ssh_url":"git@github.com:zfrenchee/Bluemoon.git","clone_url":"https://github.com/zfrenchee/Bluemoon.git","svn_url":"https://github.com/zfrenchee/Bluemoon","homepage":"","size":1817,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zfrenchee/Bluemoon/pulls/25"},"html":{"href":"https://github.com/zfrenchee/Bluemoon/pull/25"},"issue":{"href":"https://api.github.com/repos/zfrenchee/Bluemoon/issues/25"},"comments":{"href":"https://api.github.com/repos/zfrenchee/Bluemoon/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/zfrenchee/Bluemoon/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/zfrenchee/Bluemoon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zfrenchee/Bluemoon/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/zfrenchee/Bluemoon/statuses/3ddb5d20aab49d031e8ae0f7ddcabf469d8145f1"}}}}