wco_models 3.4.0.6 → 3.4.0.8
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 +4 -4
- data/app/assets/stylesheets/wco/main.scss +4 -1
- data/app/assets/stylesheets/wco/photos.scss +2 -1
- data/app/controllers/wco/publishers_controller.rb +6 -2
- data/app/models/wco/publisher.rb +17 -4
- data/app/models/wco/report.rb +5 -1
- data/app/models/wco/tag.rb +7 -2
- data/app/views/wco/publishers/_form.haml +6 -1
- data/app/views/wco/reports/_index.haml +18 -11
- data/app/views/wco/reports/show.haml +6 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9416b8c8dcbcdec99e0c9206732e1d22ccc368f378720afb3efda5627fdf0e3a
|
|
4
|
+
data.tar.gz: 5d56ddb08a45ba4f303e2a096ffcf5184a6712e8814e36505496f62ceec62241
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa9d7c2227ca38d60f2517bc7f7769422ef537cfaf27d1a7e92f7dfb924097151c5a8f0afbda50c3568d05024a408451ddd866aa4ae3916680a21f99d75cdb7a
|
|
7
|
+
data.tar.gz: b6f37b0c7c3ac3275bc805296b5b30073742eb4ec2b1df05af098a7601a1a02913cadb72c2ca27a157539132231e9f8fd133a409d63aeb83ce186fd7a2ca11c4
|
|
@@ -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
|
|
data/app/models/wco/publisher.rb
CHANGED
|
@@ -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,20 +26,26 @@ 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
|
|
|
25
33
|
def do_run
|
|
26
|
-
publisher = self
|
|
34
|
+
@publisher = publisher = self
|
|
27
35
|
|
|
28
|
-
@site = site
|
|
36
|
+
@site = publisher.site
|
|
29
37
|
@headers = {}
|
|
30
38
|
@ctx = OpenStruct.new
|
|
31
39
|
|
|
32
|
-
puts! context_eval, 'context_eval'
|
|
33
|
-
eval( context_eval )
|
|
40
|
+
puts! publisher.context_eval, 'context_eval'
|
|
41
|
+
eval( publisher.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'
|
data/app/models/wco/report.rb
CHANGED
|
@@ -25,7 +25,11 @@ class Wco::Report
|
|
|
25
25
|
|
|
26
26
|
field :body
|
|
27
27
|
def body_json
|
|
28
|
-
|
|
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
|
|
30
34
|
FORMAT_PLAINTEXT = 'format-plaintext'
|
|
31
35
|
FORMAT_FULLHTML = 'format-fullhtml'
|
data/app/models/wco/tag.rb
CHANGED
|
@@ -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
|
-
|
|
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 { |
|
|
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, @publisher, @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
|
|
@@ -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 |
|
|
6
|
+
- reports.each do |report|
|
|
7
7
|
.Card
|
|
8
|
-
.flex-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
=
|
|
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
|
-
|
|
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.
|
|
4
|
+
version: 3.4.0.8
|
|
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-
|
|
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
|