{"action":"created","comment":{"url":"https://api.github.com/repos/pretix/pretix/pulls/comments/109318974","pull_request_review_id":30413104,"id":109318974,"diff_hunk":"@@ -400,6 +405,78 @@ def post(self, request, *args, **kwargs):\n             return self.get(request)\n \n \n+class MailSettingsPreview(EventPermissionRequiredMixin, View):\n+    permission = 'can_change_settings'\n+\n+    # return the origin text if key is missing in dict\n+    class SafeDict(dict):\n+        def __missing__(self, key):\n+            return '{' + key + '}'\n+\n+    @cached_property\n+    def items(self):\n+        return {\n+            'mail_text_order_placed': ['total', 'currency', 'date', 'invoice_company',\n+                                       'event', 'paymentinfo', 'url', 'invoice_name'],\n+            'mail_text_order_paid': ['event', 'url', 'invoice_name', 'invoice_company', 'payment_info'],\n+            'mail_text_order_free': ['event', 'url', 'invoice_name', 'invoice_company'],\n+            'mail_text_resend_link': ['event', 'url', 'invoice_name', 'invoice_company'],\n+            'mail_text_resend_all_links': ['event', 'orders'],\n+            'mail_text_order_changed': ['event', 'url', 'invoice_name', 'invoice_company'],\n+            'mail_text_order_expire_warning': ['event', 'url', 'expire_date', 'invoice_name', 'invoice_company'],\n+            'mail_text_waiting_list': ['event', 'url', 'product', 'hours', 'code']\n+        }\n+\n+    @cached_property\n+    def dummy_data(self):\n+        return {\n+            'event': self.request.event.name,\n+            'total': 100,\n+            'currency': self.request.event.currency,\n+            'date': date_format(now() + timedelta(days=7), 'SHORT_DATE_FORMAT'),\n+            'paymentinfo': _('Please transfer money to this bank account: BANK-ACCOUNT-0001'),\n+            'payment_info': _('Please transfer money to this bank account: BANK-ACCOUNT-0001'),\n+            'url': build_absolute_uri('presale:event.index', kwargs={\n+                'event': self.request.event.slug,\n+                'organizer': self.request.event.organizer\n+            }),\n+            'invoice_name': _('Invoice for {}.').format(self.request.event.name),\n+            'invoice_company': self.request.event.organizer.name,\n+            'orders': 'ORDER-0001\\nORDER-0002\\nORDER-0003\\nORDER-0004',\n+            'expire_date': date_format(now() + timedelta(days=15), 'SHORT_DATE_FORMAT'),","path":"src/pretix/control/views/event.py","position":63,"original_position":63,"commit_id":"e0f690551b0d9564748daa3fc6f70d642785307a","original_commit_id":"e0f690551b0d9564748daa3fc6f70d642785307a","user":{"login":"raphaelm","id":64280,"avatar_url":"https://avatars1.githubusercontent.com/u/64280?v=3","gravatar_id":"","url":"https://api.github.com/users/raphaelm","html_url":"https://github.com/raphaelm","followers_url":"https://api.github.com/users/raphaelm/followers","following_url":"https://api.github.com/users/raphaelm/following{/other_user}","gists_url":"https://api.github.com/users/raphaelm/gists{/gist_id}","starred_url":"https://api.github.com/users/raphaelm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphaelm/subscriptions","organizations_url":"https://api.github.com/users/raphaelm/orgs","repos_url":"https://api.github.com/users/raphaelm/repos","events_url":"https://api.github.com/users/raphaelm/events{/privacy}","received_events_url":"https://api.github.com/users/raphaelm/received_events","type":"User","site_admin":false},"body":"Same as above","created_at":"2017-04-02T20:22:10Z","updated_at":"2017-04-02T20:27:28Z","html_url":"https://github.com/pretix/pretix/pull/438#discussion_r109318974","pull_request_url":"https://api.github.com/repos/pretix/pretix/pulls/438","_links":{"self":{"href":"https://api.github.com/repos/pretix/pretix/pulls/comments/109318974"},"html":{"href":"https://github.com/pretix/pretix/pull/438#discussion_r109318974"},"pull_request":{"href":"https://api.github.com/repos/pretix/pretix/pulls/438"}}},"pull_request":{"url":"https://api.github.com/repos/pretix/pretix/pulls/438","id":112578011,"html_url":"https://github.com/pretix/pretix/pull/438","diff_url":"https://github.com/pretix/pretix/pull/438.diff","patch_url":"https://github.com/pretix/pretix/pull/438.patch","issue_url":"https://api.github.com/repos/pretix/pretix/issues/438","number":438,"state":"open","locked":false,"title":"[UI only] Issue #308: Preview for email templates","user":{"login":"jlwt90","id":25281597,"avatar_url":"https://avatars2.githubusercontent.com/u/25281597?v=3","gravatar_id":"","url":"https://api.github.com/users/jlwt90","html_url":"https://github.com/jlwt90","followers_url":"https://api.github.com/users/jlwt90/followers","following_url":"https://api.github.com/users/jlwt90/following{/other_user}","gists_url":"https://api.github.com/users/jlwt90/gists{/gist_id}","starred_url":"https://api.github.com/users/jlwt90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlwt90/subscriptions","organizations_url":"https://api.github.com/users/jlwt90/orgs","repos_url":"https://api.github.com/users/jlwt90/repos","events_url":"https://api.github.com/users/jlwt90/events{/privacy}","received_events_url":"https://api.github.com/users/jlwt90/received_events","type":"User","site_admin":false},"body":"Hello, this is the PR for #308 .\r\n\r\nI modified the behaviour of the first email template: *Placed Order*. \r\n![screen shot 2017-03-25 at 4 35 31 pm](https://cloud.githubusercontent.com/assets/25281597/24320516/3bf5cf62-117a-11e7-971d-d3bd172c56e7.png)\r\n\r\nThere are two tabs at the bottom, *edit* and *preview*.\r\nWhen you click on the *preview* tab, an ajax request will be fired to `/control/event/**/***/settings/email/preview` endpoint.\r\n\r\n![screen shot 2017-03-25 at 4 35 57 pm](https://cloud.githubusercontent.com/assets/25281597/24320542/8c31b586-117a-11e7-9423-1ca3cde9f1ec.png)\r\n\r\nI haven't implemented the backend logic at this moment (I'll add more commits later). \r\nThe dummy response I am currently using is:\r\n```\r\n{\r\n            'item': 'order_placed',\r\n            'msgs': {\r\n                'mail_text_order_placed_0': 'English version!',\r\n                'mail_text_order_placed_1': 'Deutsch version!'\r\n            }\r\n        }\r\n```\r\nWhat do you think about this UI? :D\r\nPS: Please also help check whether I can improve my code too. I don't have much front-end experience. Comments are welcome :)\r\n\r\n*Task:*\r\n- [x] Draft of UI change\r\n- [x] UI Modification based on comments\r\n- [x] Remove dummy response in backend view\r\n- [x] Work on the remaining templates\r\n- [x] Add tests","created_at":"2017-03-25T07:50:03Z","updated_at":"2017-04-02T20:27:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ce2850c969bd54d29c03461e3667888a5c8a1413","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pretix/pretix/pulls/438/commits","review_comments_url":"https://api.github.com/repos/pretix/pretix/pulls/438/comments","review_comment_url":"https://api.github.com/repos/pretix/pretix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pretix/pretix/issues/438/comments","statuses_url":"https://api.github.com/repos/pretix/pretix/statuses/e0f690551b0d9564748daa3fc6f70d642785307a","head":{"label":"jlwt90:mail-template-preview","ref":"mail-template-preview","sha":"e0f690551b0d9564748daa3fc6f70d642785307a","user":{"login":"jlwt90","id":25281597,"avatar_url":"https://avatars2.githubusercontent.com/u/25281597?v=3","gravatar_id":"","url":"https://api.github.com/users/jlwt90","html_url":"https://github.com/jlwt90","followers_url":"https://api.github.com/users/jlwt90/followers","following_url":"https://api.github.com/users/jlwt90/following{/other_user}","gists_url":"https://api.github.com/users/jlwt90/gists{/gist_id}","starred_url":"https://api.github.com/users/jlwt90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlwt90/subscriptions","organizations_url":"https://api.github.com/users/jlwt90/orgs","repos_url":"https://api.github.com/users/jlwt90/repos","events_url":"https://api.github.com/users/jlwt90/events{/privacy}","received_events_url":"https://api.github.com/users/jlwt90/received_events","type":"User","site_admin":false},"repo":{"id":80030328,"name":"pretix","full_name":"jlwt90/pretix","owner":{"login":"jlwt90","id":25281597,"avatar_url":"https://avatars2.githubusercontent.com/u/25281597?v=3","gravatar_id":"","url":"https://api.github.com/users/jlwt90","html_url":"https://github.com/jlwt90","followers_url":"https://api.github.com/users/jlwt90/followers","following_url":"https://api.github.com/users/jlwt90/following{/other_user}","gists_url":"https://api.github.com/users/jlwt90/gists{/gist_id}","starred_url":"https://api.github.com/users/jlwt90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlwt90/subscriptions","organizations_url":"https://api.github.com/users/jlwt90/orgs","repos_url":"https://api.github.com/users/jlwt90/repos","events_url":"https://api.github.com/users/jlwt90/events{/privacy}","received_events_url":"https://api.github.com/users/jlwt90/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jlwt90/pretix","description":"Ticket shop application for conferences, festivals, concerts, tech events, shows, exhibitions, workshops, barcamps, etc.","fork":true,"url":"https://api.github.com/repos/jlwt90/pretix","forks_url":"https://api.github.com/repos/jlwt90/pretix/forks","keys_url":"https://api.github.com/repos/jlwt90/pretix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jlwt90/pretix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jlwt90/pretix/teams","hooks_url":"https://api.github.com/repos/jlwt90/pretix/hooks","issue_events_url":"https://api.github.com/repos/jlwt90/pretix/issues/events{/number}","events_url":"https://api.github.com/repos/jlwt90/pretix/events","assignees_url":"https://api.github.com/repos/jlwt90/pretix/assignees{/user}","branches_url":"https://api.github.com/repos/jlwt90/pretix/branches{/branch}","tags_url":"https://api.github.com/repos/jlwt90/pretix/tags","blobs_url":"https://api.github.com/repos/jlwt90/pretix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jlwt90/pretix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jlwt90/pretix/git/refs{/sha}","trees_url":"https://api.github.com/repos/jlwt90/pretix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jlwt90/pretix/statuses/{sha}","languages_url":"https://api.github.com/repos/jlwt90/pretix/languages","stargazers_url":"https://api.github.com/repos/jlwt90/pretix/stargazers","contributors_url":"https://api.github.com/repos/jlwt90/pretix/contributors","subscribers_url":"https://api.github.com/repos/jlwt90/pretix/subscribers","subscription_url":"https://api.github.com/repos/jlwt90/pretix/subscription","commits_url":"https://api.github.com/repos/jlwt90/pretix/commits{/sha}","git_commits_url":"https://api.github.com/repos/jlwt90/pretix/git/commits{/sha}","comments_url":"https://api.github.com/repos/jlwt90/pretix/comments{/number}","issue_comment_url":"https://api.github.com/repos/jlwt90/pretix/issues/comments{/number}","contents_url":"https://api.github.com/repos/jlwt90/pretix/contents/{+path}","compare_url":"https://api.github.com/repos/jlwt90/pretix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jlwt90/pretix/merges","archive_url":"https://api.github.com/repos/jlwt90/pretix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jlwt90/pretix/downloads","issues_url":"https://api.github.com/repos/jlwt90/pretix/issues{/number}","pulls_url":"https://api.github.com/repos/jlwt90/pretix/pulls{/number}","milestones_url":"https://api.github.com/repos/jlwt90/pretix/milestones{/number}","notifications_url":"https://api.github.com/repos/jlwt90/pretix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jlwt90/pretix/labels{/name}","releases_url":"https://api.github.com/repos/jlwt90/pretix/releases{/id}","deployments_url":"https://api.github.com/repos/jlwt90/pretix/deployments","created_at":"2017-01-25T16:02:13Z","updated_at":"2017-01-25T16:02:16Z","pushed_at":"2017-04-02T15:41:50Z","git_url":"git://github.com/jlwt90/pretix.git","ssh_url":"git@github.com:jlwt90/pretix.git","clone_url":"https://github.com/jlwt90/pretix.git","svn_url":"https://github.com/jlwt90/pretix","homepage":"https://pretix.eu","size":10616,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pretix:master","ref":"master","sha":"a6a3544628a9a11cbcbf0e7f45dcdbc77a317f3b","user":{"login":"pretix","id":8465417,"avatar_url":"https://avatars3.githubusercontent.com/u/8465417?v=3","gravatar_id":"","url":"https://api.github.com/users/pretix","html_url":"https://github.com/pretix","followers_url":"https://api.github.com/users/pretix/followers","following_url":"https://api.github.com/users/pretix/following{/other_user}","gists_url":"https://api.github.com/users/pretix/gists{/gist_id}","starred_url":"https://api.github.com/users/pretix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pretix/subscriptions","organizations_url":"https://api.github.com/users/pretix/orgs","repos_url":"https://api.github.com/users/pretix/repos","events_url":"https://api.github.com/users/pretix/events{/privacy}","received_events_url":"https://api.github.com/users/pretix/received_events","type":"Organization","site_admin":false},"repo":{"id":23791087,"name":"pretix","full_name":"pretix/pretix","owner":{"login":"pretix","id":8465417,"avatar_url":"https://avatars3.githubusercontent.com/u/8465417?v=3","gravatar_id":"","url":"https://api.github.com/users/pretix","html_url":"https://github.com/pretix","followers_url":"https://api.github.com/users/pretix/followers","following_url":"https://api.github.com/users/pretix/following{/other_user}","gists_url":"https://api.github.com/users/pretix/gists{/gist_id}","starred_url":"https://api.github.com/users/pretix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pretix/subscriptions","organizations_url":"https://api.github.com/users/pretix/orgs","repos_url":"https://api.github.com/users/pretix/repos","events_url":"https://api.github.com/users/pretix/events{/privacy}","received_events_url":"https://api.github.com/users/pretix/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pretix/pretix","description":"Ticket shop application for conferences, festivals, concerts, tech events, shows, exhibitions, workshops, barcamps, etc.","fork":false,"url":"https://api.github.com/repos/pretix/pretix","forks_url":"https://api.github.com/repos/pretix/pretix/forks","keys_url":"https://api.github.com/repos/pretix/pretix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pretix/pretix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pretix/pretix/teams","hooks_url":"https://api.github.com/repos/pretix/pretix/hooks","issue_events_url":"https://api.github.com/repos/pretix/pretix/issues/events{/number}","events_url":"https://api.github.com/repos/pretix/pretix/events","assignees_url":"https://api.github.com/repos/pretix/pretix/assignees{/user}","branches_url":"https://api.github.com/repos/pretix/pretix/branches{/branch}","tags_url":"https://api.github.com/repos/pretix/pretix/tags","blobs_url":"https://api.github.com/repos/pretix/pretix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pretix/pretix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pretix/pretix/git/refs{/sha}","trees_url":"https://api.github.com/repos/pretix/pretix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pretix/pretix/statuses/{sha}","languages_url":"https://api.github.com/repos/pretix/pretix/languages","stargazers_url":"https://api.github.com/repos/pretix/pretix/stargazers","contributors_url":"https://api.github.com/repos/pretix/pretix/contributors","subscribers_url":"https://api.github.com/repos/pretix/pretix/subscribers","subscription_url":"https://api.github.com/repos/pretix/pretix/subscription","commits_url":"https://api.github.com/repos/pretix/pretix/commits{/sha}","git_commits_url":"https://api.github.com/repos/pretix/pretix/git/commits{/sha}","comments_url":"https://api.github.com/repos/pretix/pretix/comments{/number}","issue_comment_url":"https://api.github.com/repos/pretix/pretix/issues/comments{/number}","contents_url":"https://api.github.com/repos/pretix/pretix/contents/{+path}","compare_url":"https://api.github.com/repos/pretix/pretix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pretix/pretix/merges","archive_url":"https://api.github.com/repos/pretix/pretix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pretix/pretix/downloads","issues_url":"https://api.github.com/repos/pretix/pretix/issues{/number}","pulls_url":"https://api.github.com/repos/pretix/pretix/pulls{/number}","milestones_url":"https://api.github.com/repos/pretix/pretix/milestones{/number}","notifications_url":"https://api.github.com/repos/pretix/pretix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pretix/pretix/labels{/name}","releases_url":"https://api.github.com/repos/pretix/pretix/releases{/id}","deployments_url":"https://api.github.com/repos/pretix/pretix/deployments","created_at":"2014-09-08T13:10:38Z","updated_at":"2017-04-02T09:17:46Z","pushed_at":"2017-04-02T20:13:07Z","git_url":"git://github.com/pretix/pretix.git","ssh_url":"git@github.com:pretix/pretix.git","clone_url":"https://github.com/pretix/pretix.git","svn_url":"https://github.com/pretix/pretix","homepage":"https://pretix.eu","size":10623,"stargazers_count":178,"watchers_count":178,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":70,"mirror_url":null,"open_issues_count":87,"forks":70,"open_issues":87,"watchers":178,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pretix/pretix/pulls/438"},"html":{"href":"https://github.com/pretix/pretix/pull/438"},"issue":{"href":"https://api.github.com/repos/pretix/pretix/issues/438"},"comments":{"href":"https://api.github.com/repos/pretix/pretix/issues/438/comments"},"review_comments":{"href":"https://api.github.com/repos/pretix/pretix/pulls/438/comments"},"review_comment":{"href":"https://api.github.com/repos/pretix/pretix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pretix/pretix/pulls/438/commits"},"statuses":{"href":"https://api.github.com/repos/pretix/pretix/statuses/e0f690551b0d9564748daa3fc6f70d642785307a"}}}}
{"actor":{"display_login":"raphaelm"}}