diff --git a/Gemfile b/Gemfile
index 3b7dbcd..d4dd1ce 100644
--- a/Gemfile
+++ b/Gemfile
@@ -29,7 +29,9 @@ gem 'ssh_data'
gem 'anomaly_detection'
+gem 'bootstrap'
gem 'rails-i18n'
+gem 'hamlit'
group :development, :test do
gem 'pry'
diff --git a/Gemfile.lock b/Gemfile.lock
index b083b32..f7dbed4 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -63,6 +63,8 @@ GEM
anomaly_detection (0.1.4-x86_64-linux-musl)
rice (>= 4.0.2)
ast (2.4.2)
+ autoprefixer-rails (10.4.2.0)
+ execjs (~> 2)
bcrypt (3.1.17-x86_64-linux-musl)
bindex (0.8.1-x86_64-linux-musl)
blazer (2.6.3)
@@ -72,6 +74,10 @@ GEM
safely_block (>= 0.1.1)
bootsnap (1.11.1-x86_64-linux-musl)
msgpack (~> 1.2)
+ bootstrap (5.1.3)
+ autoprefixer-rails (>= 9.1.0)
+ popper_js (>= 2.9.3, < 3)
+ sassc-rails (>= 2.0.0)
brakeman (5.2.3)
builder (3.2.4)
chartkick (4.1.3)
@@ -97,11 +103,16 @@ GEM
exception_notification (4.5.0)
actionmailer (>= 5.2, < 8)
activesupport (>= 5.2, < 8)
+ execjs (2.8.1)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
ffi (1.15.5-x86_64-linux-musl)
globalid (1.0.0)
activesupport (>= 5.0)
+ hamlit (2.16.0-x86_64-linux-musl)
+ temple (>= 0.8.2)
+ thor
+ tilt
i18n (1.10.0)
concurrent-ruby (~> 1.0)
jbuilder (2.11.5)
@@ -135,6 +146,7 @@ GEM
parser (3.1.2.0)
ast (~> 2.4.1)
pg (1.3.5-x86_64-linux-musl)
+ popper_js (2.9.3)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
@@ -224,6 +236,7 @@ GEM
activesupport (>= 5.2)
sprockets (>= 3.0.0)
ssh_data (1.3.0)
+ temple (0.8.2)
thor (1.2.1)
tilt (2.0.10)
turbolinks (5.2.1)
@@ -257,12 +270,14 @@ DEPENDENCIES
anomaly_detection
blazer
bootsnap (>= 1.4.4)
+ bootstrap
brakeman
database_cleaner
devise
devise-i18n
exception_notification
factory_bot
+ hamlit
jbuilder (~> 2.7)
listen (~> 3.3)
lograge
diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss
new file mode 100644
index 0000000..cbd46a7
--- /dev/null
+++ b/app/assets/stylesheets/main.scss
@@ -0,0 +1 @@
+@import "bootstrap";
diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb
new file mode 100644
index 0000000..b6d2419
--- /dev/null
+++ b/app/controllers/sites_controller.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+# Gestionar el sitio
+class SitesController < ApplicationController
+ def show
+ site
+ end
+
+ def create
+ site.update(site_params)
+
+ redirect_to site_path(site)
+ end
+
+ def update
+ site.update(site_params)
+
+ redirect_to site_path(site)
+ end
+
+ private
+
+ def site
+ @site ||= Site.first || Site.new
+ end
+
+ def site_params
+ @site_params ||= params.require(:site).permit(:title, :logo)
+ end
+end
diff --git a/app/models/site.rb b/app/models/site.rb
new file mode 100644
index 0000000..09388c4
--- /dev/null
+++ b/app/models/site.rb
@@ -0,0 +1,6 @@
+# frozen_string_literal: true
+
+class Site < ApplicationRecord
+ has_one_attached :logo
+ validates_presence_of :title
+end
diff --git a/app/views/blazer/queries/home.html.erb b/app/views/blazer/queries/home.html.erb
index 58e2686..dbdd821 100644
--- a/app/views/blazer/queries/home.html.erb
+++ b/app/views/blazer/queries/home.html.erb
@@ -25,6 +25,7 @@
<%= link_to t('.new_dashboard'), new_dashboard_path %>
<%= link_to t('.new_check'), new_check_path %>
+ <%= link_to t('.site'), Rails.application.routes.url_helpers.site_path(Site.first || Site.new) %>
diff --git a/config/application.rb b/config/application.rb
index e1df02a..6557b49 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -5,7 +5,7 @@ require "rails"
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
-# require "active_storage/engine"
+require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
# require "action_mailbox/engine"
@@ -31,5 +31,6 @@ module Ectomobile
#
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
+ config.active_storage.service = :local
end
end
diff --git a/config/routes.rb b/config/routes.rb
index 7fd39e1..784acf6 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -6,4 +6,5 @@ Rails.application.routes.draw do
mount Blazer::Engine, at: 'blazer'
resources :readings, only: %i[create]
+ resources :sites, only: %i[show create update]
end
diff --git a/config/storage.yml b/config/storage.yml
new file mode 100644
index 0000000..b4c8bda
--- /dev/null
+++ b/config/storage.yml
@@ -0,0 +1,4 @@
+local:
+ service: Disk
+ public: true
+ root: <%= Rails.root.join('storage') %>
diff --git a/db/migrate/20220514222253_create_site.rb b/db/migrate/20220514222253_create_site.rb
new file mode 100644
index 0000000..7468c7a
--- /dev/null
+++ b/db/migrate/20220514222253_create_site.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+# ConfiguraciĆ³n del sitio
+class CreateSite < ActiveRecord::Migration[6.1]
+ def change
+ create_table :sites do |t|
+ t.timestamps
+ t.string :title, null: false
+ end
+ end
+end
diff --git a/db/migrate/20220514222932_create_active_storage_tables.active_storage.rb b/db/migrate/20220514222932_create_active_storage_tables.active_storage.rb
new file mode 100644
index 0000000..8779826
--- /dev/null
+++ b/db/migrate/20220514222932_create_active_storage_tables.active_storage.rb
@@ -0,0 +1,36 @@
+# This migration comes from active_storage (originally 20170806125915)
+class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
+ def change
+ create_table :active_storage_blobs do |t|
+ t.string :key, null: false
+ t.string :filename, null: false
+ t.string :content_type
+ t.text :metadata
+ t.string :service_name, null: false
+ t.bigint :byte_size, null: false
+ t.string :checksum, null: false
+ t.datetime :created_at, null: false
+
+ t.index [ :key ], unique: true
+ end
+
+ create_table :active_storage_attachments do |t|
+ t.string :name, null: false
+ t.references :record, null: false, polymorphic: true, index: false
+ t.references :blob, null: false
+
+ t.datetime :created_at, null: false
+
+ t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
+ t.foreign_key :active_storage_blobs, column: :blob_id
+ end
+
+ create_table :active_storage_variant_records do |t|
+ t.belongs_to :blob, null: false, index: false
+ t.string :variation_digest, null: false
+
+ t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
+ t.foreign_key :active_storage_blobs, column: :blob_id
+ end
+ end
+end