Browse files

Upravy nahravani souboru pro clanek

  • Loading branch information...
1 parent 41e9e61 commit 93d72eb2cb0c70397c776c46b6f69b2ee3c72b96 @JakubMrozek committed Feb 28, 2013
View
6 apiary.apib
@@ -485,3 +485,9 @@ GET /products?filter={filter}&limit={limit}&offset={offset}&order={order}&query=
"availability": "skladem",
"price": 15000
}]}
+
+
+Vkládání obrázků k produktům.
+PUT /products/{id}/images
+< 204
+< Content-Type: application/json
View
6 app.js
@@ -56,4 +56,10 @@ app.get('/kosik', render());
app.get('/zakaznicke-udaje', render());
app.get('/potvrzeni', render());
app.get('/admin*', render('admin/layout'));
+
+//TODO nahravani obrazku, pouze docasne reseni
+app.put('/api/v1/products/*/images', function(req, res) {
+ res.send(204);
+})
+
module.exports = app;
View
4 public/js/zdrojak.service.js
@@ -39,8 +39,8 @@ module.factory('api', ['$resource', function($resource) {
//posilani souboru
api.product.upload = function(params, completeFn, errorFn, cancelFn, progressFn) {
params.upload.upload(
- 'POST',
- url + 'products/' + params.id,
+ 'PUT',
+ url + 'products/' + params.id + '/images',
completeFn,
errorFn,
cancelFn,
View
6 public/partials/admin/product-detail.html
@@ -34,13 +34,13 @@
<div class="span4 well">
<h3>Obrázky</h3>
<form ng-submit="upload()" enctype="multipart/form-data">
- <input id="file" type="file" ng-model="file" upload="upload" multiple>
+ <input id="file" type="file" ng-model="file" upload="upload" multiple accept="image/*">
</form>
<p ng-show="pbar"><progress value="{{progress}}" max="100"></progress> {{progress}}%</p>
<div id="admin-products-imgs">
<div ng-repeat="img in imgs">
- <img ng-src="{{img}}" width="100">
- <ul>
+ <p><img ng-src="{{img}}" width="100"></p>
+ <ul style="display:none">
<li><label class="radio"><input type="radio" ng-model="main" value="">Hlavní</label></li>
<li><a ng-click="removeImg(img)">Odstranit</a></li>
</ul>
View
2 public/partials/admin/products.html
@@ -18,6 +18,8 @@
</fieldset>
</form>
+<p class="button-add-product"><a class="btn" ng-href="/admin/add-product"><i class="icon-plus-sign"></i> Vložit nový produkt</a></p>
+
<hr />
<div class="row product-card-content">
View
18 test/frontend/apiary.js
@@ -290,6 +290,24 @@ var apiary = [
"body": "{\"count\":120,\n\"products\":[{\"name\": \"iPhone 4 32GB černý\",\n\"id\": \"12345\",\n\"code\": \"AB008\",\n\"url\": \"iphone-4-32gb-cerny\",\n\"perex\": \"Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.\",\n\"photo\": {\"src\":\"/img/100x100.gif\",\"width\":100,\"heigth\":100},\n\"producer\": \"Apple\",\n\"availability\": \"skladem\",\n\"price\": 15000\n},\n{\"name\": \"iPhone 4 32GB černý\",\n\"id\": \"12345\",\n\"code\": \"AB008\",\n\"url\": \"iphone-4-32gb-cerny\",\n\"perex\": \"Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.\",\n\"photo\": {\"src\":\"/img/100x100.gif\",\"width\":100,\"heigth\":100},\n\"producer\": \"Apple\",\n\"availability\": \"skladem\",\n\"price\": 15000\n},\n{\"name\": \"iPhone 4 32GB černý\",\n\"id\": \"12345\",\n\"code\": \"AB008\",\n\"url\": \"iphone-4-32gb-cerny\",\n\"perex\": \"Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.\",\n\"photo\": {\"src\":\"/img/100x100.gif\",\"width\":100,\"heigth\":100},\n\"producer\": \"Apple\",\n\"availability\": \"skladem\",\n\"price\": 15000\n},\n{\"name\": \"iPhone 4 32GB černý\",\n\"id\": \"12345\",\n\"code\": \"AB008\",\n\"url\": \"iphone-4-32gb-cerny\",\n\"perex\": \"Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.\",\n\"photo\": {\"src\":\"/img/100x100.gif\",\"width\":100,\"heigth\":100},\n\"producer\": \"Apple\",\n\"availability\": \"skladem\",\n\"price\": 15000\n},\n{\"name\": \"iPhone 4 32GB černý\",\n\"id\": \"12345\",\n\"code\": \"AB008\",\n\"url\": \"iphone-4-32gb-cerny\",\n\"perex\": \"Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.\",\n\"photo\": {\"src\":\"/img/100x100.gif\",\"width\":100,\"heigth\":100},\n\"producer\": \"Apple\",\n\"availability\": \"skladem\",\n\"price\": 15000\n},\n{\"name\": \"iPhone 4 32GB černý\",\n\"id\": \"12345\",\n\"code\": \"AB008\",\n\"url\": \"iphone-4-32gb-cerny\",\n\"perex\": \"Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.\",\n\"photo\": {\"src\":\"/img/100x100.gif\",\"width\":100,\"heigth\":100},\n\"producer\": \"Apple\",\n\"availability\": \"skladem\",\n\"price\": 15000\n}]}"
}
]
+ },
+ {
+ "description": "Vkládání obrázků k produktům.",
+ "method": "PUT",
+ "url": "/products/{id}/images",
+ "request": {
+ "headers": {},
+ "body": ""
+ },
+ "responses": [
+ {
+ "status": 204,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "body": ""
+ }
+ ]
}
]
}
View
1 views/admin/layout.html
@@ -20,7 +20,6 @@
<li><a>Parametry</a></li>
<li><a>Layouty</a></li>
<li><a>Výrobci</a></li>
- <li><a>Záruční doby</a></li>
<li><a>Správci</a></li>
</ul>
</div>

0 comments on commit 93d72eb

Please sign in to comment.