Esempio n. 1
0
def login_link(context, request, va, **kw):
    if request.authenticated_userid is None and \
            IRoot.providedBy(request.root) and \
            request.root.site_settings.get('show_login_link', True):
        need_lib('deform')
        data = {'href': request.resource_url(request.root, 'login')}
        return """<li><a data-open-modal %s>%s</a></li>""" % \
               (' '.join(['%s="%s"' % (k, v) for (k, v) in data.items()]),
                request.localizer.translate(va.title))
Esempio n. 2
0
def include_voteit_resources(view, event):
    voteit_main_css.need()
    watcher_js.need()
    need_lib('deform') #As a minimum this should be included, but it really depends on poll methods.
    navs_js.need()
    if view.request.is_moderator:
        voteit_moderator_js.need()
    if view.request.meeting:
        unread_js.need()
Esempio n. 3
0
 def __init__(self, context, request):
     self.context = context
     self.request = request
     need_lib('basic')
     main_css.need()
     common_js.need()
     search_js.need()
     html5shiv_js.need()
     view_event = ViewInitializedEvent(self)
     objectEventNotify(view_event)
Esempio n. 4
0
def include_voteit_resources(view, event):
    voteit_main_css.need()
    watcher_js.need()
    need_lib(
        'deform'
    )  #As a minimum this should be included, but it really depends on poll methods.
    navs_js.need()
    if view.request.is_moderator:
        voteit_moderator_js.need()
    if view.request.meeting:
        unread_js.need()
Esempio n. 5
0
 def view(self):
     users_groups_js.need()
     need_lib('select2')
     return {
         'fields': (
             ('userid', _('UserID')),
             ('email', _('Email')),
             ('first_name', _('First name')),
             ('last_name', _('Last name')),
             ('created', _('Created')),
         ),
     }
Esempio n. 6
0
 def test_remove_resource_with_deps(self):
     obj = self._cut()
     obj.libraries['deform_autoneed'] = library = Library('deform_autoneed', 'testing_fixture')
     unwanted_dependency = Resource(library, 'dummy.css')
     resource_with_requirement = Resource(library, 'dummy.js', depends = (unwanted_dependency,))
     obj.requirements['dummy'] = [resource_with_requirement, unwanted_dependency]
     obj.remove_resource(unwanted_dependency)
     from deform_autoneed import need_lib
     need_lib('dummy', reg = obj)
     resources = get_needed().resources()
     self.assertEqual(len(obj.requirements['dummy']), 1)
     self.assertNotIn('dummy.css', [x.filename for x in resources])
     self.assertEqual(len(resources), 1)
Esempio n. 7
0
 def render(self, context, request, view, **kwargs):
     comments = context.get('_comments', None)
     allowed_types = self.portlet.settings.get('allowed_types', ())
     if not allowed_types:
         return
     if getattr(context, 'type_name', '') not in allowed_types:
         return
     can_toggle = request.has_permission(ENABLE_COMMENTS, context)
     if comments:
         need_lib('deform')
         can_add = request.has_permission(ADD_COMMENT, comments)
         can_view = request.has_permission(PERM_VIEW, comments)
     else:
         can_add = False
         can_view = None
     return render(self.tpl, {
         'portlet': self.portlet,
         'comments': comments,
         'view': view,
         'can_toggle': can_toggle,
         'can_add': can_add,
         'can_view': can_view
     },
                   request=request)
Esempio n. 8
0
def need_subscriber(view, event):
    skl_theme_css.need()
    # Due to changes in the registration schema, the select 2 widget is needed at all times too
    need_lib('select2')
def inject(view, event):
    timer_js.need()
    inline_edit_js.need()
    need_lib('deform')
    need_lib('pickadate')
Esempio n. 10
0
def inject(view, event):
    timer_js.need()
    inline_edit_js.need()
    need_lib('deform')
    need_lib('pickadate')
def need_subscriber(view, event):
    skl_theme_css.need()
    # Due to changes in the registration schema, the select 2 widget is needed at all times too
    need_lib('select2')