Esempio n. 1
0
def Page():
    doc = document()
    with doc.head:
        link_("https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css")
        link_("https://extra-uru1z3cxu.now.sh/css/extra.css")
        link_(
            "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.css"
        )
        script_(
            'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js'
        )
        script_('http://intercoolerjs.org/release/intercooler-1.2.2.js')
    with doc.body:
        with dom.div(cls=CENTER_FRAME) as CenterFrame:
            with dom.div(cls=CARD) as Card:
                with dom.form(UPLOAD_FORM_ATTRS) as UploadForm:
                    dom.i(cls=UPLOAD_ICON,
                          onclick='''$('#fileupload').click()''')
                    dom.p("Find File", id=1, cls="text-gray-500 mt-4")
                    dom.button("Upload", type="submit", cls=BUTTON)
                    dom.input(
                        cls="hidden",
                        type="file",
                        name="image",
                        id="fileupload",
                        onchange=
                        '''$('#1').text(this.value.split("\\\\").pop(-1))''')
            with dom.div(id="there", cls=RESULT_CONTAINER) as ResultContainer:
                dom.span(id="here")  #新增
    return doc.render()
Esempio n. 2
0
def page():
    doc = document()
    with doc.head:
        link_("https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css")
        link_("https://extra-uru1z3cxu.now.sh/css/extra.css")
        link_("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.css")
        dom.script(src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js')

    with doc.body:
        with dom.div(cls=CENTER_FRAME)as CenterFrame:
            with dom.div(cls=CARD) as Card:
                with dom.form(cls=UPLOAD_FORM) as UploadForm:
                    dom.i(cls=UPLOAD_ICON,onclick=''' $('#fileupload').click()''')
                    dom.p("Find File",id =1,cls="text-gray-500 mt-4")
                    dom.button("Upload",cls=BUTTON)
                    dom.input(cls='hidden',type="file",id="fileupload",onchange=''' $('#1').text(this.value.split("\\\\").pop(-1))''')
            with dom.div(cls=RESULT_CONTAINER) as ResultContainer:
                for _ in range(4):
                    with dom.div(cls=RESULT_ITEM) as ResultItem:
                        dom.p("filename.jpg",cls="text-xl text-gray-400")
                        dom.i(cls="fas fa-download text-xl text-gray-400")

            with dom.div() as ResultContainer:
                pass
    return doc.render()
def get_alg_filter_buttons_div(r, tab_names):
    alg_filter_buttons_div = div(cls="container")

    alg_input_tag = input(id="ground_truth_CB", cls="badgebox")
    alg_input_tag.attributes['type'] = "checkbox"
    alg_span_tag = span("✓", cls="badge", id="ground_truth_CB_Span")

    alg_filter_button = label("Ground Truth",
                              cls="btn",
                              id="ground_truth_CB_Label")
    alg_filter_button.appendChild(alg_input_tag)
    alg_filter_button.appendChild(alg_span_tag)
    alg_filter_buttons_div.appendChild(alg_filter_button)

    for count in range(len(tab_names)):
        alg_input_tag = input(id=tab_names[count] + "_CB", cls="badgebox")
        alg_input_tag.attributes['type'] = "checkbox"
        alg_span_tag = span("✓", cls="badge", id=tab_names[count] + "_CB_Span")

        alg_filter_button = label(tab_names[count],
                                  cls="btn",
                                  id=tab_names[count] + "_CB_Label")
        alg_filter_button.appendChild(alg_input_tag)
        alg_filter_button.appendChild(alg_span_tag)

        alg_filter_buttons_div.appendChild(alg_filter_button)
    return alg_filter_buttons_div.render()
Esempio n. 4
0
    def get_html_forms(self, datatset_name_form=True):
        """generates html forms for all the metadata elements associated with this logical file
        type
        :param datatset_name_form If True then a form for editing dataset_name (title) attribute is
        included
        """
        root_div = div()

        with root_div:
            if datatset_name_form:
                self._get_dataset_name_form()

            keywords_div = div(cls="col-sm-12 content-block",
                               id="filetype-keywords")
            action = "/hsapi/_internal/{0}/{1}/add-file-keyword-metadata/"
            action = action.format(self.logical_file.__class__.__name__,
                                   self.logical_file.id)
            delete_action = "/hsapi/_internal/{0}/{1}/delete-file-keyword-metadata/"
            delete_action = delete_action.format(
                self.logical_file.__class__.__name__, self.logical_file.id)
            with keywords_div:
                legend("Keywords")
                with form(id="id-keywords-filetype",
                          action=action,
                          method="post",
                          enctype="multipart/form-data"):

                    input(id="id-delete-keyword-filetype-action",
                          type="hidden",
                          value=delete_action)
                    with div(cls="tags"):
                        with div(id="add-keyword-wrapper", cls="input-group"):
                            input(id="txt-keyword-filetype",
                                  cls="form-control",
                                  placeholder="keyword",
                                  type="text",
                                  name="keywords")
                            with span(cls="input-group-btn"):
                                a("Add",
                                  id="btn-add-keyword-filetype",
                                  cls="btn btn-success",
                                  type="button")
                    with ul(id="lst-tags-filetype",
                            cls="custom-well tag-list"):
                        for kw in self.keywords:
                            with li(cls="tag"):
                                span(kw)
                                with a():
                                    span(
                                        cls=
                                        "glyphicon glyphicon-remove-circle icon-remove"
                                    )
                p("Duplicate. Keywords not added.",
                  id="id-keywords-filetype-msg",
                  cls="text-danger small",
                  style="display: none;")

            self.get_extra_metadata_html_form()
            self.get_temporal_coverage_html_form()
        return root_div
Esempio n. 5
0
    def get_update_netcdf_file_html_form(self):
        form_action = "/hsapi/_internal/{}/update-netcdf-file/".format(self.id)
        style = "display:none;"
        if self.is_dirty:
            style = "margin-bottom:10px"
        root_div = div(id="div-netcdf-file-update", cls="row", style=style)

        with root_div:
            with div(cls="col-sm-12"):
                with div(cls="alert alert-warning alert-dismissible",
                         role="alert"):
                    strong(
                        "NetCDF file needs to be synced with metadata changes."
                    )
                    input(id="metadata-dirty",
                          type="hidden",
                          value=self.is_dirty)
                    with form(action=form_action,
                              method="post",
                              id="update-netcdf-file"):
                        button("Update NetCDF File",
                               type="button",
                               cls="btn btn-primary",
                               id="id-update-netcdf-file")

        return root_div
Esempio n. 6
0
    def upload_form(self):
        with tags.form(
            id=self.config['upload_name'],
            onsubmit=self.config['onsubmit'],
            enctype='multipart/form-data',
            method=self.config['upload_method'],
            action=self.config['upload_route'],
            cls='card p-3 bg-light'):

            tags.h5('Upload an image', cls='card-title')

            with tags.div(cls='form-group row'):
                with tags.div(cls='col-12'):
                    # This requires JavaScript to show the filename.
                    # https://github.com/Johann-S/bs-custom-file-input
                    #
                    # 'style' is necessary to avoid overlapping in Safari and
                    # Chrome on iOS:
                    # https://github.com/twbs/bootstrap/issues/26933
                    with tags.div(cls='custom-file', style='overflow: hidden;'):
                        tags.input(
                            type='file', cls='custom-file-input p-1 rounded',
                            id=self.config['upload_name'], name=self.config['upload_name'])
                        tags.label(
                            'Choose file', fr=self.config['upload_name'],
                            cls='custom-file-label bg-light')

            with tags.div(cls='form-group row'):
                with tags.div(cls='col-3'):
                    with tags.button(type='submit', cls='btn btn-primary'):
                        util.text('Submit')
Esempio n. 7
0
    def get_update_netcdf_file_html_form(self):
        form_action = "/hsapi/_internal/netcdf_update/{}/".\
            format(self.resource.short_id)
        style = "display:none;"
        root_div = div(id="netcdf-file-update",
                       cls="space-bottom",
                       style=style)

        with root_div:
            with div(cls="col-sm-12"):
                with div(cls="alert alert-warning alert-dismissible",
                         role="alert"):
                    div("NetCDF file needs to be synced with metadata changes.",
                        cls='space-bottom')

                    input(id="metadata-dirty",
                          type="hidden",
                          value="{{ cm.metadata.is_dirty }}")
                    with form(
                            action=form_action,
                            method="post",
                            id="update-netcdf-file",
                    ):
                        div('{% csrf_token %}')
                        button(
                            "Update NetCDF File",
                            type="submit",
                            cls="btn btn-primary",
                            id="id-update-netcdf-file",
                        )

        return root_div
Esempio n. 8
0
def page():
    doc = document()
    with doc.head:
        link_("https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css")
        link_("https://extra-uru1z3cxu.now.sh/css/extra.css")
        link_("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.css")
        script_("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js")
        script_("http://intercoolerjs.org/release/intercooler-1.2.2.js")

    with doc.body:
        with dom.div(cls=CENTER_FRAME) as CenterFrame:
            with dom.form(FORM_ATTR):
                with dom.div(cls=LABEL_CARD):
                    dom.label('Write down your mark here',
                              cls="text-white text-xl")
                    dom.input(
                        cls=LABEL_INPUT, type='text', placeholder='your watermark text here', name='mk-text')
                with dom.div(cls=IMG_CARD):
                    with dom.div(cls=IMG_FORM):
                        dom.i(cls=UPLOAD_ICON,
                              onclick='''$('#fileupload').click()''')
                        dom.p("Find File", id="file", cls="text-gray-500 mt-4")
                        dom.input(cls="hidden", type="file", name='bg-img', id="fileupload",
                                  onchange='''$('#file').text(this.value.split("\\\\").pop(-1))''')
                        dom.button('Upload', cls=BUTTON, type='submit')

            with dom.div(cls=RESULT_CONTAINER, id="there") as ResultContainer:
                dom.span(id="here")
    return doc.render()
Esempio n. 9
0
 def get_dataset_name_form(self):
     form_action = "/hsapi/_internal/{0}/{1}/update-filetype-dataset-name/"
     form_action = form_action.format(self.logical_file.__class__.__name__,
                                      self.logical_file.id)
     root_div = div(cls="col-xs-12")
     dataset_name = self.logical_file.dataset_name if self.logical_file.dataset_name else ""
     with root_div:
         with form(action=form_action,
                   id="filetype-dataset-name",
                   method="post",
                   enctype="multipart/form-data"):
             div("{% csrf_token %}")
             with div(cls="form-group"):
                 with div(cls="control-group"):
                     legend('Title')
                     with div(cls="controls"):
                         input(
                             value=dataset_name,
                             cls="form-control input-sm textinput textInput",
                             id="file_dataset_name",
                             maxlength="250",
                             name="dataset_name",
                             type="text")
             with div(cls="row", style="margin-top:10px;"):
                 with div(
                         cls=
                         "col-md-offset-10 col-xs-offset-6 col-md-2 col-xs-6"
                 ):
                     button(
                         "Save changes",
                         cls="btn btn-primary pull-right btn-form-submit",
                         style="display: none;",
                         type="button")
     return root_div
Esempio n. 10
0
 def render_post_form(self, auto_redirect=False):
     form = tag.form(id='payment_redirect_form',
                     action=self.url,
                     method=self.request_method)
     with form:
         for name, value in self.request_data.items():
             tag.input(type='hidden', name=name, value=value)
         tag.input(type='submit', name='submit', value='Продолжить оплату')
     return form.render()
Esempio n. 11
0
def page():
    doc = document()
    with doc as root:
        with doc.body:
            with dom.form(action='/file',
                          method='post',
                          enctype='multipart/form-data'):
                dom.input(type='file', name='image')
                dom.button('提交', type='submit')
    return root.render()
Esempio n. 12
0
def page():
    doc = document()
    with doc as root:
        with doc.body:  ## form input button;input三个属性:type,name,value
            with dom.form(action="/file",
                          method="post",
                          enctype="multipart/form-data"):
                dom.input(type="file", name="image")
                dom.button("submit", type="submit")
    return root.render()
Esempio n. 13
0
def taskchecklist_pretablehtml():
    pretablehtml = div()
    with pretablehtml:
        # hide / show hidden rows
        with filtercontainerdiv(style='margin-bottom: 4px;'):
            datefilter = filterdiv('positiondate-external-filter-startdate', 'In Position On')

            with datefilter:
                input(type='text', id='effective-date', name='effective-date' )
                button('Today', id='todays-date-button')

    return pretablehtml.render()
Esempio n. 14
0
 def __init__(self, users, **kwargs):
     super().__init__(f"Registration...")
     self.users = users
     with self.content:
         self.utable = mannatags.UserTable(users)
         tags.input(id=f"{self.submit_id}2", 
                    type='submit', 
                    name='submit_button',
                    _class='submit_button',
                    value="Unregister",
                    style="clear: both; width: 100%; margin-top: 20px;")
     self.on_ready_scriptage = self.utable.on_ready_scriptage + f"""
def test1(form, title_prefix, button_title):
    title = title_prefix + ' Test 1'
    d = _doc(title)
    with d:
        with t.form(action=form.action, method='post'):
            with t.fieldset():
                t.legend(title)
                with t.div(cls='form_row'):
                    _text_input(*form.nv('name'), ('autofocus', 'required'),
                                {'pattern': valid.re_alphanum})
            with t.div(cls='form_row'):
                t.input(type='submit', value=button_title)
    return d.render()
Esempio n. 16
0
def dominate_enter_page():
    """
    第三頁:確認資訊頁面,對應到  @app.route('/jump')  及其函數   registerpage_run [if request.method == 'POST']
    目標:利用dominate寫出 enter_page 的 html並在 templates 資料夾中存成 index3.html

    分為三個區塊
    doc = dominate.document()
    with doc.head   (包含css的style;meta確保中文可以運行在utf-8下)
    with doc.body   (包含 6 information: name/ password/ student_id/
                    telephone_number/ school_bike_license/ bike_lock_number and a button confirm)

    最後寫入文件中(在templates資料夾中存成index3.html)
    """
    doc = dominate.document(title="entered")

    with doc.head:
        tags.meta(name='charset', content="utf-8")
        tags.style("""\
            body {
                background-color: #F9F8F1;
                color: #2C232A;
                font-family: sans-serif;
                font-size: 14;
                text-align: center;
            }
        """)

    with doc.body:
        tags.h1('welcome' + str(name_list_temp[0]))
        tags.h2('please confirm your information')
        with tags.section(cls='information check'):
            with tags.div(cls='name', style="text-align: center"):
                tags.label('your name is  ' + str(name_list_temp[0]))
            with tags.div(cls='password', style="text-align: center"):
                tags.label('your password is  ' + str(password_temp[0]))
            with tags.div(cls='student_id', style="text-align: center"):
                tags.label('your student id is  ' + str(student_id_temp[0]))
            with tags.div(cls='telephone', style="text-align: center"):
                tags.label('your telephone number is  ' + str(telephone_number_temp[0]))
            with tags.div(cls='license', style="text-align: center"):
                tags.label('the status of your bike_lice  ' + str(school_bike_license_temp[0]))
            with tags.div(cls='lock_number', style="text-align: center"):
                tags.label('your bike lock number is  ' + str(bike_lock_number_temp[0]))
            with tags.div(cls='button', style="margin:0 auto; width:250px;"):
                tags.input(type='button', value='confirm', style="width:120px; background-color:pink;",
                           onclick="location.href='http://127.0.0.1:5000/entered'")

    fn = 'templates/index3.html'
    with open(file=fn, mode='w', encoding='utf-8') as f:
        f.write(doc.render())
    print(f)
Esempio n. 17
0
def dominate_homepage():
    """
    第一頁:歡迎頁面,對應到  @app.route('/')  及其函數  homepage_run()
    目標:利用dominate寫出homepage的html並在templates資料夾中存成index1.html

    分為三個區塊
    doc = dominate.document()
    with doc.head   (包含css的style;meta確保中文可以運行在utf-8下)
    with doc.body   (包含welcome words and a button)

    最後寫入文件中(在templates資料夾中存成index1.html)
    """
    doc = dominate.document(title='homepage')

    with doc.head:
        tags.meta(name='charset', content="utf-8")
        tags.style("""\
            body {
                background-color: #F9F8F1;
                color: #2C232A;
                font-family: sans-serif;
                font-size: 30;
                text-align: center;
            }
             section{
                  width: 300px;
                  height: 300px;
                  position: absolute;
                  top: 50%;
                  left: 50%;
                  overflow: auto;
                  text-align: center;
                  margin-left:-150px;
                  margin-top:-150px;
            } 
         """)

    with doc.body:

        with tags.section():
            with tags.div(cls='headline', style='font-size: 30;'):
                tags.h1('Find Your Bike')
            tags.input(type='button', value='click me', onclick="location.href='http://127.0.0.1:5000/jump'",
                       style="width:120px; background-color:pink; font-size: 14;")

    fn = 'templates/index1.html'
    with open(file=fn, mode='w', encoding='utf-8') as f:
        f.write(doc.render())
    print(f)
Esempio n. 18
0
def dominate_wrong_information_page():
    """
        第五頁:資料庫連接錯誤頁面,對應到  @app.route('/entered')  及其函數  eneter_success()
        目標:利用dominate寫出homepage的html並在templates資料夾中存成index5.html

        分為三個區塊
        doc = dominate.document()
        with doc.head   (包含css的style;meta確保中文可以運行在utf-8下)
        with doc.body   (包含 words and a button)

        最後寫入文件中(在templates資料夾中存成index5.html)
        """
    doc = dominate.document(title='error_page')

    with doc.head:
        tags.meta(name='charset', content="utf-8")
        tags.style("""\
                    body {
                        background-color: #F9F8F1;
                        color: #2C232A;
                        font-family: sans-serif;
                        font-size: 30;
                        text-align: center;
                    }
                     section{
                          width: 300px;
                          height: 300px;
                          position: absolute;
                          top: 50%;
                          left: 50%;
                          overflow: auto;
                          text-align: center;
                          margin-left:-150px;
                          margin-top:-150px;
                    } 
             """)

    with doc.body:
        with tags.section():
            with tags.div(cls='headline', style='font-size: 30;'):
                tags.h2("wrong information! please try again")
            tags.input(type='button', value='return back', onclick="location.href='http://127.0.0.1:5000/'",
                       style="width:120px; background-color:pink; font-size: 14;")

    fn = 'templates/index6.html'
    with open(file=fn, mode='w', encoding='utf-8') as f:
        f.write(doc.render())
    print(f)
Esempio n. 19
0
    def visit_BooleanField(self, node):
        wrap = self._wrapper(node, classes=['form-check'])

        wrap.add(tags.input(type='checkbox', cls='form-check-input', id=node.id))
        wrap.add(tags.label(node.label.text, _for=node.id, cls='form-check-label'))

        return wrap
Esempio n. 20
0
    def visit_Search(self, node):
        form = tags.form(target="_blank", method="get", role="search")
        form['role'] = 'search'
        form[
            'class'] = 'navbar-form navbar-right' if node.navbar_right else 'navbar-form navbar-left'

        # action may also have a 'get_url()' method, in which case we render
        if node.action is not None:
            if hasattr(node.action, 'get_url'):
                form['action'] = node.action.get_url()
            else:
                form['action'] = node.action

        div = form.add(tags.div(_class='form-group'))
        search_input = div.add(
            tags.input(type="text",
                       _class="form-control",
                       placeholder=node.input_placeholder))
        if node.input_id is not None:
            search_input['id'] = node.input_id
        if node.input_name is not None:
            search_input['name'] = node.input_name

        btn = form.add(tags.button(type="submit", _class="btn btn-default"))
        if node.icon is not None:
            btn.add(tags.i(_class=str(node.icon)))

        if node.btn_text is not None:
            btn.add(tags.span(node.btn_text))

        return form
Esempio n. 21
0
 def __init__(self, target_in=""):    
     super().__init__(f"Login to access {target_in}")
     self.target = target_in
     self.username = "******"
     self._passcheck = passcheck and passcheck.handles(self.target)
     if self._passcheck:
         with self.content:
             #tags.label("Username:"******"username") 
             tags.label("Password:"******"password", name="password", type="password") 
     else:
         with self.content:
             tags.p("This resource requires google oauthentication. " +
                    "Click the login button below to proceed to " +
                    "google authorization page. ")
Esempio n. 22
0
def page():
    doc = document()
    with doc.head:
        link_("https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css")
        link_("https://extra-uru1z3cxu.now.sh/css/extra.css")
        link_(
            "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.css"
        )
        dom.script(
            src=
            'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js'
        )

    with doc.body:
        with dom.div(cls=CENTER_FRAME) as CenterFrame:
            with dom.form(action='/file',
                          method='post',
                          enctype='multipart/form-data'):
                with dom.div(cls=LABEL_CARD):
                    dom.label('Write down your mark here',
                              cls="text-white text-xl")
                    dom.input(cls=LABEL_INPUT,
                              type='text',
                              placeholder='your watermark text here',
                              name='mk-text')
                with dom.div(cls=IMG_CARD):
                    with dom.div(cls=IMG_FORM):
                        dom.i(cls=UPLOAD_ICON,
                              onclick='''$('#fileupload').click()''')
                        dom.p("Find File", id="file", cls="text-gray-500 mt-4")
                        dom.input(
                            cls="hidden",
                            type="file",
                            name='bg-img',
                            id="fileupload",
                            onchange=
                            '''$('#file').text(this.value.split("\\\\").pop(-1))'''
                        )
                        dom.button('Upload', cls=BUTTON, type='submit')

            with dom.div(cls=RESULT_CONTAINER) as ResultContainer:
                for _ in range(4):
                    with dom.div(cls=RESULT_ITEM) as ResultItem:
                        dom.p("filename.jpg", cls="text-xl text-gray-400")
                        dom.i(cls="fas fa-download text-xl text-gray-400")

    return doc.render()
Esempio n. 23
0
    def visit_BooleanField(self, node):
        wrap = self._get_wrap(node, classes='form-check')

        label = wrap.add(tags.label(_for=node.id, _class='form-check-label'))
        label.add(tags.input(type='checkbox', _class='form-check-input'))
        label.add(node.label.text)

        return wrap
Esempio n. 24
0
    def visit_BooleanField(self, node):
        wrap = self._get_wrap(node, classes='checkbox')

        label = wrap.add(tags.label(_for=node.id))
        label.add(tags.input(type='checkbox'))
        label.add(node.label.text)

        return wrap
Esempio n. 25
0
def clubmembers_filters():
    pretablehtml = div()
    with pretablehtml:
        # hide / show hidden rows
        with filtercontainerdiv(style='margin-bottom: 4px;'):
            datefilter = filterdiv('fsrcmembers-external-filter-asof', 'As Of')
            with datefilter:
                with span(id='spinner', style='display:none;'):
                    i(cls='fas fa-spinner fa-spin')
                input(type='text', id='effective-date', name='effective-date')
                button('Today', id='todays-date-button')
                cachetime = TableUpdateTime.query.filter_by(
                    interest=localinterest(),
                    tablename='member').one().lastchecked
                span(f'(last update time {cachet.dt2asc(cachetime)})')
            # filterdiv('members-external-filter-level', 'Levels')
    return pretablehtml.render()
Esempio n. 26
0
    def _wrapped_input(self, node,
                       type='text',
                       classes=['form-control'], **kwargs):
        wrap = self._get_wrap(node)
        wrap.add(tags.label(node.label.text, _for=node.id))
        wrap.add(tags.input(type=type, _class=' '.join(classes), **kwargs))

        return wrap
Esempio n. 27
0
    def _wrapped_input(self, node,
                       type='text',
                       classes=['form-control'], **kwargs):
        wrap = self._get_wrap(node)
        wrap.add(tags.label(node.label.text, _for=node.id))
        wrap.add(tags.input(type=type, _class=' '.join(classes), **kwargs))

        return wrap
Esempio n. 28
0
def distribution_pretablehtml():
    pretablehtml = div()
    with pretablehtml:
        # hide / show hidden rows
        with filtercontainerdiv(style='margin-bottom: 4px;'):
            filterdiv('distribution-external-filter-tags', 'Tags')
            filterdiv('distribution-external-filter-positions', 'Positions')
            filterdiv('distribution-external-filter-roles', 'Roles')

            with filterdiv('distribution-external-filter-startdate',
                           'In Position On'):
                input(type='text',
                      id='effective-date',
                      name='effective-date',
                      _class='like-select2-sizing')
                button('Today', id='todays-date-button')

    return pretablehtml.render()
Esempio n. 29
0
 def blind(self, ):
     btn_up = input(value='click', type="button", cls='btn btn-md btn-primary', id="input" + str(self.id))
     st = "off"
     if self.value == '1':
         st = "on"
     elif self.value == '0':
         st = "off"
     btn_state = div(cls="field-value field-value-icon "+st, id=str(self.id))      
     return btn_up, btn_state
Esempio n. 30
0
 def blind(self, ):
     btn_up = input(value='click', type="button", cls='btn btn-md btn-primary', id="input" + str(self.id))
     st = "off"
     if self.value == '1':
         st = "on"
     elif self.value == '0':
         st = "off"
     btn_state = div(cls="field-value field-value-icon "+st, id=str(self.id))      
     return btn_up, btn_state
Esempio n. 31
0
    def get_update_netcdf_file_html_form(self):
        form_action = "/hsapi/_internal/{}/update-netcdf-file/".format(self.logical_file.id)
        style = "display:none;"
        self.refresh_from_db()
        if self.is_dirty:
            style = "margin-bottom:15px"
        root_div = div(id="div-netcdf-file-update", cls="row", style=style)

        with root_div:
            with div(cls="col-sm-12"):
                with div(cls="alert alert-warning alert-dismissible", role="alert"):
                    div("NetCDF file needs to be synced with metadata changes.", cls='space-bottom')
                    input(id="metadata-dirty", type="hidden", value=self.is_dirty)
                    with form(action=form_action, method="post", id="update-netcdf-file"):
                        button("Update NetCDF File", type="button", cls="btn btn-primary",
                               id="id-update-netcdf-file")

        return root_div
Esempio n. 32
0
def position_pretablehtml():
    pretablehtml = div()
    with pretablehtml:
        # hide / show hidden rows
        with filtercontainerdiv(style='margin-bottom: 4px;'):
            datefilter = filterdiv('positiondate-external-filter-startdate',
                                   'In Position On')

            with datefilter:
                input(type='text', id='effective-date', name='effective-date')
                button('Today', id='todays-date-button')

        # make dom repository for Editor wizard standalone form
        with div(style='display: none;'):
            dd(**{'data-editor-field': 'position_id'})
            dd(**{'data-editor-field': 'effective'})
            dd(**{'data-editor-field': 'members'})

    return pretablehtml.render()
Esempio n. 33
0
 def get_keywords_html_form(self):
     keywords_div = div(cls="col-sm-12 content-block",
                        id="filetype-keywords")
     action = "/hsapi/_internal/{0}/{1}/add-file-keyword-metadata/"
     action = action.format(self.logical_file.__class__.__name__,
                            self.logical_file.id)
     delete_action = "/hsapi/_internal/{0}/{1}/delete-file-keyword-metadata/"
     delete_action = delete_action.format(
         self.logical_file.__class__.__name__, self.logical_file.id)
     with keywords_div:
         legend("Keywords")
         with form(id="id-keywords-filetype",
                   action=action,
                   method="post",
                   enctype="multipart/form-data"):
             input(id="id-delete-keyword-filetype-action",
                   type="hidden",
                   value=delete_action)
             with div(cls="tags"):
                 with div(id="add-keyword-wrapper", cls="input-group"):
                     input(id="txt-keyword-filetype",
                           cls="form-control",
                           placeholder="keyword",
                           type="text",
                           name="keywords")
                     with span(cls="input-group-btn"):
                         a("Add",
                           id="btn-add-keyword-filetype",
                           cls="btn btn-success",
                           type="button")
             with ul(id="lst-tags-filetype", cls="custom-well tag-list"):
                 for kw in self.keywords:
                     with li(cls="tag"):
                         span(kw)
                         with a():
                             span(
                                 cls=
                                 "glyphicon glyphicon-remove-circle icon-remove"
                             )
         p("Duplicate. Keywords not added.",
           id="id-keywords-filetype-msg",
           cls="text-danger small",
           style="display: none;")
Esempio n. 34
0
    def get_update_netcdf_file_html_form(self):
        form_action = "/hsapi/_internal/netcdf_update/{}/".\
            format(self.resource.short_id)
        style = "display:none;"
        root_div = div(id="netcdf-file-update", cls="space-bottom", style=style)

        with root_div:
            with div(cls="col-sm-12"):
                with div(cls="alert alert-warning alert-dismissible", role="alert"):
                    div("NetCDF file needs to be synced with metadata changes.", cls='space-bottom')

                    input(id="metadata-dirty", type="hidden", value="{{ cm.metadata.is_dirty }}")
                    with form(action=form_action, method="post", id="update-netcdf-file",):
                        div('{% csrf_token %}')
                        button("Update NetCDF File", type="submit", cls="btn btn-primary",
                               id="id-update-netcdf-file",
                               )

        return root_div
Esempio n. 35
0
    def url_form(self):
        with tags.form(
            id=self.config['url_name'],
            onsubmit=self.config['onsubmit'],
            method=self.config['url_method'],
            action=self.config['url_route'],
            cls='card p-3 bg-light'):

            tags.h5('Load an image from a URL', cls='card-title')

            with tags.div(cls='form-group row'):
                with tags.div(cls='col-12'):
                    tags.input(
                        type='url', cls='form-control p-1 bg-light rounded',
                        name=self.config['url_name'], placeholder='https://example.com/image.png')

            with tags.div(cls='form-group row'):
                with tags.div(cls='col-3'):
                    with tags.button(type='submit', cls='btn btn-primary'):
                        util.text('Submit')
Esempio n. 36
0
 def slider(self,):
    
     range = input(value=self.value, type="range", min="0", max="100",  cls="field-value", id="input" + str(self.id))
     lab = label(str(self.value), id=str(self.id), style="margin-left:5px;")
     return range, lab 
Esempio n. 37
0
 def input_field(self, ):
     return input(value=self.value, min="10", max="40", type="number", cls="field-value value-text", id="input" + str(self.id))