Beispiel #1
0
 def render(self,  old_context):
     context = copy_context(old_context)
     link_id = resolve_variable(self.link_id, context, self.link_id)
     div_id = resolve_variable(self.div_id,  context, self.div_id)
     
     return render_to_string('django_utils/javascript/hide_div.html',  
                             {'link_id':link_id,  'div_id':div_id},  context)
Beispiel #2
0
 def render(self,  context):
     context = copy_context(context)
     content_type = resolve_variable(self.content_type, context, self.content_type)
     model_name = resolve_variable(self.model_name,  context, self.model_name)
     node_id = resolve_variable(self.node_id,  context, self.node_id)
     comment_class = resolve_variable(self.comment_class, context, self.comment_class)
     
     content_type_object = ContentType.objects.get(id = content_type)
     node = content_type_object.model_class().objects.get(id = node_id)
     all_comments = models.Comment.objects.comments_for_object(node, 'highest_rated')
     additional_count = all_comments.count() - self.count
     CommentForm = forms.build_comment_form(comment_class)
     comment_form = CommentForm()
     
     template = render_to_string('django_comments/standard_comments.html',   
                                     {'comment_target_node':node,
                                      'comments':all_comments[0:self.count],
                                      'comment_target_content_type':content_type_object.id,
                                      'comment_target_model':model_name,
                                      'comment_form':comment_form,
                                      'comment_class':comment_class,
                                      'additional_count':additional_count},  
                                      context
                                     )
     return template
Beispiel #3
0
 def render(self,  old_context):
     context = copy_context(old_context)
     form_id = resolve_variable(self.form_id, context, self.form_id)
     
     script = """<script type='text/javascript'>$("#%s").validate();</script>""" % (form_id)
     script = "\n" + script + "\n"
     return script
Beispiel #4
0
 def render(self,  old_context):
     context = copy_context(old_context)
     textarea_id = resolve_variable(self.textarea_id, context, self.textarea_id)
     preview_id = resolve_variable(self.preview_id,  context, self.preview_id)
     
     script = """<script type='text/javascript'>createWMD("%s", "%s");</script>""" % (textarea_id, preview_id)
     script = "\n" + script + "\n"
     return script
Beispiel #5
0
    def render(self, old_context):
        context = copy_context(old_context)
        form_id = resolve_variable(self.form_id, context, self.form_id)

        script = """<script type='text/javascript'>$("#%s").validate();</script>""" % (
            form_id)
        script = "\n" + script + "\n"
        return script
Beispiel #6
0
 def render(self,  old_context):
     context = copy_context(old_context)
     link_id = resolve_variable(self.link_id, context, self.link_id)
     div_id = resolve_variable(self.div_id,  context, self.div_id)
     visible_id = resolve_variable(self.visible_id,  context, self.visible_id)
     hidden_id = resolve_variable(self.hidden_id,  context, self.hidden_id)
     
     return render_to_string('django_utils/javascript/toggle_div_img.html',  
                             {'link_id':link_id,  'div_id':div_id,  'visible_id':visible_id,  'hidden_id':hidden_id},  context)
Beispiel #7
0
    def render(self, old_context):
        context = copy_context(old_context)
        link_id = resolve_variable(self.link_id, context, self.link_id)
        div_id = resolve_variable(self.div_id, context, self.div_id)

        return render_to_string('django_utils/javascript/hide_div.html', {
            'link_id': link_id,
            'div_id': div_id
        }, context)
 def render(self, context):
     content_type = resolve_variable(self.content_type, context, self.content_type)
     new_context = copy_context(context)
     content_type_object = ContentType.objects.get(id=int(content_type))
     model_object = content_type_object.model_class()
     tag_cloud = Tag.objects.cloud_for_model(model_object, steps=1, min_count=25)[0:50]
     new_context['node_content_type'] = content_type_object.id
     new_context['tags'] = tag_cloud
     
     return render_to_string('django_metatagging/cloud_for_model.html', {}, context)
Beispiel #9
0
    def render(self, old_context):
        context = copy_context(old_context)
        textarea_id = resolve_variable(self.textarea_id, context,
                                       self.textarea_id)
        preview_id = resolve_variable(self.preview_id, context,
                                      self.preview_id)

        script = """<script type='text/javascript'>createWMD("%s", "%s");</script>""" % (
            textarea_id, preview_id)
        script = "\n" + script + "\n"
        return script
Beispiel #10
0
 def render(self,  context):
     result = resolve_variable(self.result,  context,  self.result)
     content = result.object
     template = resolve_variable(self.template, context, self.template)
     new_context = copy_context(context)
     
     content_type_object = ContentType.objects.get_for_model(content.__class__)
     new_context['node'] = content
     new_context['node_content_type'] = content_type_object.id
     new_context['model'] = content_type_object.model
     
     context['view_url'] = reverse('content-redirect-by-id', args=[new_context['node_content_type'],
                                                                   new_context['node'].id])
     return render_to_string(template,  {},  context)
Beispiel #11
0
    def render(self, old_context):
        context = copy_context(old_context)
        link_id = resolve_variable(self.link_id, context, self.link_id)
        div_id = resolve_variable(self.div_id, context, self.div_id)
        visible_id = resolve_variable(self.visible_id, context,
                                      self.visible_id)
        hidden_id = resolve_variable(self.hidden_id, context, self.hidden_id)

        return render_to_string(
            'django_utils/javascript/toggle_div_img.html', {
                'link_id': link_id,
                'div_id': div_id,
                'visible_id': visible_id,
                'hidden_id': hidden_id
            }, context)