Добавление кнопки выхода, Изменение главной страницы на home, Выделение отдельного контроллера под организацию
This commit is contained in:
@@ -2,11 +2,13 @@ module Authorization
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
before_action :set_paper_trail_whodunnit
|
||||
before_action :load_current_user # load user from database
|
||||
before_action :set_paper_trail_whodunnit
|
||||
before_action :check_authentication # check if user authenticated
|
||||
before_action :check_current_user # check if user authorized
|
||||
|
||||
helper_method :logged_in?, :current_user
|
||||
|
||||
rescue_from ActionController::UnknownFormat do
|
||||
request.format = :html
|
||||
render_error
|
||||
@@ -15,6 +17,10 @@ module Authorization
|
||||
def current_login
|
||||
session['zombie'] || cas_login
|
||||
end
|
||||
|
||||
def logged_in?
|
||||
current_login.present?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
class OrganisationsController < ApplicationController
|
||||
def index
|
||||
organizations = Organization.all
|
||||
|
||||
@info_about_organisations = organizations.each_with_object({}) do |org, hash|
|
||||
hash[org.id] = {
|
||||
"ИНН" => org.inn,
|
||||
"Полное наименование юридического лица" => org.full_name,
|
||||
"КПП" => org.kpp,
|
||||
"Код по ОКПО" => org.okpo,
|
||||
"Форма собственности (по ОКФС)" => org.okfs,
|
||||
"Организационно-правовая форма (по ОКОПФ)" => org.okopf,
|
||||
"Вид экономической деятельности по ОКВЭД 2" => org.okved2,
|
||||
"Местонахождение (адрес)" => org.address
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
org = Organization.find(params[:id])
|
||||
|
||||
@info_about_organisation = {
|
||||
"Сведения об организации" => {
|
||||
"ИНН" => org.inn,
|
||||
"Полное наименование юридического лица" => org.full_name,
|
||||
"КПП" => org.kpp,
|
||||
"Код по ОКПО" => org.okpo,
|
||||
"Форма собственности (по ОКФС)" => org.okfs,
|
||||
"Организационно-правовая форма (по ОКОПФ)" => org.okopf,
|
||||
"Вид экономической деятельности по ОКВЭД 2" => org.okved2,
|
||||
"Местонахождение (адрес)" => org.address
|
||||
|
||||
},
|
||||
"Бухгалтерский баланс" => [["Наименование показателя", "На 31 декабря 2024 г.", "На 31 декабря 2023 г."], \
|
||||
["Нематериальные активы", 10457, 9925], \
|
||||
["Результаты исследований и разработок", 6969, 428571]],
|
||||
"Отчёт о финансовых результатах" => [["Наименование показателя", "За 2024 г.", "За 2023 г."], \
|
||||
["Выручка", 301837283, 238834307], \
|
||||
["Себестоимость продаж", -228706983, -178449438]]
|
||||
|
||||
}
|
||||
end
|
||||
end
|
||||
@@ -1,19 +1,11 @@
|
||||
class WelcomeController < ApplicationController
|
||||
|
||||
def index
|
||||
organizations = Organization.all
|
||||
|
||||
@info_about_organisations = organizations.each_with_object({}) do |org, hash|
|
||||
hash[org.id] = {
|
||||
"ИНН" => org.inn,
|
||||
"Полное наименование юридического лица" => org.full_name,
|
||||
"КПП" => org.kpp,
|
||||
"Код по ОКПО" => org.okpo,
|
||||
"Форма собственности (по ОКФС)" => org.okfs,
|
||||
"Организационно-правовая форма (по ОКОПФ)" => org.okopf,
|
||||
"Вид экономической деятельности по ОКВЭД 2" => org.okved2,
|
||||
"Местонахождение (адрес)" => org.address
|
||||
}
|
||||
def home
|
||||
if logged_in?
|
||||
if @current_user.present?
|
||||
redirect_to '/organisations/index'
|
||||
else
|
||||
render_error
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
module OrganisationsHelper
|
||||
end
|
||||
@@ -1,2 +1,7 @@
|
||||
.main-header
|
||||
= 'Отчетность за 2026 год'
|
||||
= 'Отчетность за 2026 год'
|
||||
.exit
|
||||
- if logged_in?
|
||||
a.link[href="/logout"]
|
||||
span.text-large
|
||||
= 'Выйти'
|
||||
@@ -1,5 +1,6 @@
|
||||
.nav-container
|
||||
a.link[href="/"]
|
||||
= 'Организации'
|
||||
a.link[href="/auditors/index"]
|
||||
= 'Аудиторы'
|
||||
- if @current_user.present?
|
||||
.nav-container
|
||||
a.link[href="/"]
|
||||
= 'Организации'
|
||||
a.link[href="/auditors/index"]
|
||||
= 'Аудиторы'
|
||||
@@ -13,4 +13,7 @@
|
||||
.information-data
|
||||
- params.keys.each do |key|
|
||||
.information-elem
|
||||
= "#{key}: #{params[key]}"
|
||||
= "#{key}: #{params[key]}"
|
||||
.information-button
|
||||
a.link[href="/organisations/#{organisation}"]
|
||||
= "Подробнее"
|
||||
@@ -0,0 +1,31 @@
|
||||
.header
|
||||
.header-title
|
||||
= "Организация"
|
||||
.main-container
|
||||
- unless @info_about_organisation.any?
|
||||
= 'У данной организации пока не загружена отчетность'
|
||||
- else
|
||||
.informations-data
|
||||
- @info_about_organisation.each do |organisation_name, params|
|
||||
h2
|
||||
= "#{organisation_name}"
|
||||
- if organisation_name == "Сведения об организации"
|
||||
.information-data
|
||||
- params.keys.each do |key|
|
||||
.information-elem
|
||||
= "#{key}: #{params[key]}"
|
||||
- else
|
||||
.information-table
|
||||
table
|
||||
thead
|
||||
tr
|
||||
- params[0].each do |value|
|
||||
th
|
||||
= value
|
||||
|
||||
tbody
|
||||
- params[1..-1].each do |values|
|
||||
tr
|
||||
- values.each do |value|
|
||||
td
|
||||
= value
|
||||
@@ -0,0 +1,13 @@
|
||||
.welcome__container__laptop
|
||||
div
|
||||
= 'Информационная система'
|
||||
div
|
||||
= '«Электронный дневник»'
|
||||
|
||||
- unless logged_in?
|
||||
a.link[href="/auth/login"]
|
||||
.welcome-login__container
|
||||
span
|
||||
= image_tag('auth.svg', class: 'icon')
|
||||
span.text-login
|
||||
= 'Войти'
|
||||
+7
-4
@@ -1,14 +1,17 @@
|
||||
# require 'sidekiq/web'
|
||||
|
||||
Rails.application.routes.draw do
|
||||
get 'auditors/index'
|
||||
get 'reports/create'
|
||||
|
||||
get '/auth/login', to: 'auth#login', as: :login
|
||||
get '/organisations/index'
|
||||
get '/organisations/:id', to: 'organisations#show'
|
||||
get '/auditors/index'
|
||||
get '/reports/create'
|
||||
get '/reports', to: 'reports#index'
|
||||
post '/reports', to: 'reports#create'
|
||||
|
||||
# mount Sidekiq::Web => '/sidekiq' # Для проверки работы Sidekiq через веб-интерфейс
|
||||
|
||||
|
||||
# Defines the root path route ("/")
|
||||
root "welcome#index"
|
||||
root "welcome#home"
|
||||
end
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the OrganisationsHelper. For example:
|
||||
#
|
||||
# describe OrganisationsHelper do
|
||||
# describe "string concat" do
|
||||
# it "concats two strings with spaces" do
|
||||
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
RSpec.describe OrganisationsHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
@@ -0,0 +1,18 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "Organisations", type: :request do
|
||||
describe "GET /index" do
|
||||
it "returns http success" do
|
||||
get "/organisations/index"
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET /show" do
|
||||
it "returns http success" do
|
||||
get "/organisations/show"
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "organisations/index.html.tailwindcss", type: :view do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "organisations/show.html.tailwindcss", type: :view do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
Reference in New Issue
Block a user