wco_models 3.4.0.5 → 3.4.0.7

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: f0bb6771d05e882c4932770f8c12855ae9963030689e18ec2f5395d357e1d045
4
- data.tar.gz: 623682dbcff63dabe928ae7c2783e793ae341c5a54957d60a703b74b8598abbc
3
+ metadata.gz: 6ef24908267939f55a22c88d1b022ca293b985ad0a32da5f01a4f528679c6358
4
+ data.tar.gz: 1f297824e345b3e6cb9e03f6dcb743b711619e523f4e0a94fb1978305c1b4bd1
5
5
  SHA512:
6
- metadata.gz: 314511fdd0abade9ea2466385f22703173b2ddaa6526efb5f88844697b762fd483d51014fbee9bc6c0e2e76a3d6833f29bf0ed008efe8f58952f971fd229ff45
7
- data.tar.gz: 638e823d9431c1235c8db0d24538780fb96d272328380854c5e572023baaddee1a87d584de8a36d001bec665de939ea5329876a65e34443321c24969f30a3a34
6
+ metadata.gz: 7a5341afd4417a5da9c157ce93e56f09bb443526ed7f2cc6b6812ea4328d95d58d7d2f948412a0a15ac60f748ee9b8216a05541ad77e7557fce4607cb4680c34
7
+ data.tar.gz: f066464898892187c146167ba6cd0889231abae7ac1a48118105dd0bc801ef032a08a64603b914f46b117d197b37d8f690d228adf8f924b6f7615a65af8a15b0
@@ -117,7 +117,10 @@ textarea.monospace {
117
117
  /* D */
118
118
 
119
119
  .d-flex {
120
- align-items: baseline;
120
+ align-items: baseline; /* 2026-11-12: I dont want this alignment */
121
+ }
122
+ .no-align {
123
+ align-items: unset;
121
124
  }
122
125
 
123
126
  .descr {
@@ -10,10 +10,11 @@
10
10
 
11
11
  div.thumb {
12
12
  margin: 0 0.5em 0.5em 0;
13
+ flex-shrink: 0;
13
14
  }
14
15
 
15
16
  .photos-thumbs img,
16
- img.thumb {
17
+ .thumb {
17
18
  border: 1px solid red;
18
19
  width: 100px;
19
20
  height: 100px;
@@ -17,9 +17,13 @@ class Wco::PublishersController < Wco::ApplicationController
17
17
  authorize! :do_run, @publisher
18
18
 
19
19
  @publisher.props = OpenStruct.new( JSON.parse params[:props] )
20
- @publisher.do_run
20
+ flag = @publisher.do_run
21
+ if !flag
22
+ flash_alert @publisher.errors
23
+ else
24
+ flash_notice "#do_run_any Probably ok"
25
+ end
21
26
 
22
- flash_notice "#do_run_any Probably ok"
23
27
  redirect_to request.referrer || { action: 'index' }
24
28
  end
25
29
 
@@ -1,4 +1,11 @@
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
+
2
9
  class Wco::Publisher
3
10
  include Mongoid::Document
4
11
  include Mongoid::Timestamps
@@ -19,6 +26,7 @@ class Wco::Publisher
19
26
  field :post_path
20
27
 
21
28
  has_many :oats, class_name: 'Wco::OfficeActionTemplate'
29
+ has_and_belongs_to_many :tags
22
30
 
23
31
  attr_accessor :props
24
32
 
@@ -33,6 +41,11 @@ class Wco::Publisher
33
41
  eval( context_eval )
34
42
  puts! @ctx, '@ctx'
35
43
 
44
+ if @abort
45
+ errors.add(:base, 'aborted')
46
+ return false
47
+ end
48
+
36
49
  tmpl = ERB.new publisher.post_body_tmpl
37
50
  body = JSON.parse tmpl.result(binding)
38
51
  puts! body, 'body'
@@ -25,8 +25,16 @@ class Wco::Report
25
25
 
26
26
  field :body
27
27
  def body_json
28
- body.gsub(/\r/, '').gsub(/\n\n+/, '<br /><br />').to_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
29
33
  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
30
38
 
31
39
  field :x, :type => Float
32
40
  field :y, :type => Float
@@ -29,6 +29,7 @@ class Wco::Tag
29
29
  has_and_belongs_to_many :message_stubs, class_name: '::WcoEmail::MessageStub'
30
30
  has_and_belongs_to_many :newsvideos, class_name: '::Wco::Newsvideo'
31
31
  has_and_belongs_to_many :reports, class_name: '::Wco::Report'
32
+ has_and_belongs_to_many :publishers, class_name: '::Wco::Publisher'
32
33
  has_and_belongs_to_many :videos, class_name: '::Wco::Video'
33
34
 
34
35
 
@@ -73,9 +74,13 @@ class Wco::Tag
73
74
 
74
75
 
75
76
  def to_s
76
- slug
77
+ if site
78
+ "#{slug}@#{site}"
79
+ else
80
+ slug
81
+ end
77
82
  end
78
83
  def self.list
79
- [[nil,nil]] + all.order_by( slug: :asc ).map { |p| [ p.slug, p.id ] }
84
+ [[nil,nil]] + all.includes(:site).order_by( slug: :asc ).map { |t| [ t.to_s, t.id.to_s ] }
80
85
  end
81
86
  end
@@ -23,7 +23,7 @@
23
23
  .field.d-flex.flex-column
24
24
  %label.d-block context_eval
25
25
  .descr
26
- @headers, @props
26
+ @abort, @headers, @props, @site
27
27
  = f.text_area :context_eval, class: 'monospace'
28
28
  .field.d-flex.flex-column
29
29
  %label.d-block post_body_tmpl
@@ -33,5 +33,10 @@
33
33
  .field
34
34
  %label.d-block after_eval
35
35
  = f.text_area :after_eval, class: 'monospace'
36
+
37
+ .field
38
+ %label Tags (#{publisher.tags.length}):
39
+ = f.select :tag_ids, options_for_select(@tags_list, selected: publisher.tag_ids), {}, { multiple: true, class: 'select2' }
40
+
36
41
  .actions
37
42
  = f.submit
@@ -19,7 +19,10 @@
19
19
  %label Summary
20
20
  = f.text_area :summary
21
21
 
22
- .field
22
+ .field.d-flex.flex-column
23
+ %label body_format
24
+ = f.select :body_format, options_for_select(Wco::Report::FORMATS, selected: report.body_format)
25
+
23
26
  %label Body
24
27
  = f.text_area :body, class: 'tinymce'
25
28
 
@@ -33,9 +36,9 @@
33
36
  %label image
34
37
  = f.file_field :image_thumb
35
38
 
36
- - if report.image_thumb&.image?
39
+ - if report.image_thumb
37
40
  %p Current:
38
- = image_tag report.image_thumb.image.url(:thumb)
41
+ = image_tag report.image_thumb.photo.url(:thumb)
39
42
 
40
43
  -# .field
41
44
  -# %label Newsvideo:
@@ -3,17 +3,24 @@
3
3
 
4
4
  .reports--index
5
5
  = paginate reports, :param_name => :reports_page, :views_prefix => 'wco'
6
- - reports.each do |ttt|
6
+ - reports.each do |report|
7
7
  .Card
8
- .flex-row
9
- = button_to '[x]', report_path(ttt), method: :delete, data: { confirm: 'Are you sure?' }
10
- = link_to '[~]', edit_report_path(ttt)
11
- .a
12
- = link_to ttt.title, report_path(ttt)
13
- %br
14
- `#{ttt.slug}`
15
- .gray.mini= ttt.id
16
- - if !config[:skip_tags]
8
+ .d-flex.no-align
9
+ .thumb
10
+ - if report.image_thumb
11
+ = image_tag report.image_thumb.photo.url(:thumb)
12
+
13
+
17
14
  .flex-row
18
- = render '/wco/tags/list_chips', tags: ttt.tags
15
+ = button_to '[x]', report_path(report), method: :delete, data: { confirm: 'Are you sure?' }
16
+ = link_to '[~]', edit_report_path(report)
17
+ .a
18
+ = link_to report.title, report_path(report)
19
+ %br
20
+ .gray slug: `#{report.slug}`
21
+ .gray.mini= report.id
22
+ - if !config[:skip_tags]
23
+ .flex-row
24
+ = render '/wco/tags/list_chips', tags: report.tags
25
+
19
26
  = paginate reports, :param_name => :reports_page, :views_prefix => 'wco'
@@ -21,7 +21,12 @@
21
21
  %hr
22
22
  - if @report.image_thumb
23
23
  = image_tag @report.image_thumb.photo.url(:thumb)
24
- .descr= raw @report.body
24
+ = @report.body_format
25
+ .descr
26
+ - if @report.body_format == 'format-plaintext'
27
+ %pre= @report.body
28
+ - if @report.body_format == 'format-fullhtml'
29
+ = raw @report.body
25
30
  %hr
26
31
 
27
32
  .actions
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.4.0.5
4
+ version: 3.4.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-07 00:00:00.000000000 Z
11
+ date: 2026-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3