migrate to Rails 4.0 (closes foodcoops#214)

Conflicts:
	Gemfile.lock
This commit is contained in:
wvengen 2014-02-20 15:04:53 +01:00
parent 12d1221bfc
commit 7841245795
97 changed files with 659 additions and 557 deletions

View file

@ -18,5 +18,5 @@
%td= ordergroup.users.size
%td
= link_to t('ui.edit'), edit_admin_ordergroup_path(ordergroup), class: 'btn btn-mini'
= link_to t('ui.delete'), [:admin, ordergroup], :confirm => t('admin.confirm', name: ordergroup.name),
= link_to t('ui.delete'), [:admin, ordergroup], :data => {:confirm => t('admin.confirm', name: ordergroup.name)},
:method => :delete, class: 'btn btn-mini btn-danger'

View file

@ -2,5 +2,5 @@
%section= render 'shared/group', group: @ordergroup
= link_to t('ui.edit'), edit_admin_ordergroup_path(@ordergroup), class: 'btn'
= link_to t('ui.delete'), [:admin, @ordergroup], :confirm => t('.confirm'), :method => :delete, class: 'btn btn-danger'
= link_to t('ui.delete'), [:admin, @ordergroup], :data => {:confirm => t('.confirm')}, :method => :delete, class: 'btn btn-danger'
= link_to t('.send_message'), new_message_path(:message => {:group_id => @ordergroup.id}), class: 'btn'

View file

@ -21,5 +21,5 @@
%td= format_roles(user)
%td= format_time(user.last_login)
%td= link_to t('ui.edit'), edit_admin_user_path(user), class: 'btn btn-mini'
%td= link_to t('ui.delete'), [:admin, user], :confirm => t('admin.confirm', name: user.name),
%td= link_to t('ui.delete'), [:admin, user], :data => {:confirm => t('admin.confirm', name: user.name)},
:method => :delete, class: 'btn btn-danger btn-mini'

View file

@ -29,12 +29,12 @@
.well
%h4= t '.groupabos'
%ul.unstyled
- for membership in Membership.find_all_by_user_id(@user.id)
- for membership in Membership.where(user: @user)
%li= link_to(membership.group.name, [:admin, membership.group])
%hr/
%p
= link_to t('ui.edit'), edit_admin_user_path(@user), class: 'btn'
= link_to t('ui.delete'), [:admin, @user], :confirm => t('.confirm', user: @user.first_name),
= link_to t('ui.delete'), [:admin, @user], :data => {:confirm => t('.confirm', user: @user.first_name)},
:method => :delete, class: 'btn btn-danger'
= link_to t('.send_message'), new_message_path(:message => {:mail_to => @user.id}), class: 'btn'

View file

@ -16,5 +16,5 @@
%td= format_roles(workgroup)
%td
= link_to t('ui.edit'), edit_admin_workgroup_path(workgroup), class: 'btn btn-mini'
= link_to t('ui.delete'), [:admin, workgroup], :confirm => t('admin.confirm', name: workgroup.name),
= link_to t('ui.delete'), [:admin, workgroup], :data => {:confirm => t('admin.confirm', name: workgroup.name)},
:method => :delete, class: 'btn btn-mini btn-danger'

View file

@ -2,5 +2,5 @@
%section= render 'shared/group', group: @workgroup
= link_to t('ui.edit'), edit_admin_workgroup_path(@workgroup), class: 'btn'
= link_to t('ui.delete'), [:admin, @workgroup], :confirm => t('.confirm'), :method => :delete, class: 'btn btn-danger'
= link_to t('ui.delete'), [:admin, @workgroup], :data => {:confirm => t('.confirm')}, :method => :delete, class: 'btn btn-danger'
= link_to_new_message(message_params: {group_id: @workgroup.id})

View file

@ -15,5 +15,5 @@
%td= article_category.description
%td
= link_to t('ui.edit'), edit_article_category_path(article_category), class: 'btn btn-mini'
= link_to t('ui.delete'), article_category, :method => :delete, :confirm => t('.confirm_delete'),
= link_to t('ui.delete'), article_category, :method => :delete, :data => {:confirm => t('.confirm_delete')},
class: 'btn btn-mini btn-danger'

View file

@ -14,4 +14,4 @@
%td= link_to t('ui.edit'), edit_supplier_article_path(@supplier, article),
:remote => true, class: 'btn btn-mini'
%td= link_to t('ui.delete'), [@supplier, article],
:method => :delete, :confirm => t('.confirm_delete'), :remote => true, class: 'btn btn-mini btn-danger'
:method => :delete, :data => {:confirm => t('.confirm_delete')}, :remote => true, class: 'btn btn-mini btn-danger'

View file

@ -28,7 +28,7 @@
= check_box_tag :checkall, 1, false, 'data-check-all' => '#articlesInListForm', 'data-ignore-onchange' => true
%select{:name => "selected_action", 'data-submit-onchange' => true}
%option{:value => '', :selected => 'selected'}= t '.option_select'
%option{:value => "destroy", 'data-confirm' => t('.confirm_delete')}= t '.option_delete'
%option{:value => "destroy", :data => {:confirm => t('.confirm_delete')}}= t '.option_delete'
%option{:value => "setNotAvailable"}= t '.option_not_available'
%option{:value => "setAvailable"}= t '.option_available'
= hidden_field_tag 'supplier_id', @supplier.id

View file

@ -1,7 +1,7 @@
- if @articles.empty?
%p= t '.not_found'
- else
= pagination_links_remote @articles, :params => {:search => search_params}
= pagination_links_remote @articles, :params => {:q => search_params}
%table.table.table-striped
%thead
%tr
@ -16,7 +16,7 @@
%tbody
- for article in @articles
%tr
%td= highlight article.name, params[:search][:name_contains_all]
%td= highlight article.name, params[:q][:name_cont_all]
%td= article.origin
%td= article.manufacturer
%td= article.note

View file

@ -28,7 +28,7 @@
= t '.change_supplier'
%span.caret
%ul.dropdown-menu
- Supplier.undeleted.where('id != ?', @supplier.id).order('suppliers.name ASC').each do |supplier|
- Supplier.undeleted.where.not(id: @supplier.id).order('suppliers.name ASC').each do |supplier|
%li= link_to supplier.name, supplier_articles_path(supplier), tabindex: -1
- unless @supplier.shared_supplier.nil?
@ -36,10 +36,10 @@
= form_tag shared_supplier_articles_path(@supplier), method: :get, remote: true, class: 'form-search',
'data-submit-onchange' => true do
%h3= t '.import.title'
= text_field_tag "search[name_contains_all]", "", class: 'input-medium search-query',
= text_field_tag "q[name_cont_all]", "", class: 'input-medium search-query',
placeholder: t('.import.placeholder')
%label.checkbox
= check_box_tag "search[origin_equals]", "REG", false
= check_box_tag "q[origin_eq]", "REG", false
= t '.import.restrict_region'
#search_results.clearfix
= link_to t('ui.close'), "#import", 'data-toggle-this' => '#import'

View file

@ -15,7 +15,7 @@
%td
= link_to t('ui.show'), [@supplier, delivery], class: 'btn btn-mini'
= link_to t('ui.edit'), edit_supplier_delivery_path(@supplier,delivery), class: 'btn btn-mini'
= link_to t('ui.delete'), [@supplier,delivery], :confirm => t('.confirm_delete'), :method => :delete,
= link_to t('ui.delete'), [@supplier,delivery], :data => {:confirm => t('.confirm_delete')}, :method => :delete,
class: 'btn btn-mini btn-danger'
= link_to t('.new_delivery', supplier: @supplier.name), new_supplier_delivery_path(@supplier), class: 'btn btn-primary'

View file

@ -24,7 +24,7 @@
%th.numeric= t '.sum'
%tbody
- total_net, total_gross = 0,0
- @delivery.stock_changes.all.each do |stock_change|
- @delivery.stock_changes.each do |stock_change|
- quantity = stock_change.quantity
- sum = quantity * stock_change.stock_article.price
- total_net += sum

View file

@ -24,4 +24,4 @@
class: 'btn btn-mini'
%td
= link_to t('ui.delete'), order_order_article_path(order_article.order, order_article), method: :delete,
remote: true, confirm: t('.confirm'), class: 'btn btn-danger btn-mini'
remote: true, data: {confirm: t('.confirm')}, class: 'btn btn-danger btn-mini'

View file

@ -26,6 +26,6 @@
= link_to t('orders.index.action_receive'), '#', class: 'btn btn-mini disabled'
= link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-mini btn-primary'
= link_to t('.close'), close_direct_finance_order_path(order),
:confirm => t('.confirm'), :method => :put, class: 'btn btn-mini'
:data => {:confirm => t('.confirm')}, :method => :patch, class: 'btn btn-mini'
- else
%i= t('.no_closed_orders')

View file

@ -6,5 +6,5 @@
%td= group_order.ordergroup.name
%td.numeric= number_to_currency(group_order.price)
.form-actions
= link_to t('.clear'), close_finance_order_path(@order), method: :put, class: 'btn btn-primary'
= link_to t('.clear'), close_finance_order_path(@order), method: :patch, class: 'btn btn-primary'
= link_to t('.or_cancel'), new_finance_order_path(order_id: @order.id)

View file

@ -1,7 +1,7 @@
%tr.transaction
%td
= select_tag 'financial_transactions[][ordergroup_id]',
options_for_select(Ordergroup.order(:name).all.map { |g| [ g.name, g.id ] })
options_for_select(Ordergroup.order(:name).map { |g| [ g.name, g.id ] })
%td= text_field_tag 'financial_transactions[][amount]', nil, class: 'input-small'
%td= link_to t('.remove'), "#", :title => t('.remove_group'), 'data-remove-transaction' => true,
class: 'btn btn-small'
class: 'btn btn-small'

View file

@ -27,5 +27,5 @@
%td= link_to format_date(invoice.order.ends), new_finance_order_path(order_id: invoice.order_id) if invoice.order
%td= truncate(invoice.note)
%td= link_to t('ui.edit'), edit_finance_invoice_path(invoice), class: 'btn btn-mini'
%td= link_to t('ui.delete'), finance_invoice_path(invoice), :confirm => t('.confirm_delete'), :method => :delete,
%td= link_to t('ui.delete'), finance_invoice_path(invoice), :data => {:confirm => t('.confirm_delete')}, :method => :delete,
class: 'btn btn-danger btn-mini'

View file

@ -34,6 +34,6 @@
- unless Order.closed.empty?
%section
%h2= t '.closed_orders.title'
= render :partial => "orders", :locals => {:orders => Order.closed.all(:limit => 5), :pagination => false}
= render :partial => "orders", :locals => {:orders => Order.closed.limit(5), :pagination => false}
%br/
= link_to t('.closed_orders.more'), archive_group_orders_path

View file

@ -19,5 +19,5 @@
remote: true, class: 'btn btn-success btn-small'
- if membership.group.type != 'Ordergroup'
%td= link_to t('.groups.cancel'), cancel_membership_path(membership_id: membership),
confirm: t('.groups.cancel_confirm'), method: :post,
:data => {confirm: t('.groups.cancel_confirm')}, method: :post,
class: 'btn btn-danger btn-small'

View file

@ -36,8 +36,8 @@
= t('.list.mail', email: mail_to(FoodsoftConfig[:mailing_list_subscribe])).html_safe
#recipients
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.find_all_by_id(@message.recipients_ids).map(&:token_attributes).to_json }
= f.input :group_id, :as => :select, :collection => Group.undeleted.order('type DESC, name ASC').all.reject { |g| g.memberships.empty? }
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.where(id: @message.recipients_ids).map(&:token_attributes).to_json }
= f.input :group_id, :as => :select, :collection => Group.undeleted.order('type DESC, name ASC').reject { |g| g.memberships.empty? }
= f.input :private
= f.input :subject, input_html: {class: 'input-xxlarge'}
= f.input :body, input_html: {class: 'input-xxlarge'}

View file

@ -33,13 +33,13 @@
%td= format_time(order.ends) unless order.ends.nil?
%td= truncate(order.note)
%td= link_to t('.action_end'), finish_order_path(order),
confirm: t('.confirm_end', order: order.name), method: :post,
data: {confirm: t('.confirm_end', order: order.name)}, method: :post,
class: 'btn btn-small btn-success'
%td
= link_to t('ui.edit'), edit_order_path(order), class: 'btn btn-small'
= link_to t('ui.show'), order, class: 'btn btn-small'
= link_to t('ui.delete'), order, confirm: t('.confirm_delete'), method: :delete,
= link_to t('ui.delete'), order, data: {confirm: t('.confirm_delete')}, method: :delete,
class: 'btn btn-small btn-danger'
- unless @finished_orders.empty?
@ -60,7 +60,7 @@
%td
= link_to t('ui.edit'), '#', class: 'btn btn-small disabled', tabindex: -1
= link_to t('ui.show'), order, class: 'btn btn-small'
= link_to t('ui.delete'), order, confirm: t('.confirm_delete'), method: :delete,
= link_to t('ui.delete'), order, data: {confirm: t('.confirm_delete')}, method: :delete,
class: 'btn btn-small btn-danger'
%h2= t '.orders_settled'

View file

@ -59,16 +59,15 @@
- if @order.open?
= link_to t('.action_end'), finish_order_path(@order), method: :post, class: 'btn btn-success',
confirm: t('.confirm_end', order: @order.name)
data: {confirm: t('.confirm_end', order: @order.name)}
= link_to t('ui.edit'), edit_order_path(@order), class: 'btn'
- elsif not @order.closed? and not @order.stockit?
-# TODO btn-success class only if not received before
= link_to t('orders.index.action_receive'), receive_order_path(@order), class: 'btn btn-success'
- unless @order.closed?
= link_to t('ui.delete'), @order, confirm: t('.confirm_delete'), method: :delete,
= link_to t('ui.delete'), @order, data_confirm: t('.confirm_delete'), method: :delete,
class: 'btn btn-danger'
%section#articles_table
= render @partial, order: @order

View file

@ -19,7 +19,7 @@
= number_to_currency(f.object.fc_price) rescue nil
-# do this inline, since it's being used in ajax forms only
- field = f.object.class.model_name.underscore
- field = f.object.class.model_name.to_s.underscore
:javascript
var form = $('#article_fc_price').closest('form');
$('##{field}_price, ##{field}_tax, ##{field}_deposit', form).on('change keyup', function() {

View file

@ -8,7 +8,7 @@
%acronym{:title => t('shared.articles.received_desc')}= t 'shared.articles.received'
%th= t 'shared.articles_by.price'
- for order_article in order.order_articles.ordered.all(:include => [:article, :article_price])
- for order_article in order.order_articles.ordered.includes([:article, :article_price])
= render 'shared/articles_by/article_single', order_article: order_article, edit: (edit rescue nil)
%tr
%td{colspan: 4}

View file

@ -4,7 +4,7 @@
%th{colspan: 9}
%h4.name= group_order.ordergroup.name
- total = 0
- for goa in group_order.group_order_articles.ordered.all(:include => :order_article)
- for goa in group_order.group_order_articles.ordered.includes(:order_article)
- total += goa.total_price
= render 'shared/articles_by/group_single_goa', goa: goa, edit: (edit rescue nil)
%tr{class: cycle('even', 'odd', :name => 'articles')}

View file

@ -15,5 +15,5 @@
%td= truncate stock_taking.note
%td
= link_to t('ui.edit'), edit_stock_taking_path(stock_taking), class: 'btn btn-mini'
= link_to t('ui.delete'), stock_taking, :confirm => t('.confirm_delete'), :method => :delete,
= link_to t('ui.delete'), stock_taking, :data => {:confirm => t('.confirm_delete')}, :method => :delete,
class: 'btn btn-mini btn-danger'

View file

@ -13,7 +13,7 @@
%th= t '.supplier'
%th= t '.unit'
%th= t '.amount'
- for stock_change in @stock_taking.stock_changes.all
- for stock_change in @stock_taking.stock_changes
%tr
%td= stock_change.stock_article.name
%td= stock_change.stock_article.supplier.name
@ -23,5 +23,5 @@
.btn-group
= link_to t('ui.edit'), edit_stock_taking_path(@stock_taking), class: 'btn'
= link_to t('.overview'), stock_takings_path, class: 'btn'
= link_to t('ui.delete'), @stock_taking, :method => :delete, :confirm => t('.confirm_delete'),
= link_to t('ui.delete'), @stock_taking, :method => :delete, :data => {:confirm => t('.confirm_delete')},
class: 'btn btn-danger'

View file

@ -10,5 +10,5 @@
%td= stock_article.article_category.name
%td
= link_to t('ui.edit'), edit_stock_article_path(stock_article), remote: true, class: 'btn btn-mini'
= link_to t('ui.delete'), stock_article, :method => :delete, :confirm => t('.confirm_delete', :name => stock_article.name),
= link_to t('ui.delete'), stock_article, :method => :delete, :data => {:confirm => t('.confirm_delete', :name => stock_article.name)},
class: 'btn btn-mini btn-danger', :remote => true

View file

@ -24,4 +24,4 @@
%td
= link_to t('ui.edit'), edit_supplier_path(supplier), class: 'btn btn-mini'
= link_to t('ui.delete'), supplier_path(supplier), method: :delete,
confirm: t('.confirm_del', name: supplier.name), class: 'btn btn-mini btn-danger'
:data => {confirm: t('.confirm_del', name: supplier.name)}, class: 'btn btn-mini btn-danger'

View file

@ -36,7 +36,7 @@
- if @current_user.role_suppliers?
.form-actions
= link_to t('ui.edit'), edit_supplier_path(@supplier), class: 'btn'
= link_to t('ui.delete'), @supplier, :confirm => t('.confirm_delete'), :method => :delete, class: 'btn btn-danger'
= link_to t('ui.delete'), @supplier, :data => {:confirm => t('.confirm_delete')}, :method => :delete, class: 'btn btn-danger'
.span6
%h2= t '.last_deliveries'

View file

@ -30,8 +30,8 @@
- unless @task.done?
= link_to t('.mark_done'), set_done_task_path(@task), method: :post, class: 'btn'
= link_to t('ui.edit'), edit_task_path(@task), class: 'btn'
= link_to t('ui.delete'), task_path(@task), :method => :delete, :confirm => t('.confirm_delete_single'),
= link_to t('ui.delete'), task_path(@task), :method => :delete, :data => {:confirm => t('.confirm_delete_single')},
class: 'btn btn-danger'
- if @task.periodic?
= link_to t('.delete_group'), task_path(@task, periodic: true), method: :delete,
confirm: t('.confirm_delete_group'), class: 'btn btn-danger'
:data => {confirm: t('.confirm_delete_group')}, class: 'btn btn-danger'