wco_email 0.1.1.108 → 0.1.1.109

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: c7074617480674045f74baf0320d4a084fa5e6a970e0ca056c7ee3e7ec9cad27
4
- data.tar.gz: 13d493e3372b51b61c40598b3176e33f295a739d579419c24c65f2d95c5f803b
3
+ metadata.gz: bf68db3214927127e916c92d4ba9731a536fcf79c46544ad7f813f942ef2ce0c
4
+ data.tar.gz: 57f1a425c60ffffffa72b34088009f644bf4ec22c64c033afa0382a24588cefe
5
5
  SHA512:
6
- metadata.gz: c8ae43c73f1f0f0526adbe678f63f0158747e69cfdb04156a6b205a9609b4d3cdce100853ad31634f318958e2ce901b9b6ec2363fdc2a3aa61598dde337957f9
7
- data.tar.gz: cfee9bce05425bbe4a5ee7cd6ab0429cba4a1fb9b454875635953ba45bd9eaab556847c9f129f4744b56cc4b805762903f59b997b5bc49bb2e1cfb63a06ba083
6
+ metadata.gz: 600ddd832b8e29dc775e54bf58ce05ed5eb03277c349a6c693b9cee4d356cefd5f34c2c05f9f0ea3c93b4c0fb739aa8ca16c4f3d542e4b8a2565edf0b46f16de
7
+ data.tar.gz: f4deff878f1ceceb571a50574e01f2c6cb111733fed7404e96e662e86e9358732f01d5eaaf2c22342bb0fa627bc33b6469bb8963ab8a4c47cb5638eb227fa14c
@@ -5,39 +5,75 @@ class WcoEmail::EmailFiltersController < WcoEmail::ApplicationController
5
5
 
6
6
  def create
7
7
  authorize! :create, WcoEmail::EmailFilter
8
- @email_filter = WcoEmail::EmailFilter.create params[:email_filter].permit!
9
- if @email_filter.persisted?
8
+ @email_filter = WcoEmail::EmailFilter.new
9
+
10
+ ## conditions, skip_conditions aren't wired for aject yet.
11
+ (params[:email_filter][:actions_attributes]||[]).each do |_key, attrs|
12
+ type, id = attrs.delete(:aject).split(' ')
13
+ attrs[:aject_type] = type
14
+ attrs[:aject_id] = id
15
+ end
16
+
17
+ flag = @email_filter.update_attributes( params[:email_filter].permit! )
18
+
19
+ if flag
10
20
  flash[:notice] = 'Success'
21
+ redirect_to action: :show, id: @email_filter.id
11
22
  else
12
23
  flash[:alert] = "No luck: #{@email_filter.errors.full_messages.join(', ')}."
24
+ redirect_to request.referrer
13
25
  end
14
- redirect_to action: 'new'
26
+
15
27
  end
16
28
 
17
29
  def destroy
18
- @email_filter = WcoEmail::EmailFilter.find params[:id]
19
- authorize! :destroy, @email_filter
20
- flag = @email_filter.destroy
30
+ authorize! :destroy, WcoEmail::EmailFilter
31
+
32
+ if params[:id]
33
+ @email_filter = WcoEmail::EmailFilter.find params[:id]
34
+ flag = @email_filter.destroy
35
+ elsif params[:ids]
36
+ flag = WcoEmail::EmailFilter.find( params[:ids] ).map { |ef| ef.destroy }
37
+ end
38
+
21
39
  if flag
22
40
  flash[:notice] = 'Success'
23
41
  else
24
42
  flash[:alert] = 'Error'
25
43
  end
26
- redirect_to action: 'index'
44
+ redirect_to request.referrer
27
45
  end
28
46
 
29
47
  def edit
30
48
  @email_filter = WcoEmail::EmailFilter.find params[:id]
31
49
  authorize! :edit, @email_filter
32
50
  end
51
+ def edit2
52
+ @email_filter = WcoEmail::EmailFilter.find( params[:id] )
53
+ authorize! :edit, @email_filter
54
+
55
+ @email_filter.conditions.build
56
+ @email_filter.skip_conditions.build
57
+ @email_filter.actions.build
58
+
59
+ @aject_options = {
60
+ 'none' => [ [nil,nil] ],
61
+ 'Wco::Tag' => Wco::Tag.all.map { |t| [t.slug, "Wco::Tag #{t.id}" ] },
62
+ 'WcoEmail::EmailTemplate' => WcoEmail::EmailTemplate.all.map { |t| [ t.slug, "WcoEmail::EmailTemplate #{t.id}" ] },
63
+ 'WcoEmail::EmailActionTemplate' => WcoEmail::EmailActionTemplate.all.map { |t| [ t.slug, "WcoEmail::EmailActionTemplate #{t.id}" ] },
64
+ }
65
+ end
66
+
33
67
 
34
68
  def index
35
69
  authorize! :index, WcoEmail::EmailFilter.new
36
70
  @email_filter = WcoEmail::EmailFilter.new
37
- @email_filters = WcoEmail::EmailFilter.all().includes( :email_template, :conversations )
71
+ @email_filters = WcoEmail::EmailFilter.all.includes( :email_template, :conversations )
38
72
 
39
73
  if params[:q]
40
74
  @email_filters = @email_filters.where( from_exact: /#{params[:q]}/i )
75
+ else
76
+ @email_filters = @email_filters.active
41
77
  end
42
78
 
43
79
  @email_filters = @email_filters.page( params[WcoEmail::EmailFilter::PAGE_PARAM_NAME]
@@ -52,27 +88,39 @@ class WcoEmail::EmailFiltersController < WcoEmail::ApplicationController
52
88
  @email_filter = WcoEmail::EmailFilter.new
53
89
  authorize! :new, @email_filter
54
90
 
55
- @new_email_filter_condition = WcoEmail::EmailFilterCondition.new
91
+ @email_filter.conditions.build
92
+ @email_filter.skip_conditions.build
93
+ @email_filter.actions.build
94
+
95
+ @aject_options = {
96
+ 'none' => [ [nil,nil] ],
97
+ 'Wco::Tag' => Wco::Tag.all.map { |t| [t.slug, "Wco::Tag #{t.id}" ] },
98
+ 'WcoEmail::EmailTemplate' => WcoEmail::EmailTemplate.all.map { |t| [ t.slug, "WcoEmail::EmailTemplate #{t.id}" ] },
99
+ }
56
100
  end
57
101
 
58
102
  def show
59
103
  @email_filter = WcoEmail::EmailFilter.find params[:id]
60
104
  authorize! :show, @email_filter
105
+ @conversations = @email_filter.conversations.page( params[WcoEmail::Conversation::PAGE_PARAM_NAME] ).per( current_profile.per_page )
61
106
  end
62
107
 
63
108
  def update
64
109
  @email_filter = WcoEmail::EmailFilter.find params[:id]
65
110
  authorize! :update, @email_filter
66
111
 
67
- if params[:email_filter][:tag].blank?
68
- params[:email_filter].delete :tag
112
+ ## conditions, skip_conditions aren't wired for aject yet.
113
+ (params[:email_filter][:actions_attributes]||[]).each do |_key, attrs|
114
+ type, id = attrs.delete(:aject).split(' ')
115
+ attrs[:aject_type] = type
116
+ attrs[:aject_id] = id
69
117
  end
70
118
 
71
119
  flag = @email_filter.update_attributes( params[:email_filter].permit! )
72
120
 
73
121
  if flag
74
122
  flash[:notice] = 'Success'
75
- redirect_to action: 'index'
123
+ redirect_to request.referrer
76
124
  else
77
125
  flash[:alert] = "No luck: #{@email_filter.errors.full_messages.join(', ')}."
78
126
  redirect_to request.referrer
@@ -96,3 +144,37 @@ class WcoEmail::EmailFiltersController < WcoEmail::ApplicationController
96
144
 
97
145
  end
98
146
 
147
+
148
+
149
+
150
+
151
+
152
+ =begin
153
+ params[:email_filter][:actions_attributes].each do |_key, attrs|
154
+ puts! attrs, 'attrs 1'
155
+
156
+ if '' == attrs[:kind] && '' == attrs[:aject]
157
+ next ## don't save new empty
158
+ end
159
+
160
+
161
+ if attrs[:id]
162
+ action = WcoEmail::EmailFilterAction.find attrs[:id]
163
+ else
164
+ action = WcoEmail::EmailFilterAction.new({ email_filter_id: params[:id] })
165
+ end
166
+
167
+ if '1' == attrs.delete( :_destroy )
168
+ action.destroy!
169
+ else
170
+ type, id = attrs.delete(:aject).split(' ')
171
+ attrs[:aject_type] = type
172
+ attrs[:aject_id] = id
173
+
174
+ puts! attrs, 'attrs 2'
175
+
176
+ action.update!(attrs.permit!)
177
+ end
178
+
179
+ end
180
+ =end
@@ -1,22 +1,35 @@
1
1
 
2
-
3
2
  class WcoEmail::EmailTemplatesController < WcoEmail::ApplicationController
4
3
 
5
4
  def create
6
5
  authorize! :create, WcoEmail::EmailTemplate
7
- @template = WcoEmail::EmailTemplate.create params[:template].permit!
8
- if @template.persisted?
6
+
7
+ if params[:photo].present?
8
+ photo = Wco::Photo.create! params[:photo].permit!
9
+ params[:template][:photo_id] = photo.id
10
+ end
11
+
12
+ @tmpl = WcoEmail::EmailTemplate.create params[:template].permit!
13
+ if @tmpl.persisted?
9
14
  flash[:notice] = 'Success.'
15
+ if params[:template][:photo].present?
16
+ if @tmpl.photo.present?
17
+ @tmpl.photo.update(params[:template][:photo])
18
+ else
19
+ @tmpl.photo = Wco::Photo.create(params[:template][:photo])
20
+ end
21
+ end
22
+
10
23
  else
11
- flash[:alert] = "Could not create an email template: #{@template.errors.full_messages.join(', ')}."
24
+ flash[:alert] = "Could not create an email template: #{@tmpl.errors.full_messages.join(', ')}."
12
25
  end
13
26
  redirect_to action: :index
14
27
  end
15
28
 
16
29
  def destroy
17
30
  authorize! :destroy, WcoEmail::EmailTemplate
18
- @template = WcoEmail::EmailTemplate.where({ id: params[:id] }).first || WcoEmail::EmailTemplate.find_by({ slug: params[:id] })
19
- if @template.destroy
31
+ @tmpl = WcoEmail::EmailTemplate.where({ id: params[:id] }).first || WcoEmail::EmailTemplate.find_by({ slug: params[:id] })
32
+ if @tmpl.destroy
20
33
  flash[:notice] = 'Success.'
21
34
  else
22
35
  flash[:alert] = 'Cannot destroy this template.'
@@ -27,6 +40,8 @@ class WcoEmail::EmailTemplatesController < WcoEmail::ApplicationController
27
40
  def edit
28
41
  @tmpl = @email_template = WcoEmail::EmailTemplate.where({ id: params[:id] }).first
29
42
  authorize! :edit, @tmpl
43
+
44
+ @photo = @tmpl.photo || @tmpl.build_photo
30
45
  end
31
46
 
32
47
  def iframe_src
@@ -74,8 +89,10 @@ class WcoEmail::EmailTemplatesController < WcoEmail::ApplicationController
74
89
  end
75
90
 
76
91
  def new
77
- @new_email_template = WcoEmail::EmailTemplate.new
92
+ @tmpl = WcoEmail::EmailTemplate.new
78
93
  authorize! :new, WcoEmail::EmailTemplate
94
+
95
+ @photo = @tmpl.photo || @tmpl.build_photo
79
96
  end
80
97
 
81
98
  def show
@@ -104,13 +121,19 @@ class WcoEmail::EmailTemplatesController < WcoEmail::ApplicationController
104
121
  end
105
122
 
106
123
  def update
107
- @template = WcoEmail::EmailTemplate.where({ id: params[:id] }).first
108
- authorize! :update, @template
109
- flag = @template.update_attributes( params[:template].permit! )
124
+ @tmpl = WcoEmail::EmailTemplate.where({ id: params[:id] }).first
125
+ authorize! :update, @tmpl
126
+
127
+ if params[:photo].present?
128
+ photo = Wco::Photo.create! params[:photo].permit!
129
+ params[:template][:photo_id] = photo.id
130
+ end
131
+
132
+ flag = @tmpl.update_attributes( params[:template].permit! )
110
133
  if flag
111
134
  flash[:notice] = 'Success.'
112
135
  else
113
- flash[:alert] = "No luck. #{@template.errors.full_messages.join(', ')}"
136
+ flash[:alert] = "No luck. #{@tmpl.errors.full_messages.join(', ')}"
114
137
  end
115
138
  redirect_to action: :edit
116
139
  end
@@ -7,7 +7,7 @@ class WcoEmail::MessagesController < WcoEmail::ApplicationController
7
7
  @message = WcoEmail::Message.find params[:id]
8
8
 
9
9
  @client ||= Aws::S3::Client.new({
10
- region: ::S3_CREDENTIALS[:region_ses],
10
+ region: ::S3_CREDENTIALS[:region_ses] || 'us-east-1',
11
11
  access_key_id: ::S3_CREDENTIALS[:access_key_id_ses],
12
12
  secret_access_key: ::S3_CREDENTIALS[:secret_access_key_ses],
13
13
  })
@@ -13,7 +13,7 @@
13
13
  = link_to '[+]', wco_email.new_message_stub_path
14
14
  %li= render '/wco_email/email_templates/header'
15
15
  %li= render '/wco_email/email_campaigns/header'
16
- %li= render '/wco_email/email_filters/header'
16
+ %li= render '/wco_email/email_filters/main_header'
17
17
  %li= render '/wco_email/contexts/header'
18
18
  %li= render '/wco/unsubscribes/header'
19
19
 
@@ -5,6 +5,8 @@
5
5
  = link_to '[~]', edit_context_path(@ctx)
6
6
  Email Context `#{@ctx.subject}`
7
7
 
8
+
9
+
8
10
  .row
9
11
  .col-md-8
10
12
  %ul
@@ -13,6 +15,8 @@
13
15
  <b>Template:</b> #{link_to @ctx.email_template.slug, email_template_path(@ctx.email_template), target: :_blank }
14
16
  %li <b>From:</b> #{@ctx.from_email}
15
17
  %li <b>To Lead:</b> #{link_to @ctx.lead.email, wco.lead_path(@ctx.lead)}
18
+ - if @ctx.rendered_subject.present?
19
+ %li <b>rendered_subject:</b> `#{@ctx.rendered_subject}`
16
20
  - if @ctx.reply_to_message
17
21
  %li <b>reply_to_message:</b> #{ link_to @ctx.reply_to_message, message_path(@ctx.reply_to_message), target: :_blank }
18
22
 
@@ -13,8 +13,12 @@
13
13
  = render '/wco/tags/index_chips', tags: @conversation.tags, config: { skip_checkbox: true }
14
14
 
15
15
  = render '/wco_email/conversations/tags_actions'
16
- = render '/wco/leads/index', leads: @conversation.leads
17
- = render '/wco/leadsets/list', leadsets: @conversation.leadsets
16
+ .d-flex
17
+ %i.fa.fa-compress.collapse-expand#leads Leads (#{@conversation.leads.length}):
18
+ = render '/wco/leads/list', leads: @conversation.leads
19
+ .d-flex
20
+ %i.fa.fa-compress.collapse-expand#leadsets Leadsets (#{@conversation.leadsets.length}):
21
+ = render '/wco/leadsets/list', leadsets: @conversation.leadsets
18
22
 
19
23
  - if @other_convs.present?
20
24
  %h5 Other convs:
@@ -0,0 +1,34 @@
1
+
2
+ .email-filter-actions--form
3
+
4
+ .d-flex
5
+ .field
6
+ %label [destroy]
7
+ = f.check_box :_destroy
8
+ .field
9
+ %label Kind
10
+ = f.select :kind, options_for_select( [[nil,nil]] + WcoEmail::EmailFilterAction::KINDS, selected: action.kind )
11
+ .field.flex-grow
12
+ %label aject
13
+ = f.select :aject, grouped_options_for_select( @aject_options, { selected: "#{action.aject_type} #{action.aject_id}" }), {}, { class: 'select2' }
14
+
15
+ -# .field
16
+ -# %label Email Template
17
+ -# = f.select :email_template_id, options_for_select(@email_templates_list, selected: action.email_template_id ), {}, { class: 'select2' }
18
+
19
+ -# .field
20
+ -# %label Email Action Template (EAT)
21
+ -# = f.select :email_action_template_id, options_for_select( @email_action_templates_list, selected: action.email_action_template_id ), {}, class: 'select2'
22
+
23
+ -# .field
24
+ -# %label Office Action Template (OAT)
25
+ -# = f.select :office_action_template_id, options_for_select( ::Wco::OfficeActionTemplate.list, selected: action.office_action_template_id ), {}, class: 'select2'
26
+
27
+ -# .field
28
+ -# = f.label :tag
29
+ -# = f.select :tag, options_for_select( @tags_list, selected: email_filter.tag_id ), {}, class: 'select2'
30
+
31
+ -# .field
32
+ -# %label value ( not used? )
33
+ -# = f.text_area :value
34
+
@@ -1,14 +1,18 @@
1
1
 
2
2
  .email-filter-conditions--form.descr
3
3
  .d-flex
4
+ .field
5
+ %label [destroy]
6
+ = f.check_box :_destroy
4
7
  .field
5
8
  %label Field
6
- = f.select :field, options_for_select([[nil,nil]] + WcoEmail::EmailFilter::FIELD_OPTS, selected: cond.field )
9
+ = f.select :field, options_for_select([[nil,nil]] + WcoEmail::EmailFilterCondition::FIELD_OPTS, selected: cond.field )
7
10
  .field
8
- %label Matchtype
9
- = f.select :matchtype, options_for_select([[nil,nil]] + WcoEmail::EmailFilter::MATCHTYPE_OPTS, selected: cond.matchtype)
11
+ %label Operator
12
+ = f.select :operator, options_for_select([[nil,nil]] + WcoEmail::EmailFilterCondition::OPERATOR_OPTS, selected: cond.operator)
10
13
  .field
11
14
  %label Value
12
15
  = f.text_field :value, value: cond.value
13
- [-]
14
- -# .a= cond.inspect
16
+
17
+ -# .a= cond.inspect
18
+
@@ -56,21 +56,21 @@
56
56
  %label skip from regex
57
57
  = f.text_field :skip_from_regex
58
58
 
59
- .col-12
60
- Conditions:
61
- %ul
62
- - email_filter.conditions.each do |cond|
63
- %li
64
- = f.fields_for( :conditions ) do |f_cond|
65
- = render '/wco_email/email_filter_conditions/form', cond: cond, f: f_cond
59
+ -# .col-12
60
+ -# Conditions:
61
+ -# %ul
62
+ -# - email_filter.conditions.each do |cond|
63
+ -# %li
64
+ -# = f.fields_for( :conditions ) do |f_cond|
65
+ -# = render '/wco_email/email_filter_conditions/form', cond: cond, f: f_cond
66
66
 
67
- .col-12
68
- skip conditions:
69
- %ul
70
- - email_filter.skip_conditions.each do |cond|
71
- %li
72
- = f.fields_for( :skip_conditions ) do |f_cond|
73
- = render '/wco_email/email_filter_conditions/form', cond: cond, f: f_cond
67
+ -# .col-12
68
+ -# skip conditions:
69
+ -# %ul
70
+ -# - email_filter.skip_conditions.each do |cond|
71
+ -# %li
72
+ -# = f.fields_for( :skip_conditions ) do |f_cond|
73
+ -# = render '/wco_email/email_filter_conditions/form', cond: cond, f: f_cond
74
74
 
75
75
  .col-12
76
76
  .actions
@@ -8,32 +8,27 @@
8
8
  = form_for email_filter, url: url, as: :email_filter do |f|
9
9
 
10
10
  %p If
11
- - f.fields_for( :email_filter_conditions ) do |f_cond|
12
- = render '/wco_email/email_filter_conditions/form', f: f_cond
13
- = form_for @new_email_filter_condition do |ff|
14
- = render '/wco_email/email_filter_conditions/form', f: ff
11
+ = f.fields_for( :conditions ) do |f_cond|
12
+ = render '/wco_email/email_filter_conditions/form', f: f_cond, cond: f_cond.object
13
+
14
+ -# .d-flex
15
+ -# %label add
16
+ -# = form_for @new_email_filter_condition do |f_cond|
17
+ -# = render '/wco_email/email_filter_conditions/form', f: f_cond, cond: f_cond.object
15
18
 
16
- .d-flex [+]
17
19
  %p Skip
18
- - email_filter.skip_conditions.each do |f_cond|
19
- .d-flex
20
- .field
21
- %label Field
22
- = f_cond.select :field, options_for_select(WcoEmail::EmailFilter::FIELD_OPTS, selected: f_cond.field)
23
- .field
24
- %label Matchtype
25
- = f_cond.select :matchtype, options_for_select(WcoEmail::EmailFilter::MATCHTYPE_OPTS, selected: f_cond.matchtype)
26
- .field
27
- %label Value
28
- = f_cond.text_field :value
29
- [-]
30
- .d-flex [+]
31
- %p Then
32
- .d-flex
33
- %label OAT
34
- = f.select :office_action_template, options_for_select(Wco::OfficeActionTemplate.list, selected: email_filter.office_action_template_id), {}, class: 'select2'
20
+ = f.fields_for( :skip_conditions ) do |f_cond|
21
+ = render '/wco_email/email_filter_conditions/form', f: f_cond, cond: f_cond.object
35
22
 
36
- %p [perform]
23
+ -# .d-flex
24
+ -# %label add
25
+ -# = form_for @new_email_filter_condition do |f_cond|
26
+ -# = render '/wco_email/email_filter_conditions/form', f: f_cond, cond: f_cond.object
27
+
28
+ %p Then
29
+ = f.fields_for( :actions ) do |f_action|
30
+ = render '/wco_email/email_filter_actions/form', f: f_action, action: f_action.object
37
31
 
38
32
  .actions
39
33
  = f.submit 'Go'
34
+
@@ -1,6 +1,9 @@
1
1
 
2
- = link_to "Email Filters (#{WcoEmail::EmailFilter.all.length})", email_filters_path
3
- = form_tag email_filters_path, method: :get do
4
- = text_field_tag :q
5
- = link_to '[+]', new_email_filter_path
6
- = link_to '[+2]', new2_email_filter_path
2
+ .email-filters--header
3
+ %h5.title.text-center
4
+ = link_to '[~]', wco_email.edit_email_filter_path( @email_filter )
5
+ &nbsp;
6
+ = link_to '[~2]', wco_email.edit2_email_filter_path( @email_filter )
7
+ &nbsp;
8
+ = link_to 'Email Filter', wco_email.email_filter_path( @email_filter )
9
+ `#{@email_filter.id}`
@@ -0,0 +1,6 @@
1
+
2
+ = link_to "Email Filters (#{WcoEmail::EmailFilter.all.length})", email_filters_path
3
+ = form_tag email_filters_path, method: :get do
4
+ = text_field_tag :q
5
+ = link_to '[+]', new_email_filter_path
6
+ = link_to '[+2]', new2_email_filter_path
@@ -0,0 +1,32 @@
1
+
2
+ .email-filters--show
3
+ .row
4
+ .col-6
5
+
6
+ %hr
7
+ = email_filter.inspect
8
+
9
+ .col-6
10
+ %hr
11
+ <b>Conditions (#{email_filter.conditions.length}):</b>
12
+ %ul
13
+ - email_filter.conditions.each do |cond|
14
+ %li
15
+ = cond.to_s
16
+ .gray= cond.inspect
17
+
18
+ %hr
19
+ <b>Skip Conditions (#{email_filter.skip_conditions.length}):</b>
20
+ %ul
21
+ - email_filter.skip_conditions.each do |cond|
22
+ %li
23
+ = cond.to_s
24
+ .gray= cond.pretty_inspect
25
+
26
+ %hr
27
+ <b>Actions (#{email_filter.actions.length}):</b>
28
+ %ul
29
+ - email_filter.actions.each do |act|
30
+ %li
31
+ = act.to_s
32
+ .gray= act.pretty_inspect
@@ -1,20 +1,5 @@
1
1
 
2
2
  .emails-ns.email-filters-edit.maxwidth
3
- .header
4
- %h2.title Edit Email Filter
3
+ = render 'header'
5
4
  = render 'form', email_filter: @email_filter
6
-
7
- %hr
8
- <b>Conditions (#{@email_filter.conditions.length}):</b>
9
- %ul
10
- - @email_filter.conditions.each do |cond|
11
- %li
12
- = cond.inspect
13
-
14
- %hr
15
- <b>Skip Conditions (#{@email_filter.skip_conditions.length}):</b>
16
- %ul
17
- - @email_filter.skip_conditions.each do |cond|
18
- %li
19
- = cond.inspect
20
-
5
+ -# = render 'show', email_filter: @email_filter
@@ -0,0 +1,5 @@
1
+
2
+ .emails-ns.email-filters-edit.maxwidth
3
+ = render 'header'
4
+ = render 'form2', email_filter: @email_filter
5
+ -# = render 'show', email_filter: @email_filter
@@ -6,38 +6,52 @@
6
6
  = link_to '[+]', new_email_filter_path
7
7
  = link_to '[2+]', new2_email_filter_path
8
8
 
9
- .maxwidth
10
- %hr
11
- %h5.title.collapse-expand#newEmailFilter New Email Filter
12
- = render 'form', email_filter: @email_filter
13
- %hr
9
+ -# .maxwidth
10
+ -# %hr
11
+ -# %h5.title.collapse-expand#newEmailFilter New Email Filter
12
+ -# = render 'form', email_filter: @email_filter
13
+
14
+ .actions.d-flex
15
+ .a.mr-2= button_tag 'Delete', method: :delete, class: 'delete-btn'
16
+ = render 'wco/tags/actions', resource: 'Wco::Leadset'
17
+
14
18
 
19
+ %hr
15
20
  = paginate @email_filters, param_name: WcoEmail::EmailFilter::PAGE_PARAM_NAME, views_prefix: 'wco'
16
21
  %table.bordered
17
22
  %thead
18
23
  %tr
24
+ %th.select-all.nosort
25
+ = render '/wco/select_all'
19
26
  %th &nbsp;
20
- %th &nbsp;
27
+ %th status
21
28
  %th n convs
29
+ %th to_s_full
22
30
  %th Match
23
31
  %th Skip
24
- %th Action
25
- %th Conditions
26
- %th Skip Conditions
32
+ %th Kind
33
+ -# %th Conditions
34
+ -# %th Skip Conditions
27
35
 
28
36
  - @email_filters.each_with_index do |ef, idx|
29
37
 
30
38
  %tr
31
- %td
39
+ %td.select-all
32
40
  .gray= idx+1
33
- = check_box_tag 'checked'
41
+ = check_box_tag 'email_filter_ids[]', ef.id, nil, { class: 'i-sel' }
34
42
  %td
35
43
  .flex-row
36
44
  = link_to '[~]', edit_email_filter_path(ef)
45
+ = link_to '[~2]', edit2_email_filter_path(ef)
37
46
  = link_to '[view]', email_filter_path(ef)
38
47
  .inline-block= button_to '[x]', email_filter_path(ef), method: :delete, data: { confirm: 'Are you sure?' }
48
+ .gray.small= ef.id
49
+ %td.status
50
+ = ef.status
39
51
  %td.n-convs
40
52
  = ef.conversations.length
53
+ %td.to_s_full
54
+ %pre= ef.to_s_full
41
55
  %td.match
42
56
  - if ef.from_regex.present?
43
57
  .a <b>from_regex:</b> `#{ef.from_regex}`
@@ -66,10 +80,10 @@
66
80
  - if ef.kind == EF::KIND_REMOVE_TAG
67
81
  .a <b>#{EF::KIND_REMOVE_TAG}:</b> #{ef.tag&.slug}
68
82
 
69
- %td.conditions
70
- = ef.conditions.length
71
- %td.skip-conditions
72
- = ef.skip_conditions.length
83
+ -# %td.conditions
84
+ -# = ef.conditions.length
85
+ -# %td.skip-conditions
86
+ -# = ef.skip_conditions.length
73
87
 
74
88
  = paginate @email_filters, param_name: WcoEmail::EmailFilter::PAGE_PARAM_NAME, views_prefix: 'wco'
75
89
 
@@ -1,25 +1,29 @@
1
1
 
2
2
  .email-filters-show.maxwidth
3
- .header
4
- %h5.title Email Filter `#{@email_filter.id}`
3
+ = render 'header'
5
4
 
6
5
  %pre.descr
7
6
  = @email_filter.to_s_full
8
- %h5 Conditions
9
- %ul
10
- - @email_filter.conditions.each do |cond|
11
- %li= cond.to_s_full
12
- %h5 Skip conditions
13
- %ul
14
- - @email_filter.skip_conditions.each do |item|
15
- %li= item.to_s_full
16
- %h5 Actions
17
- %ul
18
- - @email_filter.actions.each do |item|
19
- %li= item.to_s_full
20
7
 
21
8
  %hr
22
- %h5 Convs (#{@email_filter.conversations.length})
23
- %ul
24
- - @email_filter.conversations.each do |conv|
25
- %li= link_to conv, conversation_path(conv)
9
+ %i.fa.fa-compress.collapse-expand#conversations Conversations (#{@conversations.length}):
10
+ .a
11
+ = paginate @conversations, param_name: WcoEmail::Conversation::PAGE_PARAM_NAME, views_prefix: 'wco'
12
+ %table.bordered.padded
13
+ %thead
14
+ %tr
15
+ %th leadsets
16
+ %th leads
17
+ %th convo
18
+ %tbody
19
+ - @conversations.each do |conv|
20
+ %tr
21
+ %td.leadsets
22
+ = conv.leadsets.map &:to_s
23
+ %td.leads
24
+ = conv.leads.map &:to_s
25
+ %td.convo
26
+ = link_to conv, conversation_path(conv)
27
+
28
+
29
+ = render 'show', email_filter: @email_filter
@@ -2,7 +2,7 @@
2
2
  - url = email_template.new_record? ? email_templates_path : email_template_path(email_template.id)
3
3
 
4
4
  .email-templates--form.container
5
- = form_for email_template, as: :template, url: url do |f|
5
+ = form_for email_template, as: :template, url: url, :html => { :multipart => true } do |f|
6
6
  .actions
7
7
  = f.submit 'Save'
8
8
 
@@ -66,6 +66,19 @@
66
66
  = f.label :config_exe
67
67
  = f.text_area :config_exe
68
68
 
69
+ .row
70
+ .col-6
71
+ .field
72
+ %label photo
73
+
74
+ %p Current photo:
75
+ = image_tag @tmpl.photo.photo.url(:thumb)
76
+
77
+ = fields_for :photo, @photo do |p|
78
+ %p
79
+ %label photo
80
+ = p.file_field :photo
81
+
69
82
  .actions
70
83
  = f.submit 'Save'
71
84
 
@@ -11,6 +11,7 @@
11
11
  %thead
12
12
  %tr
13
13
  %th &nbsp;
14
+ %th photo
14
15
  %th Slug
15
16
  %th Created
16
17
  %th Updated
@@ -22,6 +23,9 @@
22
23
  = link_to '[use]', wco_email.new_context_path({ email_template_id: tmpl.id })
23
24
  = link_to '[~]', wco_email.edit_email_template_path({ id: tmpl })
24
25
  = button_to '[x]', wco_email.email_template_path({ id: tmpl }), method: :delete, :data => { :confirm => 'Are you sure?' }, form_class: 'inline'
26
+ %td.photo
27
+ - if tmpl.photo&.photo
28
+ = image_tag tmpl.photo.photo.url(:thumb)
25
29
  %td= link_to tmpl.slug, wco_email.email_template_path({ id: tmpl })
26
30
  %td= pp_date tmpl.created_at
27
31
  %td= pp_date tmpl.updated_at
@@ -1,5 +1,5 @@
1
1
 
2
2
  .email-templates-edit.maxwidth
3
3
  %h5
4
- Edit email_template `#{link_to @email_template.slug, email_template_path( @email_template )}`
5
- = render 'form', email_template: @email_template
4
+ Edit email_template `#{link_to @tmpl.slug, email_template_path( @tmpl )}`
5
+ = render 'form', email_template: @tmpl
@@ -3,4 +3,4 @@
3
3
  .header
4
4
  %h2.title New Email Template
5
5
 
6
- = render 'form', email_template: @new_email_template
6
+ = render 'form', email_template: @tmpl
@@ -10,5 +10,5 @@
10
10
 
11
11
  = raw @message.part_html_sanitized
12
12
 
13
- -# %hr{ style: 'border-top: 1px solid red;' }
14
- -# %pre= @message.part_txt
13
+ %hr{ style: 'border-top: 1px solid red;' }
14
+ %pre= @message.part_txt
data/config/routes.rb CHANGED
@@ -40,7 +40,9 @@ WcoEmail::Engine.routes.draw do
40
40
  post 'contexts/send_immediate/:id', to: 'contexts#send_immediate', as: :send_context
41
41
  resources :contexts
42
42
 
43
- get 'email_filters/new2', to: 'email_filters#new2', as: :new2_email_filter
43
+ get 'email_filters/new2', to: 'email_filters#new2', as: :new2_email_filter
44
+ get 'email_filters/:id/edit2', to: 'email_filters#edit2', as: :edit2_email_filter
45
+ delete 'email_filters', to: '/wco_email/email_filters#destroy'
44
46
  resources :email_filters
45
47
  resources :email_filter_conditions
46
48
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.108
4
+ version: 0.1.1.109
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-04-01 00:00:00.000000000 Z
11
+ date: 2026-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -417,11 +417,15 @@ files:
417
417
  - app/views/wco_email/email_campaigns/index.haml
418
418
  - app/views/wco_email/email_campaigns/new.haml
419
419
  - app/views/wco_email/email_campaigns/show.haml
420
+ - app/views/wco_email/email_filter_actions/_form.haml
420
421
  - app/views/wco_email/email_filter_conditions/_form.haml
421
422
  - app/views/wco_email/email_filters/_form.haml
422
423
  - app/views/wco_email/email_filters/_form2.haml
423
424
  - app/views/wco_email/email_filters/_header.haml
425
+ - app/views/wco_email/email_filters/_main_header.haml
426
+ - app/views/wco_email/email_filters/_show.haml
424
427
  - app/views/wco_email/email_filters/edit.haml
428
+ - app/views/wco_email/email_filters/edit2.haml
425
429
  - app/views/wco_email/email_filters/index.haml
426
430
  - app/views/wco_email/email_filters/new.haml
427
431
  - app/views/wco_email/email_filters/new2.haml