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