working at video comments
[living-lab-site.git] / application / views / video / comments_view.php
1 <div id="video-comments">
2         <h4><?php echo $this->lang->line('video_title_comment') ?>: </h4>
3
4         <?php echo form_open("video/comment/$video_id") ?>
5                 <textarea name="comment" id="comment" rows="2" cols="56"></textarea>
6                 
7                 <div><input type="button" id="button-post" value="<?php echo $this->lang->line('video_submit_post_comment') ?>" /></div>
8         </form>
9
10   <?php if ($comments_count == 0): ?>
11         <h4><?php echo $this->lang->line('video_title_no_comments') ?></h4>
12   <?php else: ?>
13         <h4><?php echo $this->lang->line('video_title_all_comments'). " ($comments_count): " ?></h4>
14
15         <?php foreach ($comments as $comment): ?>
16                 <div class="comment-info"><span class="comment-user"><a href="<?php echo site_url("user/profile/{$comment['username']}") ?>"><?php echo $comment['username'] ?></a></span>
17                         (<span class="comment-time"><?php echo $comment['time'] ?></span>)
18                 </div>
19                 <div class="comment-content"><?php echo $comment['content'] ?></div>
20         <?php endforeach ?>
21   <?php endif ?>
22 </div>
23
24 <script type="text/javascript">
25         $(function() {
26                 $('#button-post')
27                         .click(function() {
28                                 $.post('<?php echo site_url("video/ajax_comment/$video_id") ?>',
29                                         {comment: $('#comment').val(), 'video-id': <?php echo $video_id ?>},
30                                         function(data) {
31                                                 $('#video-comments').html(data);
32                                         });
33                         });
34         });
35
36 </script>