From 059d789a7a646d87e94759b89014856279c0f909 Mon Sep 17 00:00:00 2001 From: Adrian Hinz Date: Tue, 31 Oct 2017 23:07:29 +0100 Subject: [PATCH 1/6] m --- .gitignore | 1 + Gemfile.lock | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5f9e0d3..ce3a6a4 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ # Ignore Byebug command history file. .byebug_history Gemfile.lock +Gemfile.lock diff --git a/Gemfile.lock b/Gemfile.lock index 06a2b35..714d3b4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,7 +39,10 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) arel (7.1.2) + bcrypt (3.1.11-x64-mingw32) bcrypt (3.1.11-x86-mingw32) + bootstrap3-datetimepicker-rails (4.14.30) + momentjs-rails (>= 2.8.1) builder (3.2.2) coffee-rails (4.2.1) coffee-script (>= 2.2.0) @@ -78,9 +81,15 @@ GEM mime-types-data (3.2016.0521) mini_portile2 (2.1.0) minitest (5.9.1) + momentjs-rails (2.15.1) + railties (>= 3.1) multi_json (1.12.1) + mysql2 (0.4.4-x64-mingw32) mysql2 (0.4.4-x86-mingw32) nio4r (1.2.1) + nokogiri (1.6.8-x64-mingw32) + mini_portile2 (~> 2.1.0) + pkg-config (~> 1.1.7) nokogiri (1.6.8-x86-mingw32) mini_portile2 (~> 2.1.0) pkg-config (~> 1.1.7) @@ -152,17 +161,21 @@ GEM websocket-driver (0.6.4) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) + wicked_pdf (1.1.0) PLATFORMS + x64-mingw32 x86-mingw32 DEPENDENCIES + bootstrap3-datetimepicker-rails (~> 4.14.30) byebug coffee-rails (~> 4.2) coffee-script-source (= 1.8.0) devise jbuilder (~> 2.5) jquery-rails + momentjs-rails (>= 2.9.0) mysql2 puma (~> 3.0) rails (~> 5.0.0, >= 5.0.0.1) @@ -171,6 +184,7 @@ DEPENDENCIES tzinfo-data uglifier (>= 1.3.0) web-console + wicked_pdf BUNDLED WITH - 1.13.1 + 1.13.2 From 257631ea279c1cb6e4a7cafdb3c39a5349ac0101 Mon Sep 17 00:00:00 2001 From: Adrian Hinz Date: Sat, 9 Dec 2017 12:08:18 +0100 Subject: [PATCH 2/6] Signed-off-by: Adrian Hinz --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index a999eb7..212d05d 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 5.0.0', '>= 5.0.0.1' +gem 'rails', '~> 5.1.4' # Use sqlite3 as the database for Active Record # gem 'sqlite3' gem 'momentjs-rails', '>= 2.9.0' @@ -11,7 +11,7 @@ gem 'devise' gem 'mysql2' # Use Puma as the app server -gem 'puma', '~> 3.0' +gem 'puma', '~> 3.7' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets From 7a98865b26c95287e110f2f70096ac924494b12d Mon Sep 17 00:00:00 2001 From: Adrian Hinz Date: Sat, 9 Dec 2017 12:17:21 +0100 Subject: [PATCH 3/6] Signed-off-by: Adrian Hinz --- app/controllers/application_controller.rb | 8 -------- config/application.rb | 8 -------- 2 files changed, 16 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 399b368..9c1efd5 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,19 +3,11 @@ class ApplicationController < ActionController::Base before_action :authenticate_user! before_action :set_locale layout :layout_by_resource - after_action :set_headers def set_locale I18n.locale = params[:lang] || I18n.default_locale end - def set_headers - headers['Access-Control-Allow-Origin'] = '*' - headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS' - headers['Access-Control-Request-Method'] = '*' - headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization' - end - protected def layout_by_resource diff --git a/config/application.rb b/config/application.rb index 7622a71..b6e9294 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,14 +13,6 @@ module InvoiceKeeper # -- all .rb files in that directory are automatically loaded. config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s] config.i18n.default_locale = :pl - config.action_dispatch.default_headers.merge!({'X-Frame-Options' => 'ALLOWALL'}) - config.middleware.insert_before 0, Rack::Cors do - allow do - origins '*' - resource '*', :headers => :any, :methods => [:get, :post, :options] - end - end - config.assets.paths << Rails.root.join('app', 'assets', 'fonts') config.assets.precompile += %w( .svg .eot .woff .ttf .otf .woff2 ) From b86cd8a63bcc4d8a1d21f18a7c773404b7ffb9b7 Mon Sep 17 00:00:00 2001 From: Adrian Hinz Date: Sat, 9 Dec 2017 14:23:25 +0100 Subject: [PATCH 4/6] Signed-off-by: Adrian Hinz --- app/controllers/invoices_controller.rb | 5 +++++ app/views/invoices/_show.html.erb | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/invoices_controller.rb b/app/controllers/invoices_controller.rb index 9359280..40ba83a 100644 --- a/app/controllers/invoices_controller.rb +++ b/app/controllers/invoices_controller.rb @@ -14,6 +14,11 @@ class InvoicesController < ApplicationController disposition: 'attachment', layout: 'pdf', encoding: 'UTF-8', + page_size: 'A4', + margin: { top: 8, # default 10 (mm) + bottom: 8, + left: 8, + right: 8 }, viewport_size: '1280x1024' end end diff --git a/app/views/invoices/_show.html.erb b/app/views/invoices/_show.html.erb index c64f0aa..249d2b7 100644 --- a/app/views/invoices/_show.html.erb +++ b/app/views/invoices/_show.html.erb @@ -191,7 +191,7 @@ - +
Sprzedający:
Hinz Adrian
Osoba upowazniona do wystawienia faktury VAT
Hinz Adrian
Osoba upoważniona do wystawienia faktury VAT
@@ -200,7 +200,7 @@ - +
Kupujący:
Osoba upowazniona do odbioru faktury VATOsoba upoważniona do odbioru faktury VAT
From a2f163bebcc4adbb69aab66ad0a051447ab9aa23 Mon Sep 17 00:00:00 2001 From: Adrian Hinz Date: Sat, 9 Dec 2017 14:44:21 +0100 Subject: [PATCH 5/6] Signed-off-by: Adrian Hinz --- app/views/layouts/pdf.pdf.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/layouts/pdf.pdf.erb b/app/views/layouts/pdf.pdf.erb index acc9709..4b8b09c 100644 --- a/app/views/layouts/pdf.pdf.erb +++ b/app/views/layouts/pdf.pdf.erb @@ -3,10 +3,10 @@ FireStorm - Faktury - <%= csrf_meta_tags %> - <%= wicked_pdf_stylesheet_link_tag "bootstrap.css" -%> - <%= wicked_pdf_stylesheet_link_tag "bootstrap-theme.css" -%> - <%= wicked_pdf_stylesheet_link_tag "style.css" -%> + + <%= wicked_pdf_stylesheet_link_tag "bootstrap" -%> + <%= wicked_pdf_stylesheet_link_tag "bootstrap-theme" -%> + <%= wicked_pdf_stylesheet_link_tag "style" -%> From 7da4f19e7f99d8e88d191042481e9ee3924baa30 Mon Sep 17 00:00:00 2001 From: Adrian Hinz Date: Sat, 9 Dec 2017 14:50:44 +0100 Subject: [PATCH 6/6] Signed-off-by: Adrian Hinz --- app/views/layouts/pdf.pdf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/pdf.pdf.erb b/app/views/layouts/pdf.pdf.erb index 4b8b09c..1d0c9d5 100644 --- a/app/views/layouts/pdf.pdf.erb +++ b/app/views/layouts/pdf.pdf.erb @@ -6,7 +6,7 @@ <%= wicked_pdf_stylesheet_link_tag "bootstrap" -%> <%= wicked_pdf_stylesheet_link_tag "bootstrap-theme" -%> - <%= wicked_pdf_stylesheet_link_tag "style" -%> + <%= wicked_pdf_stylesheet_link_tag "style" -%>