Ejemplo n.º 1
0
 def test_add_resources(self):
     """
     Tests the add_resources method.
     """
     source_fragment = self.create_test_fragment()
     test_fragment = Fragment('<p>new fragment</p>')
     test_fragment.add_resources([source_fragment])
Ejemplo n.º 2
0
 def student_view(self, context=None):
     """Provide default student view."""
     result = Fragment()
     child_frags = self.runtime.render_children(self, context=context)
     result.add_resources(child_frags)
     result.add_content('<div class="unit-xblock vertical">')
     for frag in child_frags:
         result.add_content(frag.content)
     result.add_content('</div>')
     return result
Ejemplo n.º 3
0
 def view(self, context=None):
     """Provide default student view."""
     result = Fragment()
     child_frags = self.runtime.render_children(self, context=context)
     result.add_resources(child_frags)
     result.add_css("""
         .vertical {
             border: solid 1px #888; padding: 3px;
         }
         """)
     result.add_content(self.runtime.render_template("vertical.html", children=child_frags))
     return result
 def student_view(self, context):
     """
     Renders the view that learners see.
     """
     result = Fragment()
     child_frags = self.runtime.render_children(self, context=context)
     result.add_resources(child_frags)
     result.add_content('<div class="library-sourced-content">')
     for frag in child_frags:
         result.add_content(frag.content)
     result.add_content('</div>')
     return result
Ejemplo n.º 5
0
 def view(self, context=None):
     """Provide default student view."""
     result = Fragment()
     child_frags = self.runtime.render_children(self, context=context)
     result.add_resources(child_frags)
     result.add_css(u"""
         .sidebar {
             border: solid 1px #888;
             padding: 10px;
             background: #ccc;
         }
         """)
     html = []
     html.append(u"<div class='sidebar'>")
     for child in child_frags:
         html.append(child.body_html())
     html.append(u"</div>")
     result.add_content("".join(html))
     return result
Ejemplo n.º 6
0
    def view(self, context=None):
        """Provide default student view."""
        frag = Fragment()
        child_frags = self.runtime.render_children(self, context=context)
        frag.add_resources(child_frags)

        frag.add_content(self.runtime.render_template("sequence.html", children=child_frags))

        frag.add_css_url('http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css')
        frag.add_javascript_url('http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js')

        # mess things up
        frag.add_javascript("""
            function Sequence(runtime, element) {
              $(element).children('.tabs').tabs();
            };
            """)
        frag.initialize_js('Sequence')
        return frag