当前位置: 首页>>代码示例>>Python>>正文


Python Progress.to_js_detail_str方法代码示例

本文整理汇总了Python中xmodule.progress.Progress.to_js_detail_str方法的典型用法代码示例。如果您正苦于以下问题:Python Progress.to_js_detail_str方法的具体用法?Python Progress.to_js_detail_str怎么用?Python Progress.to_js_detail_str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xmodule.progress.Progress的用法示例。


在下文中一共展示了Progress.to_js_detail_str方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_html

# 需要导入模块: from xmodule.progress import Progress [as 别名]
# 或者: from xmodule.progress.Progress import to_js_detail_str [as 别名]
    def get_html(self):
        if self.contents is None:
            self.contents = [{
                'id': child.id,
                'content': child.get_html(),
                'direct_term': self.direct_term,
                'progress_detail': Progress.to_js_detail_str(self.get_progress())
            } for child in self.get_display_items()]

        return self.system.render_template('vert_module.html', {
            'items': self.contents
        })
开发者ID:NikolayStrekalov,项目名称:edx-platform,代码行数:14,代码来源:vertical_module.py

示例2: student_view

# 需要导入模块: from xmodule.progress import Progress [as 别名]
# 或者: from xmodule.progress.Progress import to_js_detail_str [as 别名]
    def student_view(self, context):
        # If we're rendering this sequence, but no position is set yet,
        # default the position to the first element
        if self.position is None:
            self.position = 1

        ## Returns a set of all types of all sub-children
        contents = []

        fragment = Fragment()

        for child in self.get_display_items():
            progress = child.get_progress()
            rendered_child = child.render("student_view", context)
            fragment.add_frag_resources(rendered_child)

            childinfo = {
                "content": rendered_child.content,
                "title": "\n".join(
                    grand_child.display_name
                    for grand_child in child.get_children()
                    if grand_child.display_name is not None
                ),
                "progress_status": Progress.to_js_status_str(progress),
                "progress_detail": Progress.to_js_detail_str(progress),
                "type": child.get_icon_class(),
                "id": child.id,
            }
            if childinfo["title"] == "":
                childinfo["title"] = child.display_name_with_default
            contents.append(childinfo)

        params = {
            "items": contents,
            "element_id": self.location.html_id(),
            "item_id": self.id,
            "position": self.position,
            "tag": self.location.category,
            "ajax_url": self.system.ajax_url,
        }

        fragment.add_content(self.system.render_template("seq_module.html", params))

        return fragment
开发者ID:ngocchung75,项目名称:edx-platform,代码行数:46,代码来源:seq_module.py

示例3: student_view

# 需要导入模块: from xmodule.progress import Progress [as 别名]
# 或者: from xmodule.progress.Progress import to_js_detail_str [as 别名]
    def student_view(self, context):
        # If we're rendering this sequence, but no position is set yet,
        # default the position to the first element
        if self.position is None:
            self.position = 1

        ## Returns a set of all types of all sub-children
        contents = []

        fragment = Fragment()

        for child in self.get_display_items():
            progress = child.get_progress()
            rendered_child = child.render('student_view', context)
            fragment.add_frag_resources(rendered_child)

            childinfo = {
                'content': rendered_child.content,
                'title': "\n".join(
                    grand_child.display_name
                    for grand_child in child.get_children()
                    if grand_child.display_name is not None
                ),
                'progress_status': Progress.to_js_status_str(progress),
                'progress_detail': Progress.to_js_detail_str(progress),
                'type': child.get_icon_class(),
                'id': child.id,
            }
            if childinfo['title'] == '':
                childinfo['title'] = child.display_name_with_default
            contents.append(childinfo)

        params = {'items': contents,
                  'element_id': self.location.html_id(),
                  'item_id': self.id,
                  'position': self.position,
                  'tag': self.location.category,
                  'ajax_url': self.system.ajax_url,
                  }

        fragment.add_content(self.system.render_template('seq_module.html', params))

        return fragment
开发者ID:SnowGeekOrg,项目名称:edx-platform,代码行数:45,代码来源:seq_module.py

示例4: student_view

# 需要导入模块: from xmodule.progress import Progress [as 别名]
# 或者: from xmodule.progress.Progress import to_js_detail_str [as 别名]
    def student_view(self, context):
        fragment = Fragment()
        contents = []
        all_contents = []

        for child in self.get_display_items():
            rendered_child = child.render('student_view', context)
            fragment.add_frag_resources(rendered_child)

            show_now = 'true'

            try:
                problem_now = child.problem_now
                if not problem_now:
                    show_now = 'false'
            except AttributeError:
                pass

            all_contents.append({
                'id': child.id,
                'content': rendered_child.content,
                'father': self.id,                
                'direct_term': self.direct_term,
                'progress_detail': Progress.to_js_detail_str(self.get_progress()),
                'type': child.get_icon_class(),
                'show_now': show_now,
                'problem_time': child.problem_time if child.get_icon_class() == 'problem' else
                [{"id": child2.id if child2.get_icon_class() == 'problem' else "video",
                  "time": child2.problem_time if child2.get_icon_class() == 'problem' and child2.problem_time is not None else "video",
                  } for child2 in self.get_display_items()]
            })
            if self.random_problem_count == -1:
                contents = all_contents
            else:
                contents = random.sample(all_contents, self.random_problem_count)

        fragment.add_content(self.system.render_template('vert_module.html', {
            'items': contents
        }))
        return fragment
开发者ID:pelikanchik,项目名称:edx-platform,代码行数:42,代码来源:vertical_module.py

示例5: render

# 需要导入模块: from xmodule.progress import Progress [as 别名]
# 或者: from xmodule.progress.Progress import to_js_detail_str [as 别名]
    def render(self):
        # If we're rendering this sequence, but no position is set yet,
        # default the position to the first element
        if self.position is None:
            self.position = 1

        if self.rendered:
            return
        ## Returns a set of all types of all sub-children
        contents = []
        for child in self.get_display_items():
            progress = child.get_progress()
            childinfo = {
                'content': child.get_html(),
                'title': "\n".join(
                    grand_child.display_name
                    for grand_child in child.get_children()
                    if grand_child.display_name is not None
                ),
                'progress_status': Progress.to_js_status_str(progress),
                'progress_detail': Progress.to_js_detail_str(progress),
                'type': child.get_icon_class(),
                'id': child.id,
                'direct_term': child.direct_term_with_default
            }
            if childinfo['title'] == '':
                childinfo['title'] = child.display_name_with_default
            contents.append(childinfo)

        params = {'items': contents,
                  'element_id': self.location.html_id(),
                  'item_id': self.id,
                  'position': self.position,
                  'tag': self.location.category
                  }

        self.content = self.system.render_template('seq_module.html', params)
        self.rendered = True
开发者ID:NikolayStrekalov,项目名称:edx-platform,代码行数:40,代码来源:seq_module.py

示例6: render

# 需要导入模块: from xmodule.progress import Progress [as 别名]
# 或者: from xmodule.progress.Progress import to_js_detail_str [as 别名]
    def render(self):
        # If we're rendering this sequence, but no position is set yet,
        # default the position to the first element
        if self.position is None:
            self.position = 1

        if self.rendered:
            return
        ## Returns a set of all types of all sub-children
        contents = []
        for child in self.get_display_items():
            progress = child.get_progress()
            childinfo = {
                "content": child.get_html(),
                "title": "\n".join(
                    grand_child.display_name
                    for grand_child in child.get_children()
                    if grand_child.display_name is not None
                ),
                "progress_status": Progress.to_js_status_str(progress),
                "progress_detail": Progress.to_js_detail_str(progress),
                "type": child.get_icon_class(),
                "id": child.id,
            }
            if childinfo["title"] == "":
                childinfo["title"] = child.display_name_with_default
            contents.append(childinfo)

        params = {
            "items": contents,
            "element_id": self.location.html_id(),
            "item_id": self.id,
            "position": self.position,
            "tag": self.location.category,
        }

        self.content = self.system.render_template("seq_module.html", params)
        self.rendered = True
开发者ID:navdeepgaur,项目名称:edx-platform,代码行数:40,代码来源:seq_module.py


注:本文中的xmodule.progress.Progress.to_js_detail_str方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。