wco_models 3.1.0.152 → 3.1.0.154
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 +11 -10
- data/app/controllers/wco/profiles_controller.rb +21 -0
- data/app/controllers/wco/reports_controller.rb +2 -1
- data/app/controllers/wco/sites_controller.rb +5 -0
- data/app/controllers/wco/tags_controller.rb +1 -0
- data/app/models/wco/profile.rb +6 -0
- data/app/models/wco/report.rb +6 -2
- data/app/models/wco/site.rb +36 -0
- data/app/models/wco/tag.rb +2 -1
- data/app/models/wco_email/message.rb +2 -2
- data/app/models/wco_email/message_stub.rb +1 -1
- data/app/models/wco_hosting/appliance.rb +1 -1
- data/app/views/wco/galleries/_header.haml +1 -1
- data/app/views/wco/galleries/_index.haml +1 -1
- data/app/views/wco/leads/show.haml +1 -1
- data/app/views/wco/profiles/_form.haml +4 -0
- data/app/views/wco/profiles/new.haml +5 -0
- data/app/views/wco/reports/{_list.haml → _index.haml} +4 -3
- data/app/views/wco/reports/index.haml +1 -1
- data/app/views/wco/reports/show.haml +2 -3
- data/app/views/wco/sites/index.haml +8 -8
- data/app/views/wco/sites/show.haml +8 -0
- data/app/views/wco/tags/_form.haml +3 -0
- data/app/views/wco/tags/_header.haml +6 -5
- data/app/views/wco/tags/_list_chips.haml +1 -0
- data/app/views/wco/tags/show.haml +1 -1
- data/app/views/wco_email/conversations/_table.haml +1 -1
- data/lib/shortcuts.rb +11 -0
- data/lib/tasks/wp_tasks.rake +10 -0
- data/lib/wco/ai_writer.rb +1 -0
- metadata +9 -4
- /data/app/views/wco/tags/{_list_mini.haml → _index_chips.haml} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8214f97a78a923e7696ac257e51c35e82735e5f49ee72fb5323897c263494eed
|
4
|
+
data.tar.gz: 50a95c9ae5bc39baf0f5ed8c959b537219e6646accffd52f46577941c393835e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ee8c67d727e601dbf625f4309651d56611f147852e50091bb0f8144b4b25aa382a88268fce8475a975157a9fd01e97d8bc7bdc06c980dd02084fe47eb6683c9
|
7
|
+
data.tar.gz: 7356863e168fc520d0dd7ba14a9a4e02bd4b77b97b92a00df164569f0136162446a843189495fde59eac51d804cae0a93adccfc99b2a292aca8c6af579cb3bc1
|
@@ -1,14 +1,15 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
require_relative '../../../lib/shortcuts'
|
3
|
+
# EC ||= WcoEmail::Conversation
|
4
|
+
# EF ||= WcoEmail::EmailFilter
|
5
|
+
# EM ||= WcoEmail::Message
|
6
|
+
# ET ||= WcoEmail::EmailTemplate
|
7
|
+
# MS ||= WcoEmail::MessageStub
|
8
|
+
# EMS ||= MS
|
9
|
+
# OA ||= Wco::OfficeAction
|
10
|
+
# OAT ||= Wco::OfficeActionTemplate
|
11
|
+
# OATT ||= Wco::OfficeActionTemplateTie
|
12
|
+
# Sch ||= WcoEmail::EmailAction
|
12
13
|
|
13
14
|
class Wco::ApplicationController < ActionController::Base
|
14
15
|
include Wco::ApplicationHelper
|
@@ -1,6 +1,18 @@
|
|
1
1
|
|
2
2
|
class Wco::ProfilesController < Wco::ApplicationController
|
3
3
|
|
4
|
+
def create
|
5
|
+
@profile = Wco::Profile.new params[:profile].permit!
|
6
|
+
authorize! :create, @profile
|
7
|
+
if @profile.save
|
8
|
+
flash_notice @profile
|
9
|
+
redirect_to action: :index
|
10
|
+
else
|
11
|
+
flash_alert @profile
|
12
|
+
render action: 'new'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
4
16
|
def edit
|
5
17
|
@profile = Wco::Profile.find params[:id]
|
6
18
|
authorize! :update, @profile
|
@@ -9,6 +21,15 @@ class Wco::ProfilesController < Wco::ApplicationController
|
|
9
21
|
def index
|
10
22
|
@profiles = Wco::Profile.all
|
11
23
|
authorize! :index, Wco::Profile
|
24
|
+
if params[:q]
|
25
|
+
q = URI.decode(params[:q])
|
26
|
+
@profiles = @profiles.where({ email: /#{q}/i })
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def new
|
31
|
+
@new_profile = Wco::Profile.new
|
32
|
+
authorize! :new, @new_profile
|
12
33
|
end
|
13
34
|
|
14
35
|
def update
|
@@ -8,6 +8,7 @@ class Wco::ReportsController < Wco::ApplicationController
|
|
8
8
|
|
9
9
|
@report = Wco::Report.new params[:report].permit!
|
10
10
|
authorize! :create, @report
|
11
|
+
@report.author = current_profile
|
11
12
|
if @report.save
|
12
13
|
flash_notice "created report"
|
13
14
|
else
|
@@ -34,7 +35,7 @@ class Wco::ReportsController < Wco::ApplicationController
|
|
34
35
|
|
35
36
|
def index
|
36
37
|
authorize! :index, Wco::Report
|
37
|
-
@reports = Wco::Report.all
|
38
|
+
@reports = Wco::Report.all.page( params[:reports_page] ).per( current_profile.per_page )
|
38
39
|
if params[:deleted]
|
39
40
|
@reports = Wco::Report.unscoped.where( :deleted_at.ne => nil )
|
40
41
|
end
|
@@ -38,6 +38,11 @@ class Wco::SitesController < Wco::ApplicationController
|
|
38
38
|
@new_site = Wco::Site.new
|
39
39
|
end
|
40
40
|
|
41
|
+
def show
|
42
|
+
@site = Wco::Site.find params[:id]
|
43
|
+
authorize! :show, @site
|
44
|
+
end
|
45
|
+
|
41
46
|
def update
|
42
47
|
@site = Wco::Site.find params[:id]
|
43
48
|
authorize! :update, @site
|
data/app/models/wco/profile.rb
CHANGED
@@ -12,6 +12,8 @@ class Wco::Profile
|
|
12
12
|
field :per_page, type: :integer, default: 25
|
13
13
|
field :show_n_thumbs, type: :integer, default: 8
|
14
14
|
|
15
|
+
has_many :reports, class_name: 'Wco::Report'
|
16
|
+
|
15
17
|
belongs_to :leadset, class_name: 'Wco::Leadset', inverse_of: :profile, optional: true
|
16
18
|
has_many :newsitems, class_name: 'Wco::Newsitem'
|
17
19
|
has_and_belongs_to_many :shared_galleries, class_name: 'Wco::Gallery', inverse_of: :shared_profiles
|
@@ -24,6 +26,10 @@ class Wco::Profile
|
|
24
26
|
[nil] + ROLES
|
25
27
|
end
|
26
28
|
|
29
|
+
def self.ai_writer
|
30
|
+
find_or_create_by email: 'ai-writer@wasya.co'
|
31
|
+
end
|
32
|
+
|
27
33
|
def to_s
|
28
34
|
email
|
29
35
|
end
|
data/app/models/wco/report.rb
CHANGED
@@ -10,11 +10,12 @@ class Wco::Report
|
|
10
10
|
store_in collection: 'wco_reports'
|
11
11
|
|
12
12
|
field :title
|
13
|
-
validates :title, presence: true, uniqueness: true
|
13
|
+
validates :title, presence: true # , uniqueness: true
|
14
14
|
index({ title: 1 }, { unique: true })
|
15
15
|
def name ; title ; end
|
16
16
|
|
17
17
|
field :subtitle
|
18
|
+
field :legacy_id, type: String
|
18
19
|
|
19
20
|
field :slug
|
20
21
|
validates :slug, presence: true, uniqueness: true
|
@@ -27,7 +28,10 @@ class Wco::Report
|
|
27
28
|
field :y, :type => Float
|
28
29
|
field :z, :type => Float
|
29
30
|
|
30
|
-
|
31
|
+
belongs_to :author, class_name: 'Wco::Profile'
|
32
|
+
|
33
|
+
# has_one :image_thumb
|
34
|
+
# has_one :image_hero
|
31
35
|
|
32
36
|
has_and_belongs_to_many :tags
|
33
37
|
|
data/app/models/wco/site.rb
CHANGED
@@ -16,6 +16,7 @@ class Wco::Site
|
|
16
16
|
|
17
17
|
has_many :publishers # , class_name: 'Wco::Publisher'
|
18
18
|
has_many :headlines # , class_name: 'Wco::Newstitle'
|
19
|
+
has_many :tags, class_name: 'Wco::Tag'
|
19
20
|
|
20
21
|
field :slug
|
21
22
|
validates :slug, presence: true, uniqueness: true
|
@@ -65,4 +66,39 @@ class Wco::Site
|
|
65
66
|
)
|
66
67
|
end
|
67
68
|
|
69
|
+
def wp_import
|
70
|
+
site = self
|
71
|
+
|
72
|
+
root_tag = Wco::Tag.find_or_create_by slug: "#{site.slug}_wp-import", site_id: site.id
|
73
|
+
url = "#{site.origin}/wp-json/wp/v2/posts"
|
74
|
+
pi_admin = Wco::Profile.find_or_create_by email: 'admin@piousbox.com'
|
75
|
+
n_pages = 12
|
76
|
+
per_page = 100
|
77
|
+
|
78
|
+
(1..n_pages).each do |page|
|
79
|
+
print "Page #{page}"
|
80
|
+
|
81
|
+
posts = HTTParty.get url, query: { per_page: per_page, page: page }
|
82
|
+
posts.each do |post|
|
83
|
+
report = Wco::Report.new({
|
84
|
+
legacy_id: post['id'],
|
85
|
+
created_at: post['date'],
|
86
|
+
slug: post['link'].sub(site.origin, ''),
|
87
|
+
title: post['title']['rendered'],
|
88
|
+
subtitle: post['excerpt']['rendered'],
|
89
|
+
body: post['content']['rendered'],
|
90
|
+
author: pi_admin,
|
91
|
+
tag_ids: ( [ root_tag ] + site.tags.where( :legacy_id.in => post['categories'] ) ).map(&:id),
|
92
|
+
})
|
93
|
+
|
94
|
+
if report.save
|
95
|
+
print '^'
|
96
|
+
else
|
97
|
+
puts report.errors.messages
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
puts "ok"
|
102
|
+
end
|
103
|
+
|
68
104
|
end
|
data/app/models/wco/tag.rb
CHANGED
@@ -9,9 +9,10 @@ class Wco::Tag
|
|
9
9
|
validates :slug, presence: true, uniqueness: true
|
10
10
|
index({ slug: -1 })
|
11
11
|
|
12
|
-
belongs_to :parent, class_name: 'Wco::Tag', inverse_of: :sons
|
12
|
+
belongs_to :parent, class_name: 'Wco::Tag', inverse_of: :sons, optional: true
|
13
13
|
has_many :sons, class_name: 'Wco::Tag', inverse_of: :parent
|
14
14
|
|
15
|
+
belongs_to :site, class_name: 'Wco::Site', optional: true
|
15
16
|
has_many :email_filters, class_name: 'WcoEmail::EmailFilter', inverse_of: :tag
|
16
17
|
|
17
18
|
has_and_belongs_to_many :conversations, class_name: 'WcoEmail::Conversation', index: true
|
@@ -70,7 +70,7 @@ class WcoEmail::Message
|
|
70
70
|
field :date, type: DateTime
|
71
71
|
def received_at ; date ; end
|
72
72
|
|
73
|
-
belongs_to :conversation, class_name: 'WcoEmail::Conversation'
|
73
|
+
belongs_to :conversation, class_name: 'WcoEmail::Conversation', index: true
|
74
74
|
def conv ; conversation ; end
|
75
75
|
|
76
76
|
belongs_to :stub, class_name: 'WcoEmail::MessageStub'
|
@@ -80,7 +80,7 @@ class WcoEmail::Message
|
|
80
80
|
has_many :replies, class_name: '::WcoEmail::Context', inverse_of: :reply_to_message
|
81
81
|
|
82
82
|
def apply_filter filter
|
83
|
-
puts! filter, 'WcoEmail::Message#apply_filter'
|
83
|
+
puts! filter, 'WcoEmail::Message#apply_filter' if DEBUG
|
84
84
|
conv.filter = filter
|
85
85
|
|
86
86
|
case filter.kind
|
@@ -12,7 +12,7 @@
|
|
12
12
|
%i.material-icons visibility_off
|
13
13
|
= render 'meta', :item => gallery
|
14
14
|
|
15
|
-
= render '/wco/tags/
|
15
|
+
= render '/wco/tags/list_chips', tags: gallery.tags, resource: gallery
|
16
16
|
|
17
17
|
%ul
|
18
18
|
%li slug :: #{gallery.slug}
|
@@ -49,7 +49,7 @@
|
|
49
49
|
.col-md-6.schs
|
50
50
|
%h5
|
51
51
|
Email Actions (#{@lead.schs.length})
|
52
|
-
= link_to '[+]', wco_email.new_email_action_path(lead_id: @lead.id)
|
52
|
+
= link_to '[+]', wco_email.new_email_action_path(lead_id: @lead.id) if defined?(wco_email)
|
53
53
|
%ul
|
54
54
|
- @lead.schs.each do |sch|
|
55
55
|
%li
|
@@ -1,7 +1,8 @@
|
|
1
1
|
|
2
2
|
- config ||= {}
|
3
3
|
|
4
|
-
.reports--
|
4
|
+
.reports--index
|
5
|
+
= paginate reports, :param_name => :reports_page, :views_prefix => 'wco'
|
5
6
|
%ul
|
6
7
|
- reports.each do |ttt|
|
7
8
|
%li.Card
|
@@ -15,5 +16,5 @@
|
|
15
16
|
.gray.mini= ttt.id
|
16
17
|
- if !config[:skip_tags]
|
17
18
|
.flex-row
|
18
|
-
= render '/wco/tags/
|
19
|
-
|
19
|
+
= render '/wco/tags/list_chips', tags: ttt.tags
|
20
|
+
= paginate reports, :param_name => :reports_page, :views_prefix => 'wco'
|
@@ -11,14 +11,14 @@
|
|
11
11
|
-# %th kind
|
12
12
|
%th origin
|
13
13
|
-# %th post_path
|
14
|
-
- @sites.each do |
|
14
|
+
- @sites.each do |site|
|
15
15
|
%tr
|
16
16
|
%td
|
17
17
|
.flex-row
|
18
|
-
= button_to '[x]', site_path(
|
19
|
-
= link_to '[~]', edit_site_path(
|
20
|
-
.gray.mini=
|
21
|
-
%td=
|
22
|
-
-# %td=
|
23
|
-
%td=
|
24
|
-
-# %td=
|
18
|
+
= button_to '[x]', site_path(site), method: :delete, data: { confirm: 'Are you sure?' }
|
19
|
+
= link_to '[~]', edit_site_path(site)
|
20
|
+
.gray.mini= site.id
|
21
|
+
%td= link_to site.slug, site_path(site)
|
22
|
+
-# %td= site.kind
|
23
|
+
%td= site.origin
|
24
|
+
-# %td= site.post_path
|
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
.
|
4
|
-
|
5
|
-
=
|
6
|
-
=
|
2
|
+
.d-flex
|
3
|
+
= link_to "Tags (#{Wco::Tag.all.length})", wco.tags_path
|
4
|
+
.inline-search
|
5
|
+
= form_tag wco.tags_path, method: :get do
|
6
|
+
= text_field_tag :q
|
7
|
+
= link_to '[+]', wco.new_tag_path
|
@@ -0,0 +1 @@
|
|
1
|
+
app/views/wco/tags/_index_chips.haml
|
@@ -22,4 +22,4 @@
|
|
22
22
|
= render 'wco/galleries/index', galleries: @galleries, config: { skip_tags: true }
|
23
23
|
%li.d-flex
|
24
24
|
<b>Reports (#{@reports.length}): </b>
|
25
|
-
= render 'wco/reports/
|
25
|
+
= render 'wco/reports/index', reports: @reports, config: { skip_tags: true }
|
@@ -40,7 +40,7 @@
|
|
40
40
|
-# = render '/wco_email/contexts/form_reply_mini', lead_id: msg.lead_id, message: msg, ctx: WcoEmail::Context.new({ from_email: msg.to&.downcase, subject: msg.subject, email_template_id: ET.find_by( slug: 'blank').id })
|
41
41
|
|
42
42
|
%td.tags.mini
|
43
|
-
= render '/wco/tags/
|
43
|
+
= render '/wco/tags/list_chips', tags: conv.tags, cache_key: conv.cache_key, config: OpenStruct.new( without_checkbox: true )
|
44
44
|
%td.latest-at
|
45
45
|
= pp_date conv.latest_at
|
46
46
|
= pp_time conv.latest_at
|
data/lib/shortcuts.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
|
2
|
+
EC ||= WcoEmail::Conversation
|
3
|
+
EF ||= WcoEmail::EmailFilter
|
4
|
+
EM ||= WcoEmail::Message
|
5
|
+
ET ||= WcoEmail::EmailTemplate
|
6
|
+
MS ||= WcoEmail::MessageStub
|
7
|
+
EMS ||= MS
|
8
|
+
OA ||= Wco::OfficeAction
|
9
|
+
OAT ||= Wco::OfficeActionTemplate
|
10
|
+
OATT ||= Wco::OfficeActionTemplateTie
|
11
|
+
Sch ||= WcoEmail::EmailAction
|
data/lib/wco/ai_writer.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.154
|
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-04-
|
11
|
+
date: 2024-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|
@@ -583,6 +583,7 @@ files:
|
|
583
583
|
- app/views/wco/profiles/_header.haml
|
584
584
|
- app/views/wco/profiles/edit.haml
|
585
585
|
- app/views/wco/profiles/index.haml
|
586
|
+
- app/views/wco/profiles/new.haml
|
586
587
|
- app/views/wco/publishers/_form.haml
|
587
588
|
- app/views/wco/publishers/_header.haml
|
588
589
|
- app/views/wco/publishers/edit.haml
|
@@ -590,7 +591,7 @@ files:
|
|
590
591
|
- app/views/wco/publishers/new.haml
|
591
592
|
- app/views/wco/reports/_form.haml
|
592
593
|
- app/views/wco/reports/_header.haml
|
593
|
-
- app/views/wco/reports/
|
594
|
+
- app/views/wco/reports/_index.haml
|
594
595
|
- app/views/wco/reports/edit.haml
|
595
596
|
- app/views/wco/reports/index.haml
|
596
597
|
- app/views/wco/reports/index_table.haml
|
@@ -601,10 +602,12 @@ files:
|
|
601
602
|
- app/views/wco/sites/edit.haml
|
602
603
|
- app/views/wco/sites/index.haml
|
603
604
|
- app/views/wco/sites/new.haml
|
605
|
+
- app/views/wco/sites/show.haml
|
604
606
|
- app/views/wco/tags/_form.haml
|
605
607
|
- app/views/wco/tags/_header.haml
|
606
608
|
- app/views/wco/tags/_index.haml
|
607
|
-
- app/views/wco/tags/
|
609
|
+
- app/views/wco/tags/_index_chips.haml
|
610
|
+
- app/views/wco/tags/_list_chips.haml
|
608
611
|
- app/views/wco/tags/edit.haml
|
609
612
|
- app/views/wco/tags/index.haml
|
610
613
|
- app/views/wco/tags/new.haml
|
@@ -659,8 +662,10 @@ files:
|
|
659
662
|
- app/views/wco_hosting/scripts/nginx_site.conf.erb
|
660
663
|
- config/initializers/assets.rb
|
661
664
|
- config/routes.rb
|
665
|
+
- lib/shortcuts.rb
|
662
666
|
- lib/tasks/db_tasks.rake
|
663
667
|
- lib/tasks/office_tasks.rake
|
668
|
+
- lib/tasks/wp_tasks.rake
|
664
669
|
- lib/wco/ai_writer.rb
|
665
670
|
- lib/wco/engine.rb
|
666
671
|
- lib/wco/office_worker.rb
|
File without changes
|