wco_models 3.1.0.44 → 3.1.0.45
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/wco/application_controller.rb +1 -0
- data/app/controllers/wco/videos_controller.rb +106 -0
- data/app/models/wco/gallery.rb +1 -1
- data/app/models/wco/photo.rb +1 -1
- data/app/models/wco/video.rb +72 -0
- data/app/views/wco/_main_header.haml +1 -0
- data/app/views/wco/application/_metaline.haml +13 -0
- data/app/views/wco/videos/_form.haml +39 -0
- data/app/views/wco/videos/_header.haml +6 -0
- data/app/views/wco/videos/_index.haml +37 -0
- data/app/views/wco/videos/edit.haml +7 -0
- data/app/views/wco/videos/index.haml +3 -0
- data/app/views/wco/videos/new.haml +6 -0
- data/app/views/wco/videos/show.haml +25 -0
- data/app/views/wco/videos/trash/_embed.haml +5 -0
- data/app/views/wco/videos/trash/_embed_half.erb +4 -0
- data/app/views/wco/videos/trash/_embed_mini.erb +4 -0
- data/app/views/wco/videos/trash/_embed_s3.erb +6 -0
- data/app/views/wco/videos/trash/_embed_youtube.erb +4 -0
- data/app/views/wco/videos/trash/_index_title.haml +27 -0
- data/app/views/wco/videos/trash/_list.haml +14 -0
- data/app/views/wco/videos/trash/_list_small.haml +9 -0
- data/app/views/wco/videos/trash/_meta_edit.haml +4 -0
- data/app/views/wco/videos/trash/_preview.haml +2 -0
- data/config/routes.rb +2 -0
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6eca81149b751af67bdaeaf83369e10a053f8df727a62cae6491a9bd6d7033b0
|
4
|
+
data.tar.gz: 073553f8ad6ca654445d4bc1685ed5c4ebd6d9deabe38494b486c28573e35cef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fe3104f7484a1ea45f73dd3ae6d8bf01a6ea135747698163768832c5b916d3e17ce930538e9eb9e4b9139911a5d18d3d17790d9291faae73434d9dd88060306
|
7
|
+
data.tar.gz: 8993d0f1294ee42d0c1a90a065f287fed3ee373fdb1417bc41256231da63301e6f2369e5b2e1fc8a895c2fb6690113b7136e3e5e3730c377470d5c62986afa30
|
@@ -0,0 +1,106 @@
|
|
1
|
+
|
2
|
+
class Wco::VideosController < Wco::ApplicationController
|
3
|
+
|
4
|
+
# before_action :set_lists
|
5
|
+
|
6
|
+
# Alphabetized : )
|
7
|
+
|
8
|
+
def create
|
9
|
+
@video = Wco::Video.new params[:video].permit!
|
10
|
+
authorize! :create, @video
|
11
|
+
|
12
|
+
if @video.save
|
13
|
+
flash[:notice] = 'Success'
|
14
|
+
redirect_to videos_path
|
15
|
+
else
|
16
|
+
flash[:alert] = 'No luck'
|
17
|
+
render :action => 'new'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def destroy
|
22
|
+
@video = Wco::Video.find params[:id]
|
23
|
+
authorize! :destroy, @video
|
24
|
+
flag = @video.delete
|
25
|
+
if flag
|
26
|
+
flash[:notice] = "deleted video"
|
27
|
+
else
|
28
|
+
flash[:alert] = "Cannot delete video: #{@video.errors.messages}"
|
29
|
+
end
|
30
|
+
redirect_to :action => 'index'
|
31
|
+
end
|
32
|
+
|
33
|
+
def edit
|
34
|
+
@video = Wco::Video.unscoped.find params[:id]
|
35
|
+
authorize! :edit, @video
|
36
|
+
end
|
37
|
+
|
38
|
+
def index
|
39
|
+
authorize! :index, Wco::Video.new
|
40
|
+
@videos = Wco::Video.order_by( :created_at => :desc )
|
41
|
+
|
42
|
+
if params[:q]
|
43
|
+
@videos = @videos.where({ :name => /#{params[:q]}/i })
|
44
|
+
end
|
45
|
+
|
46
|
+
@videos = @videos.page( params[:videos_page] ).per( 9 )
|
47
|
+
|
48
|
+
respond_to do |format|
|
49
|
+
format.html do
|
50
|
+
render
|
51
|
+
end
|
52
|
+
format.json do
|
53
|
+
render :json => @videos
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def show
|
59
|
+
if params[:youtube_id].present?
|
60
|
+
@video = Wco::Video.unscoped.where( :youtube_id => params[:youtube_id] ).first
|
61
|
+
end
|
62
|
+
@video ||= Wco::Video.unscoped.find params[:id]
|
63
|
+
authorize! :show, @video
|
64
|
+
|
65
|
+
respond_to do |format|
|
66
|
+
format.html
|
67
|
+
format.json do
|
68
|
+
render :json => @video
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def new
|
74
|
+
@video = Wco::Video.new
|
75
|
+
authorize! :new, @video
|
76
|
+
end
|
77
|
+
|
78
|
+
def update
|
79
|
+
@video = Wco::Video.unscoped.find params[:id]
|
80
|
+
authorize! :update, @video
|
81
|
+
|
82
|
+
# old_shared_profile_ids = @video.shared_profile_ids
|
83
|
+
# if params[:video][:shared_profiles].present?
|
84
|
+
# params[:video][:shared_profiles].delete('')
|
85
|
+
# end
|
86
|
+
# params[:video][:shared_profile_ids] = params[:video][:shared_profiles]
|
87
|
+
# params[:video].delete :shared_profiles
|
88
|
+
|
89
|
+
@video.update params[:video].permit!
|
90
|
+
if @video.save
|
91
|
+
|
92
|
+
# if params[:video][:shared_profile_ids].present?
|
93
|
+
# new_shared_profiles = Ish::UserProfile.find( params[:video][:shared_profile_ids]
|
94
|
+
# ).select { |p| !old_shared_profile_ids.include?( p.id ) }
|
95
|
+
# ::IshManager::ApplicationMailer.shared_video( new_shared_profiles, @video ).deliver
|
96
|
+
# end
|
97
|
+
|
98
|
+
flash[:notice] = 'Success.'
|
99
|
+
redirect_to video_path(@video)
|
100
|
+
else
|
101
|
+
flash[:alert] = "No luck: #{@video.errors.full_messages.joing(', ')}"
|
102
|
+
render :edit
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
data/app/models/wco/gallery.rb
CHANGED
data/app/models/wco/photo.rb
CHANGED
@@ -8,7 +8,7 @@ class Wco::Photo
|
|
8
8
|
include Mongoid::Paperclip
|
9
9
|
include Mongoid::Paranoia
|
10
10
|
include Wco::Utils
|
11
|
-
store_in collection: '
|
11
|
+
store_in collection: 'photos'
|
12
12
|
|
13
13
|
belongs_to :email_message, class_name: 'WcoEmail::Message', optional: true
|
14
14
|
belongs_to :gallery, class_name: 'Wco::Gallery', optional: true
|
@@ -0,0 +1,72 @@
|
|
1
|
+
|
2
|
+
class Wco::Video
|
3
|
+
include Mongoid::Document
|
4
|
+
include Mongoid::Timestamps
|
5
|
+
include Mongoid::Paperclip
|
6
|
+
include Mongoid::Paranoia
|
7
|
+
include Wco::Utils
|
8
|
+
store_in collection: 'videos'
|
9
|
+
|
10
|
+
field :name, :type => String
|
11
|
+
field :descr, :type => String, :as => :description
|
12
|
+
field :subhead ## still need it... 2023-03-24
|
13
|
+
|
14
|
+
field :is_public, :type => Boolean, :default => false
|
15
|
+
|
16
|
+
def published
|
17
|
+
where({ :is_public => true }).order_by({ :created_at => :desc })
|
18
|
+
end
|
19
|
+
|
20
|
+
field :x, type: Float
|
21
|
+
field :y, type: Float
|
22
|
+
field :z, type: Float
|
23
|
+
|
24
|
+
field :youtube_id
|
25
|
+
validates_uniqueness_of :youtube_id, allow_blank: true, case_sensitive: false
|
26
|
+
before_save { youtube_id.present? || youtube_id = nil }
|
27
|
+
|
28
|
+
# belongs_to :user_profile, :class_name => 'Ish::UserProfile', :inverse_of => :videos
|
29
|
+
# has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_videos
|
30
|
+
|
31
|
+
|
32
|
+
def self.list
|
33
|
+
[['', nil]] + self.unscoped.order_by( :created_at => :desc ).map do |item|
|
34
|
+
[ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
has_mongoid_attached_file :video,
|
39
|
+
# styles: { :thumb => { geometry: '192x108', format: 'jpeg' }, },
|
40
|
+
# processors: [ :transcoder ],
|
41
|
+
:storage => :s3,
|
42
|
+
:s3_credentials => ::S3_CREDENTIALS,
|
43
|
+
:path => "videos/:style/:id/:filename",
|
44
|
+
:s3_protocol => 'https',
|
45
|
+
:s3_permissions => 'public-read',
|
46
|
+
:validate_media_type => false,
|
47
|
+
s3_region: ::S3_CREDENTIALS[:region]
|
48
|
+
validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
|
49
|
+
|
50
|
+
has_mongoid_attached_file :thumb,
|
51
|
+
:styles => {
|
52
|
+
:mini => '20x20#',
|
53
|
+
:thumb => "100x100#",
|
54
|
+
:thumb2 => "200x200#",
|
55
|
+
:s169 => "640x360#",
|
56
|
+
# :s43 => "640x480#",
|
57
|
+
:small => "400x400>",
|
58
|
+
:large => '950x650>',
|
59
|
+
},
|
60
|
+
:storage => :s3,
|
61
|
+
:s3_credentials => ::S3_CREDENTIALS,
|
62
|
+
:path => "videos/:style/:id/thumb_:filename",
|
63
|
+
:s3_protocol => 'https',
|
64
|
+
:validate_media_type => false,
|
65
|
+
s3_region: ::S3_CREDENTIALS[:region]
|
66
|
+
validates_attachment_content_type :thumb, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
|
67
|
+
|
68
|
+
def export_fields
|
69
|
+
%w| name descr |
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
.meta
|
3
|
+
|
4
|
+
<b>On</b> #{item.created_at.to_s[0...10]}
|
5
|
+
-# - if item.user_profile
|
6
|
+
-# <b>By</b>
|
7
|
+
-# = link_to item.user_profile.name, edit_user_profile_path( item.user_profile )
|
8
|
+
|
9
|
+
-# - if item.tags.length > 0
|
10
|
+
-# <b>Tags:</b> #{ item.tags.map(&:name).join(', ') }
|
11
|
+
|
12
|
+
-# - if defined?(item.premium_tier) && item.premium_tier > 0
|
13
|
+
-# <b>Tier $#{item.premium_tier}</b>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
= form_for video do |f|
|
3
|
+
.row
|
4
|
+
.col-sm-6
|
5
|
+
.field
|
6
|
+
= f.label :youtube_id
|
7
|
+
= f.text_field :youtube_id
|
8
|
+
.field
|
9
|
+
= f.label :name
|
10
|
+
= f.text_field :name
|
11
|
+
-# .input-group
|
12
|
+
-# = f.label :premium_tier
|
13
|
+
-# = f.number_field :premium_tier
|
14
|
+
-# .input-group
|
15
|
+
-# = f.check_box :is_trash
|
16
|
+
-# = f.label :is_trash
|
17
|
+
-# .field
|
18
|
+
-# %label Lead
|
19
|
+
-# = f.select :lead_id, options_for_select(@leads_list, selected: video.lead_id), {}, class: :select2
|
20
|
+
.col-sm-6
|
21
|
+
.field
|
22
|
+
= f.label :video
|
23
|
+
= f.file_field :video
|
24
|
+
.field
|
25
|
+
= f.label :thumb
|
26
|
+
= f.file_field :thumb
|
27
|
+
|
28
|
+
|
29
|
+
-# = render 'wco/application/form_nonpublic', f: f, model: video
|
30
|
+
|
31
|
+
.row
|
32
|
+
.col-md-6
|
33
|
+
.field
|
34
|
+
= f.label :descr
|
35
|
+
= f.text_area :descr, class: :tinymce
|
36
|
+
|
37
|
+
|
38
|
+
.action
|
39
|
+
= f.submit
|
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
- videos ||= @videos
|
3
|
+
- this_videos_path ||= videos_path
|
4
|
+
|
5
|
+
.videos--index
|
6
|
+
.videos--menu
|
7
|
+
= link_to "Videos (#{videos.count})", this_videos_path
|
8
|
+
|
9
|
+
-# = render 'search', path: this_videos_path
|
10
|
+
.inline-search
|
11
|
+
= form_tag this_videos_path, method: :get do
|
12
|
+
= text_field_tag :q
|
13
|
+
|
14
|
+
= link_to '[+]', new_video_path
|
15
|
+
%hr
|
16
|
+
|
17
|
+
= paginate videos, param_name: :videos_page, views_prefix: 'wco'
|
18
|
+
|
19
|
+
.row
|
20
|
+
- videos.each do |video|
|
21
|
+
.col-md-4.item
|
22
|
+
.float-left
|
23
|
+
- if video.youtube_id.present?
|
24
|
+
%iframe{:allowfullscreen => "true", :frameborder => "0", :height => "150", :src => "//www.youtube.com/embed/#{video.youtube_id}", :width => "200"}
|
25
|
+
- else
|
26
|
+
.thumb= image_tag video.thumb.url(:thumb)
|
27
|
+
.title
|
28
|
+
= link_to video.name, video_path( video )
|
29
|
+
.meta-edit
|
30
|
+
.inline= button_to '[x]', video_path( video ), :method => :delete, :data => { :confirm => 'Are you sure?' }
|
31
|
+
= link_to '[~]', edit_video_path( video )
|
32
|
+
|
33
|
+
= render 'meta', item: video
|
34
|
+
|
35
|
+
= paginate videos, param_name: :videos_page, views_prefix: 'wco'
|
36
|
+
|
37
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
- video ||= @video
|
3
|
+
|
4
|
+
.videos-show.max-width
|
5
|
+
.row
|
6
|
+
= link_to '[Back]', videos_path
|
7
|
+
|
8
|
+
- if video.youtube_id.present?
|
9
|
+
%iframe{:allowfullscreen => "", :frameborder => "0", :height => "315", :src => "//www.youtube.com/embed/#{video.youtube_id}", :width => "560"}
|
10
|
+
- else
|
11
|
+
%iframe{:allowfullscreen => "true", :frameborder => "0", :height => "480", :src => "#{video.video.url}", :width => "640"}
|
12
|
+
|
13
|
+
.my-row
|
14
|
+
.a= image_tag video.thumb.url(:thumb)
|
15
|
+
.a
|
16
|
+
%h3
|
17
|
+
= video.name.blank? ? t('videos.no_title') : video.name
|
18
|
+
.meta-edit
|
19
|
+
.inline= button_to '[x]', video_path( video ), :method => :delete, :data => { :confirm => 'Are you sure?' }
|
20
|
+
= link_to '[~]', edit_video_path( video )
|
21
|
+
|
22
|
+
= render 'wco/application/metaline', :item => video
|
23
|
+
.flex-row
|
24
|
+
Download File: #{link_to video.video_file_name, video.video.url}
|
25
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
|
2
|
+
<div class="" style="" >
|
3
|
+
<!-- <iframe width="430" height="322" src="<%= video.video.url %>" frameborder="0" allowfullscreen></iframe> -->
|
4
|
+
<iframe width="640" height="480" src="<%= video.video.url %>" frameborder="0" allowfullscreen></iframe>
|
5
|
+
<!-- <iframe src="<%= video.video.url %>" frameborder="0" allowfullscreen></iframe> -->
|
6
|
+
</div>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
-# videos ||= @videos
|
3
|
+
-# videos = videos.page params[:videos_page]
|
4
|
+
|
5
|
+
.row
|
6
|
+
.col.s12
|
7
|
+
%h5
|
8
|
+
Videos (#{videos.count})
|
9
|
+
= link_to image_new, new_video_path
|
10
|
+
|
11
|
+
= paginate videos, :param_name => :videos_page, :views_prefix => 'ish_manager'
|
12
|
+
|
13
|
+
- videos.each do |video|
|
14
|
+
.panel
|
15
|
+
.panel-content
|
16
|
+
.row
|
17
|
+
.col.s12
|
18
|
+
.float-left= youtube_image_tag( video )
|
19
|
+
.a
|
20
|
+
= link_to video.name, video_path( video )
|
21
|
+
= link_to image_edit, edit_video_path( video )
|
22
|
+
.inline= button_to '[x]', video_path( video ), :method => :delete, :data => { :confirm => 'Are you sure?' }
|
23
|
+
= render 'meta', :item => video
|
24
|
+
|
25
|
+
= paginate videos, :param_name => :videos_page, :views_prefix => 'ish_manager'
|
26
|
+
|
27
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
.videos-list
|
3
|
+
- if videos.blank?
|
4
|
+
= t('videos.no_videos')
|
5
|
+
- else
|
6
|
+
= paginate videos, :param_name => :videos_page, :views_prefix => 'templates'
|
7
|
+
- videos.each do |video|
|
8
|
+
.callout
|
9
|
+
%h5= link_to (video.name.blank? ? t('videos.no_title') : video.name), video_path( video.youtube_id )
|
10
|
+
.text-center= render 'videos/embed', :video => video
|
11
|
+
= video.descr
|
12
|
+
= paginate videos, :param_name => :videos_page, :views_prefix => 'templates'
|
13
|
+
.c
|
14
|
+
.c
|
@@ -0,0 +1,9 @@
|
|
1
|
+
|
2
|
+
.list-small
|
3
|
+
%ul
|
4
|
+
- videos.each do |v|
|
5
|
+
%li
|
6
|
+
= image_tag( "http://img.youtube.com/vi/#{v.youtube_id}/1.jpg" )
|
7
|
+
= link_to '[~]', edit_video_path( v )
|
8
|
+
= link_to '[_]', video_path( v )
|
9
|
+
= paginate videos, :param_name => :videos_page, :views_prefix => 'templates'
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wco_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.0.
|
4
|
+
version: 3.1.0.45
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Pudeyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|
@@ -381,6 +381,7 @@ files:
|
|
381
381
|
- app/controllers/wco/sites_controller.rb
|
382
382
|
- app/controllers/wco/subscriptions_controller.rb
|
383
383
|
- app/controllers/wco/tags_controller.rb
|
384
|
+
- app/controllers/wco/videos_controller.rb
|
384
385
|
- app/helpers/wco/application_helper.rb
|
385
386
|
- app/jobs/wco_hosting/certbot_job.rb
|
386
387
|
- app/mailers/ish_models/application_mailer.rb
|
@@ -407,6 +408,7 @@ files:
|
|
407
408
|
- app/models/wco/subscription.rb
|
408
409
|
- app/models/wco/tag.rb
|
409
410
|
- app/models/wco/utils.rb
|
411
|
+
- app/models/wco/video.rb
|
410
412
|
- app/models/wco_email/campaign.rb
|
411
413
|
- app/models/wco_email/context.rb
|
412
414
|
- app/models/wco_email/conversation.rb
|
@@ -433,6 +435,7 @@ files:
|
|
433
435
|
- app/views/wco/application/_auth_widget.haml
|
434
436
|
- app/views/wco/application/_debug.haml
|
435
437
|
- app/views/wco/application/_meta.haml
|
438
|
+
- app/views/wco/application/_metaline.haml
|
436
439
|
- app/views/wco/application/home.haml
|
437
440
|
- app/views/wco/galleries/_form.haml
|
438
441
|
- app/views/wco/galleries/_header.haml
|
@@ -541,6 +544,23 @@ files:
|
|
541
544
|
- app/views/wco/tags/index.haml
|
542
545
|
- app/views/wco/tags/new.haml
|
543
546
|
- app/views/wco/tags/show.haml
|
547
|
+
- app/views/wco/videos/_form.haml
|
548
|
+
- app/views/wco/videos/_header.haml
|
549
|
+
- app/views/wco/videos/_index.haml
|
550
|
+
- app/views/wco/videos/edit.haml
|
551
|
+
- app/views/wco/videos/index.haml
|
552
|
+
- app/views/wco/videos/new.haml
|
553
|
+
- app/views/wco/videos/show.haml
|
554
|
+
- app/views/wco/videos/trash/_embed.haml
|
555
|
+
- app/views/wco/videos/trash/_embed_half.erb
|
556
|
+
- app/views/wco/videos/trash/_embed_mini.erb
|
557
|
+
- app/views/wco/videos/trash/_embed_s3.erb
|
558
|
+
- app/views/wco/videos/trash/_embed_youtube.erb
|
559
|
+
- app/views/wco/videos/trash/_index_title.haml
|
560
|
+
- app/views/wco/videos/trash/_list.haml
|
561
|
+
- app/views/wco/videos/trash/_list_small.haml
|
562
|
+
- app/views/wco/videos/trash/_meta_edit.haml
|
563
|
+
- app/views/wco/videos/trash/_preview.haml
|
544
564
|
- app/views/wco_hosting/docker-compose/dc-any.erb
|
545
565
|
- app/views/wco_hosting/docker-compose/dc-helloworld.erb
|
546
566
|
- app/views/wco_hosting/docker-compose/dc-wordpress.erb
|