Add messaging to order (closes #327)
This commit is contained in:
parent
65c7673a41
commit
124f77f2ab
4 changed files with 32 additions and 21 deletions
20
app/views/orders/_show_js.html.haml
Normal file
20
app/views/orders/_show_js.html.haml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
-# this needs to be in a separate file from show.html.erb to allow deface overrides
|
||||||
|
- content_for :javascript do
|
||||||
|
:javascript
|
||||||
|
function activate_search(view, placeholder) {
|
||||||
|
new List(document.body, {
|
||||||
|
valueNames: ['name'],
|
||||||
|
engine: 'unlist',
|
||||||
|
plugins: [
|
||||||
|
['reset', {highlightClass: 'btn-primary'}],
|
||||||
|
['delay', {delayedSearchTime: 500}],
|
||||||
|
],
|
||||||
|
// make large pages work too (as we don't have paging)
|
||||||
|
page: 10000,
|
||||||
|
indexAsync: true
|
||||||
|
});
|
||||||
|
$('#query').attr('placeholder', placeholder);
|
||||||
|
}
|
||||||
|
$(function() {
|
||||||
|
activate_search('#{j @view}', '#{j t(".search_placeholder.#{@view}")}');
|
||||||
|
});
|
|
@ -79,25 +79,5 @@
|
||||||
#new_comment= render partial: 'order_comments/form', locals: { order_comment: @order.comments.build(user: current_user)}
|
#new_comment= render partial: 'order_comments/form', locals: { order_comment: @order.comments.build(user: current_user)}
|
||||||
= link_to_top
|
= link_to_top
|
||||||
|
|
||||||
|
= render 'show_js'
|
||||||
- content_for :javascript do
|
|
||||||
:javascript
|
|
||||||
function activate_search(view, placeholder) {
|
|
||||||
new List(document.body, {
|
|
||||||
valueNames: ['name'],
|
|
||||||
engine: 'unlist',
|
|
||||||
plugins: [
|
|
||||||
['reset', {highlightClass: 'btn-primary'}],
|
|
||||||
['delay', {delayedSearchTime: 500}],
|
|
||||||
],
|
|
||||||
// make large pages work too (as we don't have paging)
|
|
||||||
page: 10000,
|
|
||||||
indexAsync: true
|
|
||||||
});
|
|
||||||
$('#query').attr('placeholder', placeholder);
|
|
||||||
}
|
|
||||||
$(function() {
|
|
||||||
activate_search('#{j @view}', '#{j t(".search_placeholder.#{@view}")}');
|
|
||||||
});
|
|
||||||
|
|
||||||
= render 'shared/articles_by/common', order: @order
|
= render 'shared/articles_by/common', order: @order
|
||||||
|
|
|
@ -40,6 +40,13 @@ class Message < ActiveRecord::Base
|
||||||
add_recipients Group.find(group_id).users unless group_id.blank?
|
add_recipients Group.find(group_id).users unless group_id.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def order_id=(order_id)
|
||||||
|
@order_id = order_id
|
||||||
|
for ordergroup in Order.find(order_id).ordergroups
|
||||||
|
add_recipients ordergroup.users
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def recipient_tokens=(ids)
|
def recipient_tokens=(ids)
|
||||||
@recipient_tokens = ids
|
@recipient_tokens = ids
|
||||||
add_recipients ids.split(",").collect { |id| User.find(id) }
|
add_recipients ids.split(",").collect { |id| User.find(id) }
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
/ insert_after 'erb:contains("title t(\'.title\'")'
|
||||||
|
- content_for :actionbar do
|
||||||
|
- if FoodsoftMessages.enabled?
|
||||||
|
= link_to_new_message message_params: {order_id: @order.id}
|
Loading…
Reference in a new issue