Ejemplo n.º 1
0
    def setHelper(self):
        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'
            if type(widget) == forms.Textarea:
                widget.attrs['rows'] = 3

        if self.instance.id:
            if self.instance.outcome:
                url = self.instance.outcome.get_absolute_url()
            else:
                url = self.instance.study_population.get_absolute_url()
            inputs = {
                "legend_text": u"Update {}".format(self.instance),
                "help_text": self.HELP_TEXT_UPDATE,
                "cancel_url": url
            }
        else:
            inputs = {
                "legend_text": u"Create new comparison set",
                "help_text": self.HELP_TEXT_CREATE,
                "cancel_url": self.parent.get_absolute_url()
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        return helper
Ejemplo n.º 2
0
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {
            "legend_text": "Password reset",
            "help_text": "Enter a new password for your account."
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"

        helper.layout.append(
            cfb.FormActions(
                cfl.Submit('submit', 'Change password'),
                cfl.HTML(
                    """<a role="button" class="btn btn-default" href="{}">Cancel</a>"""
                    .format(reverse('user:login'))),
            ))

        return helper
Ejemplo n.º 3
0
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {
            "legend_text": "HAWC login"
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"

        helper.layout.append(
            cfb.FormActions(
                cfl.Submit('login', 'Login'),
                cfl.HTML("""<a role="button" class="btn btn-default" href="{}">Cancel</a>""".format(reverse('home'))),
                cfl.HTML("""<br><br>"""),
                cfl.HTML("""<a href="{0}">Forgot your password?</a><br>""".format(reverse('user:reset_password'))),
                cfl.HTML("""<a href="{0}">Create an account</a><br>""".format(reverse('user:new')))
            )
        )

        return helper
Ejemplo n.º 4
0
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {"legend_text": "HAWC login"}

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"

        helper.layout.append(
            cfb.FormActions(
                cfl.Submit('login', 'Login'),
                cfl.HTML(
                    """<a role="button" class="btn btn-default" href="{}">Cancel</a>"""
                    .format(reverse('home'))), cfl.HTML("""<br><br>"""),
                cfl.HTML(
                    """<a href="{0}">Forgot your password?</a><br>""".format(
                        reverse('user:reset_password'))),
                cfl.HTML("""<a href="{0}">Create an account</a><br>""".format(
                    reverse('user:new')))))

        return helper
Ejemplo n.º 5
0
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {
            "legend_text": "Password reset",
            "help_text": """
                Enter your email address below, and we'll email instructions
                for setting a new password.
            """
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"

        helper.layout.append(
            cfb.FormActions(
                cfl.Submit('submit', 'Send email confirmation'),
                cfl.HTML("""<a role="button" class="btn btn-default" href="{}">Cancel</a>""".format(reverse('user:login')))
            )
        )

        return helper
Ejemplo n.º 6
0
    def setHelper(self):
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'
            if type(widget) == forms.Textarea:
                widget.attrs['rows'] = 3

        if self.instance.id:
            if self.instance.outcome:
                url = self.instance.outcome.get_absolute_url()
            else:
                url = self.instance.study_population.get_absolute_url()
            inputs = {
                "legend_text": "Update {}".format(self.instance),
                "help_text": self.HELP_TEXT_UPDATE,
                "cancel_url": url
            }
        else:
            inputs = {
                "legend_text": "Create new comparison set",
                "cancel_url": self.parent.get_absolute_url()
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        return helper
Ejemplo n.º 7
0
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {"legend_text": "Create an account"}

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"

        helper.layout.extend([
            cfl.HTML(
                '''<a class="btn btn-small" href="#license_modal" data-toggle="modal">View License</a>'''
            ),
            cfb.FormActions(
                cfl.Submit('login', 'Create account'),
                cfl.HTML(
                    """<a role="button" class="btn btn-default" href="{}">Cancel</a>"""
                    .format(reverse('user:login'))),
            )
        ])

        return helper
Ejemplo n.º 8
0
    def setHelper(self):
        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'
            if type(widget) == forms.Textarea:
                widget.attrs['rows'] = 3
                widget.attrs['class'] += " html5text"

        if self.instance.id:
            inputs = {
                "legend_text": "Update {}".format(self.instance),
                "help_text":   "Update an existing HAWC assessment.<br><br>* required fields",
                "cancel_url": self.instance.get_absolute_url()
            }
        else:
            inputs = {
                "legend_text": "Create new assessment",
                "help_text":   """
                    Assessments are the fundamental objects in HAWC; all data added to the
                    tool will be related to an assessment. The settings below are used to
                    describe the basic characteristics of the assessment, along with setting
                    up permissions for role-based authorization and access for viewing and
                    editing content associated with an assessment.<br><br>* required fields""",
                "cancel_url": reverse_lazy('portal')
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.add_fluid_row('name', 2, "span6")
        helper.add_fluid_row('version', 2, "span6")
        helper.add_fluid_row('project_manager', 3, "span4")
        helper.attrs['novalidate'] = ''
        return helper
Ejemplo n.º 9
0
    def setHelper(self):

        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        if self.instance.id:
            inputs = {
                "legend_text": u"Update {}".format(self.instance),
                "help_text":   u"Update an existing visualization.",
                "cancel_url": self.instance.get_absolute_url()
            }
        else:
            inputs = {
                "legend_text": u"Create new visualization",
                "help_text":   u"""
                    Create a custom-visualization.
                    Generally, you will select a subset of available data on the
                    "Data" tab, then will customize the visualization using the
                    "Settings" tab. To view a preview of the visual at any time,
                    select the "Preview" tab.
                """,
                "cancel_url": self.instance.get_list_url(self.instance.assessment.id)
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        return helper
Ejemplo n.º 10
0
    def setHelper(self):

        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        if self.instance.id:
            inputs = {
                "legend_text": "Update {}".format(self.instance),
                "help_text":   "Update an existing visualization.",
                "cancel_url": self.instance.get_absolute_url()
            }
        else:
            inputs = {
                "legend_text": "Create new visualization",
                "help_text":   """
                    Create a custom-visualization.
                    Generally, you will select a subset of available data on the
                    "Data" tab, then will customize the visualization using the
                    "Settings" tab. To view a preview of the visual at any time,
                    select the "Preview" tab.
                """,
                "cancel_url": self.instance.get_list_url(self.instance.assessment.id)
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.form_id = "visualForm"
        return helper
Ejemplo n.º 11
0
    def setHelper(self):

        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        if self.instance.id:
            inputs = {
                "legend_text": u"Update {}".format(self.instance),
                "help_text":   u"Update an existing data-pivot.",
                "cancel_url": self.instance.get_absolute_url()
            }
        else:
            inputs = {
                "legend_text": u"Create new data-pivot",
                "help_text":   u"""
                    Create a custom-visualization for this assessment.
                    Generally, you will select a subset of available data, then
                    customize the visualization the next-page.
                """,
                "cancel_url": self.instance.get_list_url(self.instance.assessment.id)
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        return helper
Ejemplo n.º 12
0
    def setHelper(self):

        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        if self.instance.id:
            inputs = {
                "legend_text": "Update {}".format(self.instance),
                "help_text":   "Update an existing data-pivot.",
                "cancel_url": self.instance.get_absolute_url()
            }
        else:
            inputs = {
                "legend_text": "Create new data-pivot",
                "help_text":   """
                    Create a custom-visualization for this assessment.
                    Generally, you will select a subset of available data, then
                    customize the visualization the next-page.
                """,
                "cancel_url": self.instance.get_list_url(self.instance.assessment.id)
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.form_id = "dataPivotForm"
        return helper
Ejemplo n.º 13
0
    def setHelper(self):
        inputs = {
            'cancel_url': self.instance.rob_settings.get_absolute_url()
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        return helper
Ejemplo n.º 14
0
    def setHelper(self):
        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'
            if type(widget) == forms.Textarea:
                widget.attrs['rows'] = 3
                widget.attrs['class'] += " html5text"

        if self.instance.id:
            inputs = {
                "legend_text": "Update {}".format(self.instance),
                "help_text":   "Update an existing HAWC assessment.<br><br>* required fields",
                "cancel_url": self.instance.get_absolute_url()
            }
        else:
            inputs = {
                "legend_text": "Create new assessment",
                "help_text":   """
                    Assessments are the fundamental objects in HAWC; all data added to the
                    tool will be related to an assessment. The settings below are used to
                    describe the basic characteristics of the assessment, along with setting
                    up permissions for role-based authorization and access for viewing and
                    editing content associated with an assessment.<br><br>* required fields""",
                "cancel_url": reverse_lazy('portal')
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.add_fluid_row('name', 2, "span6")
        helper.add_fluid_row('version', 2, "span6")
        helper.add_fluid_row('project_manager', 3, "span4")
        helper.attrs['novalidate'] = ''
        return helper
Ejemplo n.º 15
0
    def setHelper(self):
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'
            if type(widget) == forms.Textarea:
                widget.attrs['rows'] = 3

        if self.instance.id:
            inputs = {
                'legend_text': 'Update {}'.format(self.instance),
                'help_text': self.HELP_TEXT_UPDATE,
                'cancel_url': self.instance.get_absolute_url()
            }
        else:
            inputs = {
                'legend_text': 'Create new experimental chemical',
                'help_text': self.HELP_TEXT_CREATE,
                'cancel_url': self.instance.study.get_absolute_url()
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.add_fluid_row('name', 3, 'span4')
        helper.add_fluid_row('source', 3, 'span4')
        helper.add_fluid_row('purity_confirmed_notes', 2, 'span6')

        return helper
Ejemplo n.º 16
0
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if type(widget) not in [forms.CheckboxInput, forms.CheckboxSelectMultiple]:
                widget.attrs['class'] = 'span12'

        helper = BaseFormHelper(self)

        helper.form_method = "GET"
        helper.form_class = None

        helper.add_fluid_row('studies', 4, "span3")
        helper.add_fluid_row('species', 4, "span3")
        helper.add_fluid_row('system', 4, "span3")
        helper.add_fluid_row('paginate_by', 4, "span3")

        helper.layout.append(
            cfb.FormActions(
                cfl.Submit('submit', 'Apply filters'),
            )
        )

        return helper
Ejemplo n.º 17
0
 def setHelper(self):
     inputs = {
         'legend_text': u'Copy risk of bias approach from existing assessments',  # noqa
         'help_text': u'Copy risk of bias metrics and domains from an existing HAWC assessment which you have access to.',  # noqa
         'cancel_url': reverse(
             'riskofbias:arob_detail', args=[self.assessment.id])
     }
     helper = BaseFormHelper(self, **inputs)
     helper.layout.insert(3, cfl.Div(css_id='extra_content_insertion'))
     helper.form_class = None
     return helper
Ejemplo n.º 18
0
    def setHelper(self):
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if fld == "group":
                widget.attrs['class'] = "groupField"
                widget.attrs['style'] = "display: none;"
            if fld == "n":
                widget.attrs['class'] = "nField"

        helper = BaseFormHelper(self)
        helper.form_tag = False

        return helper
Ejemplo n.º 19
0
 def setHelper(self):
     inputs = {
         'legend_text':
         'Copy study evaluation approach from existing assessments',  # noqa
         'help_text':
         'Copy study evaluation metrics and domains from an existing HAWC assessment which you have access to.',  # noqa
         'cancel_url':
         reverse('riskofbias:arob_detail', args=[self.assessment.id])
     }
     helper = BaseFormHelper(self, **inputs)
     helper.layout.insert(3, cfl.Div(css_id='extra_content_insertion'))
     helper.form_class = None
     return helper
Ejemplo n.º 20
0
    def setHelper(self):
        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if fld == "group":
                widget.attrs['class'] = "groupField"
                widget.attrs['style'] = "display: none;"
            if fld == "n":
                widget.attrs['class'] = "nField"

        helper = BaseFormHelper(self)
        helper.form_tag = False

        return helper
Ejemplo n.º 21
0
    def setHelper(self, assessment):
        self.fields['studies'].widget.attrs['size'] = 15
        for fld in list(self.fields.keys()):
            self.fields[fld].widget.attrs['class'] = 'span12'

        inputs = {
            "legend_text": "Copy studies across assessments",
            "help_text": self.HELP_TEXT,
            "cancel_url": reverse("study:list", args=[assessment.id]),
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        return helper
Ejemplo n.º 22
0
    def setHelper(self, assessment):
        self.fields['studies'].widget.attrs['size'] = 15
        for fld in list(self.fields.keys()):
            self.fields[fld].widget.attrs['class'] = 'span12'

        inputs = {
            "legend_text": "Copy studies across assessments",
            "help_text": self.HELP_TEXT,
            "cancel_url": reverse("study:list", args=[assessment.id]),
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        return helper
Ejemplo n.º 23
0
    def setHelper(self):
        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'
            if type(widget) == forms.Textarea:
                widget.attrs['rows'] = 3

        if self.instance.id:
            inputs = {
                'legend_text': u'Update {}'.format(self.instance),
                'help_text': self.HELP_TEXT_UPDATE,
                'cancel_url': self.instance.get_absolute_url()
            }
        else:
            inputs = {
                'legend_text': u'Create new cell type',
                'help_text': self.HELP_TEXT_CREATE,
                'cancel_url': self.instance.study.get_absolute_url()
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.add_fluid_row('species', 3, 'span4')
        helper.add_fluid_row('cell_type', 2, 'span6')
        helper.add_fluid_row('tissue', 2, 'span6')

        return helper
Ejemplo n.º 24
0
    def setHelper(self):
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'
            if type(widget) == forms.Textarea:
                widget.attrs['rows'] = 3

        if self.instance.id:
            inputs = {
                'legend_text': 'Update {}'.format(self.instance),
                'help_text': self.HELP_TEXT_UPDATE,
                'cancel_url': self.instance.get_absolute_url()
            }
        else:
            inputs = {
                'legend_text': 'Create new experimental chemical',
                'help_text': self.HELP_TEXT_CREATE,
                'cancel_url': self.instance.study.get_absolute_url()
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.add_fluid_row('name', 3, 'span4')
        helper.add_fluid_row('source', 3, 'span4')
        helper.add_fluid_row('purity_confirmed_notes', 2, 'span6')

        return helper
Ejemplo n.º 25
0
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) not in [forms.CheckboxInput, forms.CheckboxSelectMultiple]:
                widget.attrs['class'] = 'span12'

        helper = BaseFormHelper(self)

        helper.form_method = "GET"
        helper.form_class = None

        helper.add_fluid_row('studies', 4, "span3")
        helper.add_fluid_row('species', 4, "span3")
        helper.add_fluid_row('name', 4, "span3")
        helper.add_fluid_row('tags', 4, "span3")

        helper.layout.append(
            cfb.FormActions(
                cfl.Submit('submit', 'Apply filters'),
            )
        )

        return helper
Ejemplo n.º 26
0
    def setHelper(self):

        self.fields['description'].widget.attrs['rows'] = 4
        for fld in list(self.fields.keys()):
            self.fields[fld].widget.attrs['class'] = 'span12'

        if self.instance.id:
            inputs = {
                "legend_text": "Update dosing regime",
                "help_text":   "Update an existing dosing-regime.",
                "cancel_url": self.instance.dosed_animals.get_absolute_url()
            }
        else:
            inputs = {
                "legend_text": "Create new dosing-regime",
                "help_text":   """
                    Create a new dosing-regime. Each dosing-regime is one
                    protocol for how animals were dosed. Multiple different
                    dose-metrics can be associated with one dosing regime. If
                    this is a generational-experiment, you may not need to create
                    a new dosing-regime, but could instead specify the dosing
                    regime of parents or other ancestors.""",
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.form_id = "dosing_regime"
        helper.add_fluid_row('route_of_exposure', 3, "span4")
        helper.add_fluid_row('num_dose_groups', 3, "span4")
        return helper
Ejemplo n.º 27
0
    def setHelper(self):
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

            if type(widget) == forms.Textarea:
                widget.attrs['rows'] = 3

        self.fields['study'].widget.attrs["class"] += " studySearch"

        helper = BaseFormHelper(self)
        helper.form_class = None
        return helper
Ejemplo n.º 28
0
 def set_helper(self):
     help_text = u"""
         Please enter your new password twice so we can verify you
         typed it in correctly.
     """
     buttons = cfb.FormActions(cfl.Submit('submit', 'Change my password'), )
     helper = BaseFormHelper(
         self,
         horizontal=False,
         legend_text='Update your password',
         help_text=help_text,
         buttons=buttons,
     )
     helper.form_class = 'loginForm'
     return helper
Ejemplo n.º 29
0
    def set_helper(self):
        buttons = cfb.FormActions(
            cfl.Submit('login', 'Create account'),
            cfl.HTML(
                '<a role="button" class="btn btn-default" href="{}">Cancel</a>'
                .format(reverse('user:login'))),
        )

        helper = BaseFormHelper(self,
                                horizontal=False,
                                legend_text='Create an account',
                                buttons=buttons)
        helper.form_class = 'loginForm'

        return helper
Ejemplo n.º 30
0
    def setHelper(self):
        inputs = {"legend_text": u"Create an account"}

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"

        helper.layout.append(
            cfb.FormActions(
                cfl.Submit('login', 'Create account'),
                cfl.HTML(
                    """<a role="button" class="btn btn-default" href="{}">Cancel</a>"""
                    .format(reverse('user:login'))),
            ))

        return helper
Ejemplo n.º 31
0
 def setHelper(self):
     inputs = {
         "legend_text": u"Update enabled modules",
         "help_text": u"""
             HAWC is composed of multiple modules, each designed
             to capture data and decisions related to specific components of a
             health assessment. This screen allows a project-manager to change
             which modules are enabled for this assessment. Modules can be
             enabled or disabled at any time; content already entered into a particular
             module will not be changed when enabling or disabling modules.
             """,
         "cancel_url": self.instance.get_absolute_url()
     }
     helper = BaseFormHelper(self, **inputs)
     helper.form_class = None
     return helper
Ejemplo n.º 32
0
    def setHelper(self):
        buttons = cfb.FormActions(
            cfl.Submit('login', 'Create account'),
            cfl.HTML(
                '<a role="button" class="btn btn-default" href="{}">Cancel</a>'
                .format(reverse('user:login'))),
        )

        helper = BaseFormHelper(
            self,
            horizontal=False,
            legend_text='Create an account',
            buttons=buttons)
        helper.form_class = 'loginForm'

        return helper
Ejemplo n.º 33
0
 def setHelper(self):
     inputs = {
         "legend_text": u"Update enabled modules",
         "help_text":   u"""
             HAWC is composed of multiple modules, each designed
             to capture data and decisions related to specific components of a
             health assessment. This screen allows a project-manager to change
             which modules are enabled for this assessment. Modules can be
             enabled or disabled at any time; content already entered into a particular
             module will not be changed when enabling or disabling modules.
             """,
         "cancel_url": self.instance.get_absolute_url()
     }
     helper = BaseFormHelper(self, **inputs)
     helper.form_class = None
     return helper
Ejemplo n.º 34
0
 def setHelper(self):
     help_text = u"""
         Please enter your new password twice so we can verify you
         typed it in correctly.
     """
     buttons = cfb.FormActions(
         cfl.Submit('submit', 'Change my password'),
     )
     helper = BaseFormHelper(
         self,
         horizontal=False,
         legend_text='Update your password',
            help_text=help_text,
         buttons=buttons,
     )
     helper.form_class = 'loginForm'
     return helper
Ejemplo n.º 35
0
    def setHelper(self):
        inputs = {
            'cancel_url':
            reverse('riskofbias:arob_update',
                    args=[self.instance.assessment.pk])
        }

        helper = BaseFormHelper(self, **inputs)
        return helper
Ejemplo n.º 36
0
    def setHelper(self):
        inputs = {
            "legend_text":
            u"Update your password",
            "help_text":
            u"""
                Please enter your new password twice so we can verify you
                typed it in correctly.
            """
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"

        helper.layout.append(
            cfb.FormActions(cfl.Submit('submit', 'Change my password'), ))

        return helper
Ejemplo n.º 37
0
    def setHelper(self):
        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {
            "legend_text": self.CREATE_LEGEND,
            "help_text":   self.CREATE_HELP_TEXT,
            "form_actions": [
                cfl.Submit('save', 'Save'),
                cfl.HTML("""<a class="btn" href='#' onclick='window.close()'>Cancel</a>"""),
            ]
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        return helper
Ejemplo n.º 38
0
    def setHelper(self):
        # by default take-up the whole row-fluid
        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {
            "legend_text": u"Contact HAWC developers",
            "help_text": u"""
                Have a question, comment, or need some help?
                Use this form to to let us know what's going on.
            """,
            "cancel_url": self.back_href
        }
        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"
        return helper
Ejemplo n.º 39
0
    def setHelper(self):

        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {
            "form_actions": [
                cfl.Submit('save', 'Save'),
                cfl.HTML('<a class="btn btn-danger" id="deleteSTBtn" href="#deleteST" data-toggle="modal">Delete</a>'),
                cfl.HTML('<a class="btn" href="{0}" >Cancel</a>'.format(
                    reverse("summary:list", kwargs={'pk': self.instance.assessment.id}))),
            ]
        }
        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        return helper
Ejemplo n.º 40
0
    def setHelper(self, inputs={}):
        for fld in ('full_citation', 'coi_details', 'funding_source', 'ask_author'):
            self.fields[fld].widget.attrs['rows'] = 3
        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'
            else:
                widget.attrs['class'] = 'checkbox'

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        if 'authors' in self.fields:
            helper.add_fluid_row('authors', 2, "span6")
        helper.add_fluid_row('short_citation', 2, "span6")
        helper.add_fluid_row('coi_reported', 2, "span6")
        helper.add_fluid_row('contact_author', 2, "span6")
        return helper
Ejemplo n.º 41
0
 def setHelper(self):
     inputs = {
         'legend_text': 'Upload full-text URLs',
         'help_text':
         'Using an Excel file, upload full-text URLs for multiple references',
         'cancel_url': reverse_lazy('lit:overview',
                                    args=[self.assessment.id])
     }
     helper = BaseFormHelper(self, **inputs)
     return helper
Ejemplo n.º 42
0
    def setHelper(self):
        # by default take-up the whole row-fluid
        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'
            if type(widget) == forms.Textarea:
                widget.attrs['rows'] = 3
                widget.attrs['class'] += " html5text"

        if self.instance.id:
            inputs = {"legend_text": u"Update {}".format(self.instance)}
        else:
            inputs = {"legend_text": u"Create new attachment"}
        inputs["cancel_url"] = self.instance.get_absolute_url()

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        return helper
Ejemplo n.º 43
0
    def setHelper(self):
        # by default take-up the whole row-fluid
        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {
            "legend_text": u"Contact HAWC developers",
            "help_text": u"""
                Have a question, comment, or need some help?
                Use this form to to let us know what's going on.
            """,
            "cancel_url": self.back_href

        }
        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"
        return helper
Ejemplo n.º 44
0
    def setHelper(self):
        # by default take-up the whole row-fluid
        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'
            if type(widget) == forms.Textarea:
                widget.attrs['rows'] = 3
                widget.attrs['class'] += " html5text"

        if self.instance.id:
            inputs = {"legend_text": u"Update {}".format(self.instance)}
        else:
            inputs = {"legend_text": u"Create new attachment"}
        inputs["cancel_url"] = self.instance.get_absolute_url()

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        return helper
Ejemplo n.º 45
0
    def setHelper(self, inputs={}):
        for fld in ('full_citation', 'coi_details', 'funding_source',
                    'ask_author'):
            self.fields[fld].widget.attrs['rows'] = 3
        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'
            else:
                widget.attrs['class'] = 'checkbox'

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.add_fluid_row('short_citation', 2, "span6")
        helper.add_fluid_row('coi_reported', 2, "span6")
        helper.add_fluid_row('contact_author', 2, "span6")
        return helper
Ejemplo n.º 46
0
    def setHelper(self):

        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {
            "form_actions": [
                cfl.Submit('save', 'Save'),
                cfl.HTML(
                    '<a class="btn btn-danger" id="deleteSTBtn" href="#deleteST" data-toggle="modal">Delete</a>'
                ),
                cfl.HTML('<a class="btn" href="{0}" >Cancel</a>'.format(
                    reverse("summary:list",
                            kwargs={'pk': self.instance.assessment.id}))),
            ]
        }
        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        return helper
Ejemplo n.º 47
0
    def setHelper(self):
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {
            "legend_text":
            self.CREATE_LEGEND,
            "help_text":
            self.CREATE_HELP_TEXT,
            "form_actions": [
                cfl.Submit('save', 'Save'),
                cfl.HTML(
                    """<a class="btn" href='#' onclick='window.close()'>Cancel</a>"""
                ),
            ]
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        return helper
Ejemplo n.º 48
0
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {
            "legend_text": u"Create an account"
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"

        helper.layout.append(
            cfb.FormActions(
                cfl.Submit('login', 'Create account'),
                cfl.HTML("""<a role="button" class="btn btn-default" href="{}">Cancel</a>""".format(reverse('user:login'))),
            )
        )

        return helper
Ejemplo n.º 49
0
    def setHelper(self):
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'
            if type(widget) == forms.Textarea:
                widget.attrs['rows'] = 3

        inputs = {
            "legend_text": "Update {}".format(self.instance),
            "help_text": self.HELP_TEXT_UPDATE,
            "cancel_url": self.instance.get_absolute_url()
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.add_fluid_row('name', 3, "span4")
        helper.add_fluid_row('sex', 2, "span6")
        helper.add_fluid_row('eligible_n', 3, "span4")
        return helper
Ejemplo n.º 50
0
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {
            "legend_text": "Update your profile",
            "help_text": "Change settings associated with your account",
            "cancel_url": reverse('user:settings')
        }
        helper = BaseFormHelper(self, **inputs)
        return helper
Ejemplo n.º 51
0
    def setHelper(self):
        inputs = {
            "cancel_url":
            reverse('study:asq_update', args=[self.instance.assessment.pk])
        }
        if self.instance.id:
            inputs["legend_text"] = u"Update risk-of-bias domain"
            inputs["help_text"] = u"Update an existing domain."
        else:
            inputs["legend_text"] = u"Create new risk-of-bias domain"
            inputs["help_text"] = u"Create a new risk-of-bias domain."

        helper = BaseFormHelper(self, **inputs)
        helper['name'].wrap(cfl.Field, css_class="span6")
        helper['description'].wrap(cfl.Field, css_class="html5text span12")
        return helper
Ejemplo n.º 52
0
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {
            "legend_text": "Change your password",
            "help_text": "Enter a new password for your account.",
            "cancel_url": reverse("user:settings")
        }

        helper = BaseFormHelper(self, **inputs)
        return helper
Ejemplo n.º 53
0
    def setHelper(self):
        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'
            if type(widget) == forms.Textarea:
                widget.attrs['rows'] = 3

        inputs = {
            "legend_text": u"Update {}".format(self.instance),
            "help_text": self.HELP_TEXT_UPDATE,
            "cancel_url": self.instance.get_absolute_url()
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.add_fluid_row('name', 3, "span4")
        helper.add_fluid_row('sex', 2, "span6")
        helper.add_fluid_row('eligible_n', 3, "span4")
        return helper
Ejemplo n.º 54
0
    def setHelper(self):
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if fld in ['title', 'authors', 'journal']:
                widget.attrs['rows'] = 3

            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {
            "legend_text": "Update reference details",
            "help_text": "Update reference information which was fetched from database or reference upload.",  # noqa
            "cancel_url": self.instance.get_absolute_url()
        }

        helper = BaseFormHelper(self, **inputs)
        helper.add_fluid_row('title', 2, "span6")
        helper.add_fluid_row('year', 2, "span6")
        helper.form_class = None
        return helper
Ejemplo n.º 55
0
    def setHelper(self):
        for fld in self.fields.keys():
            widget = self.fields[fld].widget
            if fld in ["title", "authors", "journal"]:
                widget.attrs["rows"] = 3

            if type(widget) != forms.CheckboxInput:
                widget.attrs["class"] = "span12"

        inputs = {
            "legend_text": "Update reference details",
            "help_text": """Update reference information which was fetched
                              from database or reference upload.""",
            "cancel_url": self.instance.get_absolute_url(),
        }

        helper = BaseFormHelper(self, **inputs)
        helper.add_fluid_row("title", 2, "span6")
        helper.add_fluid_row("year", 2, "span6")
        helper.form_class = None
        return helper
Ejemplo n.º 56
0
    def setHelper(self):
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if fld in ["species", "strain"]:
                widget.attrs['class'] = 'span10'
            else:
                widget.attrs['class'] = 'span12'

        if self.instance.id:
            inputs = {
                "legend_text": "Update {}".format(self.instance),
                "help_text":   "Update an existing animal-group.",
                "cancel_url": self.instance.get_absolute_url()
            }
        else:
            inputs = {
                "legend_text": "Create new animal-group",
                "help_text":   """
                    Create a new animal-group. Each animal-group is a set of
                    animals which are comparable for a given experiment. For
                    example, they may be a group of F1 rats. Animal-groups may
                    have different exposures or doses, but should be otherwise
                    comparable.""",
                "cancel_url": self.instance.experiment.get_absolute_url()
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.form_id = "animal_group"
        helper.add_fluid_row('species', 3, "span4")
        helper.add_fluid_row('lifestage_exposed', 3, "span4")

        assessment_id = self.instance.experiment.study.assessment.pk

        url = reverse('assessment:species_create', kwargs={'pk': assessment_id})
        helper.addBtnLayout(helper.layout[3], 0, url, "Add new species", "span4")

        url = reverse('assessment:strain_create', kwargs={'pk': assessment_id})
        helper.addBtnLayout(helper.layout[3], 1, url, "Add new strain", "span4")

        if "generation" in self.fields:
            helper.add_fluid_row('siblings', 3, "span4")
        return helper
Ejemplo n.º 57
0
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        self.fields["diet"].widget.attrs['rows'] = 3
        self.fields["description"].widget.attrs['rows'] = 4

        if self.instance.id:
            inputs = {
                "legend_text": "Update {}".format(self.instance),
                "help_text":   "Update an existing experiment.",
                "cancel_url": self.instance.get_absolute_url()
            }
        else:
            inputs = {
                "legend_text": "Create new experiment",
                "help_text":   """
                    Create a new experiment. Each experiment is a associated with a
                    study, and may have one or more collections of animals. For
                    example, one experiment may be a 2-year cancer bioassay,
                    while another multi-generational study. It is possible to
                    create multiple separate experiments within a single study,
                    with different study-designs, durations, or test-species.""",
                "cancel_url": self.instance.study.get_absolute_url()
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.add_fluid_row('name', 2, "span6")
        helper.add_fluid_row('chemical', 3, "span4")
        helper.add_fluid_row('purity_available', 4, ["span2", "span2", "span2", "span6"])
        helper.add_fluid_row('litter_effects', 2, "span6")
        helper.add_fluid_row('diet', 2, "span6")
        return helper
Ejemplo n.º 58
0
    def setHelper(self):
        if self.instance.id:
            inputs = {
                "legend_text": "Update {}".format(self.instance),
                "help_text":   "Update an existing endpoint.",
                "cancel_url": self.instance.get_absolute_url()
            }
        else:
            inputs = {
                "legend_text": "Create new endpoint",
                "help_text":   """
                    Create a new endpoint. An endpoint may should describe one
                    measure-of-effect which was measured in the study. It may
                    or may not contain quantitative data.""",
                "cancel_url": self.instance.animal_group.get_absolute_url()
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.form_id = "endpoint"

        self.fields['diagnostic'].widget.attrs['rows'] = 2
        for fld in ('results_notes', 'endpoint_notes', 'power_notes'):
            self.fields[fld].widget.attrs['rows'] = 3

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                if fld in ["effects"]:
                    widget.attrs['class'] = 'span10'
                else:
                    widget.attrs['class'] = 'span12'

        helper.add_fluid_row('system', 4, "span3")
        helper.add_fluid_row('effects', 2, "span6")
        helper.add_fluid_row('observation_time', 3, "span4")
        helper.add_fluid_row('data_reported', 3, "span4")
        helper.add_fluid_row('data_type', 3, "span4")
        helper.add_fluid_row('response_units', 3, "span4")
        helper.add_fluid_row('NOEL', 4, "span3")
        helper.add_fluid_row('statistical_test', 3, ["span6", "span3", "span3"])

        url = reverse('assessment:effect_tag_create', kwargs={'pk': self.instance.assessment.pk})
        helper.addBtnLayout(helper.layout[4], 0, url, "Add new effect tag", "span6")

        return helper