-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhanced matrix pdf #489
Enhanced matrix pdf #489
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks for your contribution! I'll check the changes on my local machine later, but I've added already some comments, if you want to address them in the meantime.
config/locales/en.yml
Outdated
@@ -734,6 +734,7 @@ en: | |||
- Article | |||
- Unit | |||
- Unit quantity | |||
- Netto price |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you compare it to the other translations "Nettopreis" in german is usually "Price" in english
please also update the other languages. the translation should be easy to find
@@ -217,7 +224,7 @@ GEM | |||
libv8 (3.16.14.17) | |||
loofah (2.0.3) | |||
nokogiri (>= 1.5.9) | |||
mail (2.6.6) | |||
mail (2.6.4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these version changes to a lower version really necessary? i don't think so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No they are not necessary. The Gemfile.lock changed automatically and I was not sure if I should upload it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you would like to remove these changes, that would clean it up a bit (and avoid a conflict).
Or do you need a newer prawn? If you do, please rebase on current master
.
app/documents/order_matrix.rb
Outdated
|
||
text I18n.t('documents.order_matrix.heading'), style: :bold | ||
move_down 5 | ||
text I18n.t('documents.order_matrix.total', :count => order_articles.size), size: fontsize(8) | ||
move_down 10 | ||
|
||
order_articles_data = [I18n.t('documents.order_matrix.rows')] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please avoid unnecessary whitespace changes
app/documents/order_matrix.rb
Outdated
number_with_precision(article_price(a), precision: 2), | ||
a.units] | ||
end | ||
|
||
#order_articles_data.sort_by!{|a| a[0].downcase} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please avoid useless comments
app/documents/order_matrix.rb
Outdated
name = name.split.collect { |w| w.truncate(8) }.join(" ") | ||
header << name.truncate(30) | ||
name = name.split.collect { |w| w.truncate(20) }.join(" ") | ||
header << name.truncate(35)+' - ('+header_article.article.unit+')' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
header << "#{name.truncate(35)} - (#{header_article.article.unit})"
might be easier to read
@@ -13,22 +13,26 @@ def title | |||
end | |||
|
|||
def body | |||
order_articles = @order.order_articles.ordered | |||
order_articles = @order.order_articles.sort_by{|a| a.article.name.downcase} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we do this sorting via ActiveRecord instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did the sorting still with sort_by, because I was afraid, that I make unwanted changes in the database with ActiveRecord sorting. Feel free to change this if this is a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorting belongs in the database, this is a memory hog and doesn't scale for large orders. Please reconsider the ordered
scope if you think a different sort order is useful everywhere; if it only makes sense here, don't use the .ordered
scope but use active-record sorting. If you'd like case-insensitive sorting, indexes may also be needed.
Sorry for the condensed answer, if you need more explanation, please don't hesitate to ask. We'll do our best to help!
app/documents/order_matrix.rb
Outdated
|
||
table.cells.border_width = 1 | ||
table.cells.border_color = '666666' | ||
table.row_colors = ['ffffff','ececec'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you removed the indentation for this block
Gemfile
Outdated
@@ -22,7 +22,7 @@ gem 'rails-i18n' | |||
|
|||
gem 'mysql2' | |||
gem 'prawn' | |||
gem 'prawn-table' | |||
gem 'prawn-table', :git => 'https://github.com/straydogstudio/prawn-table.git', ref: '759a27b6' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this revision is from 2014. the latest upstream version is from 2016. do you see any chance that the commit from straydogstudio gets accepted in upstream? I do not like the idea of using such an outdated version. If the merge in upstream is not possible: Could you rebase the commit from straydogstudio to upstream master, publish them in a new repository and use that in the Gemfile?
Hi @FcFlodo, thanks for your contribution! Do you see any opportunity to finish it? |
Hi @FcFlodo, no problem. What about removing the header rotation for now, so that the other improvements can be included? If then an solution is found for the issue, the rotated headers (which I can imagine would be much much nicer) can be included. I also suggest to revive the discussion upstream. If there are others interested in the feature, it may get some traction. If not, then you could try to fix it upstream and get it included. Putting it into a separate repository would not have my preference, because that basically means that we'd need to maintain it. |
…oved added whitespaces etc.
Finished my contribution without the rotated headers. I will ask if the changes made by straydogstudio in the prawn-table gem could be implemented. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! I still have some remarks.
To get an idea of how the changes would look, would you be able to show the differences visually, e.g. as screenshot(s) or an upload of the new pdf? That would help reviewing. Thanks!
@@ -217,7 +224,7 @@ GEM | |||
libv8 (3.16.14.17) | |||
loofah (2.0.3) | |||
nokogiri (>= 1.5.9) | |||
mail (2.6.6) | |||
mail (2.6.4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you would like to remove these changes, that would clean it up a bit (and avoid a conflict).
Or do you need a newer prawn? If you do, please rebase on current master
.
@@ -13,22 +13,26 @@ def title | |||
end | |||
|
|||
def body | |||
order_articles = @order.order_articles.ordered | |||
order_articles = @order.order_articles.sort_by{|a| a.article.name.downcase} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorting belongs in the database, this is a memory hog and doesn't scale for large orders. Please reconsider the ordered
scope if you think a different sort order is useful everywhere; if it only makes sense here, don't use the .ordered
scope but use active-record sorting. If you'd like case-insensitive sorting, indexes may also be needed.
Sorry for the condensed answer, if you need more explanation, please don't hesitate to ask. We'll do our best to help!
hello. we are using the foodsoft for our big wholesaler ordering! this extension:
would be absolute great ! If the articles would be ordert first by categorie and afterwards by produktname in alphabetical order would make the overview also much better ! Thank you a lot for your work on it ! Carermey |
ca76347
to
c6250de
Compare
Hey, |
A bug in the prawn gem forced me to update the gem
prawnpdf/prawn#409
prawnpdf/prawn-table#32
I have uploaded the Gemfile.lock which has changed, but I am not sure if this has to be changed?