From f0c561311f4051524447e9d6d084bd37ee506218 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Wed, 4 Feb 2026 15:09:46 -0500 Subject: [PATCH] progress today, clicking and fixing --- app/assets/config/manifest.js | 1 + .../admin/svg_elements_controller.rb | 8 ++++--- .../suppliers/products_controller.rb | 2 +- app/helpers/application_helper.rb | 4 ++-- app/services/mozo/lnd.rb | 14 ++++++++++++ app/views/admin/orders/index.html.slim | 2 +- .../admin/product_categories/index.html.slim | 2 +- app/views/admin/products/index.html.slim | 2 +- app/views/admin/sections/index.html.slim | 2 +- app/views/admin/tables/_form.html.slim | 22 +++++++++++++------ app/views/admin/tables/edit.html.slim | 4 ++-- app/views/admin/tables/index.html.slim | 7 ++++-- app/views/admin/tables/new.html.slim | 3 +-- config/locales/devise.en.yml | 4 ++-- 14 files changed, 52 insertions(+), 25 deletions(-) diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 78e2121d..e87ca952 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -9,3 +9,4 @@ //= link qr_sheet/application.css // // link user/foundation/application.css +//= link admin/application.js diff --git a/app/controllers/admin/svg_elements_controller.rb b/app/controllers/admin/svg_elements_controller.rb index 53db2267..4f99984a 100644 --- a/app/controllers/admin/svg_elements_controller.rb +++ b/app/controllers/admin/svg_elements_controller.rb @@ -6,10 +6,11 @@ module Admin end def new - + @svg_element = SvgElement.new end def create + @svg_element = SvgElement.new(svg_element_params) if @svg_element.save redirect_to [:edit, :admin, @svg_element] else @@ -18,6 +19,7 @@ module Admin end def update + @svg_element = SvgElement.find(params[:id]) if @svg_element.update_attributes svg_element_params redirect_to [:edit, :admin, @svg_element] else @@ -26,11 +28,11 @@ module Admin end def show - + @svg_element = SvgElement.find(params[:id]) end def edit - + @svg_element = SvgElement.find(params[:id]) end private diff --git a/app/controllers/suppliers/products_controller.rb b/app/controllers/suppliers/products_controller.rb index d667463f..09da25dc 100644 --- a/app/controllers/suppliers/products_controller.rb +++ b/app/controllers/suppliers/products_controller.rb @@ -114,7 +114,7 @@ module Suppliers image_type = match[1] decoded_attribute = Base64.decode64 value.sub BASE64_IMAGE_MATCHER, '' file = Tempfile.new(['image', ".#{image_type}"]) - tempfiles << file + @tempfiles << file file.binmode file.write decoded_attribute authorized_params[attribute] = file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 07ce1bc1..cd20547a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,8 +1,8 @@ module ApplicationHelper # overwrite i18n l, to handle nil values - def l(*args) + def l(*args, **options) return '' unless args.first - super(*args) + super(*args, **options) end def user_root_path diff --git a/app/services/mozo/lnd.rb b/app/services/mozo/lnd.rb index e83e5dd7..c25ac574 100644 --- a/app/services/mozo/lnd.rb +++ b/app/services/mozo/lnd.rb @@ -7,5 +7,19 @@ module Mozo lnd = Lnrpc::Client.new(credentials_path: Rails.application.config.lnd_credentials_path, macaroon_path: Rails.application.config.lnd_macaroon_path) end + def self.get_info + begin + client.lightning.get_info + + + rescue StandardError => exception + if exception&.message =~ /wallet locked/ + Rails.logger.fatal 'FATAL: LND wallet locked' + #TODO handle wallet locket + end + raise exception + end + end + end end diff --git a/app/views/admin/orders/index.html.slim b/app/views/admin/orders/index.html.slim index 8d55c612..60ae2421 100644 --- a/app/views/admin/orders/index.html.slim +++ b/app/views/admin/orders/index.html.slim @@ -1,5 +1,5 @@ - model_class = Order -div.page-header= title :index, model_class +- title :index, model_class - if @orders.any? table.table.table-striped thead diff --git a/app/views/admin/product_categories/index.html.slim b/app/views/admin/product_categories/index.html.slim index 8964d32a..ab98b073 100644 --- a/app/views/admin/product_categories/index.html.slim +++ b/app/views/admin/product_categories/index.html.slim @@ -1,5 +1,5 @@ - model_class = ProductCategory -.page-header= title :index, model_class +- title :index, model_class - if @product_categories.any? table.table.table-striped thead diff --git a/app/views/admin/products/index.html.slim b/app/views/admin/products/index.html.slim index 8b7751c9..7638ebfa 100644 --- a/app/views/admin/products/index.html.slim +++ b/app/views/admin/products/index.html.slim @@ -1,5 +1,5 @@ - model_class = Product -.page-header= title :index, model_class +- title :index, model_class - if @products.any? table.table.table-striped thead diff --git a/app/views/admin/sections/index.html.slim b/app/views/admin/sections/index.html.slim index 0c4c0e60..5236c96c 100644 --- a/app/views/admin/sections/index.html.slim +++ b/app/views/admin/sections/index.html.slim @@ -1,5 +1,5 @@ - model_class = Section -.page-header= title :index, model_class +- title :index, model_class - if @sections.any? table.table.table-striped thead diff --git a/app/views/admin/tables/_form.html.slim b/app/views/admin/tables/_form.html.slim index 18b8e245..11ef41ab 100644 --- a/app/views/admin/tables/_form.html.slim +++ b/app/views/admin/tables/_form.html.slim @@ -1,11 +1,19 @@ -= simple_form_for [:admin, @table], html: {class: 'form-horizontal' } do |f| += form_for [:admin, @table], html: {class: 'form-horizontal' } do |f| = render 'error_messages', target: @table - = f.input :number - .control-group class=(@table.errors[:supplier_id].any? ? 'error' : nil) - = f.label :supplier_id, Supplier.model_name.human, class: 'control-label' - .controls - = f.select :supplier_id, options_for_select(@suppliers.map{|a| [a.name, a.id]}), include_blank: nil - .form-actions + .form-row + .form-label= f.label :number + .form-field= f.number_field :number + .form-row class=(@table.errors[:supplier_id].any? ? 'error' : nil) + .form-label= f.label :supplier_id, Supplier.model_name.human, class: 'control-label' + .form-field= f.select :supplier_id, options_for_select(@suppliers.map{|a| [a.name, a.id]}), include_blank: nil + /.form-actions = f.submit nil, class: 'btn btn-primary' ' = link_to t("helpers.links.cancel"), admin_tables_path, class: 'btn' + /.form-row: .form-actions + = f.submit @submit || update_button_text(f.object), class: 'button' + = link_to t("helpers.links.cancel"), admin_tables_path, class: 'btn' + - content_for :page_links do + ul + li= f.submit @submit || update_button_text(f.object), class: 'button' + li= link_to link_to_index_content(Table), [:admin, Table], class: 'to-index-button' diff --git a/app/views/admin/tables/edit.html.slim b/app/views/admin/tables/edit.html.slim index 2388f891..cca6f7ab 100644 --- a/app/views/admin/tables/edit.html.slim +++ b/app/views/admin/tables/edit.html.slim @@ -1,3 +1,3 @@ - model_class = Table -.page-header= title :edit, model_class -= render 'form' +- title :edit, model_class += render 'form' diff --git a/app/views/admin/tables/index.html.slim b/app/views/admin/tables/index.html.slim index bca066f1..38b44f4f 100644 --- a/app/views/admin/tables/index.html.slim +++ b/app/views/admin/tables/index.html.slim @@ -1,5 +1,5 @@ - model_class = Table -div.page-header= title :index, model_class +- title :index, model_class - if @tables.any? table.table.table-striped thead @@ -20,5 +20,8 @@ div.page-header= title :index, model_class = link_to t("helpers.links.destroy"), [:admin, table], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger' - else = no_content_given model_class -= link_to t("helpers.links.new"), new_admin_table_path, class: 'btn btn-primary' +/= link_to t("helpers.links.new"), new_admin_table_path, class: 'btn btn-primary' +- content_for :page_links do + ul + li= link_to link_to_new_content(Table), new_admin_table_path, class: 'record-new-button' diff --git a/app/views/admin/tables/new.html.slim b/app/views/admin/tables/new.html.slim index e30c254c..cca6f7ab 100644 --- a/app/views/admin/tables/new.html.slim +++ b/app/views/admin/tables/new.html.slim @@ -1,4 +1,3 @@ - model_class = Table -.page-header - = title :new, model_class +- title :edit, model_class = render 'form' diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 0eb50020..9647921a 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -6,8 +6,8 @@ en: link: Sign in button: Sign in passwords: - title: Forgot password - link: Forgot password + title: Recover password + link: Recover password button: Send reset edit: title: Change your password