wco_models 3.4.0.10 → 3.5.0.2

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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/wco/main.scss +3 -7
  3. data/app/assets/stylesheets/wco/photos.scss +1 -2
  4. data/app/controllers/wco/api/newspartials_controller.rb +15 -5
  5. data/app/controllers/wco/newspartials_controller.rb +2 -2
  6. data/app/controllers/wco/newsvideos_controller.rb +14 -10
  7. data/app/controllers/wco/office_action_templates_controller.rb +0 -3
  8. data/app/controllers/wco/publishers_controller.rb +16 -6
  9. data/app/controllers/wco/reports_controller.rb +5 -6
  10. data/app/controllers/wco/sitemap_paths_controller.rb +2 -14
  11. data/app/controllers/wco/sites_controller.rb +1 -1
  12. data/app/controllers/wco/tags_controller.rb +1 -1
  13. data/app/models/iro/option.rb +4 -37
  14. data/app/models/iro/priceitem.rb +4 -62
  15. data/app/models/tda/option.rb +41 -39
  16. data/app/models/wco/newspartial.rb +33 -8
  17. data/app/models/wco/newsvideo.rb +4 -3
  18. data/app/models/wco/publisher.rb +8 -29
  19. data/app/models/wco/report.rb +2 -12
  20. data/app/models/wco/setting.rb +1 -1
  21. data/app/models/wco/site.rb +67 -1
  22. data/app/models/wco/sitemap_path.rb +13 -19
  23. data/app/models/wco/tag.rb +8 -15
  24. data/app/models/wco/utils.rb +19 -0
  25. data/app/views/wco/api/newsproducer/_studio_blue2.js +205 -317
  26. data/app/views/wco/api/newsproducer/_studio_fps.js +12 -12
  27. data/app/views/wco/api/newsproducer/studio_blue2.html.erb +25 -24
  28. data/app/views/wco/api/newsproducer/studio_fps.html.erb +8 -10
  29. data/app/views/wco/api/newsproducer/trash/_scenes.js-bk +20 -0
  30. data/app/views/wco/api/newsproducer/trash/_scenes.js.erb +15 -0
  31. data/app/views/wco/api/newsproducer/trash/_studio_blue0.js +326 -0
  32. data/app/views/wco/api/newsproducer/trash/_studio_blue1.js +733 -0
  33. data/app/views/wco/api/newsproducer/trash/studio_blue0.html.erb +27 -0
  34. data/app/views/wco/api/newsproducer/trash/studio_blue1.html.erb +108 -0
  35. data/app/views/wco/api/newsvideos/show.jbuilder +1 -1
  36. data/app/views/wco/newspartials/_form.haml +6 -0
  37. data/app/views/wco/newspartials/_show_in_newsvideo.haml +2 -2
  38. data/app/views/wco/newsvideos/_form.haml +4 -0
  39. data/app/views/wco/newsvideos/show.haml +2 -2
  40. data/app/views/wco/office_action_templates/index.haml +1 -1
  41. data/app/views/wco/office_actions/_actions.haml +1 -1
  42. data/app/views/wco/publishers/_form.haml +2 -11
  43. data/app/views/wco/publishers/_post_with.haml +1 -1
  44. data/app/views/wco/reports/_form.haml +2 -13
  45. data/app/views/wco/reports/_index.haml +11 -18
  46. data/app/views/wco/reports/show.haml +1 -6
  47. data/app/views/wco/sitemap_paths/_index.haml +0 -1
  48. data/app/views/wco/sitemap_paths/check.haml +13 -0
  49. data/app/views/wco/sites/index.haml +0 -6
  50. data/app/views/wco/sites/show.haml +1 -1
  51. data/app/views/wco/tags/_form.haml +0 -3
  52. data/config/routes.rb +12 -11
  53. data/lib/shortcuts.rb +1 -1
  54. data/lib/wco_models.rb +1 -1
  55. metadata +28 -24
  56. data/app/models/wco/publisher_d10.rb +0 -50
  57. data/app/views/wco/api/newsproducer/README_newsproducer.txt +0 -12
  58. data/app/views/wco/sitemap_paths/show.haml +0 -14
  59. /data/app/views/wco/api/newsproducer/{_scenes.js-bk → done/_scenes.js-bk} +0 -0
  60. /data/app/views/wco/api/newsproducer/{_scenes.js.erb → done/_scenes.js.erb} +0 -0
  61. /data/app/views/wco/api/newsproducer/{_studio_1.js → done/_studio_1.js} +0 -0
  62. /data/app/views/wco/api/newsproducer/{_studio_blue0.js → done/_studio_blue0.js} +0 -0
  63. /data/app/views/wco/api/newsproducer/{_studio_blue1.js → done/_studio_blue1.js} +0 -0
  64. /data/app/views/wco/api/newsproducer/{_studio_coc.js → done/_studio_coc.js} +0 -0
  65. /data/app/views/wco/api/newsproducer/{_studio_coc.js-bk → done/_studio_coc.js-bk} +0 -0
  66. /data/app/views/wco/api/newsproducer/{_studio_coc.js-cannon → done/_studio_coc.js-cannon} +0 -0
  67. /data/app/views/wco/api/newsproducer/{_studio_ra2.js → done/_studio_ra2.js} +0 -0
  68. /data/app/views/wco/api/newsproducer/{_touch_controls.js → done/_touch_controls.js} +0 -0
  69. /data/app/views/wco/api/newsproducer/{_touch_pad.css → done/_touch_pad.css} +0 -0
  70. /data/app/views/wco/api/newsproducer/{canvas.html.erb → done/canvas.html.erb} +0 -0
  71. /data/app/views/wco/api/newsproducer/{canvas_minimal.html.erb → done/canvas_minimal.html.erb} +0 -0
  72. /data/app/views/wco/api/newsproducer/{games_fps.html → done/games_fps.html} +0 -0
  73. /data/app/views/wco/api/newsproducer/{studio_1.html.erb → done/studio_1.html.erb} +0 -0
  74. /data/app/views/wco/api/newsproducer/{studio_blue0.html.erb → done/studio_blue0.html.erb} +0 -0
  75. /data/app/views/wco/api/newsproducer/{studio_blue1.html.erb → done/studio_blue1.html.erb} +0 -0
  76. /data/app/views/wco/api/newsproducer/{studio_coc.html.erb → done/studio_coc.html.erb} +0 -0
  77. /data/app/views/wco/api/newsproducer/{studio_ra2.html.erb → done/studio_ra2.html.erb} +0 -0
@@ -14,9 +14,10 @@ class Wco::Newspartial
14
14
 
15
15
  field :body
16
16
  field :config_json, type: :string, default: '{}'
17
- field :speech_json, type: :string, default: '{}' # the smaller config, excludes audio wav
17
+ ## no longer used. config_json has everything, including default scene config, excluding audio data.
18
+ # field :speech_json, type: :string, default: '{}' # the smaller config, excludes audio wav
18
19
 
19
- field :voice, type: :string ## 'af_jessica', 'am_fenrir'
20
+ field :voice, type: :string, default: 'af_jessica' ## defaults: 'af_jessica', 'am_fenrir'
20
21
 
21
22
  belongs_to :newsvideo
22
23
 
@@ -78,9 +79,7 @@ class Wco::Newspartial
78
79
  'Accept' => 'application/json',
79
80
  }, body: {
80
81
  input: body,
81
-
82
82
  voice: voice,
83
-
84
83
  language: "en-us",
85
84
  audioEncoding: "wav",
86
85
  }.to_json
@@ -99,12 +98,19 @@ class Wco::Newspartial
99
98
  self.audio = temp_file
100
99
  temp_file.close
101
100
  temp_file.unlink
101
+
102
102
  tmp.delete('audio')
103
+ tmp.delete('audioEncoding')
103
104
 
104
- self[:speech_json] = tmp.to_json
105
+ # puts! Wco::Utils.default_studio_config, 'Wco::Utils.default_studio_config'
106
+ tmp.merge!( Wco::Utils.default_studio_config )
107
+ tmp[:active_camera] = Wco::Utils.default_studio_config.key( Wco::Utils.voice_to_avatar(voice) )
108
+ tmp[:active_spot] = Wco::Utils.default_studio_config.key( Wco::Utils.voice_to_avatar(voice) )
109
+ self[:config_json] = tmp.to_json
110
+ # puts! tmp, 'tmp'
105
111
 
106
- self.save
107
- return out
112
+ self.save!
113
+ return tmp
108
114
  end
109
115
 
110
116
  ##
@@ -112,7 +118,7 @@ class Wco::Newspartial
112
118
  ## uses ishlib3js v0.0.2, not 0.1.0!!!
113
119
  ## @deprecated, this is being brought into wco_models
114
120
  ##
115
- def generate_video
121
+ def generate_video_bk
116
122
  cmd = "cd #{Wco::Setting.get('ISHLIB3JS_ROOT')} ;
117
123
  node ./src/talking_head/example_puppeteer_wired.js \
118
124
  --api_key=#{Wco::Setting.get('WASYACO_SIMPLE_API_KEY')} \
@@ -132,6 +138,25 @@ class Wco::Newspartial
132
138
  puts! out, 'out'
133
139
  return out
134
140
  end
141
+ def generate_video
142
+ out = `#{generate_video_cmd}`
143
+ puts! out, 'out'
144
+ end
145
+ def generate_video_cmd
146
+ cmd = "cd #{Wco::Setting.get('PUPPETEER_ROOT')} ; NEWSPARTIAL_URL='#{generate_video_url}' yarn run run_newspartial_1 "
147
+ puts "+++ puppeteer cmd:"
148
+ puts cmd
149
+ cmd
150
+ end
151
+ def generate_video_url
152
+ newspartial = self
153
+ url = Wco::Engine.routes.url_helpers.api_newspartial_config_url({ id: newspartial.id,
154
+ host: Rails.application.routes.default_url_options[:host],
155
+ wco_origin: Rails.application.routes.default_url_options[:host],
156
+ api_key: Wco::Setting.get('WASYACO_SIMPLE_API_KEY'),
157
+ api_secret: Wco::Setting.get('WASYACO_SIMPLE_API_SECRET'),
158
+ })
159
+ end
135
160
 
136
161
  def video
137
162
  Wco::Video.where( newspartial_id: self[:id] ).first
@@ -25,14 +25,15 @@ class Wco::Newsvideo
25
25
  field :config_json, type: :string
26
26
  field :duration_ms, type: :integer
27
27
 
28
- field :w_px, type: Integer
29
- field :h_px, type: Integer
28
+ field :w_px, type: Integer, default: 854
29
+ field :h_px, type: Integer, default: 480
30
+ field :fps, type: :integer, default: 30
30
31
  field :x, :type => Float
31
32
  field :y, :type => Float
32
33
  field :z, :type => Float
33
34
 
34
35
  field :next_overlay_ms, type: :integer, default: 1000
35
- field :fps, type: :integer, default: 30
36
+
36
37
 
37
38
  belongs_to :generated_video, class_name: 'Wco::Video', optional: true
38
39
 
@@ -1,11 +1,4 @@
1
1
 
2
- def url_exists?(url)
3
- response = HTTParty.head(url, timeout: 5, follow_redirects: true)
4
- response.code == 200
5
- rescue StandardError
6
- false
7
- end
8
-
9
2
  class Wco::Publisher
10
3
  include Mongoid::Document
11
4
  include Mongoid::Timestamps
@@ -26,35 +19,26 @@ class Wco::Publisher
26
19
  field :post_path
27
20
 
28
21
  has_many :oats, class_name: 'Wco::OfficeActionTemplate'
29
- has_and_belongs_to_many :tags
30
22
 
31
23
  attr_accessor :props
32
24
 
33
25
  def do_run
34
- @publisher = publisher = self
35
-
36
- @site = publisher.site
26
+ @site = site
37
27
  @headers = {}
38
28
  @ctx = OpenStruct.new
39
29
 
40
- puts! publisher.context_eval, 'context_eval'
41
- eval( publisher.context_eval )
42
- puts! @ctx, '@ctx'
30
+ # puts! context_eval, 'context_eval'
31
+ eval( context_eval )
32
+ # puts! @ctx, '@ctx'
43
33
 
44
- if @abort
45
- errors.add(:base, 'aborted')
46
- return false
47
- end
48
-
49
- tmpl = ERB.new publisher.post_body_tmpl
34
+ tmpl = ERB.new post_body_tmpl
50
35
  body = JSON.parse tmpl.result(binding)
51
- puts! body, 'body'
36
+ # puts! body, 'body'
52
37
 
53
38
  out = Wco::HTTParty.post( "#{@site.origin}#{post_path}", {
54
39
  body: body.to_json,
55
40
  headers: @headers,
56
41
  basic_auth: { username: @site.username, password: @site.password },
57
- debug_output: $stdout,
58
42
  })
59
43
  puts! out.response, 'publisher httparty response'
60
44
  puts! out.body, 'publisher httparty body'
@@ -70,17 +54,12 @@ class Wco::Publisher
70
54
  raise out.body
71
55
  end
72
56
 
73
- if after_eval.present?
74
- puts! after_eval, 'after_eval'
75
- eval( after_eval )
76
- end
77
-
78
- return true
57
+ eval( after_eval ) if after_eval.present?
79
58
  end
80
59
 
81
60
 
82
61
  def to_s
83
- "#{site} :: #{slug}"
62
+ "#{slug}: #{kind} => #{site}"
84
63
  end
85
64
 
86
65
  def self.list
@@ -25,24 +25,14 @@ class Wco::Report
25
25
 
26
26
  field :body
27
27
  def body_json
28
- out = body
29
- if FORMAT_PLAINTEXT == body_format
30
- out = out.gsub(/\r/, '').gsub(/\n\n+/, '<br /><br />')
31
- end
32
- out.to_json
28
+ body.gsub(/\r/, '').gsub(/\n\n+/, '<br /><br />').to_json
33
29
  end
34
- FORMAT_PLAINTEXT = 'format-plaintext'
35
- FORMAT_FULLHTML = 'format-fullhtml'
36
- FORMATS = [ FORMAT_PLAINTEXT, FORMAT_FULLHTML ]
37
- field :body_format, type: :string, default: FORMAT_PLAINTEXT
38
30
 
39
31
  field :x, :type => Float
40
32
  field :y, :type => Float
41
33
  field :z, :type => Float
42
- field :source_url, type: :string
43
- field :summary, type: :string
44
34
 
45
- belongs_to :author, class_name: 'Wco::Profile', optional: true
35
+ belongs_to :author, class_name: 'Wco::Profile'
46
36
 
47
37
  has_one :image_thumb, class_name: 'Wco::Photo', inverse_of: :report, dependent: :destroy
48
38
  accepts_nested_attributes_for :image_thumb
@@ -5,7 +5,7 @@ class Wco::Setting
5
5
  store_in collection: 'wco_settings'
6
6
 
7
7
  KEYS = [ 'HEAD_TTS_ORIGIN', 'ISHLIB3JS_ROOT',
8
- 'OPENAI_API_KEY', 'PEXELS_API_KEY',
8
+ 'OPENAI_API_KEY', 'PEXELS_API_KEY', 'PUPPETEER_ROOT',
9
9
  'WASYACO_ORIGIN', 'WASYACO_SIMPLE_API_KEY', 'WASYACO_SIMPLE_API_SECRET',
10
10
  ];
11
11
 
@@ -18,7 +18,7 @@ class Wco::Site
18
18
  has_many :logs, inverse_of: :obj
19
19
  has_many :publishers # , class_name: 'Wco::Publisher'
20
20
  has_many :sitemap_paths, class_name: 'Wco::SitemapPath'
21
- has_many :tags, class_name: 'Wco::Tag', inverse_of: :site
21
+ has_many :tags, class_name: 'Wco::Tag'
22
22
 
23
23
  field :slug
24
24
  validates :slug, presence: true, uniqueness: true
@@ -34,12 +34,78 @@ class Wco::Site
34
34
 
35
35
  def to_s
36
36
  slug
37
+ # origin
37
38
  end
38
39
 
39
40
  def self.list
40
41
  [[nil,nil]] + all.map { |s| [ s.slug, s.id ] }
41
42
  end
42
43
 
44
+ def body
45
+ {
46
+ "_links": {
47
+ "type":{"href":"http://pi.local/rest/type/node/article"}
48
+ },
49
+ "title":[{"value":"Node +++ 123 bac +++" }],
50
+ "body":[{"value": "<b>hello, wor</b>ld!", "format": "full_html" }],
51
+ "type":[{"target_id":"article"}],
52
+ "status": [{"value": 1}],
53
+ "_embedded": {
54
+ "http://pi.local/rest/relation/node/article/field_issue": [
55
+ { "uuid": [{ "value": "56229a95-d675-43e1-99b1-f9e11b5579c5" }] }
56
+ ],
57
+ "http://pi.local/rest/relation/node/article/field_tags": [
58
+ { "uuid": [{ "value": "45646a7d-1a16-42e8-b758-f6e1c8d976f7" }] },
59
+ { "uuid": [{ "value": "834e34e2-05ae-498d-b876-453798872ce1" }] }
60
+ ]
61
+ }
62
+
63
+ }
64
+ end
65
+
66
+ def do_post
67
+ HTTParty.post( post_url,
68
+ body: JSON.generate( body ),
69
+ headers: { 'Content-Type' => 'application/hal+json' },
70
+ basic_auth: { username: username, password: password },
71
+ )
72
+ end
73
+
74
+ def wp_import
75
+ site = self
76
+
77
+ root_tag = Wco::Tag.find_or_create_by slug: "#{site.slug}_wp-import", site_id: site.id
78
+ url = "#{site.origin}/wp-json/wp/v2/posts"
79
+ pi_admin = Wco::Profile.find_or_create_by email: 'admin@piousbox.com'
80
+ n_pages = 12
81
+ per_page = 100
82
+
83
+ (1..n_pages).each do |page|
84
+ print "Page #{page}"
85
+
86
+ posts = HTTParty.get url, query: { per_page: per_page, page: page }
87
+ posts.each do |post|
88
+ report = Wco::Report.new({
89
+ legacy_id: post['id'],
90
+ created_at: post['date'],
91
+ slug: post['link'].sub(site.origin, ''),
92
+ title: post['title']['rendered'],
93
+ subtitle: post['excerpt']['rendered'],
94
+ body: post['content']['rendered'],
95
+ author: pi_admin,
96
+ tag_ids: ( [ root_tag ] + site.tags.where( :legacy_id.in => post['categories'] ) ).map(&:id),
97
+ })
98
+
99
+ if report.save
100
+ print '^'
101
+ else
102
+ puts report.errors.messages
103
+ end
104
+ end
105
+ end
106
+ puts "ok"
107
+ end
108
+
43
109
  def check_sitemap
44
110
  @results = []
45
111
  @total_count = 0
@@ -15,15 +15,9 @@ class Wco::SitemapPath
15
15
  field :selectors, type: Array, default: []
16
16
  field :title, type: String
17
17
 
18
-
18
+ field :results, type: Array, default: []
19
19
  field :status, type: String
20
20
 
21
- # field :results, type: Array, default: []
22
- has_many :logs, inverse_of: :obj
23
- def results
24
- logs.map { |log| "#{log.message} [on #{log.created_at.to_s[0...10]}]" }
25
- end
26
-
27
21
  def check
28
22
  self.status = 'NOT_OK'
29
23
  skip_rest = false
@@ -32,26 +26,26 @@ class Wco::SitemapPath
32
26
  begin
33
27
  body = HTTParty.get( "#{site.origin}#{self[:path]}" ).body
34
28
  rescue OpenSSL::SSL::SSLError => err
35
- log = Wco::Log.create obj: self, message: "NOT OK [ssl-exception] #{self[:path]}" # .red
29
+ results.push "NOT OK [ssl-exception] #{self[:path]}" # .red
36
30
  return
37
31
  end
38
32
  doc = Nokogiri::HTML( body )
39
33
  out = doc.search self[:selector]
40
34
  if out.present?
41
- log = Wco::Log.create obj: self, message: "OK #{self[:path]}"
35
+ results.push "OK #{self[:path]}"
42
36
  self.status = 'OK'
43
37
  else
44
- log = Wco::Log.create obj: self, message: "NOT OK [selector-missing] #{self[:path]}" # .red
38
+ results.push "NOT OK [selector-missing] #{self[:path]}" # .red
45
39
  end
46
40
 
47
41
  elsif self[:redirect_to].present?
48
42
  out = HTTParty.get( "#{site.origin}#{self[:path]}", follow_redirects: false )
49
43
  if( out.headers[:location] == self[:redirect_to] ||
50
44
  out.headers[:location] == "#{site.origin}#{self[:redirect_to]}" )
51
- log = Wco::Log.create obj: self, message: "OK #{self[:path]}"
45
+ results.push "OK #{self[:path]}"
52
46
  self.status = 'OK'
53
47
  else
54
- log = Wco::Log.create obj: self, message: "NOT OK [redirect-missing] #{self[:path]}" # .red
48
+ results.push "NOT OK [redirect-missing] #{self[:path]}" # .red
55
49
 
56
50
  puts!( out.response, 'response' ) if DEBUG
57
51
  # puts!( out.body, 'body' ) if DEBUG
@@ -62,7 +56,7 @@ class Wco::SitemapPath
62
56
  end
63
57
  skip_rest = true
64
58
  else
65
- log = Wco::Log.create obj: self, message: "SKIP #{self[:path]}"
59
+ results.push "SKIP #{self[:path]}"
66
60
  self.status = 'OK'
67
61
  skip_rest = true
68
62
  end
@@ -72,10 +66,10 @@ class Wco::SitemapPath
72
66
  if self[:meta_description].present?
73
67
  out = doc.search( 'head meta[name="description"]' )[0]['content']
74
68
  if out.include?( self[:meta_description] )
75
- log = Wco::Log.create obj: self, message: "OK #{self[:path]} meta_description"
69
+ results.push "OK #{self[:path]} meta_description"
76
70
  else
77
71
  self.status = 'NOT_OK'
78
- log = Wco::Log.create obj: self, message: "NOT OK [meta-description-no-contain] #{self[:path]}" # .red
72
+ results.push "NOT OK [meta-description-no-contain] #{self[:path]}" # .red
79
73
  end
80
74
  end
81
75
 
@@ -83,10 +77,10 @@ class Wco::SitemapPath
83
77
  self[:selectors].each do |selector|
84
78
  out = doc.search selector
85
79
  if out.present?
86
- log = Wco::Log.create obj: self, message: "OK #{self[:path]} selectors:#{selector}"
80
+ results.push "OK #{self[:path]} selectors:#{selector}"
87
81
  else
88
82
  self.status = 'NOT_OK'
89
- log = Wco::Log.create obj: self, message: "NOT OK [selectors-missing:#{selector}] #{self[:path]}" # .red
83
+ results.push "NOT OK [selectors-missing:#{selector}] #{self[:path]}" # .red
90
84
  end
91
85
  end
92
86
  end
@@ -94,10 +88,10 @@ class Wco::SitemapPath
94
88
  if self[:title].present?
95
89
  out = doc.search( 'head title' )[0].text
96
90
  if out.include?( self[:title] )
97
- log = Wco::Log.create obj: self, message: "OK #{self[:path]} title"
91
+ results.push "OK #{self[:path]} title"
98
92
  else
99
93
  self.status = 'NOT_OK'
100
- log = Wco::Log.create obj: self, message: "NOT OK [title-no-contain] #{self[:path]}" # .red
94
+ results.push "NOT OK [title-no-contain] #{self[:path]}" # .red
101
95
  end
102
96
  end
103
97
 
@@ -5,21 +5,19 @@ class Wco::Tag
5
5
  store_in collection: 'wco_tags'
6
6
 
7
7
  field :slug
8
- validates :slug, presence: true, uniqueness: { scope: :site_id }
8
+ validates :slug, presence: true, uniqueness: true
9
9
  index({ slug: -1 })
10
10
 
11
11
  field :weight, type: :string, default: 'jjj'
12
- field :external_id, type: :string
13
- def eid; external_id; end
14
12
 
15
13
  belongs_to :parent, class_name: '::Wco::Tag', inverse_of: :sons, optional: true
16
14
  has_many :sons, class_name: '::Wco::Tag', inverse_of: :parent
17
15
 
18
- belongs_to :site, class_name: '::Wco::Site', optional: true, inverse_of: :tags
19
- belongs_to :sidebar_profile, class_name: 'Wco::Profile', optional: true
20
- has_many :email_filters, class_name: '::WcoEmail::EmailFilter', inverse_of: :tag
21
- has_many :email_templates, class_name: '::WcoEmail::EmailTemplate', inverse_of: :tag
22
- has_many :ajects, class_name: '::WcoEmail::EmailFilterAction', inverse_of: :aject
16
+ belongs_to :site, class_name: '::Wco::Site', optional: true
17
+ belongs_to :sidebar_profile, class_name: 'Wco::Profile', optional: true
18
+ has_many :email_filters, class_name: '::WcoEmail::EmailFilter', inverse_of: :tag
19
+ has_many :email_templates, class_name: '::WcoEmail::EmailTemplate', inverse_of: :tag
20
+ has_many :ajects, class_name: '::WcoEmail::EmailFilterAction', inverse_of: :aject
23
21
 
24
22
  has_and_belongs_to_many :conversations, class_name: '::WcoEmail::Conversation', index: true
25
23
  has_and_belongs_to_many :galleries, class_name: '::Wco::Gallery'
@@ -29,7 +27,6 @@ class Wco::Tag
29
27
  has_and_belongs_to_many :message_stubs, class_name: '::WcoEmail::MessageStub'
30
28
  has_and_belongs_to_many :newsvideos, class_name: '::Wco::Newsvideo'
31
29
  has_and_belongs_to_many :reports, class_name: '::Wco::Report'
32
- has_and_belongs_to_many :publishers, class_name: '::Wco::Publisher'
33
30
  has_and_belongs_to_many :videos, class_name: '::Wco::Video'
34
31
 
35
32
 
@@ -74,13 +71,9 @@ class Wco::Tag
74
71
 
75
72
 
76
73
  def to_s
77
- if site
78
- "#{slug}@#{site}"
79
- else
80
- slug
81
- end
74
+ slug
82
75
  end
83
76
  def self.list
84
- [[nil,nil]] + all.includes(:site).order_by( slug: :asc ).map { |t| [ t.to_s, t.id.to_s ] }
77
+ [[nil,nil]] + all.order_by( slug: :asc ).map { |p| [ p.slug, p.id ] }
85
78
  end
86
79
  end
@@ -26,6 +26,25 @@ module Wco::Utils
26
26
  end
27
27
  end
28
28
 
29
+ def self.voice_to_avatar(which)
30
+ case which
31
+ when 'af_jessica'
32
+ return 'brunette'
33
+ when 'am_fernir'
34
+ return 'denis'
35
+ end
36
+ end
37
+
38
+ def self.default_studio_config
39
+ { active_camera: 'spot_1',
40
+ active_spot: 'spot_1',
41
+ studio: 'newsroom_green',
42
+ spot_1: 'brunette',
43
+ spot_2: 'denis',
44
+ spot_3: 'eve',
45
+ }
46
+ end
47
+
29
48
  private
30
49
 
31
50
  def set_slug