wco_models 3.1.0.81 → 3.1.0.83
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/wco/utils.scss +21 -0
- data/app/controllers/wco/galleries_controller.rb +3 -0
- data/app/controllers/wco/publishers_controller.rb +3 -1
- data/app/controllers/wco/reports_controller.rb +2 -2
- data/app/models/wco/publisher.rb +8 -38
- data/app/models/wco/report.rb +1 -4
- data/app/models/wco/utils.rb +1 -1
- data/app/models/wco_email/message.rb +5 -1
- data/app/views/wco/office_action_templates/_form.haml +8 -8
- data/app/views/wco/publishers/_form.haml +8 -3
- data/app/views/wco/publishers/index.haml +14 -17
- data/app/views/wco/reports/_form.haml +1 -1
- data/app/views/wco/reports/index.haml +7 -3
- data/app/views/wco/reports/show.haml +6 -1
- data/app/views/wco/sites/_form.haml +7 -4
- data/app/views/wco/sites/index.haml +6 -6
- data/app/views/wco/tags/_index.haml +1 -0
- data/app/views/wco/tags/_index_inline.haml +1 -1
- data/app/views/wco/tags/edit.haml +4 -0
- data/config/routes.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 136fd63ec2289135d50625c8ee250e34de0ba12757cec2a0d535264d8b3af9b4
|
4
|
+
data.tar.gz: f696b308e67bd35b454f11880fbf876d378c603983ae941396605ba0ca8e5a4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 125155b3a50dc0c7ae25c9dcb0f642ef3127bf13a3fa11040c91240deab4ef7bfd787d0ec73065b6c31f25a111c524637822d45bc0c6739ab8676833e826cd9d
|
7
|
+
data.tar.gz: e8c8f58699d02a209e9be4bfa177a987e40d67daa22db0535ade103f55dc4874ef8fb45c412ab1da49b5723996b4c734ce5cec1f48172bb6a41a22b5b73c2bae
|
@@ -62,6 +62,14 @@ table.bordered {
|
|
62
62
|
|
63
63
|
/* C */
|
64
64
|
|
65
|
+
.Card {
|
66
|
+
border: 1px solid gray;
|
67
|
+
border-radius: 5px;
|
68
|
+
|
69
|
+
padding: 0.5em;
|
70
|
+
margin: 0 0.5em 0.5em 0;
|
71
|
+
}
|
72
|
+
|
65
73
|
.code,
|
66
74
|
.mono,
|
67
75
|
.monospace {
|
@@ -149,3 +157,16 @@ h5.title {
|
|
149
157
|
word-break: break-word;
|
150
158
|
}
|
151
159
|
|
160
|
+
/* W */
|
161
|
+
|
162
|
+
.w-300px {
|
163
|
+
width: 300px;
|
164
|
+
}
|
165
|
+
|
166
|
+
.w-400px {
|
167
|
+
width: 400px;
|
168
|
+
}
|
169
|
+
|
170
|
+
.w-500px {
|
171
|
+
width: 500px;
|
172
|
+
}
|
@@ -7,6 +7,8 @@ class Wco::GalleriesController < Wco::ApplicationController
|
|
7
7
|
# Alphabetized! : )
|
8
8
|
|
9
9
|
def create
|
10
|
+
params[:gallery][:tag_ids]&.delete ''
|
11
|
+
|
10
12
|
# params[:gallery][:shared_profiles] ||= []
|
11
13
|
# params[:gallery][:shared_profiles].delete('')
|
12
14
|
# params[:gallery][:shared_profiles] = Wco::Profile.find params[:gallery][:shared_profiles]
|
@@ -99,6 +101,7 @@ class Wco::GalleriesController < Wco::ApplicationController
|
|
99
101
|
end
|
100
102
|
|
101
103
|
def update
|
104
|
+
params[:gallery][:tag_ids]&.delete ''
|
102
105
|
authorize! :update, @gallery
|
103
106
|
|
104
107
|
old_shared_profile_ids = @gallery.shared_profiles.map(&:id)
|
@@ -20,7 +20,9 @@ class Wco::PublishersController < Wco::ApplicationController
|
|
20
20
|
@publisher = Wco::Publisher.find params[:id]
|
21
21
|
authorize! :do_run, @publisher
|
22
22
|
|
23
|
-
@publisher.
|
23
|
+
@publisher.props = OpenStruct.new( JSON.parse params[:publisher][:props] )
|
24
|
+
# @publisher.do_run binding
|
25
|
+
@publisher.do_run
|
24
26
|
|
25
27
|
flash_notice "Probably ok"
|
26
28
|
|
@@ -4,7 +4,7 @@ class Wco::ReportsController < Wco::ApplicationController
|
|
4
4
|
before_action :set_lists
|
5
5
|
|
6
6
|
def create
|
7
|
-
params[:report][:tag_ids]
|
7
|
+
params[:report][:tag_ids]&.delete ''
|
8
8
|
|
9
9
|
@report = Wco::Report.new params[:report].permit!
|
10
10
|
authorize! :create, @report
|
@@ -51,7 +51,7 @@ class Wco::ReportsController < Wco::ApplicationController
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def update
|
54
|
-
params[:report][:tag_ids]
|
54
|
+
params[:report][:tag_ids]&.delete ''
|
55
55
|
|
56
56
|
@report = Wco::Report.unscoped.find params[:id]
|
57
57
|
authorize! :update, @report
|
data/app/models/wco/publisher.rb
CHANGED
@@ -17,14 +17,17 @@ class Wco::Publisher
|
|
17
17
|
field :context_eval
|
18
18
|
field :after_eval
|
19
19
|
field :post_body_tmpl
|
20
|
+
field :post_path
|
20
21
|
|
21
22
|
has_many :oats, class_name: 'Wco::OfficeActionTemplate'
|
22
23
|
|
23
|
-
|
24
|
+
attr_accessor :props
|
25
|
+
|
24
26
|
def do_run
|
25
|
-
@
|
27
|
+
@site = site
|
28
|
+
@headers = {}
|
29
|
+
@ctx = OpenStruct.new
|
26
30
|
|
27
|
-
@ctx = OpenStruct.new
|
28
31
|
eval( context_eval )
|
29
32
|
puts! @ctx, '@ctx'
|
30
33
|
|
@@ -32,14 +35,9 @@ class Wco::Publisher
|
|
32
35
|
body = JSON.parse tmpl.result(binding)
|
33
36
|
puts! body, 'body'
|
34
37
|
|
35
|
-
|
36
|
-
if Wco::Site::KIND_DRUPAL == site.kind
|
37
|
-
headers['Content-Type'] = 'application/hal+json'
|
38
|
-
end
|
39
|
-
|
40
|
-
out = Wco::HTTParty.post( "#{site.origin}#{site.post_path}", {
|
38
|
+
out = Wco::HTTParty.post( "#{@site.origin}#{post_path}", {
|
41
39
|
body: body.to_json,
|
42
|
-
headers: headers,
|
40
|
+
headers: @headers,
|
43
41
|
basic_auth: { username: site.username, password: site.password },
|
44
42
|
})
|
45
43
|
puts! out.response, 'out'
|
@@ -47,33 +45,6 @@ class Wco::Publisher
|
|
47
45
|
eval( after_eval )
|
48
46
|
end
|
49
47
|
|
50
|
-
def publish_report report
|
51
|
-
@report = report
|
52
|
-
@site = site
|
53
|
-
|
54
|
-
@ctx = OpenStruct.new
|
55
|
-
eval( context_eval )
|
56
|
-
puts! @ctx, '@ctx'
|
57
|
-
|
58
|
-
|
59
|
-
tmpl = ERB.new post_body_tmpl
|
60
|
-
body = JSON.parse tmpl.result(binding)
|
61
|
-
puts! body, 'body'
|
62
|
-
|
63
|
-
headers = {}
|
64
|
-
if Wco::Site::KIND_DRUPAL == site.kind
|
65
|
-
headers['Content-Type'] = 'application/hal+json'
|
66
|
-
end
|
67
|
-
|
68
|
-
out = Wco::HTTParty.post( "#{site.origin}#{site.post_path}", {
|
69
|
-
body: body.to_json,
|
70
|
-
headers: headers,
|
71
|
-
basic_auth: { username: site.username, password: site.password },
|
72
|
-
})
|
73
|
-
puts! out.response, 'out'
|
74
|
-
|
75
|
-
eval( after_eval )
|
76
|
-
end
|
77
48
|
|
78
49
|
def to_s
|
79
50
|
"#{slug}: #{kind} => #{site}"
|
@@ -82,7 +53,6 @@ class Wco::Publisher
|
|
82
53
|
def self.list
|
83
54
|
[[nil,nil]] + all.map { |p| [p, p.id] }
|
84
55
|
end
|
85
|
-
|
86
56
|
end
|
87
57
|
|
88
58
|
=begin
|
data/app/models/wco/report.rb
CHANGED
@@ -14,6 +14,7 @@ class Wco::Report
|
|
14
14
|
field :title
|
15
15
|
validates :title, presence: true, uniqueness: true
|
16
16
|
index({ title: 1 }, { unique: true })
|
17
|
+
def name ; title ; end
|
17
18
|
|
18
19
|
field :subtitle
|
19
20
|
|
@@ -39,10 +40,6 @@ class Wco::Report
|
|
39
40
|
|
40
41
|
# has_one :photo
|
41
42
|
|
42
|
-
def export_fields
|
43
|
-
%w| name descr |
|
44
|
-
end
|
45
|
-
|
46
43
|
has_and_belongs_to_many :tags
|
47
44
|
|
48
45
|
end
|
data/app/models/wco/utils.rb
CHANGED
@@ -105,7 +105,11 @@ class WcoEmail::Message
|
|
105
105
|
})
|
106
106
|
|
107
107
|
when WcoEmail::EmailFilter::KIND_AUTORESPOND_EACT
|
108
|
-
|
108
|
+
##
|
109
|
+
## This error is normal:
|
110
|
+
## Mongoid::Errors::Validations `Email action template is already taken`
|
111
|
+
##
|
112
|
+
out = Sch.create({
|
109
113
|
email_action_template: filter.email_action_template,
|
110
114
|
status: Sch::STATUS_ACTIVE,
|
111
115
|
lead_id: lead.id,
|
@@ -13,14 +13,14 @@
|
|
13
13
|
%label action_exe
|
14
14
|
= f.text_area :action_exe, class: :monospace
|
15
15
|
|
16
|
-
.field.flex-row
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
.field.flex-row
|
22
|
-
|
23
|
-
|
16
|
+
-# .field.flex-row
|
17
|
+
-# %label From
|
18
|
+
-# = f.select :from_type, options_for_select( @from_types_list, selected: params[:from_type] || oat.from_type )
|
19
|
+
-# = f.select :from_id, options_for_select( @from_ids_list ), {}, class: 'select2'
|
20
|
+
|
21
|
+
-# .field.flex-row
|
22
|
+
-# %label Publisher
|
23
|
+
-# = f.select :publisher, options_for_select( @publishers_list, selected: oat.publisher ), {}, class: 'select2'
|
24
24
|
|
25
25
|
.row
|
26
26
|
.col-md-4
|
@@ -1,9 +1,11 @@
|
|
1
1
|
|
2
2
|
.publishers--form
|
3
3
|
= form_for publisher do |f|
|
4
|
-
.
|
4
|
+
.actions
|
5
|
+
= f.submit
|
6
|
+
.d-flex
|
5
7
|
= f.label :slug
|
6
|
-
= f.text_field :slug
|
8
|
+
= f.text_field :slug, class: 'w-100'
|
7
9
|
|
8
10
|
-## this is unnecessary b/c I use eval() :
|
9
11
|
-# .field
|
@@ -12,9 +14,12 @@
|
|
12
14
|
-# = f.label :from_gallery
|
13
15
|
-# = f.select :from_gallery, options_for_select( @galleries_list, selected: publisher.from_gallery ), class: 'select2'
|
14
16
|
|
15
|
-
.
|
17
|
+
.d-flex
|
16
18
|
%label site
|
17
19
|
= f.select :site, options_for_select( @sites_list, selected: publisher.site_id ), {}, class: 'select2'
|
20
|
+
.d-flex
|
21
|
+
%label post_path
|
22
|
+
= f.text_field :post_path, class: 'w-100'
|
18
23
|
.field
|
19
24
|
%label.d-block context_eval
|
20
25
|
= f.text_area :context_eval, class: 'monospace'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
.publishers-index.
|
2
|
+
.publishers-index.maxwidth
|
3
3
|
%h5
|
4
4
|
Publishers
|
5
5
|
= link_to '[+]', wco.new_publisher_path
|
@@ -9,29 +9,26 @@
|
|
9
9
|
%th
|
10
10
|
%th
|
11
11
|
slug
|
12
|
-
|
12
|
+
%th
|
13
13
|
site
|
14
14
|
%th
|
15
|
-
|
16
|
-
%br
|
17
|
-
post_body_eval
|
15
|
+
Run
|
18
16
|
- @publishers.each do |item|
|
19
17
|
%tr
|
20
18
|
%td
|
21
19
|
.flex-row
|
22
|
-
= button_to '
|
20
|
+
= button_to 'x', wco.publisher_path(item), method: :delete, data: { confirm: 'Are you sure?' }
|
23
21
|
= link_to '[~]', wco.edit_publisher_path(item)
|
24
|
-
= button_to '[run]', wco.do_run_publisher_path( item ), data: { confirm: 'Are you sure?' }
|
25
22
|
%td
|
23
|
+
-# = link_to item.slug, publisher_path(item)
|
26
24
|
= item.slug
|
27
|
-
%hr
|
28
|
-
= item.site.origin
|
29
25
|
%td
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
26
|
+
= link_to '[~]', edit_site_path(item.site)
|
27
|
+
-# = link_to item.site.origin, site_path(item.site)
|
28
|
+
= item.site
|
29
|
+
%td
|
30
|
+
.Card
|
31
|
+
= form_for item, url: wco.run_publisher_path( item ), method: :post do |f|
|
32
|
+
%label props
|
33
|
+
= f.text_field :props, class: 'w-400px'
|
34
|
+
= f.submit 'run', data: { confirm: 'Are you sure?' }
|
@@ -6,12 +6,16 @@
|
|
6
6
|
|
7
7
|
%ul
|
8
8
|
- @reports.each do |ttt|
|
9
|
-
%li
|
9
|
+
%li.Card
|
10
10
|
.flex-row
|
11
11
|
= button_to '[x]', report_path(ttt), method: :delete, data: { confirm: 'Are you sure?' }
|
12
12
|
= link_to '[~]', edit_report_path(ttt)
|
13
|
-
|
13
|
+
.a
|
14
|
+
= link_to ttt.title, report_path(ttt)
|
15
|
+
%br
|
16
|
+
`#{ttt.slug}`
|
17
|
+
.gray.mini= ttt.id
|
14
18
|
.flex-row
|
15
|
-
|
19
|
+
|
16
20
|
= render '/wco/tags/index_inline', tags: ttt.tags
|
17
21
|
|
@@ -1,6 +1,11 @@
|
|
1
1
|
|
2
2
|
.reports-show.maxwidth
|
3
|
-
%h5
|
3
|
+
%h5
|
4
|
+
= link_to '[~]', edit_report_path(@report)
|
5
|
+
Report #{link_to @report.title, report_path(@report)}
|
6
|
+
%br
|
7
|
+
`#{@report.slug}`
|
8
|
+
.gray.mini= @report.id
|
4
9
|
|
5
10
|
.descr= raw @report.body
|
6
11
|
-# %pre.descr= raw @report.body
|
@@ -1,17 +1,20 @@
|
|
1
1
|
|
2
2
|
.sites--form
|
3
3
|
= form_for site do |f|
|
4
|
+
.actions
|
5
|
+
= f.submit
|
4
6
|
.field
|
5
7
|
%label Slug
|
6
8
|
= f.text_field :slug
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
+
-# = f.label :kind
|
11
|
+
-# = f.select :kind, options_for_select( Wco::Site.kinds_list, selected: site.kind )
|
12
|
+
|
10
13
|
.field
|
11
14
|
= f.label :origin
|
12
15
|
= f.text_field :origin
|
13
|
-
= f.label :post_path
|
14
|
-
= f.text_field :post_path
|
16
|
+
-# = f.label :post_path
|
17
|
+
-# = f.text_field :post_path
|
15
18
|
.field
|
16
19
|
= f.label :username
|
17
20
|
= f.text_field :username
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
.sites-index.
|
2
|
+
.sites-index.flexwidth
|
3
3
|
%h5
|
4
4
|
Sites
|
5
5
|
= link_to '[+]', new_site_path
|
@@ -8,17 +8,17 @@
|
|
8
8
|
%tr
|
9
9
|
%th
|
10
10
|
%th slug
|
11
|
-
%th kind
|
11
|
+
-# %th kind
|
12
12
|
%th origin
|
13
|
-
%th post_path
|
13
|
+
-# %th post_path
|
14
14
|
- @sites.each do |ttt|
|
15
15
|
%tr
|
16
16
|
%td
|
17
17
|
.flex-row
|
18
18
|
= button_to '[x]', site_path(ttt), method: :delete, data: { confirm: 'Are you sure?' }
|
19
19
|
= link_to '[~]', edit_site_path(ttt)
|
20
|
-
|
20
|
+
.gray.mini= ttt.id
|
21
21
|
%td= ttt.slug
|
22
|
-
%td= ttt.kind
|
22
|
+
-# %td= ttt.kind
|
23
23
|
%td= ttt.origin
|
24
|
-
%td= ttt.post_path
|
24
|
+
-# %td= ttt.post_path
|
data/config/routes.rb
CHANGED
@@ -37,7 +37,7 @@ Wco::Engine.routes.draw do
|
|
37
37
|
resources :prices
|
38
38
|
resources :products
|
39
39
|
resources :profiles
|
40
|
-
post 'publishers/:id/do-run', to: 'publishers#do_run', as: :
|
40
|
+
post 'publishers/:id/do-run', to: 'publishers#do_run', as: :run_publisher
|
41
41
|
resources :publishers
|
42
42
|
resources :photos
|
43
43
|
|