From 446219f3c1c6415422ab12122970c1008f6e1be3 Mon Sep 17 00:00:00 2001 From: Jonathan Bouzekri Date: Mon, 10 Aug 2015 22:38:14 +0200 Subject: [PATCH] update doc and remove row-id --- Resources/doc/base/markup.md | 16 ++++++++-------- Resources/public/js/jbfileupload.js | 2 +- Resources/views/Form/fields.html.twig | 6 ++---- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Resources/doc/base/markup.md b/Resources/doc/base/markup.md index 006c1e4..652481f 100644 --- a/Resources/doc/base/markup.md +++ b/Resources/doc/base/markup.md @@ -7,12 +7,12 @@ File without preview -------------------- ``` html -
+
Import a file - + | @@ -26,7 +26,7 @@ File without preview
``` -* `.jb_fileupload[data-row-id]` : the attribut data-row-id indicated the parent div rom which we can find using jQuery all children having jb_* class +* `.jb_fileupload_row` : this class is the starting point of the markup. Find query are done to find others child classes starting with jb_* * `.jb_result_error` : used to display error * `.fileinput-button` : used in css to hide the input file behind the upload file link * `.jb_fileupload` : the base class used to activate the jquery plugin. It must be place on the input file. @@ -42,7 +42,7 @@ Image upload with preview ------------------------- ``` html -
+
@@ -50,7 +50,7 @@ Image upload with preview Import a file - + | @@ -72,7 +72,7 @@ Image upload with crop ---------------------- ``` html -
+
@@ -80,7 +80,7 @@ Image upload with crop Import a file - + | @@ -116,4 +116,4 @@ Most of the jb_* classes have been explained above. What add this field is the ` * `.jb_crop_height` : height of the crop zone * `.jb_crop_filename` : filename to crop -_Note : I am open to pointer to make a plugin less dependant on html markup_ \ No newline at end of file +_Note : I am open to pointer to make a plugin less dependant on html markup_ diff --git a/Resources/public/js/jbfileupload.js b/Resources/public/js/jbfileupload.js index 5d0e07c..02f95fe 100644 --- a/Resources/public/js/jbfileupload.js +++ b/Resources/public/js/jbfileupload.js @@ -6,7 +6,7 @@ return this.each(function() { // Find parent div to allow select of all important children element - var $parentTag = $(this).closest('.file-upload'), + var $parentTag = $(this).closest('.jb_fileupload_row'), $resultError = $parentTag.find('.jb_result_error'), $cropTool = $parentTag.find('.jb_crop_tool'), $cropUpload = $parentTag.find('.jb_crop_upload'), diff --git a/Resources/views/Form/fields.html.twig b/Resources/views/Form/fields.html.twig index 5e01a30..04d6c72 100644 --- a/Resources/views/Form/fields.html.twig +++ b/Resources/views/Form/fields.html.twig @@ -1,10 +1,9 @@ {# -The id on the row and the attribute data-row-id are important. They are used in the js code. -Same thing for all classes starting with jb_ +All classes starting with jb_ are part of the markup. They are used in the js code. #} {% block jb_file_ajax_row %} -
+
{{- form_label(form) -}} {{- form_errors(form) -}} @@ -20,7 +19,6 @@ Same thing for all classes starting with jb_ type="file" name="{{ id }}_file" data-url="{{ oneup_uploader_endpoint(endpoint) }}" - data-row-id="{{ id }}_row" data-use-crop="{{ use_crop ? "true" : "false" }}" /> {% if remove_link %}