Инициалиазация репозитория

This commit is contained in:
ada
2025-11-11 08:24:49 +03:00
commit 39f93667fe
114 changed files with 5137 additions and 0 deletions
View File
+5
View File
@@ -0,0 +1,5 @@
//= link_tree ../images
//= link_tree ../builds
//= link_tree ../../javascript .js
//= link_tree ../../../vendor/javascript .js
//= link_directory ../stylesheets .css
View File
+21
View File
@@ -0,0 +1,21 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
* vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
//*= require_tree .
//*= require_self
*/
@use "bootstrap-icons";
@use "slimselect";
@use "jquery-ui/core";
@use "toastr";
@use "base";
@@ -0,0 +1,13 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
/*
@layer components {
.btn-primary {
@apply py-2 px-4 bg-blue-200;
}
}
*/
+25
View File
@@ -0,0 +1,25 @@
.required-label::after {
content: ' *';
color: red;
margin-left: -1px; // Optional: Adjust spacing
}
.field_with_errors {
input:not([type="submit"]),
.ss-main {
border: 1px solid red !important;
background-color: #ffd7d7;
color: red;
&::placeholder {
color: red;
}
}
.error-message {
color: red;
font-size: 16px;
font-weight: 500;
}
}
@@ -0,0 +1,4 @@
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
@@ -0,0 +1,4 @@
module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
@@ -0,0 +1,7 @@
include Pagy::Backend
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include Authorization
end
View File
+69
View File
@@ -0,0 +1,69 @@
module Authorization
extend ActiveSupport::Concern
included do
before_action :set_paper_trail_whodunnit
before_action :load_current_user # load user from database
before_action :check_authentication # check if user authenticated
before_action :check_current_user # check if user authorized
rescue_from ActionController::UnknownFormat do
request.format = :html
render_error
end
def current_login
session['zombie'] || cas_login
end
private
def cas_login
session['cas'] && session['cas']['user']
end
def set_current_user(options = {})
return nil if current_login.blank?
load_current_user
end
def load_current_user
@current_user ||= User.where('lower(login) = lower(?)', current_login).first
end
def check_authentication
if session.blank? || session['cas'].blank? || session['cas']['user'].blank? ||
(request.get? && !request.xhr? && request.xhr? != 0 && (session['cas']['last_validated_at'].blank? || session['cas']['last_validated_at'] < 15.minutes.ago))
render plain: 'Требуется авторизация', status: 401
end
end
def check_current_user
render_error unless @current_user
end
def render_error(error = 'Доступ запрещен!', options = {})
@error = error
status = options[:status] || 403
request.format = options[:format] if options[:format]
respond_to do |format|
format.html { render 'error', status: status }
format.js { render js: %(alert("#{@error}")), status: status }
format.json { render json: {error: @error}, status: status }
# session.destroy
end
end
def permissions
render_error unless admin_permission
end
def admin_permission
@current_user.try(:administrator?)
end
def user_for_paper_trail
current_login || 'Anonymous'
end
end
end
+4
View File
@@ -0,0 +1,4 @@
class WelcomeController < ApplicationController
def home; end
end
+7
View File
@@ -0,0 +1,7 @@
module ApplicationHelper
include Pagy::Frontend
def bicon(name)
image_tag("", class: "bi bi-#{name}")
end
end
+2
View File
@@ -0,0 +1,2 @@
module WelcomeHelper
end
+7
View File
@@ -0,0 +1,7 @@
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
import "@hotwired/turbo-rails"
import "controllers"
import "jquery"
import "jquery_ujs"
import "toastr"
window.toastr = toastr
@@ -0,0 +1,9 @@
import { Application } from "@hotwired/stimulus"
const application = Application.start()
// Configure Stimulus development experience
application.debug = false
window.Stimulus = application
export { application }
@@ -0,0 +1,7 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
connect() {
this.element.textContent = "Hello World!"
}
}
+4
View File
@@ -0,0 +1,4 @@
// Import and register all your controllers from the importmap via controllers/**/*_controller
import { application } from "controllers/application"
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
eagerLoadControllersFrom("controllers", application)
+7
View File
@@ -0,0 +1,7 @@
class ApplicationJob < ActiveJob::Base
# Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked
# Most jobs are safe to ignore if the underlying records are no longer available
# discard_on ActiveJob::DeserializationError
end
+4
View File
@@ -0,0 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: "from@example.com"
layout "mailer"
end
+5
View File
@@ -0,0 +1,5 @@
class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
has_paper_trail # enable global changes logging
strip_attributes # auto strip all attributes
end
View File
+2
View File
@@ -0,0 +1,2 @@
class User < ApplicationRecord
end
+4
View File
@@ -0,0 +1,4 @@
.card.border-danger
h1.bg-danger.text-white.card-header=defined?(status) ? status : response.status
.card-body
h1=error
+1
View File
@@ -0,0 +1 @@
=render 'error', error: @error
+19
View File
@@ -0,0 +1,19 @@
doctype html
html
head
title
=t('app_name')
meta[name="viewport" content="width=device-width,initial-scale=1"]
meta name="turbo-refresh-method" content="morph"
= csrf_meta_tags
= csp_meta_tag
/ = favicon_link_tag 'favicon.ico'
/ = favicon_link_tag 'favicon-32x32.png', sizes: '32x32'
/ = favicon_link_tag 'apple-icon.png', rel: 'apple-touch-icon'
= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload"
= stylesheet_link_tag "application", media: "all", "data-turbo-track": "reload"
script[async src="https://ga.jspm.io/npm:es-module-shims@1.8.2/dist/es-module-shims.js" data-turbo-track="reload"]
= javascript_importmap_tags
= hotwire_livereload_tags if Rails.env.development?
body
= yield
+8
View File
@@ -0,0 +1,8 @@
doctype html
html
head
meta content: "text/html; charset=utf-8" http-equiv="Content-Type" /
css:
/!* Email styles need to be inline */
body
= yield
+1
View File
@@ -0,0 +1 @@
= yield
View File