wco_email 0.1.1.27 → 0.1.1.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascript/wco_email/conversations.js +2 -0
- data/app/assets/stylesheets/wco_email/conversations.scss +3 -0
- data/app/controllers/wco_email/application_controller.rb +1 -1
- data/app/controllers/wco_email/conversations_controller.rb +30 -30
- data/app/views/layouts/wco_email/application.haml +3 -0
- data/app/views/wco_email/conversations/_actions.haml +2 -1
- data/app/views/wco_email/conversations/index.haml +10 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0336e9d11575454d0186560074d18786b577ad9b8dadb5ed7c79fa70d8c5082
|
4
|
+
data.tar.gz: 21fcdb2342f09c69a6d31c19801bd2dcb1937adeb1a8151aafb0fe26a75d95f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
@@ -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
|
-
|
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
|
-
|
28
|
-
|
29
|
-
|
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
|
-
|
91
|
-
outs = convs.map do |conv|
|
92
|
-
|
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
|
-
|
95
|
-
|
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
|
+
|
@@ -10,7 +10,8 @@
|
|
10
10
|
%i.material-icons refresh
|
11
11
|
refresh
|
12
12
|
.bordered.inline-block
|
13
|
-
|
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
|