Hello,
This is the code for remove picture. Make sure its available in \Presentation\Nop.Web\Administration\Views\Shared\Picture.cshtml file.
<script type="text/javascript">
$(document).ready(function() {
$("#@(clientId + "remove")").click(function(e) {
$("#@(clientId + "image")").html("<img src='@pictureService.GetDefaultPictureUrl(pictureSize)'/>");
$("#@(clientId + "value") input").val(0);
$(this).hide();
});
</script>
Also i need to uplod all type of files(pdf,word etc).
For that you need to customize in then AsyncUpload() of PictureController
Also i need explanation how [UIHint("Picture")] is actually works,
UIHint is nothing but Attribute And its reference from System.ComponentModel.DataAnnotations
How it redirects to AsyncUpload() action of PictureController
For this you can find below code in Picture.cshtml
Let me know if you have any question or query.
Thanks,
Jatin
This is the code for remove picture. Make sure its available in \Presentation\Nop.Web\Administration\Views\Shared\Picture.cshtml file.
<div class="remove-image-button pull-left margin-t-5">
@if (picture != null)
{
<span id="@(clientId + "remove")" class="btn bg-red">@T("Admin.Picture.RemovePicture")</span>
}
else
{
<span id="@(clientId + "remove")" class="btn bg-red" style="display: none;">@T("Admin.Picture.RemovePicture")</span>
}
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#@(clientId + "remove")").click(function(e) {
$("#@(clientId + "image")").html("<img src='@pictureService.GetDefaultPictureUrl(pictureSize)'/>");
$("#@(clientId + "value") input").val(0);
$(this).hide();
});
</script>
Also i need to uplod all type of files(pdf,word etc).
For that you need to customize in then AsyncUpload() of PictureController
Also i need explanation how [UIHint("Picture")] is actually works,
UIHint is nothing but Attribute And its reference from System.ComponentModel.DataAnnotations
How it redirects to AsyncUpload() action of PictureController
For this you can find below code in Picture.cshtml
$("#@(clientId)").fineUploader({
request: {
endpoint: '@(Url.Content("~/Admin/Picture/AsyncUpload"))'
},
template: "@(clientId)-qq-template",
multiple: false
}).on("complete", function(event, id, name, responseJSON, xhr) {
if (responseJSON.success) {
$("#@(clientId + "image")").html("<img src='" + responseJSON.imageUrl + "'/>");
$("#@(clientId + "value") input").val(responseJSON.pictureId);
$("#@(clientId + "remove")").show();
}
});
Let me know if you have any question or query.
Thanks,
Jatin
how does nopcomerce uses "~/Admin/Picture/AsyncUpload" in
endpoint: '@(Url.Content("~/Admin/Picture/AsyncUpload"))'
it is even not matches any namespace nor the folder structure
----------------------------------------
i have created new controller in the following path
presentation\nop.web\controllers\picturecontroller.cs