Edit shop_code
This commit is contained in:
@@ -86,6 +86,28 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
// Image Upload
|
||||
$("#set_menu_item_image_path").fileinput({
|
||||
previewFileType: "image",
|
||||
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||
browseClass: "btn btn-success",
|
||||
browseLabel: "Pick Image",
|
||||
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
||||
removeClass: "btn btn-danger",
|
||||
removeLabel: "Delete",
|
||||
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
||||
showUpload: false,
|
||||
// uploadClass: "btn btn-info",
|
||||
// uploadLabel: "Upload",
|
||||
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||
previewTemplates: {
|
||||
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
||||
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||
'</div>\n',
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#product_image_path").fileinput({
|
||||
previewFileType: "image",
|
||||
allowedFileExtensions: ["jpg", "gif", "png"],
|
||||
|
||||
@@ -15,7 +15,7 @@ class MenuItemImageUploader < CarrierWave::Uploader::Base
|
||||
# Override the directory where uploaded files will be stored.
|
||||
# This is a sensible default for uploaders that are meant to be mounted:
|
||||
def store_dir
|
||||
"image/menu_images"
|
||||
"image/menu_images/#{Shop.find(1).shop_code}"
|
||||
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||
end
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ json.id item.id
|
||||
json.code item.item_code
|
||||
json.name item.name
|
||||
json.alt_name item.alt_name
|
||||
if !request_url.nil? && request_url != '' && !item.image_path.url.nil?
|
||||
json.image request_url + item.image_path.url.to_s
|
||||
if !request_url.nil? && request_url != '' && !item.image_path.nil?
|
||||
json.image request_url + item.image_path.to_s
|
||||
else
|
||||
json.image item.image_path.url
|
||||
end
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 368 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 243 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 113 KiB |
Reference in New Issue
Block a user