Example #1
0
    def _add_resources(self):

        if self.ie_html5_workaround and rendering_html5():
            self.metadata.resources.insert(
                0,
                Script("/cocktail/scripts/html5shiv-printshiv.js",
                       ie_condition="lt IE 9"))

        for resource in self.metadata.resources:
            if resource.mime_type == "text/javascript":
                self._add_core_scripts()
                break

        resource_sets = self.create_resource_sets()

        if resource_sets:
            remaining_resources = []

            for resource in self.metadata.resources:
                for resource_set in resource_sets:
                    if resource_set.matches(resource):
                        resource_set.append(resource)
                        break
                else:
                    remaining_resources.append(resource)

            for resource_set in resource_sets:
                resource_set.insert_into_document(self)
        else:
            remaining_resources = self.metadata.resources

        for resource in remaining_resources:
            resource.link(self)
Example #2
0
 def _ready(self):
     TextBox._ready(self)
     if rendering_html5():
         self["type"] = "number"
         if self.member:
             if isinstance(self.member.min, int):
                 self["min"] = self.member.min
             if isinstance(self.member.max, int):
                 self["max"] = self.member.max
Example #3
0
 def _ready(self):
     TextBox._ready(self)
     if rendering_html5():
         self["type"] = "url"
Example #4
0
 def _ready(self):
     if rendering_html5():
         self["type"] = "search"