carrier 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/TODO +1 -0
- data/VERSION +1 -1
- data/app/assets/images/carrier/chosen-sprite.png +0 -0
- data/app/assets/javascripts/carrier/chosen.jquery.min.js +10 -0
- data/app/assets/javascripts/carrier/chosen.js +5 -0
- data/app/assets/stylesheets/{carrier.css → carrier/carrier.css} +43 -5
- data/app/assets/stylesheets/carrier/chosen.css +367 -0
- data/app/controllers/carrier/chains_controller.rb +7 -5
- data/app/controllers/carrier/messages_controller.rb +4 -6
- data/app/helpers/carrier/application_helper.rb +5 -8
- data/app/models/carrier/chain.rb +2 -2
- data/app/models/carrier/message.rb +23 -19
- data/app/models/carrier/message/validations.rb +1 -1
- data/app/validators/recipients/exclude_self.rb +1 -1
- data/app/validators/recipients/recipients_presence_validator.rb +8 -0
- data/app/validators/recipients/right_recipients_validator.rb +10 -0
- data/app/views/carrier/messages/_chosen.html.erb +7 -0
- data/app/views/carrier/messages/_form.html.erb +30 -24
- data/app/views/carrier/messages/_head.html.erb +1 -6
- data/app/views/carrier/messages/_index_message.html.erb +2 -2
- data/app/views/carrier/messages/{_message_expanded.html.erb → _message.html.erb} +0 -0
- data/app/views/carrier/messages/_message_collapsed.html.erb +1 -1
- data/app/views/carrier/messages/_nav_messages.html.erb +5 -5
- data/app/views/carrier/messages/_recipients.html.erb +1 -0
- data/app/views/carrier/messages/_reply.html.erb +17 -14
- data/app/views/carrier/messages/as_sent.html.erb +4 -0
- data/app/views/carrier/messages/create.js.erb +1 -1
- data/app/views/carrier/messages/index.html.erb +12 -1
- data/app/views/carrier/messages/new.html.erb +6 -0
- data/app/views/carrier/messages/reply.js.erb +1 -1
- data/app/views/carrier/messages/show.html.erb +34 -32
- data/app/views/layouts/carrier/application.html.erb +2 -2
- data/app/views/partials/_error_messages_for.html.erb +2 -2
- data/carrier.gemspec +21 -115
- data/config/locales/carrier.en.yml +11 -5
- data/config/locales/carrier.ru.yml +12 -1
- data/config/routes.rb +6 -2
- data/lib/carrier.rb +0 -1
- data/lib/carrier/configuration.rb +6 -8
- data/lib/carrier/configuration/routes.rb +19 -0
- data/lib/carrier/configuration/user.rb +24 -0
- data/lib/carrier/rails/engine.rb +15 -4
- data/lib/carrier/rails/helpers.rb +17 -3
- data/lib/carrier/version.rb +3 -0
- data/spec/dummy/config/initializers/carrier.rb +2 -0
- data/spec/integration/carrier_spec.rb +4 -2
- data/spec/requests/main_spec.rb +0 -1
- metadata +134 -223
- data/app/assets/javascripts/autocomplete.js +0 -4
- data/app/assets/javascripts/autocomplete/i18n/jquery-ui-i18n.js +0 -1379
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-af.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ar-DZ.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ar.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-az.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-bg.js +0 -24
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-bs.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ca.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-cs.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-da.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-de.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-el.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-en-AU.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-en-GB.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-en-NZ.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-eo.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-es.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-et.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-eu.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fa.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fi.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fo.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fr-CH.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fr.js +0 -25
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-gl.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-he.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-hr.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-hu.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-hy.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-id.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-is.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-it.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ja.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ko.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-kz.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-lt.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-lv.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ml.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ms.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-nl.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-no.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-pl.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-pt-BR.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-pt.js +0 -22
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-rm.js +0 -21
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ro.js +0 -26
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ru.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sk.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sl.js +0 -24
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sq.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sr-SR.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sr.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sv.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ta.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-th.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-tj.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-tr.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-uk.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-vi.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-zh-CN.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-zh-HK.js +0 -23
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-zh-TW.js +0 -23
- data/app/assets/javascripts/autocomplete/jquery.ui.autocomplete.min.js +0 -32
- data/app/assets/javascripts/autocomplete/jquery.ui.core.min.js +0 -17
- data/app/assets/javascripts/autocomplete/jquery.ui.position.min.js +0 -16
- data/app/assets/javascripts/autocomplete/jquery.ui.widget.min.js +0 -15
- data/app/assets/javascripts/carrier.js +0 -8
- data/app/assets/javascripts/rich-multiselect/jquery-ui.min.js +0 -405
- data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-de.js +0 -11
- data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-en.js +0 -11
- data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-es.js +0 -11
- data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-fr.js +0 -11
- data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-it.js +0 -13
- data/app/assets/javascripts/rich-multiselect/plugins/localisation/jquery.localisation-min.js +0 -7
- data/app/assets/javascripts/rich-multiselect/plugins/localisation/jquery.localisation-pack.js +0 -7
- data/app/assets/javascripts/rich-multiselect/plugins/localisation/jquery.localisation.js +0 -99
- data/app/assets/javascripts/rich-multiselect/plugins/scrollTo/README.txt +0 -37
- data/app/assets/javascripts/rich-multiselect/plugins/scrollTo/changes.txt +0 -82
- data/app/assets/javascripts/rich-multiselect/plugins/scrollTo/jquery.scrollTo-min.js +0 -11
- data/app/assets/javascripts/rich-multiselect/plugins/scrollTo/jquery.scrollTo.js +0 -207
- data/app/assets/javascripts/rich-multiselect/ui.multiselect.js +0 -339
- data/app/assets/stylesheets/carrier_rich.css +0 -48
- data/app/assets/stylesheets/carrier_simple.css +0 -15
- data/app/assets/stylesheets/rich-multiselect/ui.multiselect.css +0 -30
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_55_fbf9ee_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_65_ffffff_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_75_cccccc_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_75_dadada_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_75_e6e6e6_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_95_fef1ec_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-icons_888888_256x240.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/stylesheets/ui-lightness/jquery-ui-1.8.14.custom.css +0 -342
- data/app/helpers/carrier/post_helper.rb +0 -4
- data/app/validators/recipients/recipients_validator.rb +0 -10
- data/app/views/carrier/messages/rich/_multiselect.html.erb +0 -18
- data/app/views/carrier/messages/rich/_recipients.html.erb +0 -6
- data/app/views/carrier/messages/simple/_autocomplete.html.erb +0 -45
- data/app/views/carrier/messages/simple/_autocomplete_includes.html.erb +0 -7
- data/app/views/carrier/messages/simple/_recipients.html.erb +0 -3
- data/lib/carrier/configuration/ui.rb +0 -28
@@ -1,15 +1,17 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
module Carrier
|
3
|
-
class ChainsController < ApplicationController
|
3
|
+
class ChainsController < Carrier::ApplicationController
|
4
|
+
|
5
|
+
before_filter :only => %w[archive unarchive] do
|
6
|
+
@user = User.send find_method_for_user, params[:user_id]
|
7
|
+
@chain = Carrier::Chain.find(params[:chain_id])
|
8
|
+
end
|
9
|
+
|
4
10
|
def archive
|
5
|
-
@chain = Chain.find(params[:chain_id])
|
6
|
-
@user = User.find(params[:user_id])
|
7
11
|
@chain.archive_for!(@user)
|
8
12
|
end
|
9
13
|
|
10
14
|
def unarchive
|
11
|
-
@chain = Chain.find(params[:chain_id])
|
12
|
-
@user = User.find(params[:user_id])
|
13
15
|
@chain.unarchive_for!(@user)
|
14
16
|
end
|
15
17
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Carrier
|
4
4
|
class MessagesController < ApplicationController
|
5
5
|
|
6
|
-
after_filter :only => [:
|
6
|
+
after_filter :only => [:show] { @message.mark_as_read! :for => current_user }
|
7
7
|
|
8
8
|
[:collapsed, :expanded].each do |mode|
|
9
9
|
define_method(mode) do
|
@@ -30,23 +30,21 @@ module Carrier
|
|
30
30
|
render 'index'
|
31
31
|
end
|
32
32
|
|
33
|
-
def as_sent
|
34
|
-
@message = Message.find(params[:id], :include => :chain)
|
35
|
-
end
|
36
|
-
|
37
33
|
def show
|
38
34
|
@message = Message.find(params[:id], :include => :chain)
|
39
35
|
end
|
40
36
|
|
37
|
+
# TODO: introduce [:id or :username] key to be passed with to= param
|
41
38
|
def new
|
42
39
|
@message = Message.new
|
40
|
+
@message.recipients_names = params[:to] if params[:to]
|
43
41
|
end
|
44
42
|
|
45
43
|
def create
|
46
44
|
@message = Message.new(params[:message])
|
47
45
|
respond_to do |format|
|
48
46
|
if @message.save
|
49
|
-
format.html { redirect_to(
|
47
|
+
format.html { redirect_to(@message, :notice => t('views.carrier.successfully_created')) }
|
50
48
|
format.js
|
51
49
|
else
|
52
50
|
format.js { render :action => "new" }
|
@@ -7,20 +7,17 @@ module Carrier
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def archived? message
|
10
|
-
return
|
11
|
-
message.archived_for?
|
10
|
+
return if !message || message.new_record?
|
11
|
+
message.archived_for?(current_user)
|
12
12
|
end
|
13
13
|
|
14
14
|
def b string
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
def without_current_user
|
19
|
-
User.all.without(current_user).map{|user| "'#{user.username}'" }.join(', ')
|
15
|
+
content_tag :b, string
|
20
16
|
end
|
21
17
|
|
18
|
+
# Extract this query somewhere...
|
22
19
|
def without_current_user_select
|
23
|
-
User.
|
20
|
+
User.select('id, username').where(User.arel_table[:id].not_in(current_user.id)).collect {|user| [user.username, user.id] }
|
24
21
|
end
|
25
22
|
end
|
26
23
|
end
|
data/app/models/carrier/chain.rb
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
module Carrier
|
3
3
|
class Chain < ActiveRecord::Base
|
4
4
|
|
5
|
-
|
5
|
+
self.table_name = Carrier.config.models.table_for :chain
|
6
6
|
|
7
7
|
serialize :participants, Array
|
8
8
|
serialize :archived_for, Array
|
9
9
|
|
10
10
|
paginates_per 25
|
11
11
|
|
12
|
-
has_many :messages, :order => "created_at"
|
12
|
+
has_many :messages, :order => "created_at", :class_name => "Carrier::Message"
|
13
13
|
|
14
14
|
accepts_nested_attributes_for :messages, :reject_if => proc { |attrs| attrs.all? {|k,v| v.blank?}}
|
15
15
|
|
@@ -1,17 +1,19 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
module Carrier
|
3
3
|
class Message < ActiveRecord::Base
|
4
|
-
|
4
|
+
self.table_name = Carrier.config.models.table_for :message
|
5
5
|
|
6
6
|
concerned_with :scopes, :subject, :validations
|
7
7
|
|
8
8
|
serialize :recipients, Array
|
9
9
|
paginates_per 25
|
10
10
|
|
11
|
-
belongs_to :chain, :counter_cache => true
|
12
|
-
|
13
|
-
|
11
|
+
belongs_to :chain, :counter_cache => true, :class_name => "Carrier::Chain"
|
12
|
+
|
13
|
+
delegate :messages, :to => :chain, :prefix => true
|
14
14
|
delegate :archived_for?, :archived_for_any_user?, :participants!, :to => :chain
|
15
|
+
|
16
|
+
belongs_to :sender_user, :foreign_key => "sender", :class_name => "User"
|
15
17
|
|
16
18
|
acts_as_readable :on => :created_at
|
17
19
|
|
@@ -48,10 +50,6 @@ module Carrier
|
|
48
50
|
def chain_archived?
|
49
51
|
chain && archived_for_any_user?
|
50
52
|
end
|
51
|
-
|
52
|
-
def chain!
|
53
|
-
self.chain = Chain.create if !chain
|
54
|
-
end
|
55
53
|
|
56
54
|
def make_last
|
57
55
|
self.last = true
|
@@ -71,23 +69,27 @@ module Carrier
|
|
71
69
|
end
|
72
70
|
|
73
71
|
def default_subject!
|
74
|
-
self.subject = I18n.t
|
72
|
+
self.subject = I18n.t('models.carrier.no_subject') if !subject || subject.empty?
|
75
73
|
end
|
76
74
|
|
77
75
|
def sender_name
|
78
76
|
sender_user.username
|
79
77
|
end
|
80
78
|
|
81
|
-
def recipients_names
|
82
|
-
recipients.collect{|id| User.find(id, :select => "username").username}.join(', ') #
|
83
|
-
end
|
84
|
-
|
85
79
|
def recipients_ids
|
86
80
|
recipients
|
87
81
|
end
|
88
82
|
|
89
83
|
def recipients_ids= ra
|
90
|
-
self.recipients = ra.scan(/\
|
84
|
+
self.recipients = ra.scan(/\d+/).map(&:to_i)
|
85
|
+
end
|
86
|
+
|
87
|
+
def recipients= r_arr
|
88
|
+
super r_arr.without("").map(&:to_i)
|
89
|
+
end
|
90
|
+
|
91
|
+
def recipients_names
|
92
|
+
recipients.collect{|id| User.find(id, :select => "username").username}.join(', ') #
|
91
93
|
end
|
92
94
|
|
93
95
|
def recipients_names= recipients_array
|
@@ -101,18 +103,20 @@ module Carrier
|
|
101
103
|
end
|
102
104
|
|
103
105
|
def participants
|
104
|
-
[] | recipients << sender
|
106
|
+
([] | recipients << sender).compact
|
105
107
|
end
|
106
108
|
|
107
|
-
def chain_messages
|
108
|
-
chain.messages
|
109
|
-
end
|
110
|
-
|
111
109
|
def date_formatted
|
112
110
|
created_at.strftime('%H:%M %d.%m')
|
113
111
|
end
|
114
112
|
|
115
113
|
protected
|
116
114
|
|
115
|
+
private
|
116
|
+
|
117
|
+
def chain!
|
118
|
+
self.chain = Carrier::Chain.create if !chain
|
119
|
+
end
|
120
|
+
|
117
121
|
end
|
118
122
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Carrier
|
2
2
|
class Message < ActiveRecord::Base
|
3
3
|
validates :sender, :presence => true
|
4
|
-
validates :recipients, :
|
4
|
+
validates :recipients, :recipients_presence => true, :exclude_self => true, :right_recipients => true
|
5
5
|
validates :content, :presence => true
|
6
6
|
end
|
7
7
|
end
|
@@ -3,7 +3,7 @@ class ExcludeSelfValidator < ActiveModel::EachValidator
|
|
3
3
|
recipients = record.send(attribute)
|
4
4
|
|
5
5
|
if recipients.include?(record.sender)
|
6
|
-
record.errors.add
|
6
|
+
record.errors.add :recipients, (options[:message] || t('activerecord.errors.models.carrier/message.attributes.recipients.cannot_write_to_self') )
|
7
7
|
recipients.delete(record.sender)
|
8
8
|
end
|
9
9
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class RecipientsPresenceValidator < ActiveModel::EachValidator
|
2
|
+
def validate_each(record, attribute, value)
|
3
|
+
recipients = record.send(attribute)
|
4
|
+
|
5
|
+
record.errors.add :recipients, (options[:message] || I18n.t('activerecord.errors.models.carrier/message.attributes.recipients.empty')) if recipients.empty?
|
6
|
+
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class RightRecipientsValidator < ActiveModel::EachValidator
|
2
|
+
def validate_each(record, attribute, value)
|
3
|
+
recipients = record.send(attribute)
|
4
|
+
|
5
|
+
if recipients.include?(nil)
|
6
|
+
record.errors.add :recipients, (options[:message] || I18n.t('activerecord.errors.models.carrier/message.attributes.recipients.wrong'))
|
7
|
+
recipients.compact!
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -1,30 +1,36 @@
|
|
1
1
|
<%= form_for([carrier, @message], :html => { :autocomplete => :off }) do |f| %>
|
2
|
-
|
3
|
-
<%= error_messages_for @message %>
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<div
|
10
|
-
|
3
|
+
<%= error_messages_for @message %>
|
4
|
+
|
5
|
+
<div class="message_ma_new_wrapper">
|
6
|
+
<div class="message_ma_new_wrapper_1">
|
7
|
+
<div class="field">
|
8
|
+
<div>
|
9
|
+
<%= f.label :recipients, t('views.carrier.new_recipients') %>
|
10
|
+
</div>
|
11
|
+
<div id="recipients">
|
12
|
+
<%= render :partial => "carrier/messages/recipients", :locals => {:f => f } %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<div class="message_ma_new_wrapper_2">
|
17
|
+
<div class="field">
|
18
|
+
<div>
|
19
|
+
<%= f.label :subject, t('views.carrier.new_subject') %>
|
20
|
+
</div>
|
21
|
+
<%= f.text_field :subject %>
|
11
22
|
</div>
|
12
|
-
|
23
|
+
<div class="field">
|
24
|
+
<div>
|
25
|
+
<%= f.label :content, t('views.carrier.new_content') %>
|
26
|
+
</div>
|
27
|
+
<%= f.text_area :content, :rows => 6 %>
|
28
|
+
</div>
|
29
|
+
<%= f.hidden_field :sender, :value => current_user.id %>
|
30
|
+
<div class="actions">
|
31
|
+
<%= f.submit t('views.carrier.new_send') %>
|
32
|
+
</div>
|
33
|
+
</div>
|
13
34
|
</div>
|
14
|
-
<div class="message_ma_new_wrapper_2">
|
15
|
-
<div class="field">
|
16
|
-
<%= f.label :subject, t('views.carrier.new_subject') %><br />
|
17
|
-
<%= f.text_field :subject %>
|
18
|
-
</div>
|
19
|
-
<div class="field">
|
20
|
-
<%= f.label :content, t('views.carrier.new_content') %><br />
|
21
|
-
<%= f.text_area :content, :rows => 6 %>
|
22
|
-
</div>
|
23
|
-
<%= f.hidden_field :sender, :value => current_user.id %>
|
24
|
-
<div class="actions">
|
25
|
-
<%= f.submit t('views.carrier.new_send') %>
|
26
|
-
</div>
|
27
|
-
</div>
|
28
|
-
</div>
|
29
35
|
|
30
36
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= link_to
|
1
|
+
<%= link_to message, :class => "message_ma_wrapper #{'ma_has_new' if m > 0 }" do %>
|
2
2
|
<div class="message_ma_date"><%= message.date_formatted %></div>
|
3
3
|
<div class="message_ma_users">
|
4
4
|
<%= truncate(message.sender_name + " + " + message.recipients_names, :length => 20) %>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
</span>
|
8
8
|
</div>
|
9
9
|
<div class="message_ma_body">
|
10
|
-
<%=
|
10
|
+
<%= simple_format truncate(%| <span class="message_ma_subj %s">%s</span> » %s | % [('ma_has_new' if m > 0), message.subject, message.content], :length => 140) %>
|
11
11
|
</div>
|
12
12
|
<% end %>
|
13
13
|
|
File without changes
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<% if unread_messages.include? message %>
|
7
7
|
<b class='red'>unread</b>
|
8
8
|
<% end %>
|
9
|
-
<%=
|
9
|
+
<%= simple_format truncate("%s » %s" % [message.subject, message.content], :length => 88) %>
|
10
10
|
</div>
|
11
11
|
</div>
|
12
12
|
<% end %>
|
@@ -1,14 +1,14 @@
|
|
1
1
|
<div class="carrier_nav_line">
|
2
2
|
<div class="carrier_nav_line_inner">
|
3
3
|
|
4
|
-
<div class="carrier_new">
|
5
|
-
<%= link_to raw(t 'views.carrier.new_link'), carrier.new_message_path %>
|
4
|
+
<div class="carrier_new<%= ' active' if request.fullpath =~ /#{prefix_for_messages}\/new\Z/ %>">
|
5
|
+
<%= link_to raw(t 'views.carrier.new_link'), carrier.new_message_path, :class => "#{'active' if request.fullpath =~ /#{prefix_for_messages}\/new\Z/ }"%>
|
6
6
|
</div>
|
7
7
|
<div class="carrier_nav">
|
8
8
|
<ul>
|
9
|
-
<li class="<%= 'active' if request.fullpath =~
|
10
|
-
<li class="<%= 'active' if request.fullpath =~
|
11
|
-
<li class="<%= 'active' if request.fullpath =~
|
9
|
+
<li class="<%= 'active' if request.fullpath =~ /#{prefix_for_messages}(\/\d+)?\z/ && !archived?(@message) %>"><%= link_to raw(t 'views.carrier.inbox_link'), carrier.messages_path %></li>
|
10
|
+
<li class="<%= 'active' if request.fullpath =~ /#{prefix_for_messages}\/(\d+\/.*)?sent/ %>"><%= link_to raw(t 'views.carrier.sent_link'), carrier.sent_messages_path %></li>
|
11
|
+
<li class="<%= 'active' if request.fullpath =~ /#{prefix_for_messages}\/archive/ || archived?(@message) %>"><%= link_to raw(t 'views.carrier.archived_link'), carrier.archive_messages_path %></li>
|
12
12
|
</ul>
|
13
13
|
</div>
|
14
14
|
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= select("message", "recipients", without_current_user_select, {}, { :multiple => true, :class => 'chosen', :"data-placeholder" => " " }) %>
|
@@ -1,19 +1,22 @@
|
|
1
1
|
<%= form_for(@message, :remote => true) do |f| %>
|
2
2
|
|
3
|
-
<%= error_messages_for @message %>
|
3
|
+
<%= error_messages_for @message %>
|
4
4
|
|
5
|
-
<div class="message_ma_new_wrapper replay_message_ma">
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
<%= f.
|
5
|
+
<div class="message_ma_new_wrapper replay_message_ma">
|
6
|
+
<h4><span class=""><%= current_user.username %></span> ⇒ <span class="red"><%= @message.recipients_names %></span></h4>
|
7
|
+
<div class="field">
|
8
|
+
<%= f.label "Сообщение:" %><br />
|
9
|
+
<%= f.text_area :content, :rows => 6 %>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<%= f.hidden_field :recipients_ids %>
|
13
|
+
<%= f.hidden_field :chain_id %>
|
14
|
+
<%= f.hidden_field :sender %>
|
15
|
+
<%= f.hidden_field :answers_to %>
|
16
|
+
<%= f.hidden_field :subject %>
|
17
|
+
|
18
|
+
<div class="actions">
|
19
|
+
<%= f.submit 'Отправить' %>
|
20
|
+
</div>
|
17
21
|
</div>
|
18
|
-
</div>
|
19
22
|
<% end %>
|
@@ -1,3 +1,5 @@
|
|
1
|
+
<div id="carrier">
|
2
|
+
<div class="carrier_wr">
|
1
3
|
<%= render :partial => 'head' %>
|
2
4
|
<%= render :partial => 'nav_messages' %>
|
3
5
|
<div class="message_ma_box_info">
|
@@ -34,3 +36,5 @@
|
|
34
36
|
<%= link_to raw(t 'views.carrier.reply_link'), reply_message_path(@message), :remote => true %>
|
35
37
|
<div id="reply_form"></div>
|
36
38
|
</div>
|
39
|
+
</div>
|
40
|
+
</div>
|
@@ -1 +1 @@
|
|
1
|
-
document.location.href = '<%=
|
1
|
+
document.location.href = '<%= message_path @message %>'
|
@@ -1,9 +1,20 @@
|
|
1
|
+
<div id="carrier">
|
2
|
+
<div class="carrier_wr">
|
1
3
|
<%= render :partial => 'head' %>
|
2
4
|
<%= render :partial => 'nav_messages' %>
|
3
5
|
<div class="carrier_messagelist">
|
6
|
+
<% if @messages.any? %>
|
4
7
|
<% @messages.each do |message| %>
|
5
8
|
<%= render :partial => 'index_message', :locals => {:message => message, :m => (message & unread_messages).size} %>
|
6
9
|
<% end if @messages.size > 0 %>
|
7
10
|
<%= paginate @messages, :window => 4 %>
|
8
|
-
|
11
|
+
<% end %>
|
9
12
|
|
13
|
+
<% unless @messages.any? %>
|
14
|
+
<div class="no_messages">
|
15
|
+
<%= raw(t('views.carrier.no_messages')) %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|