merged main

This commit is contained in:
Hub Feenix Member 2023-01-14 14:49:24 +02:00
commit d5b8d83096
57 changed files with 472 additions and 46 deletions

View File

@ -1 +1 @@
3.0.4
3.1.3

View File

@ -1,6 +1,6 @@
source "https://rubygems.org"
ruby "3.0.4"
ruby "3.1.3"
gem "rails", "~> 7.0"
@ -18,6 +18,8 @@ gem 'carrierwave', '>= 3.0.0.beta', '< 4.0'
gem "ruby2js" , git: "https://github.com/ruby2js/ruby2js/" , branch: "haml_fix"
gem 'thredded', '~> 1.0'
gem "rest-client"
gem "simple_form" , "5.1.0"
gem "simple_form_tailwind_css"
@ -26,10 +28,10 @@ gem "simple_form_tailwind_css"
gem "merged" , path: "../merged"
gem "passenger" , require: "phusion_passenger/rack_handler"
gem "bootsnap", require: false
group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "bootsnap", require: false
gem "debug", platforms: %i[ mri mingw x64_mingw ]
gem "mina"
gem 'guard-minitest'

View File

@ -136,6 +136,8 @@ GEM
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
erubi (1.12.0)
erubis (2.7.0)
execjs (2.8.1)
@ -143,7 +145,7 @@ GEM
formatador (1.1.0)
friendly_id (5.5.0)
activerecord (>= 4.0.0)
git (1.13.0)
git (1.13.1)
addressable (~> 2.8)
rchardet (~> 1.8)
globalid (1.0.0)
@ -181,6 +183,9 @@ GEM
nokogiri (>= 1.6.0)
ruby_parser (~> 3.5)
htmlentities (4.3.4)
http-accept (1.7.0)
http-cookie (1.0.5)
domain_name (~> 0.5)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
image_processing (1.12.2)
@ -226,6 +231,9 @@ GEM
marcel (1.0.2)
matrix (0.4.2)
method_source (1.0.0)
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
mina (1.2.4)
open4 (~> 1.3.4)
rake
@ -245,6 +253,7 @@ GEM
timeout
net-smtp (0.3.3)
net-protocol
netrc (0.11.0)
nio4r (2.5.8)
nokogiri (1.13.10-x86_64-linux)
racc (~> 1.4)
@ -316,6 +325,11 @@ GEM
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.5)
rinku (2.0.6)
ruby-vips (2.1.4)
@ -388,6 +402,9 @@ GEM
timeout (0.3.1)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
warden (1.2.9)
rack (>= 2.0.9)
web-console (4.2.0)
@ -426,6 +443,7 @@ DEPENDENCIES
passenger
pg (~> 1.1)
rails (~> 7.0)
rest-client
ruby2js!
sassc-rails
selenium-webdriver
@ -438,7 +456,7 @@ DEPENDENCIES
webdrivers
RUBY VERSION
ruby 3.0.4p208
ruby 3.1.3p185
BUNDLED WITH
2.2.33
2.3.26

View File

@ -0,0 +1,61 @@
class EntitiesController < ApplicationController
before_action :set_entity, only: %i[ show edit update destroy ]
before_action :authenticate_member!
# redirect_to main_app.root_path unless current_member.admin?
# GET /entities
def index
@entities = Entity.all
end
# GET /entities/1
def show
end
# GET /entities/new
def new
@entity = Entity.new
end
# GET /entities/1/edit
def edit
end
# POST /entities
def create
@entity = Entity.new(entity_params)
if @entity.save
redirect_to @entity, notice: "Entity was successfully created."
else
render :new, status: :unprocessable_entity
end
end
# PATCH/PUT /entities/1
def update
if @entity.update(entity_params)
redirect_to @entity, notice: "Entity was successfully updated."
else
render :edit, status: :unprocessable_entity
end
end
# DELETE /entities/1
def destroy
@entity.destroy
redirect_to entities_url, notice: "Entity was successfully destroyed."
end
private
# Use callbacks to share common setup or constraints between actions.
def set_entity
@entity = Entity.find(params[:id])
end
# Only allow a list of trusted parameters through.
def entity_params
params.require(:entity).permit(:name, :ha_id, :ha_type, :member_id)
end
end

View File

@ -21,4 +21,8 @@ module ApplicationHelper
Rails.application.routes.url_helpers
end
def button_classes
"mr-3 inline-block rounded-lg px-3 py-2 text-md font-medium border border-gray-500"
end
end

View File

@ -0,0 +1,2 @@
module EntitiesHelper
end

28
app/models/entity.rb Normal file
View File

@ -0,0 +1,28 @@
class Entity < ApplicationRecord
belongs_to :member
validates :name , presence: true
validates :ha_id , presence: true
validates :member_id , presence: true
def value
@data = Entity.response("/" + ha_id)
@data["state"]
end
def type
ha_id.split(".").first.capitalize
end
def self.ha_entities
res = response()
res.collect{|i| i["entity_id"]}.select{|i| i.include?("4a") || i.include?("2d")}
end
def self.response(path = "")
token = Rails.application.credentials[:ha_token]
all = RestClient.get( "10.30.39.238:8123/api/states#{path}" ,
{"Authorization" => "Bearer #{token}" })
res = JSON.parse(all.body)
end
end

View File

@ -6,6 +6,8 @@ class Member < ApplicationRecord
mount_uploader :picture, PictureUploader
has_many :entities
def admin
true
end

View File

@ -0,0 +1,16 @@
= simple_form_for @entity do |f|
- if @entity.errors.any?
#error_explanation
%h2= "#{pluralize(@entity.errors.count, "error")} prohibited this entity from being saved:"
%ul
- @entity.errors.full_messages.each do |message|
%li= message
.field
= f.input :name
.field
= f.input :ha_id , collection: Entity.ha_entities
.field
= f.input :member_id , collection: Member.all.collect{|m| [m.name , m.id ]}
.actions{class: button_classes}
= f.submit 'Save'

View File

@ -0,0 +1,7 @@
%h1 Editing entity
= render 'form'
= link_to 'Show', @entity
\|
= link_to 'Back', entities_path

View File

@ -0,0 +1,27 @@
%h1 Listing entities
%table
%thead
%tr
%th Name
%th Ha
%th Type
%th Member
%th
%th
%th
%tbody
- @entities.each do |entity|
%tr
%td= entity.name
%td= entity.ha_id
%td= entity.type
%td= entity.member.name
%td= link_to 'Show', entity
%td= link_to 'Edit', edit_entity_path(entity)
%td= link_to 'Destroy', entity, method: :delete, data: { confirm: 'Are you sure?' }
%br
= link_to 'New Entity', new_entity_path

View File

@ -0,0 +1,7 @@
%h1 New entity
.grid.grid-cols-3
%div
= render 'form'
= link_to 'Back', entities_path

View File

@ -0,0 +1,22 @@
.grid.grid-cols-3
%div
%div
%p
%b Name:
= @entity.name
%p
%b Ha:
= @entity.ha_id
%p
%b Type:
= @entity.type
%p
%b Value:
= @entity.value
%p
%b Member:
= @entity.member.name
= link_to 'Edit', edit_entity_path(@entity)
\|
= link_to 'Back', entities_path

View File

@ -2,7 +2,7 @@
.max-w-screen-xl.px-4.py-16.mx-auto.sm:px-6.lg:px-8
.lg:flex.lg:items-start.lg:gap-8
%a.inline-flex.items-center{"aria-label" => "Hub Feenix", :href => "/", :title => "Hub Feenix"}
= image_tag("feenix_lintu" , class: "h-20")
= image_tag("feenix_lintu.webp" , class: "h-20")
.grid.grid-cols-2.gap-8.mt-8.lg:mt-0.lg:grid-cols-5.lg:gap-y-16
.col-span-2
%div
@ -46,6 +46,10 @@
%p.font-medium.text-gray-900 News
%nav.mt-6{"aria-label" => "Footer Navigation - Downloads"}
%ul.space-y-4.text-sm
- if blog = Merged::PagesHelper.last_blog
%li
%a.text-gray-700.transition.hover:opacity-75{:href => main_app.view_blog_path(blog.page.name) }
Latest News
%li
%a.text-gray-700.transition.hover:opacity-75{:href => "https://www.facebook.com/hubfeenix" , :target => "_blank"}
Facebook

View File

@ -1,7 +1,7 @@
%header.px-4.py-5.mx-auto.sm:max-w-xl.md:max-w-full.lg:max-w-screen-xl.md:px-24.lg:px-8
.relative.flex.items-center.justify-between
%a.inline-flex.items-center{"aria-label" => "Hub Feenix", :href => "/", :title => "Hub Feenix"}
= image_tag("feenix_lintu" , class: "h-20")
= image_tag("feenix_lintu.webp" , class: "h-20")
%span.ml-2.text-xl.font-bold.tracking-wide.text-gray-800.uppercase Hub Feenix
%ul.flex.items-center.hidden.space-x-8.lg:flex
- [:retreats , :studios , :makerspace , :coworking, :about].each do |link|
@ -9,7 +9,7 @@
%a.font-medium.tracking-wide.text-gray-700.transition-colors.duration-400.hover:text-cyan-800{"aria-label" => "Our product", :href => "/#{link}", :title => link.capitalize}= link.capitalize
%li
= link_to "https://www.facebook.com/hubfeenix" , :target => "_blank" do
= image_tag("fb" , class: "h-10 rounded-md")
= image_tag("fb.webp" , class: "h-10 rounded-md")
%li
- unless member_signed_in?
%a.inline-flex.items-center.justify-center.h-12.px-6.font-medium.tracking-wide.text-white.transition.duration-200.rounded-lg.shadow-md.bg-green-800.hover:bg-blue-800.focus:shadow-outline.focus:outline-none{"aria-label" => "Sign up", :href => main_app.member_session_path, :title => "Log in or Sign up"}
@ -28,7 +28,7 @@
.lg:hidden.flex.items-center.justify-between
.mr-20
= link_to "https://www.facebook.com/hubfeenix" , :target => "_blank" do
= image_tag("fb" , class: "h-10 rounded-md")
= image_tag("fb.webp" , class: "h-10 rounded-md")
%button.p-2.-mr-1.transition.duration-200.rounded.focus:outline-none.focus:shadow-outline.hover:bg-deep-purple-50.focus:bg-deep-purple-50{"aria-label" => "Open Menu", :title => "Open Menu" , onclick: "menu_on();"}
%svg.w-5.text-gray-600{:viewbox => "0 0 24 24"}
%path{:d => "M23,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h22c0.6,0,1,0.4,1,1S23.6,13,23,13z", :fill => "currentColor"}

View File

@ -3,7 +3,7 @@
.flex.items-center.justify-between.mb-4
%div
%a.inline-flex.items-center{"aria-label" => "Hub Feenix", :href => "/", :title => "Hub Feenix"}
= image_tag("feenix_lintu" , class: "h-20")
= image_tag("feenix_lintu.webp" , class: "h-20")
%span.ml-2.text-xl.font-bold.tracking-wide.text-gray-800.uppercase Hub Feenix
%div
%button.p-2.-mt-2.-mr-2.transition.duration-200.rounded.hover:bg-gray-200.focus:bg-gray-200.focus:outline-none.focus:shadow-outline{"aria-label" => "Close Menu", :title => "Close Menu" , onclick: "menu_off();"}

View File

@ -1,6 +1,24 @@
!!!
%html
%head
%link{:href => "/apple-icon-57x57.png", :rel => "apple-touch-icon", :sizes => "57x57"}/
%link{:href => "/apple-icon-60x60.png", :rel => "apple-touch-icon", :sizes => "60x60"}/
%link{:href => "/apple-icon-72x72.png", :rel => "apple-touch-icon", :sizes => "72x72"}/
%link{:href => "/apple-icon-76x76.png", :rel => "apple-touch-icon", :sizes => "76x76"}/
%link{:href => "/apple-icon-114x114.png", :rel => "apple-touch-icon", :sizes => "114x114"}/
%link{:href => "/apple-icon-120x120.png", :rel => "apple-touch-icon", :sizes => "120x120"}/
%link{:href => "/apple-icon-144x144.png", :rel => "apple-touch-icon", :sizes => "144x144"}/
%link{:href => "/apple-icon-152x152.png", :rel => "apple-touch-icon", :sizes => "152x152"}/
%link{:href => "/apple-icon-180x180.png", :rel => "apple-touch-icon", :sizes => "180x180"}/
%link{:href => "/android-icon-192x192.png", :rel => "icon", :sizes => "192x192", :type => "image/png"}/
%link{:href => "/favicon-32x32.png", :rel => "icon", :sizes => "32x32", :type => "image/png"}/
%link{:href => "/favicon-96x96.png", :rel => "icon", :sizes => "96x96", :type => "image/png"}/
%link{:href => "/favicon-16x16.png", :rel => "icon", :sizes => "16x16", :type => "image/png"}/
%link{:href => "/manifest.json", :rel => "manifest"}/
%meta{:content => "#ffffff", :name => "msapplication-TileColor"}/
%meta{:content => "/ms-icon-144x144.png", :name => "msapplication-TileImage"}/
%meta{:content => "#ffffff", :name => "theme-color"}/
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title Hubfeenix
%meta{:content => "width=device-width,initial-scale=1", :name => "viewport"}/
@ -10,6 +28,9 @@
= stylesheet_link_tag "application"
= javascript_importmap_tags
- if false
%script{:src => "https://cdn.tailwindcss.com"}
%body
= render "layouts/header"
= render "layouts/messages"

View File

@ -3,32 +3,32 @@
.flex.justify-center.m-20
.flex.flex-col
%h1 Editing member
%h1.text-4xl Editing profile
= simple_form_for @member , builder: SimpleForm::Tailwind::FormBuilder do |f|
= f.error_notification
.grid.grid-cols-3.gap-10.mx-20
= f.input :name
= f.input :public , label: "Public: (Click box below)"
= f.input :picture , as: :file
.grid.grid-cols-4.mx-20
.info.mr-8
= f.input :name
= f.input :public , label: "Public: (Click box below)"
= f.input :picture , as: :file
.flex.justify-center.actions.m-10
= f.button :button, "Update", class: button_classes + " bg-cyan-200"
= link_to member_path(@member) do
%button.ml-10{type: :submit, class: button_classes}
Back
.field.flex.flex-col.pr-2.border-r-8.border-slate-600
= f.text_area :bio ,rows: 18 , "v-model" => "markdown" , class: "appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
%div.h-90
-if @member.picture_url
%div.overflow-hidden.ml-2.mr-8
= image_tag @member.picture_url, class: "object-contain w-full"
-else
No Picture
.preview.prose
%b.text-2xl Preview
%div{"v-html" => "compiledMarkdown"}
.field.flex.flex-col
= f.text_area :bio ,rows: 15 , "v-model" => "markdown" , class: "appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
%div
-if @member.picture_url
%div.overflow-hidden
.my-5 Currently
= image_tag @member.picture_url, class: "object-contain h-40"
-else
No Picture
.flex.justify-center.actions.m-10
= f.button :button, "Update", class: "flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
= link_to member_path(@member) do
%button.ml-20.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400{type: :submit}
Back
:ruby2js
class Mark < Vue
options el: '.grid'

View File

@ -17,11 +17,17 @@
%svg.inline-block.w-3.ml-2{:fill => "currentColor", :viewbox => "0 0 12 12"}
%path{:d => "M9.707,5.293l-5-5A1,1,0,0,0,3.293,1.707L7.586,6,3.293,10.293a1,1,0,1,0,1.414,1.414l5-5A1,1,0,0,0,9.707,5.293Z"}
.flex.justify-around
= link_to edit_member_path(@member) do
%button.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
Edit
-if @member == current_member or current_member.admin?
= form_tag( destroy_member_session_path , {method: :delete } ) do
%button.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400{type: :submit}
Sign out
.flex.justify-around
= link_to edit_member_path(@member) do
%button.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
Edit
.grid.grid-cols-3.gap-4
-@member.entities.each do |entity|
%div= entity.type
%div= entity.name
%div= entity.value
= form_tag( destroy_member_session_path , {method: :delete } ) do
%button.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400{type: :submit}
Sign out

View File

@ -24,6 +24,7 @@ module HubfeenixFi
config.load_defaults 7.0
config.hosts << "green-machine.local" #our "staging"
config.hosts << "staging.hubfeenix.fi" #production
# Configuration for the application, engines, and railties goes here.
#

View File

@ -1 +1 @@
cBfiDOsfbpoerJLrgx0rBBWV9DYuW4cvbHG2261uc/LGtU3jGCmKfjPlf+9jlnTBwX4hgz/5gOQkweeFKTnqKqN53ZmvIuMVsWA3fZfNNO4YzUzK6PAR3qBx3670JFUcEC9yhgUPij+Vmg/+d/ZndgA09Rsm+6JKn7MwQexuxs2enDR5khb5t3g7j45CsnYSvry6NFZ0fFd2LTvzBDAjP3lVsTHDgXL/R/w2Efk2H5djU6Km79xW1/XF7NEUDZllR9tExeXNjtdK00E5VqqsVQCCsNLxB5z9pr97rqQi++VmDD1YMuHRKrglnc8wRHzGp++kSb8u2dUQV8nhcyofUhgMYuo9HHLsOCXEiuxK7aEKbCuiyJLeFpUwDe63j2+F217Fe8ziawE6k+EiAkpRImmap6TrPDkI4VpT--f/0FgHT/l+vdOJty--Q4RW6cJzfppEBMzZFujQZg==
OaKTik0EStvonrwTuP2M/z94Dn97BOuyOeP0zCgiKOG0C3K9D7XLKwhboSBBprkWBxAadS3U+JXKr+uF3J72fE3DYO2O1Ruddx60CWi4XnIsUi2TUKDgHvvRJMMCp1hbclggixuqH3r5d+YVoFeEtp0XBE1JZscUSDEEG8m7+5WeBnuKa+cWu1OVFtgqn68AAD4Jr8wEp8agNIZlvZk/77nO5jmIpgzWlVsIgznDDdyZW7IK6jdVxKBrnu6HvfJqt8Np9nZnsQ+EtwioCQO5nvfYtM5lrHVOvVKxVnmaycKvC42Vh2MH8IUO2mQZAX5543FPBovmxRcQFqDgrHr6C4NQ2x7UHRxeD5RD6A9fZ4RaEAxKVRYWXL3YVkz+HUutJ+bKJMaMlPwnEBfYnshFJdI5ca57UpiUY+c09WikIDMjZjtCos4obwJbIX8Oy9/ClhSWEkoJBr1eZ3ieUZz66gKZvfiKgNhMnE/KBCj3CqUBmHLi5XfmKqdOlAf+EoZDm4XRbXd4BanmheJ4FWJeIQhFXM7lwIvv1q9PiuBP60Ss95dWQR4q7NZiu3LKkfAodZkgbPjPNzmUWlZsq0q4ze0Koz1XGki9vkx3hz7DbWnHehSuJw2cHKOTJuEfi2b2bXnsVi+vV/+naczyQn9mzU0SG9WHTJZVKUiT8fKnS2v5VO/c3cbYGGylJRNxS0EQ50FDSqgVQgbeI/08BivcBxnGq9beXyuaeqkGE4JFeI9i6gJrU2FfsjKdTjw6T8TwUV6qP0/MJOtSo2UaP4aIFAV7U90+3y0B+mUj2M5JtfpFWMKWcWMNsIHqowINz6H4bnV/XQ==--u9baZdFij677MR3P--ozXUG3v6hK2XQxftbhMiQQ==

View File

@ -22,7 +22,7 @@ set :user, 'feenix' # Username in the server to SSH to.
# Shared dirs and files will be symlinked into the app-folder by the 'deploy:link_shared_paths' step.
# Some plugins already add folders to shared_dirs like `mina/rails` add `public/assets`, `vendor/bundle` and many more
# run `mina -d` to see all folders and files already included in `shared_dirs` and `shared_files`
set :shared_dirs, fetch(:shared_dirs, []).push('tmp/pids' , 'tmp/sockets')
set :shared_dirs, fetch(:shared_dirs, []).push('tmp/pids' , 'tmp/sockets' , 'public/uploads')
set :shared_files, fetch(:shared_files, []).push('config/master.key')
# This task is the environment that is loaded for all remote run commands, such as
@ -54,6 +54,7 @@ task :deploy do
invoke :'bundle:install'
invoke :'rails:assets_precompile'
invoke :'deploy:cleanup'
invoke :'rails[db:migrate]'
on :launch do
in_path(fetch(:current_path)) do

View File

@ -55,11 +55,24 @@ Rails.application.configure do
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "hubfeenix_fi_production"
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
config.action_mailer.smtp_settings = {
:address => Rails.application.credentials.mail_server,
:port => 465,
:domain => Rails.application.credentials.domain_name,
:user_name => Rails.application.credentials.admin_email,
:password => Rails.application.credentials.admin_pass,
:ssl => true,
:tls => true,
:authentication => :login,
:enable_starttls_auto => true
}
# ActionMailer Config
config.action_mailer.default_url_options = { :host => Rails.application.credentials.domain_name }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).

View File

@ -1,4 +1,5 @@
Rails.application.routes.draw do
resources :entities
devise_for :members
@ -8,6 +9,8 @@ Rails.application.routes.draw do
mount Merged::Engine => "/merged"
get ":id" , to: "merged/view#view" , id: :id
root "merged/view#view" , id: 'index'
get "/news/:id" , to: "merged/view#page" , id: :id , as: :view_blog
get ":id" , to: "merged/view#page" , id: :id , as: :view_page
root "merged/view#page" , id: 'index'
end

View File

@ -0,0 +1,12 @@
class CreateEntities < ActiveRecord::Migration[7.0]
def change
create_table :entities do |t|
t.string :name
t.string :ha_id
t.string :ha_type
t.references :member, null: false, foreign_key: true
t.timestamps
end
end
end

13
db/schema.rb generated
View File

@ -10,10 +10,20 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2022_12_31_154221) do
ActiveRecord::Schema[7.0].define(version: 2023_01_13_170732) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "entities", force: :cascade do |t|
t.string "name"
t.string "ha_id"
t.string "ha_type"
t.bigint "member_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["member_id"], name: "index_entities_on_member_id"
end
create_table "friendly_id_slugs", force: :cascade do |t|
t.string "slug", null: false
t.integer "sluggable_id", null: false
@ -277,6 +287,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_31_154221) do
t.index ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true
end
add_foreign_key "entities", "members"
add_foreign_key "thredded_messageboard_users", "thredded_messageboards", on_delete: :cascade
add_foreign_key "thredded_messageboard_users", "thredded_user_details", on_delete: :cascade
add_foreign_key "thredded_user_post_notifications", "members", column: "user_id", on_delete: :cascade

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/apple-icon-57x57.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
public/apple-icon-60x60.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
public/apple-icon-72x72.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
public/apple-icon-76x76.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/apple-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

2
public/browserconfig.xml Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig><msapplication><tile><square70x70logo src="/ms-icon-70x70.png"/><square150x150logo src="/ms-icon-150x150.png"/><square310x310logo src="/ms-icon-310x310.png"/><TileColor>#ffffff</TileColor></tile></msapplication></browserconfig>

BIN
public/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

BIN
public/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
public/favicon-96x96.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 1.1 KiB

41
public/manifest.json Normal file
View File

@ -0,0 +1,41 @@
{
"name": "App",
"icons": [
{
"src": "\/android-icon-36x36.png",
"sizes": "36x36",
"type": "image\/png",
"density": "0.75"
},
{
"src": "\/android-icon-48x48.png",
"sizes": "48x48",
"type": "image\/png",
"density": "1.0"
},
{
"src": "\/android-icon-72x72.png",
"sizes": "72x72",
"type": "image\/png",
"density": "1.5"
},
{
"src": "\/android-icon-96x96.png",
"sizes": "96x96",
"type": "image\/png",
"density": "2.0"
},
{
"src": "\/android-icon-144x144.png",
"sizes": "144x144",
"type": "image\/png",
"density": "3.0"
},
{
"src": "\/android-icon-192x192.png",
"sizes": "192x192",
"type": "image\/png",
"density": "4.0"
}
]
}

BIN
public/ms-icon-144x144.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
public/ms-icon-150x150.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
public/ms-icon-310x310.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
public/ms-icon-70x70.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,48 @@
require "test_helper"
class EntitiesControllerTest < ActionDispatch::IntegrationTest
setup do
@entity = entities(:one)
end
test "should get index" do
get entities_url
assert_response :success
end
test "should get new" do
get new_entity_url
assert_response :success
end
test "should create entity" do
assert_difference("Entity.count") do
post entities_url, params: { entity: { ha_id: @entity.ha_id, member_id: @entity.member_id, name: @entity.name, type: @entity.type } }
end
assert_redirected_to entity_url(Entity.last)
end
test "should show entity" do
get entity_url(@entity)
assert_response :success
end
test "should get edit" do
get edit_entity_url(@entity)
assert_response :success
end
test "should update entity" do
patch entity_url(@entity), params: { entity: { ha_id: @entity.ha_id, member_id: @entity.member_id, name: @entity.name, type: @entity.type } }
assert_redirected_to entity_url(@entity)
end
test "should destroy entity" do
assert_difference("Entity.count", -1) do
delete entity_url(@entity)
end
assert_redirected_to entities_url
end
end

13
test/fixtures/entities.yml vendored Normal file
View File

@ -0,0 +1,13 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
ha_id: MyString
type:
member: one
two:
name: MyString
ha_id: MyString
type:
member: two

View File

@ -0,0 +1,7 @@
require "test_helper"
class EntityTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,47 @@
require "application_system_test_case"
class EntitiesTest < ApplicationSystemTestCase
setup do
@entity = entities(:one)
end
test "visiting the index" do
visit entities_url
assert_selector "h1", text: "Entities"
end
test "should create entity" do
visit entities_url
click_on "New entity"
fill_in "Ha", with: @entity.ha_id
fill_in "Member", with: @entity.member_id
fill_in "Name", with: @entity.name
fill_in "Type", with: @entity.type
click_on "Create Entity"
assert_text "Entity was successfully created"
click_on "Back"
end
test "should update Entity" do
visit entity_url(@entity)
click_on "Edit this entity", match: :first
fill_in "Ha", with: @entity.ha_id
fill_in "Member", with: @entity.member_id
fill_in "Name", with: @entity.name
fill_in "Type", with: @entity.type
click_on "Update Entity"
assert_text "Entity was successfully updated"
click_on "Back"
end
test "should destroy Entity" do
visit entity_url(@entity)
click_on "Destroy this entity", match: :first
assert_text "Entity was successfully destroyed"
end
end