lib/lentil/admin/images.rb in lentil-0.3.1 vs lib/lentil/admin/images.rb in lentil-0.4.0

- old
+ new

@@ -4,10 +4,11 @@ config.batch_actions = false config.per_page = 10 filter :state, :as => :select, :collection => proc { Lentil::Image::States } + filter :media_type, :as => :select filter :user_user_name, :as => :string, :label => "Username" filter :user_full_name, :as => :string, :label => "Full Name" filter :staff_like, :as => :select filter :do_not_request_donation, :as => :select filter :win_pct @@ -29,11 +30,15 @@ action_item { link_to "Flagging History", flagging_history_admin_lentil_images_path } action_item { link_to "Add Instagram Image", manual_input_admin_lentil_images_path } index do column "Image" do |image| - link_to(image_tag(image.image_url, :class => "moderation_thumbnail"), admin_lentil_image_path(image)) + unless image.media_type == "video" + link_to(image_tag(image.image_url, :class => "moderation_thumbnail"), admin_lentil_image_path(image)) + else + link_to(video_tag(image.video_url, controls: true, size: "250x250"), admin_lentil_image_path(image)) + end end column :id column :description column "User", :user do |i| names = [] @@ -89,11 +94,15 @@ row :file_harvested_date row :state do image.state_name end row :image do - link_to(image_tag(image.image_url), admin_lentil_image_path(image)) + unless image.media_type == "video" + link_to(image_tag(image.image_url), admin_lentil_image_path(image)) + else + video_tag(image.video_url, controls: true, size: "640x640") + end end end active_admin_comments end @@ -209,6 +218,6 @@ end redirect_to :back, notice: "#{image_counter} #{'URL'.pluralize(image_counter)} added (out of #{total_urls})", alert: errors.join('<br>').html_safe end end -end \ No newline at end of file +end