wco_models 3.1.0.220 → 3.1.0.224

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 461981337b6a6f94df0581778032d46227f9e65ae4a2dcc129f67800fd44283b
4
- data.tar.gz: a155d238218a1da0f1c0929334b4f83aa3fb55bbcc9316c207ce0e7d8153d478
3
+ metadata.gz: 910066e8184ca8433dd00339a22bb1448129a8746bb8153b8aa2335e8a8b41a7
4
+ data.tar.gz: 90ffa8bc24791a77c0e24b3b4ed38bcc0fe9ba729cc5ac19b0001f236cae7799
5
5
  SHA512:
6
- metadata.gz: 3050697e8cf1bb209f3bd6361bda7f645522073e038acd0e238a9af8d6d83e20c9ce888ea8256558795e788fc39513b36606af2ee45b35e8a6367105d7064a49
7
- data.tar.gz: 3797f701465b4cecf109d1e43aa7c40232cf95353e0135aeafe61ad5ca589e86a848d5a399d66a5c282b99ecbe2add1df826d396a4ab8013dde6b195c4d4371d
6
+ metadata.gz: 963791fb3291709f2ddd071f9b7a0bee781ccd045f655d0b445953dff503bde05c10a667c70d9c1e9f173929cff613d9112f04843c9ef3ebd7e430f3f8d223af
7
+ data.tar.gz: 032d41773a8a44c06e436a33e651a5e62e6e81c46279ade0e15fb070963750487eb912ac966c9d60f1e1c0c374850c28556f13d961550369a11f7af8d05c31cc
@@ -0,0 +1,31 @@
1
+
2
+ .Timeline {
3
+ border: 1px solid blue;
4
+ position: relative;
5
+
6
+ .full-text {
7
+ position: absolute;
8
+ left: 300px;
9
+ }
10
+
11
+ .main {
12
+ width: 200px;
13
+ }
14
+
15
+
16
+ .ts { /* timestamp */
17
+ position: absolute;
18
+ .word {
19
+ border: 1px solid cyan;
20
+ left: 100px;
21
+ position: absolute;
22
+ }
23
+ .wtime {
24
+ border: 1px solid yellow;
25
+ left: 20px;
26
+ position: absolute;
27
+ }
28
+ }
29
+
30
+ }
31
+
@@ -0,0 +1,52 @@
1
+
2
+ class Wco::Api::NewspartialsController < Wco::ApiController
3
+
4
+ skip_before_action :decode_jwt
5
+ skip_before_action :verify_authenticity_token
6
+ before_action :decode_simple_api_key
7
+
8
+
9
+ def add_config
10
+ puts! params, 'api newspartials#add_config params'
11
+
12
+ @newspartial = Wco::Newspartial.find params[:id]
13
+ authorize! :create, @newspartial
14
+
15
+ raw_payload = request.raw_post
16
+ # parsed_payload = JSON.parse(raw_payload)
17
+ @newspartial.config_json = raw_payload
18
+
19
+ if @newspartial.save
20
+ puts! @newspartial, 'added config to a newspartial.'
21
+ flash[:notice] = 'Success'
22
+ render json: { status: :ok, message: 'added config to a newspartial.' }
23
+ else
24
+ flash[:alert] = 'No luck'
25
+ render json: { status: :not_ok, message: "Could not add config to newspartial: #{@newspartial.errors.full_messages.join(', ')}." }
26
+ end
27
+ end
28
+
29
+
30
+ def create
31
+ puts! params, 'api newspartials#create params'
32
+
33
+ @newspartial = Wco::Newspartial.new params[:newspartial].permit!
34
+ @newspartial.author = Wco::Profile.find_by email: current_user.email
35
+ authorize! :create, @newspartial
36
+
37
+ if @newspartial.save
38
+ puts! @newspartial, 'Created a newspartial.'
39
+ flash[:notice] = 'Success'
40
+ render json: { status: :ok, message: @newspartial.attributes }
41
+ else
42
+ flash[:alert] = 'No luck'
43
+ render json: { status: :not_ok, message: "Could not create a newspartial: #{@newspartial.errors.full_messages.join(', ')}." }
44
+ end
45
+ end
46
+
47
+ def show_config
48
+ @newspartial = Wco::Newspartial.find params[:id]
49
+ render json: @newspartial.speech_json
50
+ end
51
+
52
+ end
@@ -6,9 +6,13 @@ class Wco::Api::VideosController < Wco::ApiController
6
6
  before_action :decode_simple_api_key
7
7
 
8
8
  def create
9
- puts! params, 'ze params'
9
+ # puts! params, 'api videos#create params'
10
10
 
11
- @video = Wco::Video.new name: params[:name], video: params[:video]
11
+ @video = Wco::Video.new({ name: params[:name],
12
+ thumb: params[:thumb],
13
+ video: params[:video],
14
+ newspartial_id: params[:newspartial_id],
15
+ })
12
16
  authorize! :create, @video
13
17
 
14
18
  if @video.save
@@ -21,6 +21,8 @@ class Wco::ApiController < ActionController::Base
21
21
  params[:api_secret] === SIMPLE_API_SECRET
22
22
  user = User.find_by({ email: 'piousbox@gmail.com' })
23
23
  sign_in user
24
+ else
25
+ throw :unauthorized
24
26
  end
25
27
  end
26
28
 
@@ -0,0 +1,95 @@
1
+
2
+ class Wco::NewspartialsController < Wco::ApplicationController
3
+
4
+ before_action :set_lists
5
+
6
+ def create
7
+ params[:newspartial][:tag_ids]&.delete ''
8
+
9
+ @newspartial = Wco::Newspartial.new params[:newspartial].permit!
10
+ authorize! :create, @newspartial
11
+
12
+ if @newspartial.save
13
+ flash_notice "created newspartial"
14
+ else
15
+ flash_alert "Cannot create newspartial: #{@newspartial.errors.messages}"
16
+ end
17
+ redirect_to controller: 'newsvideos', id: @newspartial.newsvideo_id, action: 'show'
18
+ end
19
+
20
+ def destroy
21
+ @newspartial = Wco::Newspartial.find params[:id]
22
+ authorize! :destroy, @newspartial
23
+ if @newspartial.destroy
24
+ flash_notice 'ok'
25
+ else
26
+ flash_alert 'No luck.'
27
+ end
28
+ redirect_to action: 'index'
29
+ end
30
+
31
+ def edit
32
+ @newspartial = Wco::Newspartial.unscoped.find params[:id]
33
+ authorize! :edit, @newspartial
34
+ end
35
+
36
+ def generate_speech
37
+ @newspartial = Wco::Newspartial.unscoped.find params[:id]
38
+ authorize! :show, @newspartial
39
+ @newspartial.generate_speech
40
+ redirect_to controller: 'newsvideos', id: @newspartial.newsvideo_id, action: 'show'
41
+ end
42
+
43
+ def generate_video
44
+ @newspartial = Wco::Newspartial.unscoped.find params[:id]
45
+ authorize! :show, @newspartial
46
+ @newspartial.generate_video
47
+ redirect_to controller: 'newsvideos', id: @newspartial.newsvideo_id, action: 'show'
48
+ end
49
+
50
+ def index
51
+ authorize! :index, Wco::Newspartial
52
+ @newspartials = Wco::Newspartial.all
53
+ if params[:deleted]
54
+ @newspartials = Wco::Newspartial.unscoped.where( :deleted_at.ne => nil )
55
+ end
56
+ @newspartials = @newspartials.page( params[:newspartials_page] ).per( current_profile.per_page )
57
+ end
58
+
59
+ def new
60
+ authorize! :new, Wco::Newspartial
61
+ @newspartial = Wco::Newspartial.new
62
+ end
63
+
64
+ def show
65
+ @newspartial = Wco::Newspartial.unscoped.find params[:id]
66
+ authorize! :show, @newspartial
67
+
68
+ # @config = JSON.parse( @newspartial.config_json )
69
+ # @duration_ms = @config['vtimes'].last.to_i + @config['vdurations'].last.to_i
70
+ end
71
+
72
+ def update
73
+ params[:newspartial][:tag_ids]&.delete ''
74
+
75
+ @newspartial = Wco::Newspartial.unscoped.find params[:id]
76
+ authorize! :update, @newspartial
77
+ if @newspartial.update params[:newspartial].permit!
78
+ flash_notice "updated newspartial"
79
+ else
80
+ flash_alert "Cannot update newspartial: #{@newspartial.errors.messages}"
81
+ end
82
+ redirect_to action: 'index'
83
+ end
84
+
85
+ ##
86
+ ## private
87
+ ##
88
+ private
89
+
90
+ def set_lists
91
+ @tags_list = Wco::Tag.list
92
+ @newsvideos_list = Wco::Newsvideo.list
93
+ end
94
+
95
+ end
@@ -0,0 +1,102 @@
1
+ require 'net/ssh'
2
+
3
+ class Wco::NewsvideosController < Wco::ApplicationController
4
+
5
+ before_action :set_lists
6
+
7
+ def create
8
+ params[:newsvideo][:tag_ids]&.delete ''
9
+
10
+ @newsvideo = Wco::Newsvideo.new params[:newsvideo].permit!
11
+ authorize! :create, @newsvideo
12
+ @newsvideo.author = current_profile
13
+ if @newsvideo.save
14
+ flash_notice "created newsvideo"
15
+ else
16
+ flash_alert "Cannot create newsvideo: #{@newsvideo.errors.messages}"
17
+ end
18
+ redirect_to action: 'index'
19
+ end
20
+
21
+ def destroy
22
+ end
23
+
24
+ def edit
25
+ @newsvideo = Wco::Newsvideo.unscoped.find params[:id]
26
+ authorize! :edit, @newsvideo
27
+ end
28
+
29
+ def generate_illustration
30
+ @newsvideo = Wco::Newsvideo.unscoped.find params[:id]
31
+ authorize! :edit, @newsvideo
32
+
33
+ cmd = " cd /opt/projects/simple_ai_1/src/Stability ; \
34
+ wget --user-agent='Mozilla/5.0' -O input.png #{params[:image_url]} ";
35
+
36
+ cmd_1 = " . zenv_stability/bin/activate ; \
37
+ rm -rf out ; \
38
+ python scripts/minimal_run.py ";
39
+
40
+ cmd_2 = " ffmpeg -framerate 7 -i out/frames/frame_%04d.png -c:v libx264 -pix_fmt yuv420p out/output.mp4 ; \
41
+
42
+ curl -v -X POST '#{WCO_ORIGIN_2}/wco/api/videos/?api_key=#{SIMPLE_API_KEY}&api_secret=#{SIMPLE_API_SECRET}' \
43
+ -H 'Accept: application/json' \
44
+ -F 'video=@out/output.mp4' \
45
+ -F 'thumb=@out/frames/frame_0000.png' \
46
+ -F 'name=#{@newsvideo.title}' \
47
+ -D 'newsvideo_id=#{params[:id]}' ";
48
+
49
+ out = `ssh pc-ai " whoami ; pwd ; #{cmd} ; #{cmd_1} ; #{cmd_2} ; "`
50
+ puts! out, 'out'
51
+
52
+ render json: { status: :ok } ## _TODO: remove
53
+ # redirect_to action: 'show', newsvideo_id: params[:id]
54
+ end
55
+
56
+ def index
57
+ authorize! :index, Wco::Newsvideo
58
+ @newsvideos = Wco::Newsvideo.all
59
+ if params[:deleted]
60
+ @newsvideos = Wco::Newsvideo.unscoped.where( :deleted_at.ne => nil )
61
+ end
62
+ @newsvideos = @newsvideos.page( params[:newsvideos_page] ).per( current_profile.per_page )
63
+ end
64
+
65
+ def new
66
+ @newsvideo = Wco::Newsvideo.new
67
+ authorize! :create, @newsvideo
68
+ end
69
+
70
+ def show
71
+ @newsvideo = Wco::Newsvideo.unscoped.find params[:id]
72
+ authorize! :show, @newsvideo
73
+ @newspartials = Wco::Newspartial.where( newsvideo_id: @newsvideo.id.to_s).includes(:video)
74
+
75
+ # @config = JSON.parse( @newsvideo.config_json )
76
+ # @duration_ms = @config['vtimes'].last.to_i + @config['vdurations'].last.to_i
77
+ end
78
+
79
+
80
+ def update
81
+ params[:newsvideo][:tag_ids]&.delete ''
82
+
83
+ @newsvideo = Wco::Newsvideo.unscoped.find params[:id]
84
+ authorize! :update, @newsvideo
85
+ if @newsvideo.update params[:newsvideo].permit!
86
+ flash_notice "updated newsvideo"
87
+ else
88
+ flash_alert "Cannot update newsvideo: #{@newsvideo.errors.messages}"
89
+ end
90
+ redirect_to action: 'index'
91
+ end
92
+
93
+ ##
94
+ ## private
95
+ ##
96
+ private
97
+
98
+ def set_lists
99
+ @tags_list = Wco::Tag.list
100
+ end
101
+
102
+ end
@@ -50,6 +50,9 @@ class Wco::ReportsController < Wco::ApplicationController
50
50
  def show
51
51
  @report = Wco::Report.unscoped.find params[:id]
52
52
  authorize! :show, @report
53
+
54
+ # @config = JSON.parse( @report.config_json )
55
+ # @duration_ms = @config['vtimes'].last.to_i + @config['vdurations'].last.to_i
53
56
  end
54
57
 
55
58
  def update
@@ -72,6 +75,7 @@ class Wco::ReportsController < Wco::ApplicationController
72
75
 
73
76
  def set_lists
74
77
  @tags_list = Wco::Tag.list
78
+ @newsvideos_list = Wco::Newsvideo.list
75
79
  end
76
80
 
77
81
  end
@@ -1,6 +1,10 @@
1
1
 
2
2
  module Wco::ApplicationHelper
3
3
 
4
+ def pexels_search_path(opts)
5
+ "/2025/pexels_example_169.html?pexels_api_key=#{PEXELS_API_KEY}&newsvideo_id=#{opts[:newsvideo_id]}"
6
+ end
7
+
4
8
  def my_truthy? which
5
9
  ["1", "t", "T", "true"].include?( which )
6
10
  end
@@ -0,0 +1,76 @@
1
+
2
+ class Wco::Newspartial
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+ include Mongoid::Paranoia
6
+ include Wco::Utils
7
+ store_in collection: 'wco_newspartials'
8
+
9
+ PAGE_PARAM_NAME = 'newspartials_page'
10
+
11
+ field :title
12
+ # validates :title, presence: true, uniqueness: true
13
+ index({ title: 1 }, { unique: true })
14
+
15
+ field :body
16
+ field :config_json, type: :string, default: '{}'
17
+ field :speech_json, type: :string, default: '{}' # the smaller config, excludes audio wav
18
+
19
+ belongs_to :newsvideo
20
+ has_one :video
21
+
22
+ def config
23
+ @config ||= JSON.parse self[:config_json]
24
+ end
25
+ def duration_ms
26
+ duration = config['vtimes'].last.to_i + config['vdurations'].last.to_i rescue 0
27
+ end
28
+
29
+ def generate_speech
30
+ out = HTTParty.post( "#{HEAD_TTS_ORIGIN}/v1/synthesize",
31
+ headers: {
32
+ 'Content-Type' => 'application/json',
33
+ 'Accept' => 'application/json',
34
+ }, body: {
35
+ input: body,
36
+ voice: "af_bella",
37
+ language: "en-us",
38
+ audioEncoding: "wav",
39
+ }.to_json
40
+ );
41
+ out = out.body
42
+ puts! out, 'out'
43
+
44
+ self[:config_json] = out
45
+
46
+ tmp = JSON.parse( out )
47
+ tmp.delete('audio')
48
+ self[:speech_json] = tmp.to_json
49
+
50
+ self.save
51
+ return out
52
+ end
53
+
54
+ def generate_video
55
+ cmd = "cd #{ISHLIB3JS_ROOT} ;
56
+ node ./src/talking_head/example_puppeteer_wired.js \
57
+ --api_key=#{SIMPLE_API_KEY} \
58
+ --api_secret=#{SIMPLE_API_SECRET} \
59
+ --wco_origin=#{WCO_ORIGIN} \
60
+ --newspartial_id=#{self[:id]} ";
61
+
62
+ puts! cmd, 'cmd'
63
+ begin
64
+ out = `#{cmd}`
65
+ rescue err
66
+ puts! err, 'err'
67
+ end
68
+ puts! out, 'out'
69
+ return out
70
+ end
71
+
72
+ def video
73
+ Wco::Video.where( newspartial_id: self[:id] ).first
74
+ end
75
+
76
+ end
@@ -0,0 +1,41 @@
1
+
2
+
3
+ class Wco::Newsvideo
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+ include Mongoid::Paranoia
7
+ include Wco::Utils
8
+ store_in collection: 'wco_newsvideos'
9
+
10
+ PAGE_PARAM_NAME = 'newsvideos_page'
11
+
12
+ field :title
13
+ validates :title, presence: true, uniqueness: true
14
+ index({ title: 1 }, { unique: true })
15
+ def name ; title ; end
16
+ def to_s
17
+ title
18
+ end
19
+
20
+ field :slug
21
+ validates :slug, presence: true, uniqueness: true
22
+ index({ :slug => 1 }, { :unique => true })
23
+ before_validation :set_slug, on: :create
24
+
25
+ field :body
26
+ field :config_json, type: :string
27
+
28
+ field :x, :type => Float
29
+ field :y, :type => Float
30
+ field :z, :type => Float
31
+
32
+ # has_one :image_thumb
33
+ # has_one :image_hero
34
+
35
+ belongs_to :author, class_name: 'Wco::Profile'
36
+
37
+ has_and_belongs_to_many :tags
38
+ has_many :newspartials
39
+ has_many :videos
40
+
41
+ end
@@ -18,7 +18,7 @@ class Wco::Profile
18
18
  field :schwab_refresh_token, type: :string
19
19
  field :schwab_id_token, type: :string
20
20
 
21
-
21
+ has_many :newsvideos, class_name: 'Wco::Newsvideo'
22
22
  has_many :reports, class_name: 'Wco::Report'
23
23
  has_many :stocks, class_name: 'Iro::Stock'
24
24
 
@@ -16,14 +16,17 @@ class Wco::Tag
16
16
  has_many :email_filters, class_name: 'WcoEmail::EmailFilter', inverse_of: :tag
17
17
 
18
18
  has_and_belongs_to_many :conversations, class_name: 'WcoEmail::Conversation', index: true
19
- has_and_belongs_to_many :message_stubs, class_name: 'WcoEmail::MessageStub'
19
+ has_and_belongs_to_many :galleries
20
20
  has_and_belongs_to_many :headlines # , class_name: 'Headline'
21
21
  has_and_belongs_to_many :leads, index: true # , class_name: 'Lead'
22
22
  has_and_belongs_to_many :leadsets # , class_name: 'Leadset'
23
- has_and_belongs_to_many :galleries
23
+ has_and_belongs_to_many :logs
24
+ has_and_belongs_to_many :message_stubs, class_name: 'WcoEmail::MessageStub'
25
+ has_and_belongs_to_many :newsvideos
24
26
  has_and_belongs_to_many :reports
25
27
  has_and_belongs_to_many :videos
26
- has_and_belongs_to_many :logs
28
+
29
+
27
30
 
28
31
  INBOX = 'inbox'
29
32
  def self.inbox
@@ -34,7 +34,9 @@ class Wco::Video
34
34
  # belongs_to :user_profile, :class_name => 'Ish::UserProfile', :inverse_of => :videos
35
35
  # has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_videos
36
36
 
37
- belongs_to :lead, optional: true
37
+ belongs_to :lead, optional: true
38
+ belongs_to :newspartial, optional: true
39
+ belongs_to :newsvideo, optional: true
38
40
 
39
41
  has_and_belongs_to_many :tags
40
42
 
@@ -38,6 +38,7 @@
38
38
  %li= render '/wco/headlines/header'
39
39
  %li= render '/wco/publishers/header'
40
40
  %li= render '/wco/galleries/header_mini'
41
+ %li= render '/wco/newsvideos/header_mini'
41
42
  %li= render '/wco/reports/header'
42
43
  %li= render '/wco/videos/header'
43
44
 
@@ -0,0 +1,20 @@
1
+
2
+ .newspartials--form
3
+ = form_for newspartial do |f|
4
+ .actions
5
+ = f.submit
6
+
7
+ .field.flex-row
8
+ %label Title
9
+ = f.text_field :title, class: 'w-100'
10
+
11
+ .field
12
+ %label Body
13
+ = f.text_area :body, class: 'tinymce'
14
+
15
+ .field
16
+ %label Newsvideo:
17
+ = f.select :newsvideo_id, options_for_select(@newsvideos_list, selected: newspartial.newsvideo_id || params[:newsvideo_id] ), {}, {}
18
+
19
+ .actions
20
+ = f.submit
@@ -0,0 +1,31 @@
1
+
2
+ - height_ms = 100.0/1000
3
+
4
+ .newspartials--show-in-newsvideo
5
+
6
+ .a
7
+ = link_to '[~]', edit_newspartial_path(newspartial)
8
+ Newspartial `#{link_to newspartial.title, newspartial_path(newspartial)}`
9
+ %span{ class: 'gray' } #{newspartial.id}
10
+ = link_to '[api]', api_newspartial_config_path(newspartial, format: :json, api_key: SIMPLE_API_KEY, api_secret: SIMPLE_API_SECRET ), target: :_blank
11
+
12
+
13
+ .Timeline{ style: "height: #{newspartial.duration_ms*height_ms}px; min-height: 100px;" }
14
+ .main
15
+ - newspartial.config['wtimes']&.each_with_index do |wtime, idx|
16
+
17
+ %div.ts{ style: "top: #{wtime.to_f*height_ms}px"}
18
+ .wtime= wtime
19
+ .word= newspartial.config['words'][idx]
20
+
21
+ .full-text
22
+ = newspartial.body
23
+ .d-inline-block= button_to 'Generate visemes', newspartial_generate_speech_path(newspartial)
24
+ .d-inline-block= button_to 'Generate video', newspartial_generate_video_path(newspartial)
25
+
26
+ .a= newspartial.config_json[0...100]
27
+ .a= newspartial.speech_json[0...100]
28
+ .a
29
+ Video:
30
+ - if newspartial.video
31
+ = image_tag newspartial.video.thumb.url(:thumb), class: 'thumb'
@@ -0,0 +1,6 @@
1
+
2
+ .newspartials-index.maxwidth
3
+ .header
4
+ %h5.title
5
+ = render 'header'
6
+ = render 'wco/newspartials/index', newspartials: @newspartials
@@ -0,0 +1,4 @@
1
+
2
+ .newspartials-new.maxwidth
3
+ %h5 New Newspartial
4
+ = render 'form', newspartial: @newspartial
@@ -0,0 +1,28 @@
1
+
2
+ .newsvideos--form
3
+ = form_for newsvideo do |f|
4
+ .actions
5
+ = f.submit
6
+
7
+ .field.flex-row
8
+ %label Title
9
+ = f.text_field :title, class: 'w-100'
10
+ .field.flex-row
11
+ %label Slug
12
+ = f.text_field :slug, class: 'w-100'
13
+
14
+ .field
15
+ %label deleted_at
16
+ = f.text_field :deleted_at
17
+
18
+ .field
19
+ %label Body
20
+ = f.text_area :body, class: 'tinymce'
21
+
22
+ .field
23
+ %label Tags (#{newsvideo.tags.length}):
24
+ -# = render '/wco/tags/index', tags: newsvideo.tags
25
+ = f.select :tag_ids, options_for_select(@tags_list, selected: newsvideo.tag_ids), {}, { multiple: true, class: 'select2' }
26
+
27
+ .actions
28
+ = f.submit
@@ -0,0 +1,8 @@
1
+
2
+ - newsvideos ||= Wco::Newsvideo.all
3
+
4
+ = link_to "Newsvideos (#{newsvideos.length})", wco.newsvideos_path
5
+ .d-inline-block
6
+ = form_tag wco.newsvideos_path, method: :get do
7
+ = text_field_tag :q
8
+ = link_to '[+]', wco.new_newsvideo_path
@@ -0,0 +1,2 @@
1
+
2
+ = render 'form', newsvideo: @newsvideo
@@ -0,0 +1,6 @@
1
+
2
+ .newsvideos-index
3
+ %h5.text-center Newsvideos
4
+ %ul
5
+ - @newsvideos.each do |nv|
6
+ %li= link_to nv.title, newsvideo_path(nv)
@@ -0,0 +1,4 @@
1
+
2
+ .newsvideos-new.maxwidth
3
+ %h5.text-center New newsvideo
4
+ = render 'form', newsvideo: @newsvideo
@@ -0,0 +1,10 @@
1
+
2
+ .newsvideos-show.maxwidth
3
+ %h5.text-center Newsvideo `#{@newsvideo.title}` #{link_to '[~]', edit_newsvideo_path(@newsvideo)}
4
+ .descr= @newsvideo.body
5
+ %hr
6
+ .text-center
7
+ Newspartials #{link_to '[+]', new_newspartial_path(newsvideo_id: @newsvideo.id) }
8
+ = link_to '[+ illustration]', pexels_search_path(newsvideo_id: @newsvideo.id), target: :_blank
9
+ - @newspartials.each do |newspartial|
10
+ = render 'wco/newspartials/show_in_newsvideo', newspartial: newspartial
@@ -24,5 +24,9 @@
24
24
  -# = render '/wco/tags/index', tags: report.tags
25
25
  = f.select :tag_ids, options_for_select(@tags_list, selected: report.tag_ids), {}, { multiple: true, class: 'select2' }
26
26
 
27
+ .field
28
+ %label Newsvideo:
29
+ = f.select :newsvideo_id, options_for_select(@newsvideos_list, selected: report.newsvideo_id), {}, {}
30
+
27
31
  .actions
28
32
  = f.submit
@@ -1,4 +1,4 @@
1
1
 
2
2
  .reports-new.maxwidth
3
- %h5 Edit Report
3
+ %h5 Edit Report `#{link_to @report.title, report_path(@report)}`
4
4
  = render 'form', report: @report
@@ -1,4 +1,6 @@
1
1
 
2
+ - height_ms = 100.0/1000
3
+
2
4
  .reports-show.maxwidth
3
5
  %h5
4
6
  = link_to '[~]', edit_report_path(@report)
@@ -10,3 +12,19 @@
10
12
  = render 'wco/tags/index_chips', tags: @report.tags
11
13
 
12
14
  .descr= raw @report.body
15
+
16
+ .Timeline{ style: "height: #{@duration_ms*height_ms}px" }
17
+ .main
18
+ - @config['wtimes'].each_with_index do |wtime, idx|
19
+
20
+ %div.ts{ style: "top: #{wtime.to_f*height_ms}px"}
21
+ .wtime= wtime
22
+ .word= @config['words'][idx]
23
+
24
+ .reports-show.maxwidth
25
+ %hr
26
+ %label config_json
27
+ .descr
28
+ = @report.config_json
29
+
30
+
@@ -22,4 +22,5 @@
22
22
  = render 'wco/application/metaline', :item => video
23
23
  .flex-row
24
24
  Download File:&nbsp;#{link_to video.video_file_name, video.video.url}
25
-
25
+ %ul
26
+ %li newspartial_id: #{video.newspartial_id}
data/config/routes.rb CHANGED
@@ -8,6 +8,10 @@ Wco::Engine.routes.draw do
8
8
  get 'obf', to: 'obfuscated_redirects#show' ## testing only.
9
9
  get 'obf/:id', to: 'obfuscared_redirects#show'
10
10
 
11
+ post 'reports', to: 'reports#create'
12
+ patch 'reports/:id/add-config', to: 'reports#add_config'
13
+ get 'newspartials/:id/config', to: 'newspartials#show_config', as: :newspartial_config
14
+
11
15
  get 'tags', to: 'tags#index'
12
16
 
13
17
  post 'videos', to: 'videos#create'
@@ -43,6 +47,13 @@ Wco::Engine.routes.draw do
43
47
  delete 'logs/bulkop', to: 'logs#bulkop', as: :logs_bulkop
44
48
  resources :logs
45
49
 
50
+ match 'newspartials/:id/generate-speech', to: 'newspartials#generate_speech', as: :newspartial_generate_speech, via: [ :get, :post ]
51
+ match 'newspartials/:id/generate-video', to: 'newspartials#generate_video', as: :newspartial_generate_video, via: [ :get, :post ]
52
+ resources :newspartials
53
+
54
+ match 'newsvideos/:id/generate-illustration', to: 'newsvideos#generate_illustration', as: :newsvideo_generate_illustration, via: [ :get, :post ]
55
+ resources :newsvideos
56
+
46
57
  resources :obfuscated_redirects
47
58
 
48
59
  post 'office_action_templates', to: 'office_action_templates#update'
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.220
4
+ version: 3.1.0.224
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-25 00:00:00.000000000 Z
11
+ date: 2026-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ahoy_matey
@@ -422,12 +422,14 @@ files:
422
422
  - app/assets/stylesheets/wco/galleries.scss
423
423
  - app/assets/stylesheets/wco/leads_leadsets.scss
424
424
  - app/assets/stylesheets/wco/main.scss
425
+ - app/assets/stylesheets/wco/newsvideos_newspartials.scss
425
426
  - app/assets/stylesheets/wco/office_action_templates.scss
426
427
  - app/assets/stylesheets/wco/pagination.scss
427
428
  - app/assets/stylesheets/wco/photos.scss
428
429
  - app/assets/stylesheets/wco/sitemaps.scss
429
430
  - app/assets/stylesheets/wco/videos.scss
430
431
  - app/controllers/wco/api/leads_controller.rb
432
+ - app/controllers/wco/api/newspartials_controller.rb
431
433
  - app/controllers/wco/api/obfuscated_redirects_controller.rb
432
434
  - app/controllers/wco/api/tags_controller.rb
433
435
  - app/controllers/wco/api/videos_controller.rb
@@ -439,6 +441,8 @@ files:
439
441
  - app/controllers/wco/leads_controller.rb
440
442
  - app/controllers/wco/leadsets_controller.rb
441
443
  - app/controllers/wco/logs_controller.rb
444
+ - app/controllers/wco/newspartials_controller.rb
445
+ - app/controllers/wco/newsvideos_controller.rb
442
446
  - app/controllers/wco/obfuscated_redirects_controller.rb
443
447
  - app/controllers/wco/office_action_templates_controller.rb
444
448
  - app/controllers/wco/office_actions_controller.rb
@@ -482,6 +486,8 @@ files:
482
486
  - app/models/wco/leadset_appliance_tmpl.rb
483
487
  - app/models/wco/log.rb
484
488
  - app/models/wco/newsitem.rb
489
+ - app/models/wco/newspartial.rb
490
+ - app/models/wco/newsvideo.rb
485
491
  - app/models/wco/obfuscated_redirect.rb
486
492
  - app/models/wco/office_action.rb
487
493
  - app/models/wco/office_action_template.rb
@@ -594,6 +600,16 @@ files:
594
600
  - app/views/wco/logs/_index.haml
595
601
  - app/views/wco/logs/edit.haml
596
602
  - app/views/wco/logs/new.haml
603
+ - app/views/wco/newspartials/_form.haml
604
+ - app/views/wco/newspartials/_show_in_newsvideo.haml
605
+ - app/views/wco/newspartials/index.haml-trash
606
+ - app/views/wco/newspartials/new.haml
607
+ - app/views/wco/newsvideos/_form.haml
608
+ - app/views/wco/newsvideos/_header_mini.haml
609
+ - app/views/wco/newsvideos/edit.haml
610
+ - app/views/wco/newsvideos/index.haml
611
+ - app/views/wco/newsvideos/new.haml
612
+ - app/views/wco/newsvideos/show.haml
597
613
  - app/views/wco/obfuscated_redirects/_form.haml
598
614
  - app/views/wco/obfuscated_redirects/_header.haml
599
615
  - app/views/wco/obfuscated_redirects/edit.haml