Fixed articles views.

This commit is contained in:
benni 2012-10-19 01:12:47 +02:00
parent fd361090b4
commit f30e57dd49
18 changed files with 159 additions and 153 deletions

View file

@ -1,28 +1,19 @@
%p
Gefundene Artikel:
%b= @total
- if @supplier.articles.count > 20
= items_per_page
= pagination_links_remote @articles
%p
%table{:style => "width:100%"}
%tr
%td
= pagination_links_remote @articles, :params => {:sort => params[:sort]}
%td{:style => "text-align:right"}
- if @total > 30
= items_per_page :per_page_options => [30, 100, 500]
%table#articles_table.list.articles
%table#articles_table.table.table-striped
%thead
%tr
%th
%th[sort_td_class_helper("name")]
%th{class: sort_td_class_helper(:name)}
= sort_link_helper "Name", "name"
%th
%th[sort_td_class_helper("category")]
%th{class: sort_td_class_helper(:category)}
= sort_link_helper "Kategorie", "category"
%th[sort_td_class_helper("unit")]
%th{class: sort_td_class_helper(:unit)}
= sort_link_helper "Einheit", "unit"
%th[sort_td_class_helper("note")]
%th{class: sort_td_class_helper(:note)}
= sort_link_helper "Notiz", "note"
%th{:style => "width: 4em;"} Gebgr.
%th{:style => "width: 5em;"} Preis
@ -32,7 +23,7 @@
%tbody#listbody
- if @total > 0
- unless @articles.empty?
- for article in @articles
= render(article)
%tfoot
@ -46,5 +37,4 @@
%option{:value => "setAvailable"} Artikel sind verfügbar
= hidden_field_tag 'supplier_id', @supplier.id
%p= pagination_links_remote @articles, :params => {:sort => params[:sort]}
= hidden_field_tag :per_page, params[:per_page]
= pagination_links_remote @articles

View file

@ -1,18 +1,24 @@
= simple_form_for [@supplier, @article], :validate => true, :remote => true do |f|
= f.input :availability
= f.input :name
= f.input :origin
= f.input :manufacturer
= f.input :unit
= f.input :note
= f.association :article_category
= f.input :price
= f.input :unit_quantity
= f.input :order_number
= f.input :tax
= f.input :deposit
= f.submit
= f.hidden_field :shared_updated_on
= f.hidden_field :supplier_id
= f.hidden_field :supplier_id
.modal-header
= button_tag "x", class: 'close', data: {dismiss: 'modal'}
%h3 Neuen Artikel einfügen
.modal-body
= f.input :availability
= f.input :name
= f.input :origin
= f.input :manufacturer
= f.input :unit
= f.input :note
= f.association :article_category
= f.input :price
= f.input :unit_quantity
= f.input :order_number
= f.input :tax
= f.input :deposit
.modal-footer
= button_tag "Schließen", class: 'btn', data: {dismiss: 'modal'}
= f.submit class: 'btn btn-primary'

View file

@ -1,25 +1,33 @@
%p= pagination_links_remote @articles, :per_page => 10, :params => {:search => params[:search]}
%table.list
%thead
%tr
%th Name
%th Herkunft
%th Hersteller
%th Notiz
%th{:style => "width:4em"} Preis
%th Einheit
%th GebGröße
%th
%tbody
- for article in @articles
%tr{:class => cycle('even','odd', :name => 'import_search_results')}
%td= highlight article.name, params[:search][:name_contains_all]
%td= article.origin
%td= article.manufacturer
%td= article.note
%td= number_to_currency(article.price)
%td= article.unit
%td= article.unit_quantity
%td= link_to 'importieren', import_supplier_articles_path(@supplier, :shared_article_id => article.id),
:remote => true
- if @articles.empty?
%p Keine Artikel gefunden
- else
= pagination_links_remote @articles, :params => {:search => search_params}
%table.table.table-striped
%thead
%tr
%th Name
%th Herkunft
%th Hersteller
%th Notiz
%th{:style => "width:4em"} Preis
%th Einheit
%th GebGröße
%th
%tbody
- for article in @articles
%tr
%td= highlight article.name, params[:search][:name_contains_all]
%td= article.origin
%td= article.manufacturer
%td= article.note
%td= number_to_currency(article.price)
%td= article.unit
%td= article.unit_quantity
%td
- logger.debug "[debug] #{article.attributes.inspect}"
- if @supplier.articles.where(order_number: article.number).exists?
%i.icon-ok
schon importiert
- else
= link_to 'importieren', import_supplier_articles_path(@supplier, :shared_article_id => article.id),
:remote => true, class: 'btn btn-small btn-success'

View file

@ -1,2 +1,2 @@
$('#modalContainer').modal('hide');
$('#listbody').prepend('#{escape_javascript(render(@article))}');
$.fancybox.close();

View file

@ -1,66 +1,48 @@
- title "Artikel von #{@supplier.name}"
- title "Artikel von #{@supplier.name} (#{@supplier.articles.count})"
// import menu
- unless @supplier.shared_supplier.nil?
.menu{:style => 'width: 16em'}
%ul
%li
Zugriff auf externe Datenbank
%ul
%li= link_to "Suchen/Importieren", "#import", 'data-toggle-this' => '#import'
%li= link_to "Synchronisieren", sync_supplier_articles_path(@supplier), :method => :post
#change_supplier{:style => "padding:0 0 0.5em 0.7em;"}
%span{:style => "float:left"}
Lieferantin wechseln:
= select_tag :switch_supplier,
options_for_select(Supplier.order(:name).map {|s| [s.name, supplier_articles_url(s)] }, supplier_articles_url(@supplier)),
:style => "font-size: 0.9em;margin-left:1em;",
'data-redirect-to' => true
- unless @supplier.shared_supplier.nil?
#import.single_column{:style => "display:none; clear:both"}
.box_title
%h2 Artikel importieren
.column_content
#search{:style => "padding-bottom:3em"}
= form_tag shared_supplier_articles_path(@supplier), :method => :get, :remote => true do
= text_field_tag "search[name_contains_all]", "", :size => 10
= submit_tag "Suchen"
- if @supplier.shared_supplier.lists
Suche in folgenden Listen:
- @supplier.shared_supplier.lists.each do |token, name|
= check_box_tag "search[list_equals_any][]", token, true
= name
|
Nur aus der Region:
= check_box_tag "search[origin_equals]", "REG", false
#search_results
= link_to "Schließen", "#import", 'data-toggle-this' => '#import'
.single_column{:style => 'width:100%; clear:both'}
.box_title
.column_content
#links
%b= link_to "Neuer Artikel", new_supplier_article_path(@supplier), :remote => true
|
= link_to "Alle bearbeiten", edit_all_supplier_articles_path(@supplier)
|
= link_to "Artikel hochladen", upload_supplier_articles_path(@supplier)
- if current_user.role_orders?
|
= link_to "Bestellung anlegen", new_order_path(:supplier_id => @supplier)
#article_filter
#article_search_form{:style=>"display:inline;"}
= form_tag supplier_articles_path(@supplier), :method => :get, :remote => true, 'data-submit-onchange' => true do
%label{:for => 'article_name'} Suche im Artikelnamen:
= text_field_tag :query, params[:query], :size => 10
= submit_tag "Suchen"
= form_tag update_selected_supplier_articles_path(@supplier), :id => "articlesInListForm",
.well.well-small
.btn-toolbar
= form_tag supplier_articles_path(@supplier), method: :get, remote: true, class: 'form-search pull-right',
'data-submit-onchange' => true do
#table= render 'articles'
= text_field_tag :query, params[:query], class: 'input-medium search-query',
placeholder: 'Name ...'
#edit_article{:style => "display:none"}
.btn-group
= link_to "Neuer Artikel", new_supplier_article_path(@supplier), remote: true, class: 'btn btn-primary'
= link_to "Alle bearbeiten", edit_all_supplier_articles_path(@supplier), class: 'btn'
= link_to "Artikel hochladen", upload_supplier_articles_path(@supplier), class: 'btn'
- if current_user.role_orders?
= link_to "Bestellung anlegen", new_order_path(supplier_id: @supplier), class: 'btn'
- unless @supplier.shared_supplier.nil?
.btn-group
= link_to '#', data: {toggle: 'dropdown'}, class: 'btn btn-success dropdown-toggle' do
Externe Datenbank
%span.caret
%ul.dropdown-menu
%li= link_to "Suchen/Importieren", "#import", 'data-toggle-this' => '#import'
%li= link_to "Synchronisieren", sync_supplier_articles_path(@supplier), method: :post
.btn-group
= link_to '#', data: {toggle: 'dropdown'}, class: 'btn dropdown-toggle' do
Lieferant wechseln ..
%span.caret
%ul.dropdown-menu
- Supplier.where('id != ?', @supplier.id).order('name ASC').each do |supplier|
%li= link_to supplier.name, supplier_articles_path(supplier), tabindex: -1
- unless @supplier.shared_supplier.nil?
#import.well.well-small(style="display:none;")
= form_tag shared_supplier_articles_path(@supplier), method: :get, remote: true, class: 'form-search',
'data-submit-onchange' => true do
%h3 Artikel importieren
= text_field_tag "search[name_contains_all]", "", class: 'input-medium search-query', placeholder: 'Name ...'
%label.checkbox
= check_box_tag "search[origin_equals]", "REG", false
Nur aus der Region
#search_results.clearfix
= link_to "Schließen", "#import", 'data-toggle-this' => '#import'
= form_tag update_selected_supplier_articles_path(@supplier), id: "articlesInListForm",
'data-submit-onchange' => true do
#table= render 'articles'

View file

@ -1 +1,2 @@
$.fancybox('#{escape_javascript(render("form"))}');
$('#modalContainer').html('#{escape_javascript(render("form"))}');
$('#modalContainer').modal();