Exemplo n.º 1
0
 def toggle_limit_future(self):
     name = 'IC/ics_limit_future' # series shortnames must be at least 3 letters
     return toggle(
         tglid="tlg" + name.replace('/','--'),
         name=name,
         value=1 if self.ics_limit_future else -1,
         classes="subscribe ics_options"
     )
Exemplo n.º 2
0
    def show_subscribe(self):
        if current_user.is_anonymous:
            return ""

        name = "{sem}/{ctr}".format(sem=self.seminar_id, ctr=self.seminar_ctr)
        return toggle(tglid="tlg" + name.replace('/', '--'),
                      name=name,
                      value=1 if self.is_subscribed() else -1,
                      classes="subscribe")
Exemplo n.º 3
0
    def show_subscribe(self):
        if current_user.is_anonymous:
            return ""

        return toggle(
            tglid="tlg" + self.shortname,
            name=self.shortname,
            value=1 if self.is_subscribed() else -1,
            classes="subscribe",
        )
Exemplo n.º 4
0
 def _toggle(self, code=None):
     kwds = {}
     if code is None:
         code = "language"
         onchange = 'toggleFilters(this.id);'
         value = 1 if request.cookies.get('filter_language', '-1') == '1' else -1
     else:
         onchange = 'toggleLanguage(this.id);'
         value = 1 if code in request.cookies.get("languages", "").split(",") else -1
         code = "langlink-" + code
         kwds["classes"] = "sub_language"
     return toggle(code, value=value, onchange=onchange, **kwds)