diff --git a/Gemfile b/Gemfile index b28de653..9c007f6f 100644 --- a/Gemfile +++ b/Gemfile @@ -73,8 +73,8 @@ gem 'simply_stored', github: 'bterkuile/simply_stored', branch: :master gem 'devise' #, github: 'plataformatec/devise', branch: 'lm-rails-4-2' #, '3.1.0' #, '2.0.4' gem 'devise_simply_stored', github: 'bterkuile/devise_simply_stored', branch: :master gem 'devise-i18n' -gem 'omniauth-facebook' -gem 'omniauth-instagram' +#gem 'omniauth-facebook' +#gem 'omniauth-instagram' #gem 'simple_form' gem 'active_decorator' #, path: '/Users/bterkuile/companytools/development/rails/components/active_decorator' #gem 'cmtool', github: 'bterkuile/cmtool' diff --git a/Gemfile.lock b/Gemfile.lock index 10dd7df2..8c04deda 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -151,9 +151,9 @@ GEM airbrussh (1.5.3) sshkit (>= 1.6.1, != 1.7.0) base64 (0.3.0) - bcrypt (3.1.20) + bcrypt (3.1.21) bcrypt_pbkdf (1.1.1) - bigdecimal (3.3.1) + bigdecimal (4.0.1) builder (3.3.0) cancancan (3.6.1) capistrano (3.19.2) @@ -197,8 +197,8 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.3.5) - connection_pool (2.5.4) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) cookiejar (0.3.4) couchrest (2.0.1) httpclient (~> 2.8) @@ -213,11 +213,11 @@ GEM cucumber-messages (29.0.1) cuke_modeler (3.26.0) cucumber-gherkin (< 37.0) - date (3.5.0) - devise (4.9.4) + date (3.5.1) + devise (5.0.0) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0) + railties (>= 7.0) responders warden (~> 1.2.3) devise-i18n (1.15.0) @@ -238,7 +238,7 @@ GEM eventmachine (>= 1.0.0.beta.4) email_validator (2.2.4) activemodel - erb (6.0.0) + erb (6.0.1) erubi (1.13.1) eventmachine (1.2.7) exception_notification (5.0.1) @@ -250,12 +250,6 @@ GEM factory_bot_rails (6.5.1) factory_bot (~> 6.5) railties (>= 6.1.0) - faraday (2.14.0) - faraday-net_http (>= 2.0, < 3.5) - json - logger - faraday-net_http (3.4.2) - net-http (~> 0.5) faye (1.4.1) cookiejar (>= 0.3.0) em-http-request (>= 1.1.6) @@ -303,15 +297,15 @@ GEM google-protobuf (>= 3.25, < 5.0) googleapis-common-protos-types (~> 1.0) hashdiff (1.2.1) - hashie (5.0.0) http_parser.rb (0.8.0) httpclient (2.9.0) mutex_m - i18n (1.14.7) + i18n (1.14.8) concurrent-ruby (~> 1.0) - io-console (0.8.1) - irb (1.15.3) + io-console (0.8.2) + irb (1.17.0) pp (>= 0.6.0) + prism (>= 1.3.0) rdoc (>= 4.0.0) reline (>= 0.4.2) iso_country_codes (0.7.8) @@ -324,9 +318,7 @@ GEM js-routes (2.3.5) railties (>= 5) sorbet-runtime - json (2.16.0) - jwt (3.1.2) - base64 + json (2.18.1) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -352,7 +344,7 @@ GEM letter_opener (1.10.0) launchy (>= 2.2, < 4) logger (1.7.0) - loofah (2.24.1) + loofah (2.25.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.9.0) @@ -374,16 +366,13 @@ GEM mini_magick (5.3.1) logger mini_mime (1.1.5) - minitest (5.26.2) + minitest (6.0.1) + prism (~> 1.5) momentjs-rails (2.29.4.1) railties (>= 3.1) multi_json (1.17.0) - multi_xml (0.7.2) - bigdecimal (~> 3.1) mutex_m (0.3.0) naught (1.1.0) - net-http (0.8.0) - uri (>= 0.11.1) net-imap (0.5.12) date net-protocol @@ -399,32 +388,12 @@ GEM net-protocol net-ssh (7.3.0) nio4r (2.7.5) - nokogiri (1.18.10-aarch64-linux-gnu) + nokogiri (1.19.0-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.18.10-x86_64-darwin) + nokogiri (1.19.0-x86_64-darwin) racc (~> 1.4) - nokogiri (1.18.10-x86_64-linux-gnu) + nokogiri (1.19.0-x86_64-linux-gnu) racc (~> 1.4) - oauth2 (2.0.18) - faraday (>= 0.17.3, < 4.0) - jwt (>= 1.0, < 4.0) - logger (~> 1.2) - multi_xml (~> 0.5) - rack (>= 1.2, < 4) - snaky_hash (~> 2.0, >= 2.0.3) - version_gem (~> 1.1, >= 1.1.9) - omniauth (1.9.2) - hashie (>= 3.4.6) - rack (>= 1.6.2, < 3) - omniauth-facebook (10.0.0) - bigdecimal - omniauth-oauth2 (>= 1.2, < 3) - omniauth-instagram (1.3.0) - omniauth (~> 1) - omniauth-oauth2 (~> 1) - omniauth-oauth2 (1.7.3) - oauth2 (>= 1.4, < 3) - omniauth (>= 1.9, < 3) orm_adapter (0.5.0) ostruct (0.6.3) paperclip (6.1.0) @@ -443,6 +412,7 @@ GEM pp (0.6.3) prettyprint prettyprint (0.2.0) + prism (1.9.0) pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) @@ -451,23 +421,23 @@ GEM yard (~> 0.9.11) pry-rails (0.3.11) pry (>= 0.13.0) - psych (5.2.6) + psych (5.3.1) date stringio public_suffix (6.0.2) puma (7.1.0) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.21) + rack (3.2.4) rack-cors (2.0.2) rack (>= 2.0.0) - rack-session (1.0.2) - rack (< 3) + rack-session (2.1.1) + base64 (>= 0.1.0) + rack (>= 3.0.0) rack-test (2.2.0) rack (>= 1.3) - rackup (1.0.1) - rack (< 3) - webrick + rackup (2.3.1) + rack (>= 3) rails (8.1.1) actioncable (= 8.1.1) actionmailbox (= 8.1.1) @@ -506,7 +476,7 @@ GEM tsort (>= 0.2) zeitwerk (~> 2.6) rake (13.3.1) - rdoc (6.15.1) + rdoc (7.2.0) erb psych (>= 4.0.0) tsort @@ -573,9 +543,6 @@ GEM actionpack (>= 3.1) railties (>= 3.1) slim (>= 3.0, < 6.0, != 5.0.0) - snaky_hash (2.0.3) - hashie (>= 0.1.0, < 6) - version_gem (>= 1.1.8, < 3) sorbet-runtime (0.6.12780) sprockets (4.2.2) concurrent-ruby (~> 1.0) @@ -592,13 +559,13 @@ GEM net-sftp (>= 2.1.2) net-ssh (>= 2.8.0) ostruct - stringio (3.1.8) + stringio (3.2.0) temple (0.10.4) terrapin (0.6.0) climate_control (>= 0.0.3, < 1.0) test_squad (0.1.3) rails - thor (1.4.0) + thor (1.5.0) tilt (2.6.1) timecop (0.9.10) timeout (0.4.4) @@ -612,14 +579,12 @@ GEM execjs (>= 0.3.0, < 3) uri (1.1.1) useragent (0.16.11) - version_gem (1.1.9) warden (1.2.9) rack (>= 2.0.9) webmock (3.26.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.9.1) websocket-driver (0.8.0) base64 websocket-extensions (>= 0.1.0) @@ -627,7 +592,7 @@ GEM xpath (3.2.0) nokogiri (~> 1.8) yard (0.9.37) - zeitwerk (2.7.3) + zeitwerk (2.7.4) PLATFORMS aarch64-linux @@ -674,8 +639,6 @@ DEPENDENCIES mini_magick mutex_m naught - omniauth-facebook - omniauth-instagram pickadate-rails poltergeist pry-doc diff --git a/app/assets/stylesheets/theme1/elements/_forms.sass b/app/assets/stylesheets/theme1/elements/_forms.sass index cc31a12f..a2a64b0b 100644 --- a/app/assets/stylesheets/theme1/elements/_forms.sass +++ b/app/assets/stylesheets/theme1/elements/_forms.sass @@ -28,6 +28,12 @@ h3 color: $form-error-color font-size: 1.2em +// Temporary hack for some forms +.control-group + .controls + .error + // compensate the margin-bottom of the input above + margin-top: -16px body label &.number diff --git a/app/controllers/contact_forms_controller.rb b/app/controllers/contact_forms_controller.rb index 4b7d55cc..4803d41f 100644 --- a/app/controllers/contact_forms_controller.rb +++ b/app/controllers/contact_forms_controller.rb @@ -1,3 +1,4 @@ +# Contact page form class ContactFormsController < ApplicationController def create @contact_form = Cmtool::ContactForm.new(contact_form_params) diff --git a/app/controllers/suppliers/sessions_controller.rb b/app/controllers/employees/sessions_controller.rb similarity index 84% rename from app/controllers/suppliers/sessions_controller.rb rename to app/controllers/employees/sessions_controller.rb index 4146f7b7..2a9ae68f 100644 --- a/app/controllers/suppliers/sessions_controller.rb +++ b/app/controllers/employees/sessions_controller.rb @@ -1,4 +1,4 @@ -class Suppliers::SessionsController < Devise::SessionsController +class Employees::SessionsController < Devise::SessionsController respond_to :json def create @@ -10,6 +10,7 @@ class Suppliers::SessionsController < Devise::SessionsController render json: {employee_id: current_employee.id, auth_token: current_employee.authentication_token} end + # deprecated? def destroy session[:supplier_id] = nil super diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb new file mode 100644 index 00000000..7150a438 --- /dev/null +++ b/app/controllers/errors_controller.rb @@ -0,0 +1,5 @@ +class ErrorsController < ApplicationController + def not_found + head :not_found # Renders an empty body with 404 status [5] + end +end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index bb71c0ec..bb6544de 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -1,13 +1,13 @@ -class RegistrationsController < Devise::RegistrationsController - protected - - #def after_sign_up_path(resource) - #end - - private - - # override devise internal to allow name as sign_up param - def sign_up_params - params.require(resource_name).permit resource_class.authentication_keys + [:name, :password, :password_confirmation] - end -end +# class RegistrationsController < Devise::RegistrationsController +# protected +# +# #def after_sign_up_path(resource) +# #end +# +# private +# +# # override devise internal to allow name as sign_up param +# def sign_up_params +# params.require(resource_name).permit resource_class.authentication_keys + [:name, :password, :password_confirmation] +# end +# end diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb new file mode 100644 index 00000000..4313b537 --- /dev/null +++ b/app/controllers/users/registrations_controller.rb @@ -0,0 +1,9 @@ +class Users::RegistrationsController < Devise::RegistrationsController + def create + devise_parameter_sanitizer.permit(:sign_up, keys: [:name]) + super + # if resource.persisted? + # self.response_body = nil + # end + end +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 00000000..106020f6 --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,6 @@ +class UsersController < ApplicationController + def show + authenticate_user! + @user = current_user + end +end diff --git a/app/controllers/waiter_controller.rb b/app/controllers/waiter_controller.rb index d3b454d3..e14c8330 100644 --- a/app/controllers/waiter_controller.rb +++ b/app/controllers/waiter_controller.rb @@ -1,20 +1,20 @@ -class WaiterController < ApplicationController - layout 'waiter' - def index - - end - - def product_categories - respond_to do |format| - format.html { redirect_to '/waiter'} - format.json { render json: ProductCategory.all.include_relation(:product), root: 'product_categories', each_serializer: ProductCategorySerializer } - end - end - - def order_products - @table= Table.find_by_supplier_id_and_id!(current_supplier.id, params[:table_id]) - @list = List.from_table_by_employee(@table, current_employee) - @list.place_order products: params[:order], employee: current_employee - render nothing: true - end -end +# class WaiterController < ApplicationController +# layout 'waiter' +# def index +# +# end +# +# def product_categories +# respond_to do |format| +# format.html { redirect_to '/waiter'} +# format.json { render json: ProductCategory.all.include_relation(:product), root: 'product_categories', each_serializer: ProductCategorySerializer } +# end +# end +# +# def order_products +# @table= Table.find_by_supplier_id_and_id!(current_supplier.id, params[:table_id]) +# @list = List.from_table_by_employee(@table, current_employee) +# @list.place_order products: params[:order], employee: current_employee +# render nothing: true +# end +# end diff --git a/app/models/user.rb b/app/models/user.rb index 99217024..782439c3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -14,7 +14,7 @@ class User property :oauth_expires_at property :auth_data - devise_plugins = [:database_authenticatable, :recoverable, :rememberable, :trackable, :omniauthable, {omniauth_providers: [:facebook, :instagram]}] #, :token_authenticatable , :registerable + devise_plugins = [:database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, :trackable] #, :omniauthable, {omniauth_providers: [:facebook, :instagram]}] #, :token_authenticatable , :registerable devise_plugins -= [:trackable] if Rails.env.test? # creates conflicts devise *devise_plugins diff --git a/app/views/devise/_links.html.slim b/app/views/devise-disabled/_links.html.slim similarity index 100% rename from app/views/devise/_links.html.slim rename to app/views/devise-disabled/_links.html.slim diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise-disabled/confirmations/new.html.erb similarity index 100% rename from app/views/devise/confirmations/new.html.erb rename to app/views/devise-disabled/confirmations/new.html.erb diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise-disabled/mailer/confirmation_instructions.html.erb similarity index 100% rename from app/views/devise/mailer/confirmation_instructions.html.erb rename to app/views/devise-disabled/mailer/confirmation_instructions.html.erb diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise-disabled/mailer/reset_password_instructions.html.erb similarity index 100% rename from app/views/devise/mailer/reset_password_instructions.html.erb rename to app/views/devise-disabled/mailer/reset_password_instructions.html.erb diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise-disabled/mailer/unlock_instructions.html.erb similarity index 100% rename from app/views/devise/mailer/unlock_instructions.html.erb rename to app/views/devise-disabled/mailer/unlock_instructions.html.erb diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise-disabled/registrations/edit.html.erb similarity index 100% rename from app/views/devise/registrations/edit.html.erb rename to app/views/devise-disabled/registrations/edit.html.erb diff --git a/app/views/devise/registrations/new.html.slim b/app/views/devise-disabled/registrations/new.html.slim similarity index 85% rename from app/views/devise/registrations/new.html.slim rename to app/views/devise-disabled/registrations/new.html.slim index 7e4d99ef..04808147 100644 --- a/app/views/devise/registrations/new.html.slim +++ b/app/views/devise-disabled/registrations/new.html.slim @@ -2,6 +2,7 @@ h2= t('devise.registrations.title') = form_for(resource, :as => resource_name, :url => registration_path(resource_name), html: {class: 'form-horizontal'}) do |f| = devise_error_messages! .control-group + - binding.pry = f.label :name, class: 'control-label' .controls= f.text_field :name .control-group @@ -15,5 +16,5 @@ h2= t('devise.registrations.title') .controls= f.password_field :password_confirmation .control-group .controls - = f.submit t('devise.registrations.button'), class: 'btn btn-primary' -= render "devise_links" + = f.submit t('devise.registrations.button'), class: 'button2' += render "devise/links" diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise-disabled/sessions/new.html.erb similarity index 100% rename from app/views/devise/sessions/new.html.erb rename to app/views/devise-disabled/sessions/new.html.erb diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise-disabled/shared/_links.html.erb similarity index 100% rename from app/views/devise/shared/_links.html.erb rename to app/views/devise-disabled/shared/_links.html.erb diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise-disabled/unlocks/new.html.erb similarity index 100% rename from app/views/devise/unlocks/new.html.erb rename to app/views/devise-disabled/unlocks/new.html.erb diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb deleted file mode 100644 index 343b2656..00000000 --- a/app/views/devise/registrations/new.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -