improved shared database import ui

This commit is contained in:
wvengen 2014-02-24 14:07:03 +01:00
parent 950480941a
commit 0014435663
8 changed files with 97 additions and 61 deletions

View file

@ -208,9 +208,15 @@ class ArticlesController < ApplicationController
end
# fills a form whith values of the selected shared_article
# when the direct parameter is set and the article is valid, it is imported directly
def import
@article = SharedArticle.find(params[:shared_article_id]).build_new_article(@supplier)
render :action => 'new', :layout => false
@article.article_category_id = params[:article_category_id] unless params[:article_category_id].blank?
if params[:direct] and not params[:article_category_id].blank? and @article.valid? and @article.save
render :action => 'create', :layout => false
else
render :action => 'new', :layout => false
end
end
# sync all articles with the external database