diff --git a/app/assets/javascripts/translations.js.coffee.erb b/app/assets/javascripts/translations.js.coffee.erb index 5b2a3f9c..b34c5526 100644 --- a/app/assets/javascripts/translations.js.coffee.erb +++ b/app/assets/javascripts/translations.js.coffee.erb @@ -96,7 +96,7 @@ $("[data-t]").each -> $(this).html t($(this).data("t"), $(this).data("tAttributes")) - $("*[data-time]").each -> + $("[data-time]").each -> $(this).text moment($(this).data("time")).format($(this).data("timeFormat") or "dd D MMM HH:mm") # jQuery UI datepicker support diff --git a/app/controllers/supplier_controller.rb b/app/controllers/supplier_controller.rb index 95183878..aec81d9e 100644 --- a/app/controllers/supplier_controller.rb +++ b/app/controllers/supplier_controller.rb @@ -3,7 +3,7 @@ class SupplierController < Suppliers::ApplicationController if Rails.env.development? redirect_to "http://localhost:4202/supplier/#{params[:other]}" else - render html: File.read(Rails.root.join('public/supplier/index.html')) + redirect_to "https://supplier.mozo.bar/supplier/#{params[:other]}" end end =begin diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 580f9091..dd32c759 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -1,7 +1,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController def passthru + return show_404 alert: 'Test' send(params[:provider]) and return if available_action?(params[:provider]) - show_404 # Or alternatively, # raise ActionController::RoutingError.new('Not Found') end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 93c87064..60c63fcd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,21 +1,4 @@ module ApplicationHelper - def title(*args) - res = content_tag :h1, class: 'page-title' do - if args.first.is_a?(Symbol) && (args[1].respond_to?(:model_name) || args[1].class.respond_to?(:model_name)) - model = args[1].respond_to?(:model_name) ? args[1] : args[1].class - if args.first == :index - t('action.index.label', models: model.model_name.human_plural) - else - t("action.#{args.first}.label", model: model.model_name.human) - end - else - args.first - end - end - content_for :page_title, res - res - end - # overwrite i18n l, to handle nil values def l(*args) return '' unless args.first diff --git a/app/models/user.rb b/app/models/user.rb index b390efb4..69262b0b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -51,6 +51,14 @@ class User ) end + # needed for cmtool + def is_admin? + admin? + end + def active? + true + end + def facebook_id uid end diff --git a/app/views/admin/suppliers/index.html.slim b/app/views/admin/suppliers/index.html.slim index 867e0066..2022f131 100644 --- a/app/views/admin/suppliers/index.html.slim +++ b/app/views/admin/suppliers/index.html.slim @@ -1,21 +1,20 @@ - model_class = Supplier -.page-header= title :index, model_class +- title :index, model_class - if @suppliers.any? table.table thead tr th= model_class.human_attribute_name(:name) th= model_class.human_attribute_name(:created_at) - th=t 'helpers.actions.title' + th.action-header + th.action-header tbody - @suppliers.each do |supplier| tr td= link_to supplier.name, [:admin, supplier] - td=l supplier.created_at, format: :short - td - = link_to t('helpers.links.edit'), [:edit, :admin, supplier], class: 'btn btn-mini' - ' - = link_to t("helpers.links.destroy"), [:admin, supplier], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger' + td data-time=supplier.created_at.iso8601 data-time-format="dd D MMM HH:mm YYYY" + = edit_td [:admin, supplier] + = destroy_td [:admin, supplier] - else = no_content_given model_class = link_to t("helpers.links.new"), new_admin_supplier_path, class: 'btn btn-primary' diff --git a/app/views/admin/user_feedbacks/index.html.slim b/app/views/admin/user_feedbacks/index.html.slim index 997b84c7..fb657988 100644 --- a/app/views/admin/user_feedbacks/index.html.slim +++ b/app/views/admin/user_feedbacks/index.html.slim @@ -1,5 +1,5 @@ - model_class = UserFeedback -.page-header= title :index, model_class +- title :index, model_class - if @user_feedbacks.any? = paginate @user_feedbacks table.table.table-striped @@ -8,17 +8,16 @@ th= User.model_name.human th= model_class.human_attribute_name(:content) th= model_class.human_attribute_name(:created_at) - th=t 'helpers.actions.title' + th.action-header + th.action-header tbody - @user_feedbacks.each do |user_feedback| tr td= link_to user_feedback.user.email, [:admin, user_feedback.user] td= user_feedback.content - td=l user_feedback.created_at, format: :short - td - = link_to t('helpers.links.edit'), [:edit, :admin, user_feedback], class: 'btn btn-mini' - ' - = link_to t("helpers.links.destroy"), [:admin, user_feedback], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger' + td data-time=user_feedback.created_at.iso8601 data-time-format="dd D MMM HH:mm YYYY" + = edit_td [:admin, user_feedback] + = destroy_td [:admin, user_feedback] - else = no_content_given model_class /= link_to t("helpers.links.new"), new_admin_user_path, class: 'btn btn-primary' diff --git a/config/application.rb b/config/application.rb index 936f5448..e73575cd 100644 --- a/config/application.rb +++ b/config/application.rb @@ -249,11 +249,12 @@ module Qwaiter before :users do group label: :mozo do # Allow other tools to inject into the mozo menu title 'Mozo' - resource_link UserFeedback, scope: 'Admin' - resource_link Supplier, scope: 'Admin' - resource_link Section, scope: 'Admin' - resource_link Table, scope: 'Admin' - resource_link SvgElement, scope: 'Admin' + resource_link UserFeedback, scope: :admin + resource_link User, scope: :admin + resource_link Supplier, scope: :admin + resource_link Section, scope: :admin + resource_link Table, scope: :admin + resource_link SvgElement, scope: :admin engine_link Rails.application, title: 'Go to the website', path: '/' end end @@ -296,14 +297,6 @@ module Qwaiter end end - config.middleware.insert_before 0, Rack::Cors do - allow do - origins 'localhost', 'supplier.mozo.local', 'user.mozo.local' - #resource '/user/*', :headers => '*', :methods => '*' #[:get, :post, :options] - resource '*', headers: :any, methods: [:get, :post, :put, :patch, :delete, :options] - end - end - # Version of your assets, change this if you want to expire all your assets config.assets.version = '1.0' end diff --git a/config/environments/development.rb b/config/environments/development.rb index f33945f2..77bda002 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -5,6 +5,14 @@ Qwaiter::Application.configure do # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false + config.middleware.insert_before 0, Rack::Cors do + allow do + origins 'localhost', 'supplier.mozo.local', 'user.mozo.local', 'events.mozo.local' + #resource '/user/*', :headers => '*', :methods => '*' #[:get, :post, :options] + resource '*', headers: :any, methods: [:get, :post, :put, :patch, :delete, :options] + end + end + # Do not eager load code on boot. config.eager_load = false diff --git a/config/environments/production.rb b/config/environments/production.rb index 5e4194b2..77c8d77a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -4,6 +4,14 @@ Qwaiter::Application.configure do # Code is not reloaded between requests config.cache_classes = true + config.middleware.insert_before 0, Rack::Cors do + allow do + origins 'localhost', 'supplier.mozo.bar', 'user.mozo.bar', 'events.mozo.bar' + #resource '/user/*', :headers => '*', :methods => '*' #[:get, :post, :options] + resource '*', headers: :any, methods: [:get, :post, :put, :patch, :delete, :options] + end + end + # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both thread web servers # and those relying on copy on write to perform better. diff --git a/drb_counter/rebuild-docker.sh b/drb_counter/rebuild-docker.sh index ec243310..7d02e990 100755 --- a/drb_counter/rebuild-docker.sh +++ b/drb_counter/rebuild-docker.sh @@ -23,7 +23,7 @@ docker build -f drb_counter/Dockerfile -t mozo_drb_counter . # docker run --network=host --env DRB_ENV=production -t -i --rm mozo_drb_counter bash # 5. Spin up the counter container from the generated image -docker run --network=host --env DRB_ENV=production --detach --name=mozo_drb_counter mozo_drb_counter +docker run --network=host --env DRB_ENV=production --restart unless-stopped --detach --name=mozo_drb_counter mozo_drb_counter # To just start the container created through al these steps without rebuilding them: # docker container start $(docker ps -a -q --filter ancestor=mozo_drb_counter) diff --git a/faye/rebuild-docker.sh b/faye/rebuild-docker.sh index 2787b3b3..995a344d 100755 --- a/faye/rebuild-docker.sh +++ b/faye/rebuild-docker.sh @@ -31,7 +31,7 @@ docker build -f faye/Dockerfile -t mozo_faye . # docker run --network=host --env DRB_ENV=production -t -i --rm mozo_faye bash # 5. Spin up the counter container from the generated image -docker run --network=host --env DRB_ENV=production --detach --name=mozo_faye mozo_faye +docker run --network=host --env DRB_ENV=production --restart unless-stopped --detach --name=mozo_faye mozo_faye # To just start the container created through al these steps without rebuilding them: # docker container start $(docker ps -a -q --filter ancestor=mozo_faye)