Преглед изворни кода

Added tagging to animelist

Michael Francis пре 14 година
родитељ
комит
54e62827df
2 измењених фајлова са 25 додато и 2 уклоњено
  1. 18 1
      views/Anime_list/add.html.php
  2. 7 1
      views/layouts/default.html.php

+ 18 - 1
views/Anime_list/add.html.php

@@ -1,3 +1,5 @@
+<?php $this->form->config(array('templates' => array(
+	 'error' => '<div class="notification error">{:content}</div>'))); ?>
 <?php if (empty($anime)): ?>
 <h2 class="ribbon full">Find an Anime:</h2>
 <div class="triangle-ribbon"></div>
@@ -7,6 +9,21 @@
 <div class="triangle-ribbon"></div>
 <br class="clear" />
 <?php endif; ?>
+
+<script type="text/javascript">
+		
+		function onAddTag(tag) {
+			alert("Added a tag: " + tag);
+		}
+		function onRemoveTag(tag) {
+			alert("Removed a tag: " + tag);
+		}
+		
+		$(function() {
+			$('#tags').tagsInput();
+		});
+</script>
+
 <?php 
 	echo $this->form->create($entry);
 
@@ -34,7 +51,7 @@
 	echo $this->form->field('my_times_watched', array('label' => 'Times Watched'));
     echo $this->form->label('rewatch_value', 'Rewatch Value');
     echo $this->form->select('rewatch_value', array('High', 'Medium', 'Low', 'None'), array('value' => 0));
-	echo $this->form->field('tags', array('type' => 'textarea'));
+	echo $this->form->field('tags', array('type' => 'textarea', 'id' => 'tags'));
 	echo $this->form->checkbox('rewatching', array('label' =>'Rewatching?', 'value' => false));
 	echo $this->form->submit('Save!');
 ?>

+ 7 - 1
views/layouts/default.html.php

@@ -14,6 +14,10 @@
 	<?php echo $this->html->style(array('style', 'base', 'grid')); ?>
 	<?php echo $this->html->style(array('themes/light', 'themes/green')); ?>
   <?php echo $this->html->style(array('prettyPhoto')); ?>
+ 
+  <script src="/js/jquery-1.6.1.min.js" type="text/javascript"></script>  
+  <?php echo $this->html->style(array('jquery.tagsinput')); ?>
+  <?= $this->html->script("/js/jquery.tagsinput.min.js"); ?>
 
 
 	<script type="text/javascript" >
@@ -94,8 +98,9 @@
   </footer>
   <!-- footer end --> 
   </div>
+
+
   <!-- Javascript at the bottom for fast page loading -->
-  <script src="/js/jquery-1.6.1.min.js" type="text/javascript"></script> 
   <script src="/js/jquery.tools.min.js" type="text/javascript"></script> 
   <script src="/js/jquery.lightbox-0.5.min.js" type="text/javascript"></script> 
   <script src="/js/jquery.form.js" type="text/javascript"></script> 
@@ -106,6 +111,7 @@
   <?= $this->html->script("/js/jquery.anchor.js"); ?>
   <?= $this->html->script("/js/jquery.prettyPhoto.js"); ?>
 
+
 <script type="text/javascript" charset="utf-8">
   $(document).ready(function(){
     $("a[rel^='prettyPhoto']").prettyPhoto();