Merge remote-tracking branch 'bennibu/rails3' into rails3
Conflicts: app/assets/stylesheets/bootstrap_and_overrides.css.less app/controllers/stockit_controller.rb app/models/ordergroup.rb app/models/workgroup.rb app/views/stockit/index.html.haml
This commit is contained in:
commit
2d382df1f1
10 changed files with 50 additions and 24 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
||||||
log/*.log
|
log/*.log
|
||||||
tmp/**/*
|
tmp/**/*
|
||||||
config/*.yml
|
config/*.yml
|
||||||
|
config/initializers/secret_token.rb
|
||||||
db/*.sqlite3
|
db/*.sqlite3
|
||||||
nbproject/
|
nbproject/
|
||||||
config/environments/development.rb
|
config/environments/development.rb
|
||||||
|
|
|
@ -37,6 +37,11 @@ body {
|
||||||
|
|
||||||
// Custom styles
|
// Custom styles
|
||||||
|
|
||||||
|
// Fix empty dd tags in horizontal dl, see https://github.com/twitter/bootstrap/issues/4062
|
||||||
|
.dl-horizontal {
|
||||||
|
dd { .clearfix(); }
|
||||||
|
}
|
||||||
|
|
||||||
@mainRedColor: #ED0606;
|
@mainRedColor: #ED0606;
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
|
@ -196,17 +201,10 @@ tr.unavailable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ********* Tweaks & fixes
|
// ********* Tweaks & fixes
|
||||||
|
|
||||||
// https://github.com/twitter/bootstrap/issues/4062
|
|
||||||
.dl-horizontal {
|
|
||||||
dd { .clearfix(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
// need more space for supplier&order information (in German, at least)
|
// need more space for supplier&order information (in German, at least)
|
||||||
.dl-horizontal {
|
.dl-horizontal {
|
||||||
dt { width: 160px; }
|
dt { width: 160px; }
|
||||||
dd { margin-left: 170px; }
|
dd { margin-left: 170px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class ArticlesController < ApplicationController
|
||||||
sort = "article_categories.name, articles.name"
|
sort = "article_categories.name, articles.name"
|
||||||
end
|
end
|
||||||
|
|
||||||
@articles = Article.where(supplier_id: @supplier).includes(:article_category).order(sort)
|
@articles = Article.where(supplier_id: @supplier, :type => nil).includes(:article_category).order(sort)
|
||||||
@articles = @articles.where('articles.name LIKE ?', "%#{params[:query]}%") unless params[:query].nil?
|
@articles = @articles.where('articles.name LIKE ?', "%#{params[:query]}%") unless params[:query].nil?
|
||||||
|
|
||||||
@articles = @articles.page(params[:page]).per(@per_page)
|
@articles = @articles.page(params[:page]).per(@per_page)
|
||||||
|
|
|
@ -32,11 +32,12 @@ class StockitController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
StockArticle.find(params[:id]).destroy
|
@article = StockArticle.find(params[:id])
|
||||||
redirect_to stock_articles_path
|
@article.destroy
|
||||||
|
render :layout => false
|
||||||
rescue => error
|
rescue => error
|
||||||
flash[:error] = I18n.t('errors.general_msg', :msg => error.message)
|
render :partial => "destroy_fail", :layout => false,
|
||||||
redirect_to stock_articles_path
|
:locals => { :fail_msg => I18n.t('errors.general_msg', :msg => error.message) }
|
||||||
end
|
end
|
||||||
|
|
||||||
#TODO: Fix this!!
|
#TODO: Fix this!!
|
||||||
|
|
|
@ -19,6 +19,10 @@ class OrderFax < OrderPdf
|
||||||
text contact[:street], align: :right
|
text contact[:street], align: :right
|
||||||
move_down 5
|
move_down 5
|
||||||
text "#{contact[:zip_code]} #{contact[:city]}", align: :right
|
text "#{contact[:zip_code]} #{contact[:city]}", align: :right
|
||||||
|
move_down 5
|
||||||
|
if @order.supplier.customer_number != ''
|
||||||
|
text "Kundennummer: #{@order.supplier.customer_number}", align: :right
|
||||||
|
end
|
||||||
move_down 10
|
move_down 10
|
||||||
text contact[:phone], size: 9, align: :right
|
text contact[:phone], size: 9, align: :right
|
||||||
move_down 5
|
move_down 5
|
||||||
|
@ -34,6 +38,7 @@ class OrderFax < OrderPdf
|
||||||
text "Fax: " + @order.supplier.fax
|
text "Fax: " + @order.supplier.fax
|
||||||
end
|
end
|
||||||
|
|
||||||
|
move_down 5
|
||||||
text Date.today.strftime('%d.%m.%Y'), align: :right
|
text Date.today.strftime('%d.%m.%Y'), align: :right
|
||||||
|
|
||||||
move_down 10
|
move_down 10
|
||||||
|
|
|
@ -117,5 +117,15 @@ class Ordergroup < Group
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
|
||||||
|
def uniqueness_of_name
|
||||||
|
id = new_record? ? '' : self.id
|
||||||
|
group = Ordergroup.with_deleted.where('groups.id != ? AND groups.name = ?', id, name).first
|
||||||
|
if group.present?
|
||||||
|
message = group.deleted? ? :taken_with_deleted : :taken
|
||||||
|
errors.add :name, message
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
5
app/views/stockit/_destroy_fail.js.haml
Normal file
5
app/views/stockit/_destroy_fail.js.haml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
-# please polish the following line if you know how, same in view destroy
|
||||||
|
var errorDiv = $('<div class="alert fade in alert-error"><a class="close" data-dismiss="alert" href="#">x</a></div>');
|
||||||
|
|
||||||
|
errorDiv.append(document.createTextNode('#{j(fail_msg)}'));
|
||||||
|
$('div.container-fluid').prepend(errorDiv);
|
14
app/views/stockit/destroy.js.haml
Normal file
14
app/views/stockit/destroy.js.haml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
-# please polish the following line if you know how, same in partial _destroy_fail
|
||||||
|
var successDiv = $('<div class="alert fade in alert-success"><a class="close" data-dismiss="alert" href="#">x</a></div>');
|
||||||
|
|
||||||
|
successDiv.append(document.createTextNode('Artikel #{j(@article.name)} gelöscht.'));
|
||||||
|
$('div.container-fluid').prepend(successDiv);
|
||||||
|
|
||||||
|
-# WARNING: If you try to use the escape j(...) here, an error occurs:
|
||||||
|
-# Ein Fehler ist aufgetreten: undefined method `gsub' for 50:Fixnum
|
||||||
|
-# However, it should work without without escaping.
|
||||||
|
-# Note that article names which are purely numeric, e.g. 12345, are escaped correctly (see above).
|
||||||
|
|
||||||
|
$('#stockArticle-#{@article.id}').remove();
|
||||||
|
|
||||||
|
-# WARNING: Do not use a simple .fadeOut() above, because it conflicts with the show/hide function of unavailable articles.
|
|
@ -29,7 +29,6 @@
|
||||||
- Supplier.all.each do |supplier|
|
- Supplier.all.each do |supplier|
|
||||||
%li= link_to supplier.name, new_supplier_delivery_path(supplier), tabindex: -1
|
%li= link_to supplier.name, new_supplier_delivery_path(supplier), tabindex: -1
|
||||||
|
|
||||||
|
|
||||||
%table.table.table-hover#articles
|
%table.table.table-hover#articles
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
|
@ -45,7 +44,7 @@
|
||||||
%th
|
%th
|
||||||
%tbody
|
%tbody
|
||||||
- for article in @stock_articles
|
- for article in @stock_articles
|
||||||
%tr{:class => stock_article_classes(article)}
|
%tr{:class => stock_article_classes(article), :id => "stockArticle-#{article.id}"}
|
||||||
%td=h article.name
|
%td=h article.name
|
||||||
%td= article.quantity
|
%td= article.quantity
|
||||||
%td= article.quantity - article.quantity_available
|
%td= article.quantity - article.quantity_available
|
||||||
|
@ -58,7 +57,7 @@
|
||||||
%td
|
%td
|
||||||
= link_to t('ui.edit'), edit_stock_article_path(article), class: 'btn btn-mini'
|
= link_to t('ui.edit'), edit_stock_article_path(article), class: 'btn btn-mini'
|
||||||
= link_to t('ui.delete'), article, :method => :delete, :confirm => t('.confirm_delete'),
|
= link_to t('ui.delete'), article, :method => :delete, :confirm => t('.confirm_delete'),
|
||||||
class: 'btn btn-mini btn-danger'
|
class: 'btn btn-mini btn-danger', :remote => true
|
||||||
%p
|
%p
|
||||||
= t '.stock_worth'
|
= t '.stock_worth'
|
||||||
= number_to_currency StockArticle.stock_value
|
= number_to_currency StockArticle.stock_value
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
# Be sure to restart your server when you modify this file.
|
|
||||||
|
|
||||||
# Your secret key for verifying the integrity of signed cookies.
|
|
||||||
# If you change this key, all old signed cookies will become invalid!
|
|
||||||
# Make sure the secret is at least 30 characters and all random,
|
|
||||||
# no regular words or you'll be exposed to dictionary attacks.
|
|
||||||
Foodsoft::Application.config.secret_token = '2be5574568ff4d270b108399078a8e485b363af84d441d02d2a6fd3fc51a8c015065790b7e414134e6d97ffc40da898a5a12f66f9de6b992b7ea96e7a34839b8'
|
|
Loading…
Reference in a new issue