Render parent books, child books, and other books separately - minor clean in modal.html
authorrougeronj
Tue, 07 Apr 2015 12:01:58 +0200
changeset 75 288fb435874e
parent 74 44ebb0d0b836
child 76 aa0a2d37faca
Render parent books, child books, and other books separately - minor clean in modal.html
client/app/books/book.css
client/app/books/books.html
client/app/search/modal.html
--- a/client/app/books/book.css	Tue Apr 07 12:00:14 2015 +0200
+++ b/client/app/books/book.css	Tue Apr 07 12:01:58 2015 +0200
@@ -51,5 +51,9 @@
 
 .accordion-toggle .glyphicon{
 	font-size: 17px;
-	margin-left:5px;
+	margin-left:10px;
+}
+
+.list-books:nth-child(odd){
+	background-color:#f8f8f8;
 }
\ No newline at end of file
--- a/client/app/books/books.html	Tue Apr 07 12:00:14 2015 +0200
+++ b/client/app/books/books.html	Tue Apr 07 12:01:58 2015 +0200
@@ -1,13 +1,26 @@
 <p>Liste des books&nbsp;:</p>
 
-<accordion>
-	<accordion-group ng-repeat="i in books | orderBy:'-date'">
+<accordion close-others="false">
+	<accordion-group ng-repeat="parentBook in books | filter:{ parent_visit: 'null', idArticle: '!null' }" is-open=true>
 		<accordion-heading>
-			{{ i.title }}
-            <a class="pull-right" ng-click="$event.stopPropagation();" href="#/slideshow/{{ i.id }}"><span class="glyphicon glyphicon-eye-open"></span></a>
-            <a class="pull-right" ng-click="$event.preventDefault(); $event.stopPropagation(); deleteItem($index)"><span class="glyphicon glyphicon-minus"></span></a>
+			{{ parentBook.title }}
+			<a class="pull-right" ng-click="$event.preventDefault(); $event.stopPropagation(); addBook(parentBook.id)"><span class="glyphicon glyphicon-plus"></span></a>
             <a class="pull-right" ng-click="$event.preventDefault(); $event.stopPropagation(); edit()"><span class="glyphicon glyphicon-wrench"></span></a>
+            <a class="pull-right" ng-click="$event.stopPropagation();" href="#/slideshow/{{ parentBook.id }}"><span class="glyphicon glyphicon-eye-open"></span></a>
         </accordion-heading>
+        <div class="list-books" ng-repeat="childBook in books | filter:{ parent_visit: parentBook.id }:true">
+		        <a href="#/books/{{ childBook.id }}">{{ childBook.title }}</a>
+		        <a class="pull-right" ng-click="deleteItem(childBook)"><span class="glyphicon glyphicon-minus"></span></a>
+        </div>
+	</accordion-group>
+	<accordion-group ng-repeat="parentBook in books | filter:{ parent_visit: 'null', idArticle: 'null' }" is-open=true>
+		<accordion-heading>
+			Autres Books
+		</accordion-heading>
+		<div class="list-books" ng-repeat="childBook in books | filter:{ parent_visit: 'null', idArticle: 'null' }">
+		        <a href="#/books/{{ childBook.id }}">{{ childBook.title }}</a>
+		        <a class="pull-right" ng-click="deleteItem(childBook)"><span class="glyphicon glyphicon-minus"></span></a>
+        </div>
 	</accordion-group>
 </accordion>
 
--- a/client/app/search/modal.html	Tue Apr 07 12:00:14 2015 +0200
+++ b/client/app/search/modal.html	Tue Apr 07 12:01:58 2015 +0200
@@ -6,7 +6,7 @@
 	<ul class="row ">
 		<li class="" ng-repeat="i in books | orderBy:'-date'">
 			<div>
-				<a class="visite" ng-click="addToBook(i.id)">{{ i.title }}</a>
+				<a ng-click="addToBook(i.id)">{{ i.title }}</a>
 			</div>
 		</li>
 	</ul>