wco_models 3.1.0.82 → 3.1.0.83

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: cd7385bbbad06fcc84a31720f2f549a80703b2740d2031115b2479579c47a1d3
4
- data.tar.gz: 6c19ad0bc735c05ebd457870aff9ca5e6b9368dbabd71cab789aa2bbadc8a06b
3
+ metadata.gz: 136fd63ec2289135d50625c8ee250e34de0ba12757cec2a0d535264d8b3af9b4
4
+ data.tar.gz: f696b308e67bd35b454f11880fbf876d378c603983ae941396605ba0ca8e5a4a
5
5
  SHA512:
6
- metadata.gz: f94c696a9048b71fa7497ec41033d74515d7136dbf342fa1c5c61c1430ef26c9ca4bad59b66b825a3ec3e11de3865a552ee0702c063bcde7aa40950dd6e7ead9
7
- data.tar.gz: 9701df840501d675f1a6607fbb97dc7a7c0536052f490b29c902eee1e21f8f9fd038ec13bb7a2b7a28c90862cfd0170b083214997a7104fc53ba75d072f5e83b
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
+ }
@@ -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.do_run binding
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
 
@@ -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
- ## @TODO: move to PublisherDrupal
24
+ attr_accessor :props
25
+
24
26
  def do_run
25
- @report = report
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
- headers = {}
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
@@ -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
- %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'
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
- .field
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
- .field
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.padded
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 &nbsp;
10
10
  %th
11
11
  slug
12
- %br
12
+ %th
13
13
  site
14
14
  %th
15
- context_eval
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 '[x]', wco.publisher_path(item), method: :delete, data: { confirm: 'Are you sure?' }
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
- %pre.monospace
31
- = item.context_eval
32
- %hr
33
- %pre.monospace
34
- = item.post_body_tmpl
35
- %hr
36
- %pre.monospace
37
- = item.after_eval
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?' }
@@ -17,7 +17,7 @@
17
17
 
18
18
  .field
19
19
  %label Body
20
- = f.text_area :body, class: 'p-2'
20
+ = f.text_area :body, class: 'tinymce'
21
21
 
22
22
  .field
23
23
  %label Tags (#{report.tags.length}):
@@ -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
- = link_to ttt.slug, report_path(ttt)
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
- <b>Tags (#{ttt.tags.length}):</b>&nbsp;
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 Report `#{@report.slug}`
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
- = f.label :kind
9
- = f.select :kind, options_for_select( Wco::Site.kinds_list, selected: site.kind )
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.padded
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 &nbsp;
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
- = ttt.id
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
@@ -3,6 +3,7 @@
3
3
  %ul
4
4
  - tags.each do |tag|
5
5
  %li
6
+ = link_to '[~]', edit_tag_path(tag)
6
7
  = link_to tag.slug, tag_path(tag)
7
8
  <b>N headlines:</b> #{tag.headlines.length}
8
9
  <b>N reports:</b> #{tag.reports.length}
@@ -1,7 +1,7 @@
1
1
 
2
2
 
3
3
  .tags--index-inline
4
- <b>Tags:</b>
4
+ <b>Tags (#{tags.length}):</b>
5
5
  - tags.each_with_index do |tag, idx|
6
6
  = link_to tag.slug, tag_path(tag)
7
7
  - if idx+1 != tags.length
@@ -0,0 +1,4 @@
1
+
2
+ .tags-edit.maxwidth
3
+
4
+ = render 'form', tag: @tag
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: :do_run_publisher
40
+ post 'publishers/:id/do-run', to: 'publishers#do_run', as: :run_publisher
41
41
  resources :publishers
42
42
  resources :photos
43
43
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.82
4
+ version: 3.1.0.83
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev