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 ->
$(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
+1 -1
View File
@@ -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
@@ -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
-17
View File
@@ -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
+8
View File
@@ -51,6 +51,14 @@ class User
)
end
# needed for cmtool
def is_admin?
admin?
end
def active?
true
end
def facebook_id
uid
end
+6 -7
View File
@@ -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'
@@ -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'
+6 -13
View File
@@ -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
+8
View File
@@ -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
+8
View File
@@ -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.
+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
# 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)
+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
# 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)