# HG changeset patch
# User rougeronj
# Date 1433869845 -7200
# Node ID c6fa8ee3f5625c0451696c0dbe9e24920bb2d8d2
# Parent a8b5b11ef6b208d149243594652fad40e00d6e84
refactor idArticle to id_article and idInventory to id_inventory
remove "/" from resource path
diff -r a8b5b11ef6b2 -r c6fa8ee3f562 client/app/books/add_book_modal.html
--- a/client/app/books/add_book_modal.html Tue Jun 09 19:09:29 2015 +0200
+++ b/client/app/books/add_book_modal.html Tue Jun 09 19:10:45 2015 +0200
@@ -5,13 +5,13 @@
Les books de vos visites:
- -
+
-
Autres Books:
- -
+
-
diff -r a8b5b11ef6b2 -r c6fa8ee3f562 client/app/books/books.html
--- a/client/app/books/books.html Tue Jun 09 19:09:29 2015 +0200
+++ b/client/app/books/books.html Tue Jun 09 19:10:45 2015 +0200
@@ -1,7 +1,7 @@
-
+
@@ -15,11 +15,6 @@
{{book.count}} objets
-
-
-
diff -r a8b5b11ef6b2 -r c6fa8ee3f562 client/app/books/books_controller.js
--- a/client/app/books/books_controller.js Tue Jun 09 19:09:29 2015 +0200
+++ b/client/app/books/books_controller.js Tue Jun 09 19:10:45 2015 +0200
@@ -11,28 +11,15 @@
});
for (var i = 0; i < data.length; i++) {
- if (data[i].idArticle === null){
+ if (data[i].id_article === null){
data[i].slides = Slide.query({idBook:data[i].id, limit: 5, format:'json'});
}
}
});
-
- $scope.toggleModal = function (index) {
-
- var modalInstance = $modal.open({
- templateUrl: 'books/add_book_modal.html',
- controller: 'ModalAddBookCtrl',
- size: 'sm'
- });
-
- modalInstance.result.then(function (idBook) {
- var newSlide = {
- book: idBook,
- idInventory: $scope.results.hits[index].metas_dict.inventorynumber
- };
- Slide.save(newSlide);
- });
- };
+
+// $scope.$on('slideDeleted', function (event, data) {
+// console.log(data); // 'Data to send'
+// });
$scope.addBook = function (idParent) {
$modal.open({
@@ -44,30 +31,6 @@
});
});
};
- $scope.deleteItem = function(item){
- if(window.confirm('Êtes-vous sûr(e) de vouloir effacer cet élément ? Cette action est irrémédiable.')){
- Slide.delete({idSlide: item.id}, function(){
- $scope.book.slides.splice($scope.book.slides.indexOf(item), 1);
- },
- function(error) {
- if (error.status === 404){
- $scope.book.slides.splice($scope.book.indexOf(item), 1);
- }
- });
- }
- };
- $scope.deleteBook = function(book){
- if(window.confirm('Êtes-vous sûr(e) de vouloir effacer cet élément ? Cette action est irrémédiable.')){
- Book.delete({idBook: book.id}, function(){
- $scope.books.splice($scope.books.indexOf(book), 1);
- },
- function(error) {
- if (error.status === 404){
- $scope.books.splice($scope.books.indexOf(book), 1);
- }
- });
- }
- };
})
.controller('bookCtrl', function($scope, $location, $routeParams, $modal, Book, Slide, Order) {
@@ -81,23 +44,6 @@
});
});
- $scope.toggleModal = function (index) {
-
- var modalInstance = $modal.open({
- templateUrl: 'books/add_book_modal.html',
- controller: 'ModalAddBookCtrl',
- size: 'sm'
- });
-
- modalInstance.result.then(function (idBook) {
- var newSlide = {
- book: idBook,
- idInventory: $scope.results.hits[index].metas_dict.inventorynumber
- };
- Slide.save(newSlide);
- });
- };
-
$scope.sortableOptions = {
stop: function() {
var order = $scope.book.slides.map(function(i){
diff -r a8b5b11ef6b2 -r c6fa8ee3f562 client/app/books/galleryItem.html
--- a/client/app/books/galleryItem.html Tue Jun 09 19:09:29 2015 +0200
+++ b/client/app/books/galleryItem.html Tue Jun 09 19:10:45 2015 +0200
@@ -2,7 +2,7 @@
{{ slide.details.title }}
\ No newline at end of file
diff -r a8b5b11ef6b2 -r c6fa8ee3f562 client/app/components/app_service.js
--- a/client/app/components/app_service.js Tue Jun 09 19:09:29 2015 +0200
+++ b/client/app/components/app_service.js Tue Jun 09 19:10:45 2015 +0200
@@ -4,11 +4,11 @@
angular.module('ammicoCommon', ['ngRoute'])
.factory('Book', function($resource, context) {
- var books = $resource(context.urls.ammicoUrl+'/books/:idBook', {idBook:'@id'}, {update: { method: 'PUT'}});
+ var books = $resource(context.urls.ammicoUrl+'books/:idBook', {idBook:'@id', idExpo: context.idExpo}, {update: { method: 'PUT'}});
return books;
})
- .factory('Slide', function($resource, context) {
- var slides = $resource(context.urls.ammicoUrl+'/slides/:idSlide', {idSlide:'@id'}, {update: { method: 'PUT'}});
+ .factory('Slide', function($resource, context, $modal) {
+ var slides = $resource(context.urls.ammicoUrl+'slides/:idSlide', {idSlide:'@id'}, {update: { method: 'PUT'}});
angular.extend(slides.prototype, {
@@ -16,6 +16,24 @@
this.favorite = !this.favorite;
this.$update();
},
+ addToBook: function () {
+ var _this = this;
+ var modalInstance = $modal.open({
+ templateUrl: 'books/add_book_modal.html',
+ controller: 'ModalAddBookCtrl',
+ size: 'sm'
+ });
+
+ modalInstance.result.then(function (idBook) {
+ var newSlide = _this;
+ newSlide.book = idBook;
+ delete newSlide["id"];
+ slides.save(newSlide);
+ });
+ },
+ update: function(){
+ console.log('test');
+ },
remove: function (array) {
var _this = this;
if(window.confirm('Êtes-vous sûr(e) de vouloir effacer cet élément ? Cette action est irrémédiable.')){
@@ -23,6 +41,7 @@
if (array){
array.splice(array.indexOf(_this), 1);
}
+ //$scope.$emit("slideDeleted", array);
},
function(error) {
if (error.status === 404 && array){
@@ -36,7 +55,7 @@
return slides;
})
.factory('Order', function($resource, context) {
- return $resource(context.urls.ammicoUrl+'/books/:idBook/order', {idBook:'@id'});
+ return $resource(context.urls.ammicoUrl+'books/:idBook/order', {idBook:'@id'});
})
.service('Utils', function($resource, context, $sce) {
this.sanitizeUrls = function(data){
@@ -48,10 +67,10 @@
};
})
.service('authApi', function($resource, context) {
- this.login = $resource(context.urls.ammicoUrl+'/auth/api-token-auth');
- this.logout = $resource(context.urls.ammicoUrl+'/auth/logout');
- this.user = $resource(context.urls.ammicoUrl+'/auth/user');
- this.test = $resource(context.urls.ammicoUrl+'/auth/auth');
+ this.login = $resource(context.urls.ammicoUrl+'auth/api-token-auth', {idExpo: context.idExpo});
+ this.logout = $resource(context.urls.ammicoUrl+'auth/logout');
+ this.user = $resource(context.urls.ammicoUrl+'auth/user');
+ this.test = $resource(context.urls.ammicoUrl+'auth/auth');
})
.service('searchApi', function($resource, context) {
this.searchResource = function(params){
diff -r a8b5b11ef6b2 -r c6fa8ee3f562 client/app/index.html
--- a/client/app/index.html Tue Jun 09 19:09:29 2015 +0200
+++ b/client/app/index.html Tue Jun 09 19:10:45 2015 +0200
@@ -78,11 +78,17 @@
.value('context', {
+
+ idExpo: "1",
+
record: angular.fromJson('{"record": "record value"}'),
urls: {
- base_static: "./",
- ammicoUrl: "http://127.0.0.1:8000/ammico",
+
+ ammicoUrl: "http://127.0.0.1:8000/ammico/",
+
+
searchUrl: "http://ammico.labs.exalead.com/search-api"
+
}
});
diff -r a8b5b11ef6b2 -r c6fa8ee3f562 client/app/my_visit/my_visit.html
--- a/client/app/my_visit/my_visit.html Tue Jun 09 19:09:29 2015 +0200
+++ b/client/app/my_visit/my_visit.html Tue Jun 09 19:10:45 2015 +0200
@@ -1,7 +1,7 @@
-
+
{{ parentBook.title }}
diff -r a8b5b11ef6b2 -r c6fa8ee3f562 client/app/my_visit/my_visit_controller.js
--- a/client/app/my_visit/my_visit_controller.js Tue Jun 09 19:09:29 2015 +0200
+++ b/client/app/my_visit/my_visit_controller.js Tue Jun 09 19:10:45 2015 +0200
@@ -11,7 +11,7 @@
});
for (var i = 0; i < data.length; i++) {
- if (data[i].idArticle){
+ if (data[i].id_article){
data[i].slides = Slide.query({idBook:data[i].id, format:'json'});
}
}
diff -r a8b5b11ef6b2 -r c6fa8ee3f562 client/app/search/modal.html
--- a/client/app/search/modal.html Tue Jun 09 19:09:29 2015 +0200
+++ b/client/app/search/modal.html Tue Jun 09 19:10:45 2015 +0200
@@ -5,13 +5,13 @@
Les books de vos visites:
- -
+
-
Autres Books:
- -
+
-
diff -r a8b5b11ef6b2 -r c6fa8ee3f562 client/app/search/search_controller.js
--- a/client/app/search/search_controller.js Tue Jun 09 19:09:29 2015 +0200
+++ b/client/app/search/search_controller.js Tue Jun 09 19:10:45 2015 +0200
@@ -24,7 +24,7 @@
modalInstance.result.then(function (idBook) {
var newSlide = {
book: idBook,
- idInventory: $scope.results.hits[index].metas_dict.inventorynumber
+ id_inventory: $scope.results.hits[index].metas_dict.inventorynumber
};
Slide.save(newSlide);
});
diff -r a8b5b11ef6b2 -r c6fa8ee3f562 client/app/visites/add_book_modal.html
--- a/client/app/visites/add_book_modal.html Tue Jun 09 19:09:29 2015 +0200
+++ b/client/app/visites/add_book_modal.html Tue Jun 09 19:10:45 2015 +0200
@@ -5,13 +5,13 @@
Les books de vos visites:
- -
+
-
Autres Books:
- -
+
-
diff -r a8b5b11ef6b2 -r c6fa8ee3f562 client/app/visites/visites.html
--- a/client/app/visites/visites.html Tue Jun 09 19:09:29 2015 +0200
+++ b/client/app/visites/visites.html Tue Jun 09 19:10:45 2015 +0200
@@ -1,5 +1,5 @@
-
+
{{ visit.title }}
diff -r a8b5b11ef6b2 -r c6fa8ee3f562 client/app/visites/visites_controller.js
--- a/client/app/visites/visites_controller.js Tue Jun 09 19:09:29 2015 +0200
+++ b/client/app/visites/visites_controller.js Tue Jun 09 19:10:45 2015 +0200
@@ -11,7 +11,7 @@
});
for (var i = 0; i < data.length; i++) {
- if (data[i].idArticle){
+ if (data[i].id_article){
data[i].slides = Slide.query({idBook:data[i].id, limit: 5, format:'json'});
}
}
@@ -28,7 +28,7 @@
modalInstance.result.then(function (idBook) {
var newSlide = {
book: idBook,
- idInventory: $scope.results.hits[index].metas_dict.inventorynumber
+ id_inventory: $scope.results.hits[index].metas_dict.inventorynumber
};
Slide.save(newSlide);
});