infra updates

This commit is contained in:
2020-03-05 11:36:49 -05:00
parent aec5364f2e
commit 840bac4d54
12 changed files with 47 additions and 49 deletions
@@ -96,7 +96,7 @@
$("[data-t]").each -> $("[data-t]").each ->
$(this).html t($(this).data("t"), $(this).data("tAttributes")) $(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") $(this).text moment($(this).data("time")).format($(this).data("timeFormat") or "dd D MMM HH:mm")
# jQuery UI datepicker support # jQuery UI datepicker support
+1 -1
View File
@@ -3,7 +3,7 @@ class SupplierController < Suppliers::ApplicationController
if Rails.env.development? if Rails.env.development?
redirect_to "http://localhost:4202/supplier/#{params[:other]}" redirect_to "http://localhost:4202/supplier/#{params[:other]}"
else else
render html: File.read(Rails.root.join('public/supplier/index.html')) redirect_to "https://supplier.mozo.bar/supplier/#{params[:other]}"
end end
end end
=begin =begin
@@ -1,7 +1,7 @@
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def passthru def passthru
return show_404 alert: 'Test'
send(params[:provider]) and return if available_action?(params[:provider]) send(params[:provider]) and return if available_action?(params[:provider])
show_404
# Or alternatively, # Or alternatively,
# raise ActionController::RoutingError.new('Not Found') # raise ActionController::RoutingError.new('Not Found')
end end
-17
View File
@@ -1,21 +1,4 @@
module ApplicationHelper 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 # overwrite i18n l, to handle nil values
def l(*args) def l(*args)
return '' unless args.first return '' unless args.first
+8
View File
@@ -51,6 +51,14 @@ class User
) )
end end
# needed for cmtool
def is_admin?
admin?
end
def active?
true
end
def facebook_id def facebook_id
uid uid
end end
+6 -7
View File
@@ -1,21 +1,20 @@
- model_class = Supplier - model_class = Supplier
.page-header= title :index, model_class - title :index, model_class
- if @suppliers.any? - if @suppliers.any?
table.table table.table
thead thead
tr tr
th= model_class.human_attribute_name(:name) th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:created_at) th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions.title' th.action-header
th.action-header
tbody tbody
- @suppliers.each do |supplier| - @suppliers.each do |supplier|
tr tr
td= link_to supplier.name, [:admin, supplier] td= link_to supplier.name, [:admin, supplier]
td=l supplier.created_at, format: :short td data-time=supplier.created_at.iso8601 data-time-format="dd D MMM HH:mm YYYY"
td = edit_td [:admin, supplier]
= link_to t('helpers.links.edit'), [:edit, :admin, supplier], class: 'btn btn-mini' = destroy_td [:admin, supplier]
'
= link_to t("helpers.links.destroy"), [:admin, supplier], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else - else
= no_content_given model_class = no_content_given model_class
= link_to t("helpers.links.new"), new_admin_supplier_path, class: 'btn btn-primary' = link_to t("helpers.links.new"), new_admin_supplier_path, class: 'btn btn-primary'
@@ -1,5 +1,5 @@
- model_class = UserFeedback - model_class = UserFeedback
.page-header= title :index, model_class - title :index, model_class
- if @user_feedbacks.any? - if @user_feedbacks.any?
= paginate @user_feedbacks = paginate @user_feedbacks
table.table.table-striped table.table.table-striped
@@ -8,17 +8,16 @@
th= User.model_name.human th= User.model_name.human
th= model_class.human_attribute_name(:content) th= model_class.human_attribute_name(:content)
th= model_class.human_attribute_name(:created_at) th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions.title' th.action-header
th.action-header
tbody tbody
- @user_feedbacks.each do |user_feedback| - @user_feedbacks.each do |user_feedback|
tr tr
td= link_to user_feedback.user.email, [:admin, user_feedback.user] td= link_to user_feedback.user.email, [:admin, user_feedback.user]
td= user_feedback.content td= user_feedback.content
td=l user_feedback.created_at, format: :short td data-time=user_feedback.created_at.iso8601 data-time-format="dd D MMM HH:mm YYYY"
td = edit_td [:admin, user_feedback]
= link_to t('helpers.links.edit'), [:edit, :admin, user_feedback], class: 'btn btn-mini' = destroy_td [:admin, user_feedback]
'
= link_to t("helpers.links.destroy"), [:admin, user_feedback], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else - else
= no_content_given model_class = no_content_given model_class
/= link_to t("helpers.links.new"), new_admin_user_path, class: 'btn btn-primary' /= link_to t("helpers.links.new"), new_admin_user_path, class: 'btn btn-primary'
+6 -13
View File
@@ -249,11 +249,12 @@ module Qwaiter
before :users do before :users do
group label: :mozo do # Allow other tools to inject into the mozo menu group label: :mozo do # Allow other tools to inject into the mozo menu
title 'Mozo' title 'Mozo'
resource_link UserFeedback, scope: 'Admin' resource_link UserFeedback, scope: :admin
resource_link Supplier, scope: 'Admin' resource_link User, scope: :admin
resource_link Section, scope: 'Admin' resource_link Supplier, scope: :admin
resource_link Table, scope: 'Admin' resource_link Section, scope: :admin
resource_link SvgElement, scope: 'Admin' resource_link Table, scope: :admin
resource_link SvgElement, scope: :admin
engine_link Rails.application, title: 'Go to the website', path: '/' engine_link Rails.application, title: 'Go to the website', path: '/'
end end
end end
@@ -296,14 +297,6 @@ module Qwaiter
end end
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 # Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0' config.assets.version = '1.0'
end end
+8
View File
@@ -5,6 +5,14 @@ Qwaiter::Application.configure do
# every request. This slows down response time but is perfect for development # 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. # since you don't have to restart the web server when you make code changes.
config.cache_classes = false 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. # Do not eager load code on boot.
config.eager_load = false config.eager_load = false
+8
View File
@@ -4,6 +4,14 @@ Qwaiter::Application.configure do
# Code is not reloaded between requests # Code is not reloaded between requests
config.cache_classes = true 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 # Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers # your application in memory, allowing both thread web servers
# and those relying on copy on write to perform better. # and those relying on copy on write to perform better.
+1 -1
View File
@@ -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 # 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 # 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: # 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) # docker container start $(docker ps -a -q --filter ancestor=mozo_drb_counter)
+1 -1
View File
@@ -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 # docker run --network=host --env DRB_ENV=production -t -i --rm mozo_faye bash
# 5. Spin up the counter container from the generated image # 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: # To just start the container created through al these steps without rebuilding them:
# docker container start $(docker ps -a -q --filter ancestor=mozo_faye) # docker container start $(docker ps -a -q --filter ancestor=mozo_faye)