parent
3ade87167a
commit
71bdf3bfcc
5 changed files with 19 additions and 7 deletions
|
@ -36,6 +36,11 @@ class ArticlesController < ApplicationController
|
|||
render :layout => false
|
||||
end
|
||||
|
||||
def copy
|
||||
@article = @supplier.articles.find(params[:article_id]).dup
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def create
|
||||
@article = Article.new(params[:article])
|
||||
if @article.valid? && @article.save
|
||||
|
|
|
@ -11,7 +11,11 @@
|
|||
= number_to_currency(article.price)
|
||||
%td= number_to_percentage(article.tax) if article.tax != 0
|
||||
%td= number_to_currency(article.deposit) if article.deposit != 0
|
||||
%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, :data => {:confirm => t('ui.confirm_delete', name: article.name)}, :remote => true, class: 'btn btn-mini btn-danger'
|
||||
%td
|
||||
= link_to t('ui.edit'), edit_supplier_article_path(@supplier, article),
|
||||
remote: true, class: 'btn btn-mini'
|
||||
= link_to t('ui.copy'), supplier_article_copy_path(@supplier, article),
|
||||
remote: true, class: 'btn btn-mini'
|
||||
= link_to t('ui.delete'), [@supplier, article],
|
||||
method: :delete, data: {confirm: t('ui.confirm_delete', name: article.name)},
|
||||
remote: true, class: 'btn btn-mini btn-danger'
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
%th{:style => "width: 5em;"}= heading_helper Article, :price
|
||||
%th{:style => "width: 3.5em;"}= heading_helper Article, :tax
|
||||
%th{:style => "width: 4em;"}= heading_helper Article, :deposit
|
||||
%th{:style => "width: 3em;"}
|
||||
|
||||
%th
|
||||
|
||||
%tbody#listbody
|
||||
|
||||
|
||||
- unless @articles.empty?
|
||||
- for article in @articles
|
||||
= render(article)
|
||||
|
|
2
app/views/articles/copy.js.haml
Normal file
2
app/views/articles/copy.js.haml
Normal file
|
@ -0,0 +1,2 @@
|
|||
$('#modalContainer').html('#{j(render("form"))}');
|
||||
$('#modalContainer').modal();
|
|
@ -125,6 +125,7 @@ Foodsoft::Application.routes.draw do
|
|||
end
|
||||
|
||||
resources :articles do
|
||||
get :copy
|
||||
collection do
|
||||
post :update_selected
|
||||
get :edit_all
|
||||
|
|
Loading…
Reference in a new issue