GitHub PullRequestReviewCommentEvent at 2014-03-11 13:07:03
Repository: edx-platform
Actor: cpennington
Payload: {"comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/10471558","id":10471558,"diff_hunk":"@@ -155,11 +170,35 @@ def _staff_view(self, context):\n         fragment.initialize_js('ABTestSelector')\n         return fragment\n \n+    def studio_preview(self, context):\n+        # Render each of the children one after the other\n+        fragment = Fragment()\n+        contents = []\n+\n+        for child in self.descriptor.get_children():\n+            rendered_child = self.runtime.get_module(child).render('student_view', context)\n+            fragment.add_frag_resources(rendered_child)\n+\n+            contents.append({\n+                'id': child.id,\n+                'content': rendered_child.content\n+            })\n+\n+        fragment.add_content(self.system.render_template('vert_module.html', {\n+            'items': contents\n+        }))\n+\n+        return fragment\n+\n     def student_view(self, context):\n         \"\"\"\n         Render the contents of the chosen condition for students, and all the\n         conditions for staff.\n         \"\"\"\n+        # When rendering in Studio, use the custom preview rendering\n+        if context and context['runtime_type'] == 'studio':\n+            return self.studio_preview(context)","path":"common/lib/xmodule/xmodule/split_test_module.py","position":78,"original_position":78,"commit_id":"43b6bd678e390be8bf27001730c02f484d1a9846","original_commit_id":"43b6bd678e390be8bf27001730c02f484d1a9846","user":{"login":"cpennington","id":30236,"avatar_url":"https://gravatar.com/avatar/bf7434838ed52e9c1c4536d064451605?d=https%3A%2F%2Fidenticons.github.com%2Fe9a0ddc40651a765e246e1f4b8c3d3c8.png&r=x","gravatar_id":"bf7434838ed52e9c1c4536d064451605","url":"https://api.github.com/users/cpennington","html_url":"https://github.com/cpennington","followers_url":"https://api.github.com/users/cpennington/followers","following_url":"https://api.github.com/users/cpennington/following{/other_user}","gists_url":"https://api.github.com/users/cpennington/gists{/gist_id}","starred_url":"https://api.github.com/users/cpennington/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpennington/subscriptions","organizations_url":"https://api.github.com/users/cpennington/orgs","repos_url":"https://api.github.com/users/cpennington/repos","events_url":"https://api.github.com/users/cpennington/events{/privacy}","received_events_url":"https://api.github.com/users/cpennington/received_events","type":"User","site_admin":false},"body":"Given this pattern, it seems like maybe it would make more sense to actually have a `studio_preview_view` function. The the StudioMixin could just default that function to call student_view.","created_at":"2014-03-11T13:07:03Z","updated_at":"2014-03-11T13:07:03Z","html_url":"https://github.com/edx/edx-platform/pull/2888#discussion_r10471558","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/2888","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/10471558"},"html":{"href":"https://github.com/edx/edx-platform/pull/2888#discussion_r10471558"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/2888"}}}}