wco_email 0.1.1.26 → 0.1.1.28

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10d682e880850ef7136b49cea54bb6ec459103320b16a6d3754c4b11f038e6c1
4
- data.tar.gz: c1555643d033e6eae3e67a69ef8c2256680edbc3673cbc117d746c2e89fcfa8f
3
+ metadata.gz: b0336e9d11575454d0186560074d18786b577ad9b8dadb5ed7c79fa70d8c5082
4
+ data.tar.gz: 21fcdb2342f09c69a6d31c19801bd2dcb1937adeb1a8151aafb0fe26a75d95f2
5
5
  SHA512:
6
- metadata.gz: ee4e9c8e6859c7279566b4aa1b475697e7ebf0414f70f3dd9f39d5df94b973ab17ede0560f1fc1c829a8050ee53ab926524671d2a342bb4af0e9c28700d46981
7
- data.tar.gz: ec2793fdf59131a44e0bacfa0422ba1ae897d495abb57186e7af086340d72bd894081e725cc9a9c50489626daddda9d96022fedf09e797847a791217ac4ffeb3
6
+ metadata.gz: e7142fd9806c8c9a48aaf646a7e9a3e58864107cc40caf433801e9b30768003fa062633174a379afc232792af4380d0de76532a87eb2c191e1d4e2f1662c7680
7
+ data.tar.gz: 38b8f687b20babcd4baebdcc98b575498b783c663c3f486d3dcd2b43b7754c80be2183f32af49f5186378a4688e1e167279963216f5fdf64d71eeb6fdd0f4e10
@@ -101,6 +101,7 @@ $(".add-tag-btn").click(function(e) {
101
101
  },
102
102
  error: e => {
103
103
  logg((e||{}).responseText, 'Err')
104
+ location.reload()
104
105
  },
105
106
  })
106
107
 
@@ -133,6 +134,7 @@ $(".remove-tag-btn").click(function(e) {
133
134
  },
134
135
  error: e => {
135
136
  logg((e||{}).responseText, 'Err')
137
+ location.reload()
136
138
  },
137
139
  })
138
140
 
@@ -14,3 +14,6 @@ th.select-all {
14
14
  }
15
15
  }
16
16
 
17
+ th.tags {
18
+ width: 200px;
19
+ }
@@ -1,6 +1,6 @@
1
1
 
2
2
  class WcoEmail::ApplicationController < Wco::ApplicationController
3
- before_action :set_lists
3
+ # before_action :set_lists
4
4
  layout 'wco_email/application'
5
5
 
6
6
 
@@ -4,48 +4,35 @@ class WcoEmail::ConversationsController < WcoEmail::ApplicationController
4
4
  # layout 'wco_email/mailbox'
5
5
 
6
6
  before_action :set_lists
7
+ before_action :find_convs_tags, only: %i| addtag rmtag |
7
8
 
8
9
  ## many tags to many convs
9
10
  def addtag
10
11
  authorize! :addtag, WcoEmail::Conversation
11
- # convs = WcoEmail::Conversation.where({ :id.in => params[:ids].split(",") })
12
- convs = WcoEmail::Conversation.find( params[:ids] )
13
- tags = Wco::Tag.where({ :slug.in => params[:slug].split(",") })
14
- if tags.blank?
15
- tags = Wco::Tag.where({ :id.in => params[:slug].split(",") })
16
- end
12
+
17
13
  inbox = Wco::Tag.inbox
18
- outs = convs.map do |conv|
19
- conv.tags.push tags
14
+ outs = @convs.map do |conv|
15
+ conv.tags.push @tags
20
16
  conv.tags.delete( inbox ) if params[:is_move]
21
17
  conv.save
22
18
  end
23
19
  flash_notice "Outcomes: #{outs}"
24
- redirect_to request.referrer || root_path
25
- end
26
20
 
27
- # def delete
28
- # authorize! :delete, WcoEmail::Conversation
29
- # convs = WcoEmail::Conversation.find params[:ids]
30
- # outs = convs.map do |conv|
31
- # conv.add_tag( WpTag::TRASH )
32
- # conv.remove_tag( WpTag::INBOX )
33
- # end
34
- # flash[:notice] = "outcome: #{outs}"
35
- # render json: { status: :ok }
36
- # end
21
+ render json: { status: 'ok' }
22
+ # redirect_to request.referrer # || root_path
23
+ end
37
24
 
38
25
  def index
39
26
  authorize! :index, WcoEmail::Conversation
40
27
  @conversations = WcoEmail::Conversation.all
41
28
 
42
29
  if params[:tagname]
43
- tag = Wco::Tag.find_by slug: params[:tagname]
44
- @conversations = @conversations.where( :tag_ids.in => [ tag.id ] )
30
+ @tag = Wco::Tag.find_by slug: params[:tagname]
31
+ @conversations = @conversations.where( :tag_ids.in => [ @tag.id ] )
45
32
  end
46
33
  if params[:tagname_not]
47
- tag_not = Wco::Tag.find_by slug: params[:tagname_not]
48
- @conversations = @conversations.where( :tag_ids.nin => [ tag_not.id ] )
34
+ @tag_not = Wco::Tag.find_by slug: params[:tagname_not]
35
+ @conversations = @conversations.where( :tag_ids.nin => [ @tag_not.id ] )
49
36
  end
50
37
 
51
38
  if params[:subject].present?
@@ -84,15 +71,18 @@ class WcoEmail::ConversationsController < WcoEmail::ApplicationController
84
71
  redirect_to action: :show, id: conv2.id
85
72
  end
86
73
 
87
- #
88
74
  def rmtag
89
75
  authorize! :addtag, WcoEmail::Conversation
90
- convs = WcoEmail::Conversation.find params[:ids]
91
- outs = convs.map do |conv|
92
- conv.remove_tag( params[:emailtag] )
76
+
77
+ outs = @convs.map do |conv|
78
+ @tags.map do |tag|
79
+ conv.tags.delete( tag )
80
+ end
81
+ conv.save
93
82
  end
94
- flash[:notice] = "outcome: #{outs}"
95
- redirect_to request.referrer
83
+ flash_notice "Outcomes: #{outs}"
84
+ render json: { status: 'ok' }
85
+ # redirect_to request.referrer || root_path
96
86
  end
97
87
 
98
88
  def show
@@ -118,6 +108,14 @@ class WcoEmail::ConversationsController < WcoEmail::ApplicationController
118
108
  ##
119
109
  private
120
110
 
111
+ def find_convs_tags
112
+ @convs = WcoEmail::Conversation.find params[:ids]
113
+ @tags = Wco::Tag.where({ :slug.in => params[:slug].split(",") })
114
+ if @tags.blank?
115
+ @tags = Wco::Tag.where({ :id.in => params[:slug].split(",") })
116
+ end
117
+ end
118
+
121
119
  def set_lists
122
120
  @tags = Wco::Tag.all
123
121
  @email_templates_list = [ [nil, nil] ] + WcoEmail::EmailTemplate.all.map { |tmpl| [ tmpl.slug, tmpl.id ] }
@@ -127,3 +125,5 @@ class WcoEmail::ConversationsController < WcoEmail::ApplicationController
127
125
 
128
126
  end
129
127
 
128
+
129
+
@@ -44,6 +44,9 @@
44
44
 
45
45
  = render "/wco/main_header"
46
46
  = render "/wco_email/main_header"
47
+
48
+
49
+ -# notice #{notice.inspect} alert #{alert.inspect}
47
50
  = render '/wco/alerts_notices' if notice || alert
48
51
  %hr
49
52
 
@@ -10,7 +10,8 @@
10
10
  %i.material-icons refresh
11
11
  refresh
12
12
  .bordered.inline-block
13
- = select_tag :emailtag, options_for_select(@tags_list)
13
+ .d-inline-block
14
+ = select_tag :emailtag, options_for_select(@tags_list), class: 'select2'
14
15
  = check_box_tag :is_move
15
16
  %label move?
16
17
  %a.btn.add-tag-btn{ href: "javascript: void(0)", data: { url: conversations_addtag_path } }
@@ -4,10 +4,14 @@
4
4
 
5
5
  .conversations-index
6
6
 
7
+ %h5
8
+ - if @tag
9
+ Tag `#{@tag}`
10
+ - if @tag_not
11
+ Tag-not `#{@tag_not}`
7
12
  = render '/wco_email/conversations/actions'
8
13
 
9
14
  = render '/wco/paginate', resource: @conversations, param_name: :conv_page
10
-
11
15
  %table.bordered
12
16
  %tr
13
17
  %th.select-all.nosort
@@ -16,6 +20,7 @@
16
20
  .n-selected -
17
21
  %th.leads leads
18
22
  %th.subject subject, preview
23
+ %th.tags Tags
19
24
  %th.latest-at latest_at
20
25
  - @conversations.each_with_index do |conv, idx|
21
26
  %tr
@@ -35,9 +40,11 @@
35
40
  = link_to conv.subject, email_conversation_path(conv)
36
41
  <b>(#{conv.messages.length})</b>
37
42
  %span.gray= conv.preview
43
+ %td.tags.mini
44
+ - conv.tags.each do |tag|
45
+ .mb-1
46
+ .Chip= tag.slug
38
47
  %td.latest-at
39
48
  = pp_date conv.latest_at
40
49
  = pp_time conv.latest_at
41
-
42
-
43
50
  = render '/wco/paginate', resource: @conversations, param_name: :conv_page
@@ -160,7 +160,7 @@ namespace :wco_email do
160
160
 
161
161
  desc 'send contexts'
162
162
  task send_contexts: :environment do
163
- puts! "Starting wco_email:run_email_actions..."
163
+ puts! "Starting wco_email:send_contexts..."
164
164
  while true do
165
165
 
166
166
  ctxs = WcoEmail::Context.scheduled.notsent
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.26
4
+ version: 0.1.1.28
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-01-14 00:00:00.000000000 Z
11
+ date: 2024-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3