wco_models 3.1.0.212 → 3.1.0.214

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: 54ce9287983a420344ec45522cb35c6e8a44c77778f0c519b4de471250cb8d28
4
- data.tar.gz: bc7c4abacc63202c4f5f6982a15571327e4f739cb156e58ad423b084b6dec3ab
3
+ metadata.gz: cdeac595a719fd8ca76e389973edd35dcebde79b128db8b2b0336ce5b90138d2
4
+ data.tar.gz: 012f0b8ba7459279cd2781260aab2549d7aac5dc4b1c2543813bc9537fbd2b07
5
5
  SHA512:
6
- metadata.gz: 4dda730058477e870a2b8f79879044b4b4a7b9a5473be8b72a504dbacfc656b1faf008273032017d709db31ee6633a311957d6bcfe86287f81062b3e4d1a81b6
7
- data.tar.gz: 615c6699f124ad7357680091acbdb79d6a087186acf7641993c506bef60851725a379397a1c1c669604a3d866c62f64919cf4fa368da55384155d818cef67820
6
+ metadata.gz: 9b2269ccb090f1d833206ae2ff0da27ef239ca28133bc31c269897a6a892614f40ea0128807c488e2ef829f6d27ef33d732feb3a3fc7f678f71042770052c9b7
7
+ data.tar.gz: 2f12f75f8feca3fde8a3b5599e3ff8d92ed6330e7aa57e8af959e832c24aec083b6df67befa01ffef45379fe20f99502216ee37e4efa226bb329094c96784309
data/README.txt CHANGED
@@ -1,5 +1,17 @@
1
1
 
2
- Wco Models.
2
+ WasyaCo Models. The functionality shared across all (most) projects, including:
3
+ * The ActiveRecord models
4
+ * some stylesheets,
5
+ * some javascript.
6
+
7
+ == Setup ==
8
+
9
+ Docker is reqiured for development. It is used for mongo, and localstack.
10
+
11
+ Some infrastructure is driven by ansible - therefore, local python is required:
12
+
13
+ python3 -m venv zenv
14
+ . zenv/bin/activate
3
15
 
4
16
  == Test ==
5
17
 
@@ -25,9 +25,14 @@ class Wco::OfficeActionTemplatesController < Wco::ApplicationController
25
25
  def perform
26
26
  @oat = OAT.find params[:id]
27
27
  authorize! :run, @oat
28
- @conversations = WcoEmail::Conversation.find( params[:conversation_ids] )
29
- out = eval( @oat.action_exe )
28
+ @conversations = WcoEmail::Conversation.find( params[:conversation_ids] ) if params[:conversation_ids].present?
29
+ if 'rb' == @oat.action_type
30
+ out = eval( @oat.action_exe )
31
+ elsif 'sh' == @oat.action_type
32
+ out = `#{@oat.action_exe}`
33
+ end
30
34
  flash_notice out
35
+ redirect_to action: :index
31
36
  end
32
37
 
33
38
  def show
@@ -15,6 +15,17 @@ class Wco::OfficeActionsController < Wco::ApplicationController
15
15
  redirect_to action: :index
16
16
  end
17
17
 
18
+ def destroy
19
+ @oa = OA.find params[:id]
20
+ authorize! :destroy, @oa
21
+ if @oa.delete
22
+ flash_notice @oa
23
+ else
24
+ flash_alert @oa
25
+ end
26
+ redirect_to action: :index
27
+ end
28
+
18
29
  def edit
19
30
  @oa = OA.find params[:id]
20
31
  authorize! :edit, @oa
@@ -16,6 +16,7 @@ class Wco::OfficeActionTemplate
16
16
  belongs_to :from, polymorphic: true, optional: true
17
17
  belongs_to :publisher, class_name: 'Wco::Publisher', optional: true
18
18
 
19
+ field :action_type, type: :string, default: 'rb' # 'js', 'rb', 'sh'
19
20
  field :action_exe, type: :string
20
21
  validates :action_exe, presence: true
21
22
  def do_run
@@ -8,7 +8,11 @@ class Wco::Price
8
8
  ## Wco::Product, WcoHosting::ApplianceTmpl
9
9
  belongs_to :product, polymorphic: true
10
10
 
11
- belongs_to :leadset, class_name: 'Wco::Leadset'
11
+ ## 2025-09-12 This used to be required - but I think it's unreasonable...
12
+ ## all leadsets can have the same price.
13
+ ## but I'll keep this around - to be able to override per-leadset.
14
+ ## something else may be broken b/c I made this optional.
15
+ belongs_to :leadset, class_name: 'Wco::Leadset', optional: true
12
16
 
13
17
  has_many :subscriptions, class_name: 'Wco::Subscription', inverse_of: :price, foreign_key: :wco_price_id
14
18
 
@@ -47,7 +47,7 @@
47
47
  - @appliance_tmpl_prices_list.each do |price|
48
48
  .descr
49
49
  = check_box_tag 'leadset[appliance_tmpl_ids][]', price.id, leadset.appliance_tmpls.include?(price)
50
- %label= price.product.name
50
+ %label= price.product&.name
51
51
 
52
52
 
53
53
  .actions
@@ -9,8 +9,11 @@
9
9
  %label Slug
10
10
  = f.text_field :slug, class: 'w-100'
11
11
 
12
+ .field
13
+ %label action_type
14
+ = f.select :action_type, options_for_select( [ nil, 'js', 'rb', 'sh' ], selected: oat.action_type )
12
15
  .descr
13
- available vars: @conversations , @oat ,
16
+ rb available vars: @conversations , @oat ,
14
17
  .field
15
18
  %label action_exe
16
19
  = f.text_area :action_exe, class: :monospace
@@ -6,10 +6,15 @@
6
6
  %ul
7
7
  - @oats.each do |oat|
8
8
  %li
9
- = link_to '[~]', edit_office_action_template_path(oat)
10
- .d-inline-block= button_to 'x', office_action_template_path(oat), method: :delete, html: { confirm: 'Are you sure?' }
11
- = link_to oat.slug, office_action_template_path(oat)
12
- %br
9
+ .d-flex
10
+ = link_to '[~]', edit_office_action_template_path(oat)
11
+ &nbsp;
12
+ = button_to 'x', office_action_template_path(oat), method: :delete, data: { confirm: 'Are you sure?' }
13
+ &nbsp;
14
+ = link_to oat.slug, office_action_template_path(oat)
15
+ &nbsp;
16
+ = button_to 'Run', office_action_templates_perform_path(oat), data: { confirm: 'Are you sure?' }
17
+
13
18
  = render '/wco/office_action_templates/ties', ties: oat.ties, oat: oat
14
19
  -# = oat.inspect
15
20
 
@@ -6,7 +6,7 @@
6
6
  = link_to '[~]', edit_office_action_template_path(@oat)
7
7
 
8
8
  .a
9
- %label action_exe
9
+ %label action_exe #{@oat.action_type}
10
10
  %pre.mono.descr= @oat.action_exe
11
11
 
12
12
  .a
@@ -3,5 +3,5 @@
3
3
  %h5 Office Action
4
4
  .d-inline-block
5
5
  = select_tag :office_action_template, options_for_select(@office_action_templates_list), class: 'select2'
6
- %a.btn.office-action-templates-perform-btn{ href: "javascript: void(0)", data: { url: wco.office_action_templates_perform_path } }
6
+ %a.btn.office-action-templates-perform-btn{ href: "javascript: void(0)", data: { url: wco.oat_perform_with_conversations_path } }
7
7
  Perform
@@ -6,6 +6,8 @@
6
6
  = link_to '[~]', edit_office_action_path(oa)
7
7
  &nbsp;
8
8
  = link_to oa.slug, office_action_path(oa)
9
+ &nbsp;
10
+ = button_to 'x', office_action_path(oa), method: :delete, data: { confirm: 'Are you sure?' }
9
11
  %ul
10
12
  %li
11
13
  .gray.mini= oa.id
data/config/routes.rb CHANGED
@@ -44,7 +44,9 @@ Wco::Engine.routes.draw do
44
44
  resources :obfuscated_redirects
45
45
 
46
46
  post 'office_action_templates', to: 'office_action_templates#update'
47
- post 'office_action_templates/perform', to: 'office_action_templates#perform', as: :office_action_templates_perform
47
+ post 'office_action_templates/perform', to: 'office_action_templates#perform', as: :oat_perform_with_conversations ## from the mailbox, the oat_id is passed as a body param.
48
+ post 'office_action_templates/:id/perform', to: 'office_action_templates#perform', as: :oat_perform
49
+ get 'office_action_templates/:id/perform', to: 'office_action_templates#perform'
48
50
  resources :office_action_templates
49
51
  resources :office_actions
50
52
 
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.212
4
+ version: 3.1.0.214
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-19 00:00:00.000000000 Z
11
+ date: 2025-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ahoy_matey