enter image description here

I want to add the last link video to Spree Admin panel under Product. How I could go ahead and make this feature.

I would appreciate any help.

Thank you

1

There are 1 answers

2
Optimus Pette On

You can create a spree extension or use one of your already existing extensions. In the extension's models/spree directory create a model file video.rb.

module Spree
  class Video < ActiveRecord::Base
  #Add your active record associations
  #validations and model methods

  end
end

You then have to decorate Spree Core models affected by your new video model. For example your Spree Product model. In your extension's models/spree directory create a product model decorator product_decorator.rb.

module Spree
  Product.class_eval do
  #your video association with the product. e.g
  has_one :video
  end
end

You can do this for any other spree core models associated with your video model.

In your extension's controllers/spree/adminyou have to create videos_controller.rb. I suggest you take a look at spree backend images_controller for directions on how you can add this controller. If you plan to upload the videos to your application, you might need an audio/video transcoder such as paperclip-av-transcoder.

You will also have to deface spree/backend/app/views/spree/admin/products/new.html.erb and spree/backend/app/views/spree/admin/products/edit.html.erb to add the video addition and removal functionalities. I do not know the structure and complexity of your application and therefore this is not a definite answer but a direction on how you can achieve what you want.

`