wco_email 0.1.1.27 → 0.1.1.29

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: 35252cf2e1f40bddca28aee1d91db68f7323f2f0285b316d0eb0a1c39f96eafd
4
- data.tar.gz: 74864a8f2de923fa0bd533011e3e56cdf91fae8e6778dbce04f99e3e76996093
3
+ metadata.gz: e2500dced19f77d14d09ee053b480da60b57367f7886601335648755ee6dd469
4
+ data.tar.gz: 123bc96615a05149351d12ec506d942e0aa67f77ea60c9640f8999e778e294a4
5
5
  SHA512:
6
- metadata.gz: 618f52745f4b92250b95bba5065ba945966db6a718a8fb09022b12b9c3def9213854c162805d35ed5efeb4b6eabf08dc88edecefb9b1a68b5124fa512ec7036d
7
- data.tar.gz: 776427c271c8631acddaa491dee932a738b3344633a417cea00d2567774f534b472519c48a4b570b4d9660af122eaca64fa60ed805c452a0ecd9b3cd8539d2e9
6
+ metadata.gz: 212b7600cafb1edac351981ce893346c1aa249ebb6cbdd62398f37b33d2705f4d16be508fdaf91277ec5decf6a75f9fa1732a82c695017a10794ca1a1bd092df
7
+ data.tar.gz: 663ab4c1ea2b13a8ce5cab672823d7c206dd4ac80b76062420fe4e40ab6bfcebdd63afb8a0eb3437df5538bb47d48a4c735f2415533687c78e34acd8d485cf9a
@@ -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
@@ -26,7 +26,9 @@
26
26
  = link_to sch.lead.email, wco.lead_path(sch.lead)
27
27
  %td.tmpl
28
28
  = render '/wco_email/email_templates/show_cell', tmpl: sch.tmpl.email_template
29
- %td= sch.perform_at.in_time_zone
29
+ %td
30
+ = pp_date sch.perform_at.in_time_zone
31
+ = pp_time sch.perform_at.in_time_zone
30
32
 
31
33
 
32
34
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.27
4
+ version: 0.1.1.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev