eaec4b3927a30cd2bab08ea11d481da226eab223
Gemfile
| ... | ... | @@ -26,7 +26,12 @@ gem "stimulus-rails" |
| 26 | 26 | # Build JSON APIs with ease [https://github.com/rails/jbuilder] |
| 27 | 27 | gem "jbuilder" |
| 28 | 28 | |
| 29 | -gem 'gollum' |
|
| 29 | +gem 'devise' |
|
| 30 | +gem 'devise-i18n' |
|
| 31 | +gem 'activeadmin' |
|
| 32 | +gem 'activeadmin_addons' |
|
| 33 | + |
|
| 34 | +gem 'gollum', path: 'gollum' |
|
| 30 | 35 | |
| 31 | 36 | gem 'pry-byebug' |
| 32 | 37 | gem 'pry-rails' |
Gemfile.lock
| ... | ... | @@ -1,3 +1,26 @@ |
| 1 | +PATH |
|
| 2 | + remote: gollum |
|
| 3 | + specs: |
|
| 4 | + gollum (6.1.1) |
|
| 5 | + gemojione (~> 4.1) |
|
| 6 | + gollum-lib (~> 6.0) |
|
| 7 | + i18n (~> 1.8) |
|
| 8 | + kramdown (~> 2.3) |
|
| 9 | + kramdown-parser-gfm (~> 1.1.0) |
|
| 10 | + mustache-sinatra (~> 2.0) |
|
| 11 | + octicons (~> 19.0) |
|
| 12 | + rack (>= 3.0) |
|
| 13 | + rackup (~> 2.1) |
|
| 14 | + rdoc (~> 6) |
|
| 15 | + rss (~> 0.3) |
|
| 16 | + sinatra (~> 4.0) |
|
| 17 | + sinatra-contrib (~> 4.0) |
|
| 18 | + sprockets (~> 4.1) |
|
| 19 | + sprockets-helpers (~> 1.2) |
|
| 20 | + therubyrhino (~> 2.1.0) |
|
| 21 | + useragent (~> 0.16.2) |
|
| 22 | + webrick (~> 1.7) |
|
| 23 | + |
|
| 1 | 24 | GEM |
| 2 | 25 | remote: https://rubygems.org/ |
| 3 | 26 | specs: |
| ... | ... | @@ -50,6 +73,25 @@ GEM |
| 50 | 73 | erubi (~> 1.11) |
| 51 | 74 | rails-dom-testing (~> 2.2) |
| 52 | 75 | rails-html-sanitizer (~> 1.6) |
| 76 | + active_material (1.5.2) |
|
| 77 | + activeadmin (3.3.0) |
|
| 78 | + arbre (~> 1.2, >= 1.2.1) |
|
| 79 | + csv |
|
| 80 | + formtastic (>= 3.1) |
|
| 81 | + formtastic_i18n (>= 0.4) |
|
| 82 | + inherited_resources (~> 1.7) |
|
| 83 | + jquery-rails (>= 4.2) |
|
| 84 | + kaminari (>= 1.2.1) |
|
| 85 | + railties (>= 6.1) |
|
| 86 | + ransack (>= 4.0) |
|
| 87 | + activeadmin_addons (1.10.2) |
|
| 88 | + active_material (~> 1.5) |
|
| 89 | + railties |
|
| 90 | + redcarpet |
|
| 91 | + require_all |
|
| 92 | + sassc |
|
| 93 | + sassc-rails |
|
| 94 | + xdan-datetimepicker-rails (~> 2.5.1) |
|
| 53 | 95 | activejob (7.1.5.1) |
| 54 | 96 | activesupport (= 7.1.5.1) |
| 55 | 97 | globalid (>= 0.3.6) |
| ... | ... | @@ -80,7 +122,11 @@ GEM |
| 80 | 122 | tzinfo (~> 2.0) |
| 81 | 123 | addressable (2.8.7) |
| 82 | 124 | public_suffix (>= 2.0.2, < 7.0) |
| 125 | + arbre (1.7.0) |
|
| 126 | + activesupport (>= 3.0.0) |
|
| 127 | + ruby2_keywords (>= 0.0.2) |
|
| 83 | 128 | base64 (0.3.0) |
| 129 | + bcrypt (3.1.20) |
|
| 84 | 130 | benchmark (0.4.1) |
| 85 | 131 | bigdecimal (3.2.2) |
| 86 | 132 | bindex (0.8.1) |
| ... | ... | @@ -101,37 +147,32 @@ GEM |
| 101 | 147 | concurrent-ruby (1.3.5) |
| 102 | 148 | connection_pool (2.5.3) |
| 103 | 149 | crass (1.0.6) |
| 150 | + csv (3.3.5) |
|
| 104 | 151 | date (3.4.1) |
| 105 | 152 | debug (1.11.0) |
| 106 | 153 | irb (~> 1.10) |
| 107 | 154 | reline (>= 0.3.8) |
| 155 | + devise (4.9.4) |
|
| 156 | + bcrypt (~> 3.0) |
|
| 157 | + orm_adapter (~> 0.1) |
|
| 158 | + railties (>= 4.1.0) |
|
| 159 | + responders |
|
| 160 | + warden (~> 1.2.3) |
|
| 161 | + devise-i18n (1.14.0) |
|
| 162 | + devise (>= 4.9.0) |
|
| 163 | + rails-i18n |
|
| 108 | 164 | drb (2.2.3) |
| 109 | 165 | erb (5.0.1) |
| 110 | 166 | erubi (1.13.1) |
| 167 | + ffi (1.17.2-x86_64-linux-gnu) |
|
| 168 | + formtastic (5.0.0) |
|
| 169 | + actionpack (>= 6.0.0) |
|
| 170 | + formtastic_i18n (0.7.0) |
|
| 111 | 171 | gemojione (4.3.3) |
| 112 | 172 | json |
| 113 | 173 | github-markup (4.0.2) |
| 114 | 174 | globalid (1.2.1) |
| 115 | 175 | activesupport (>= 6.1) |
| 116 | - gollum (6.1.0) |
|
| 117 | - gemojione (~> 4.1) |
|
| 118 | - gollum-lib (~> 6.0) |
|
| 119 | - i18n (~> 1.8) |
|
| 120 | - kramdown (~> 2.3) |
|
| 121 | - kramdown-parser-gfm (~> 1.1.0) |
|
| 122 | - mustache-sinatra (~> 2.0) |
|
| 123 | - octicons (~> 19.0) |
|
| 124 | - rack (>= 3.0) |
|
| 125 | - rackup (~> 2.1) |
|
| 126 | - rdoc (~> 6) |
|
| 127 | - rss (~> 0.3) |
|
| 128 | - sinatra (~> 4.0) |
|
| 129 | - sinatra-contrib (~> 4.0) |
|
| 130 | - sprockets (~> 4.1) |
|
| 131 | - sprockets-helpers (~> 1.2) |
|
| 132 | - therubyrhino (~> 2.1.0) |
|
| 133 | - useragent (~> 0.16.2) |
|
| 134 | - webrick (~> 1.7) |
|
| 135 | 176 | gollum-lib (6.0) |
| 136 | 177 | gemojione (~> 4.1) |
| 137 | 178 | github-markup (~> 4.0) |
| ... | ... | @@ -143,12 +184,20 @@ GEM |
| 143 | 184 | gollum-rugged_adapter (3.0) |
| 144 | 185 | mime-types (~> 3.4) |
| 145 | 186 | rugged (~> 1.5) |
| 187 | + has_scope (0.8.2) |
|
| 188 | + actionpack (>= 5.2) |
|
| 189 | + activesupport (>= 5.2) |
|
| 146 | 190 | i18n (1.14.7) |
| 147 | 191 | concurrent-ruby (~> 1.0) |
| 148 | 192 | importmap-rails (2.1.0) |
| 149 | 193 | actionpack (>= 6.0.0) |
| 150 | 194 | activesupport (>= 6.0.0) |
| 151 | 195 | railties (>= 6.0.0) |
| 196 | + inherited_resources (1.14.0) |
|
| 197 | + actionpack (>= 6.0) |
|
| 198 | + has_scope (>= 0.6) |
|
| 199 | + railties (>= 6.0) |
|
| 200 | + responders (>= 2) |
|
| 152 | 201 | io-console (0.8.0) |
| 153 | 202 | irb (1.15.2) |
| 154 | 203 | pp (>= 0.6.0) |
| ... | ... | @@ -157,7 +206,23 @@ GEM |
| 157 | 206 | jbuilder (2.13.0) |
| 158 | 207 | actionview (>= 5.0.0) |
| 159 | 208 | activesupport (>= 5.0.0) |
| 209 | + jquery-rails (4.6.0) |
|
| 210 | + rails-dom-testing (>= 1, < 3) |
|
| 211 | + railties (>= 4.2.0) |
|
| 212 | + thor (>= 0.14, < 2.0) |
|
| 160 | 213 | json (2.12.2) |
| 214 | + kaminari (1.2.2) |
|
| 215 | + activesupport (>= 4.1.0) |
|
| 216 | + kaminari-actionview (= 1.2.2) |
|
| 217 | + kaminari-activerecord (= 1.2.2) |
|
| 218 | + kaminari-core (= 1.2.2) |
|
| 219 | + kaminari-actionview (1.2.2) |
|
| 220 | + actionview |
|
| 221 | + kaminari-core (= 1.2.2) |
|
| 222 | + kaminari-activerecord (1.2.2) |
|
| 223 | + activerecord |
|
| 224 | + kaminari-core (= 1.2.2) |
|
| 225 | + kaminari-core (1.2.2) |
|
| 161 | 226 | kramdown (2.5.1) |
| 162 | 227 | rexml (>= 3.3.9) |
| 163 | 228 | kramdown-parser-gfm (1.1.0) |
| ... | ... | @@ -201,6 +266,7 @@ GEM |
| 201 | 266 | nokogiri (1.18.8-x86_64-linux-gnu) |
| 202 | 267 | racc (~> 1.4) |
| 203 | 268 | octicons (19.15.3) |
| 269 | + orm_adapter (0.5.0) |
|
| 204 | 270 | pg (1.5.9) |
| 205 | 271 | pp (0.6.2) |
| 206 | 272 | prettyprint |
| ... | ... | @@ -253,6 +319,9 @@ GEM |
| 253 | 319 | rails-html-sanitizer (1.6.2) |
| 254 | 320 | loofah (~> 2.21) |
| 255 | 321 | nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) |
| 322 | + rails-i18n (7.0.10) |
|
| 323 | + i18n (>= 0.7, < 2) |
|
| 324 | + railties (>= 6.0.0, < 8) |
|
| 256 | 325 | railties (7.1.5.1) |
| 257 | 326 | actionpack (= 7.1.5.1) |
| 258 | 327 | activesupport (= 7.1.5.1) |
| ... | ... | @@ -262,12 +331,21 @@ GEM |
| 262 | 331 | thor (~> 1.0, >= 1.2.2) |
| 263 | 332 | zeitwerk (~> 2.6) |
| 264 | 333 | rake (13.3.0) |
| 334 | + ransack (4.3.0) |
|
| 335 | + activerecord (>= 6.1.5) |
|
| 336 | + activesupport (>= 6.1.5) |
|
| 337 | + i18n |
|
| 265 | 338 | rdoc (6.14.2) |
| 266 | 339 | erb |
| 267 | 340 | psych (>= 4.0.0) |
| 341 | + redcarpet (3.6.1) |
|
| 268 | 342 | regexp_parser (2.10.0) |
| 269 | 343 | reline (0.6.1) |
| 270 | 344 | io-console (~> 0.5) |
| 345 | + require_all (3.0.0) |
|
| 346 | + responders (3.1.1) |
|
| 347 | + actionpack (>= 5.2) |
|
| 348 | + railties (>= 5.2) |
|
| 271 | 349 | rexml (3.4.1) |
| 272 | 350 | rouge (3.30.0) |
| 273 | 351 | rss (0.3.1) |
| ... | ... | @@ -275,6 +353,14 @@ GEM |
| 275 | 353 | ruby2_keywords (0.0.5) |
| 276 | 354 | rubyzip (2.4.1) |
| 277 | 355 | rugged (1.9.0) |
| 356 | + sassc (2.4.0) |
|
| 357 | + ffi (~> 1.9) |
|
| 358 | + sassc-rails (2.1.2) |
|
| 359 | + railties (>= 4.0.0) |
|
| 360 | + sassc (>= 2.0) |
|
| 361 | + sprockets (> 3.0) |
|
| 362 | + sprockets-rails |
|
| 363 | + tilt |
|
| 278 | 364 | securerandom (0.4.1) |
| 279 | 365 | selenium-webdriver (4.34.0) |
| 280 | 366 | base64 (~> 0.2) |
| ... | ... | @@ -325,6 +411,8 @@ GEM |
| 325 | 411 | unf_ext |
| 326 | 412 | unf_ext (0.0.9.1) |
| 327 | 413 | useragent (0.16.11) |
| 414 | + warden (1.2.9) |
|
| 415 | + rack (>= 2.0.9) |
|
| 328 | 416 | web-console (4.2.1) |
| 329 | 417 | actionview (>= 6.0.0) |
| 330 | 418 | activemodel (>= 6.0.0) |
| ... | ... | @@ -336,6 +424,9 @@ GEM |
| 336 | 424 | base64 |
| 337 | 425 | websocket-extensions (>= 0.1.0) |
| 338 | 426 | websocket-extensions (0.1.5) |
| 427 | + xdan-datetimepicker-rails (2.5.4) |
|
| 428 | + jquery-rails |
|
| 429 | + rails (>= 3.2.16) |
|
| 339 | 430 | xpath (3.2.0) |
| 340 | 431 | nokogiri (~> 1.8) |
| 341 | 432 | zeitwerk (2.7.3) |
| ... | ... | @@ -344,10 +435,14 @@ PLATFORMS |
| 344 | 435 | x86_64-linux |
| 345 | 436 | |
| 346 | 437 | DEPENDENCIES |
| 438 | + activeadmin |
|
| 439 | + activeadmin_addons |
|
| 347 | 440 | bootsnap |
| 348 | 441 | capybara |
| 349 | 442 | debug |
| 350 | - gollum |
|
| 443 | + devise |
|
| 444 | + devise-i18n |
|
| 445 | + gollum! |
|
| 351 | 446 | importmap-rails |
| 352 | 447 | jbuilder |
| 353 | 448 | pg (~> 1.1) |
app/admin/admin_users.rb
| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | +ActiveAdmin.register AdminUser do |
|
| 2 | + permit_params :email, :password, :password_confirmation |
|
| 3 | + |
|
| 4 | + index do |
|
| 5 | + selectable_column |
|
| 6 | + id_column |
|
| 7 | + column :email |
|
| 8 | + column :current_sign_in_at |
|
| 9 | + column :sign_in_count |
|
| 10 | + column :created_at |
|
| 11 | + actions |
|
| 12 | + end |
|
| 13 | + |
|
| 14 | + filter :email |
|
| 15 | + filter :current_sign_in_at |
|
| 16 | + filter :sign_in_count |
|
| 17 | + filter :created_at |
|
| 18 | + |
|
| 19 | + form do |f| |
|
| 20 | + f.inputs do |
|
| 21 | + f.input :email |
|
| 22 | + f.input :password |
|
| 23 | + f.input :password_confirmation |
|
| 24 | + end |
|
| 25 | + f.actions |
|
| 26 | + end |
|
| 27 | + |
|
| 28 | +end |
app/admin/dashboard.rb
| ... | ... | @@ -0,0 +1,32 @@ |
| 1 | +# frozen_string_literal: true |
|
| 2 | +ActiveAdmin.register_page "Dashboard" do |
|
| 3 | + menu priority: 1, label: proc { I18n.t("active_admin.dashboard") } |
|
| 4 | + |
|
| 5 | + content title: proc { I18n.t("active_admin.dashboard") } do |
|
| 6 | + div class: "blank_slate_container", id: "dashboard_default_message" do |
|
| 7 | + span class: "blank_slate" do |
|
| 8 | + link_to 'Перейти к редактированию Wiki', precious_app_path |
|
| 9 | + end |
|
| 10 | + end |
|
| 11 | + |
|
| 12 | + # Here is an example of a simple dashboard with columns and panels. |
|
| 13 | + # |
|
| 14 | + # columns do |
|
| 15 | + # column do |
|
| 16 | + # panel "Recent Posts" do |
|
| 17 | + # ul do |
|
| 18 | + # Post.recent(5).map do |post| |
|
| 19 | + # li link_to(post.title, admin_post_path(post)) |
|
| 20 | + # end |
|
| 21 | + # end |
|
| 22 | + # end |
|
| 23 | + # end |
|
| 24 | + |
|
| 25 | + # column do |
|
| 26 | + # panel "Info" do |
|
| 27 | + # para "Welcome to ActiveAdmin." |
|
| 28 | + # end |
|
| 29 | + # end |
|
| 30 | + # end |
|
| 31 | + end # content |
|
| 32 | +end |
app/assets/javascripts/active_admin.js
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +//= require active_admin/base |
app/assets/stylesheets/active_admin.scss
| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | +// Sass variable overrides must be declared before loading up Active Admin's styles. |
|
| 2 | +// |
|
| 3 | +// To view the variables that Active Admin provides, take a look at |
|
| 4 | +// `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the |
|
| 5 | +// Active Admin source. |
|
| 6 | +// |
|
| 7 | +// For example, to change the sidebar width: |
|
| 8 | +// $sidebar-width: 242px; |
|
| 9 | + |
|
| 10 | +// Active Admin's got SASS! |
|
| 11 | +@import "active_admin/mixins"; |
|
| 12 | +@import "active_admin/base"; |
|
| 13 | + |
|
| 14 | +// Overriding any non-variable Sass must be done after the fact. |
|
| 15 | +// For example, to change the default status-tag color: |
|
| 16 | +// |
|
| 17 | +// .status_tag { background: #6090DB; } |
app/models/admin_user.rb
| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | +class AdminUser < ApplicationRecord |
|
| 2 | + # Include default devise modules. Others available are: |
|
| 3 | + # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable |
|
| 4 | + devise :database_authenticatable, |
|
| 5 | + :recoverable, :rememberable, :validatable |
|
| 6 | +end |
app/models/application_record.rb
| ... | ... | @@ -1,3 +1,12 @@ |
| 1 | +# frozen_string_literal: true |
|
| 2 | + |
|
| 1 | 3 | class ApplicationRecord < ActiveRecord::Base |
| 2 | 4 | primary_abstract_class |
| 5 | + def self.ransackable_associations(_auth_object = nil) |
|
| 6 | + @ransackable_associations ||= reflect_on_all_associations.map { |a| a.name.to_s } |
|
| 7 | + end |
|
| 8 | + |
|
| 9 | + def self.ransackable_attributes(_auth_object = nil) |
|
| 10 | + @ransackable_attributes ||= column_names + _ransackers.keys + _ransack_aliases.keys + attribute_aliases.keys |
|
| 11 | + end |
|
| 3 | 12 | end |
config/initializers/active_admin.rb
| ... | ... | @@ -0,0 +1,352 @@ |
| 1 | +ActiveAdmin.setup do |config| |
|
| 2 | + # == Site Title |
|
| 3 | + # |
|
| 4 | + # Set the title that is displayed on the main layout |
|
| 5 | + # for each of the active admin pages. |
|
| 6 | + # |
|
| 7 | + config.site_title = "Wiki" |
|
| 8 | + |
|
| 9 | + # Set the link url for the title. For example, to take |
|
| 10 | + # users to your main site. Defaults to no link. |
|
| 11 | + # |
|
| 12 | + # config.site_title_link = "/" |
|
| 13 | + |
|
| 14 | + # Set an optional image to be displayed for the header |
|
| 15 | + # instead of a string (overrides :site_title) |
|
| 16 | + # |
|
| 17 | + # Note: Aim for an image that's 21px high so it fits in the header. |
|
| 18 | + # |
|
| 19 | + # config.site_title_image = "logo.png" |
|
| 20 | + |
|
| 21 | + # == Load Paths |
|
| 22 | + # |
|
| 23 | + # By default Active Admin files go inside app/admin/. |
|
| 24 | + # You can change this directory. |
|
| 25 | + # |
|
| 26 | + # eg: |
|
| 27 | + # config.load_paths = [File.join(Rails.root, 'app', 'ui')] |
|
| 28 | + # |
|
| 29 | + # Or, you can also load more directories. |
|
| 30 | + # Useful when setting namespaces with users that are not your main AdminUser entity. |
|
| 31 | + # |
|
| 32 | + # eg: |
|
| 33 | + # config.load_paths = [ |
|
| 34 | + # File.join(Rails.root, 'app', 'admin'), |
|
| 35 | + # File.join(Rails.root, 'app', 'cashier') |
|
| 36 | + # ] |
|
| 37 | + |
|
| 38 | + # == Default Namespace |
|
| 39 | + # |
|
| 40 | + # Set the default namespace each administration resource |
|
| 41 | + # will be added to. |
|
| 42 | + # |
|
| 43 | + # eg: |
|
| 44 | + # config.default_namespace = :hello_world |
|
| 45 | + # |
|
| 46 | + # This will create resources in the HelloWorld module and |
|
| 47 | + # will namespace routes to /hello_world/* |
|
| 48 | + # |
|
| 49 | + # To set no namespace by default, use: |
|
| 50 | + # config.default_namespace = false |
|
| 51 | + # |
|
| 52 | + # Default: |
|
| 53 | + # config.default_namespace = :admin |
|
| 54 | + # |
|
| 55 | + # You can customize the settings for each namespace by using |
|
| 56 | + # a namespace block. For example, to change the site title |
|
| 57 | + # within a namespace: |
|
| 58 | + # |
|
| 59 | + # config.namespace :admin do |admin| |
|
| 60 | + # admin.site_title = "Custom Admin Title" |
|
| 61 | + # end |
|
| 62 | + # |
|
| 63 | + # This will ONLY change the title for the admin section. Other |
|
| 64 | + # namespaces will continue to use the main "site_title" configuration. |
|
| 65 | + |
|
| 66 | + # == User Authentication |
|
| 67 | + # |
|
| 68 | + # Active Admin will automatically call an authentication |
|
| 69 | + # method in a before filter of all controller actions to |
|
| 70 | + # ensure that there is a currently logged in admin user. |
|
| 71 | + # |
|
| 72 | + # This setting changes the method which Active Admin calls |
|
| 73 | + # within the application controller. |
|
| 74 | + config.authentication_method = :authenticate_admin_user! |
|
| 75 | + |
|
| 76 | + # == User Authorization |
|
| 77 | + # |
|
| 78 | + # Active Admin will automatically call an authorization |
|
| 79 | + # method in a before filter of all controller actions to |
|
| 80 | + # ensure that there is a user with proper rights. You can use |
|
| 81 | + # CanCanAdapter or make your own. Please refer to documentation. |
|
| 82 | + # config.authorization_adapter = ActiveAdmin::CanCanAdapter |
|
| 83 | + |
|
| 84 | + # In case you prefer Pundit over other solutions you can here pass |
|
| 85 | + # the name of default policy class. This policy will be used in every |
|
| 86 | + # case when Pundit is unable to find suitable policy. |
|
| 87 | + # config.pundit_default_policy = "MyDefaultPunditPolicy" |
|
| 88 | + |
|
| 89 | + # If you wish to maintain a separate set of Pundit policies for admin |
|
| 90 | + # resources, you may set a namespace here that Pundit will search |
|
| 91 | + # within when looking for a resource's policy. |
|
| 92 | + # config.pundit_policy_namespace = :admin |
|
| 93 | + |
|
| 94 | + # You can customize your CanCan Ability class name here. |
|
| 95 | + # config.cancan_ability_class = "Ability" |
|
| 96 | + |
|
| 97 | + # You can specify a method to be called on unauthorized access. |
|
| 98 | + # This is necessary in order to prevent a redirect loop which happens |
|
| 99 | + # because, by default, user gets redirected to Dashboard. If user |
|
| 100 | + # doesn't have access to Dashboard, he'll end up in a redirect loop. |
|
| 101 | + # Method provided here should be defined in application_controller.rb. |
|
| 102 | + # config.on_unauthorized_access = :access_denied |
|
| 103 | + |
|
| 104 | + # == Current User |
|
| 105 | + # |
|
| 106 | + # Active Admin will associate actions with the current |
|
| 107 | + # user performing them. |
|
| 108 | + # |
|
| 109 | + # This setting changes the method which Active Admin calls |
|
| 110 | + # (within the application controller) to return the currently logged in user. |
|
| 111 | + config.current_user_method = :current_admin_user |
|
| 112 | + |
|
| 113 | + # == Logging Out |
|
| 114 | + # |
|
| 115 | + # Active Admin displays a logout link on each screen. These |
|
| 116 | + # settings configure the location and method used for the link. |
|
| 117 | + # |
|
| 118 | + # This setting changes the path where the link points to. If it's |
|
| 119 | + # a string, the strings is used as the path. If it's a Symbol, we |
|
| 120 | + # will call the method to return the path. |
|
| 121 | + # |
|
| 122 | + # Default: |
|
| 123 | + config.logout_link_path = :destroy_admin_user_session_path |
|
| 124 | + |
|
| 125 | + # This setting changes the http method used when rendering the |
|
| 126 | + # link. For example :get, :delete, :put, etc.. |
|
| 127 | + # |
|
| 128 | + # Default: |
|
| 129 | + # config.logout_link_method = :get |
|
| 130 | + |
|
| 131 | + # == Root |
|
| 132 | + # |
|
| 133 | + # Set the action to call for the root path. You can set different |
|
| 134 | + # roots for each namespace. |
|
| 135 | + # |
|
| 136 | + # Default: |
|
| 137 | + # config.root_to = 'dashboard#index' |
|
| 138 | + |
|
| 139 | + # == Admin Comments |
|
| 140 | + # |
|
| 141 | + # This allows your users to comment on any resource registered with Active Admin. |
|
| 142 | + # |
|
| 143 | + # You can completely disable comments: |
|
| 144 | + # config.comments = false |
|
| 145 | + # |
|
| 146 | + # You can change the name under which comments are registered: |
|
| 147 | + # config.comments_registration_name = 'AdminComment' |
|
| 148 | + # |
|
| 149 | + # You can change the order for the comments and you can change the column |
|
| 150 | + # to be used for ordering: |
|
| 151 | + # config.comments_order = 'created_at ASC' |
|
| 152 | + # |
|
| 153 | + # You can disable the menu item for the comments index page: |
|
| 154 | + # config.comments_menu = false |
|
| 155 | + # |
|
| 156 | + # You can customize the comment menu: |
|
| 157 | + # config.comments_menu = { parent: 'Admin', priority: 1 } |
|
| 158 | + |
|
| 159 | + # == Batch Actions |
|
| 160 | + # |
|
| 161 | + # Enable and disable Batch Actions |
|
| 162 | + # |
|
| 163 | + config.batch_actions = true |
|
| 164 | + |
|
| 165 | + # == Controller Filters |
|
| 166 | + # |
|
| 167 | + # You can add before, after and around filters to all of your |
|
| 168 | + # Active Admin resources and pages from here. |
|
| 169 | + # |
|
| 170 | + # config.before_action :do_something_awesome |
|
| 171 | + |
|
| 172 | + # == Attribute Filters |
|
| 173 | + # |
|
| 174 | + # You can exclude possibly sensitive model attributes from being displayed, |
|
| 175 | + # added to forms, or exported by default by ActiveAdmin |
|
| 176 | + # |
|
| 177 | + config.filter_attributes = [:encrypted_password, :password, :password_confirmation] |
|
| 178 | + |
|
| 179 | + # == Localize Date/Time Format |
|
| 180 | + # |
|
| 181 | + # Set the localize format to display dates and times. |
|
| 182 | + # To understand how to localize your app with I18n, read more at |
|
| 183 | + # https://guides.rubyonrails.org/i18n.html |
|
| 184 | + # |
|
| 185 | + # You can run `bin/rails runner 'puts I18n.t("date.formats")'` to see the |
|
| 186 | + # available formats in your application. |
|
| 187 | + # |
|
| 188 | + config.localize_format = :long |
|
| 189 | + |
|
| 190 | + # == Setting a Favicon |
|
| 191 | + # |
|
| 192 | + # config.favicon = 'favicon.ico' |
|
| 193 | + |
|
| 194 | + # == Meta Tags |
|
| 195 | + # |
|
| 196 | + # Add additional meta tags to the head element of active admin pages. |
|
| 197 | + # |
|
| 198 | + # Add tags to all pages logged in users see: |
|
| 199 | + # config.meta_tags = { author: 'My Company' } |
|
| 200 | + |
|
| 201 | + # By default, sign up/sign in/recover password pages are excluded |
|
| 202 | + # from showing up in search engine results by adding a robots meta |
|
| 203 | + # tag. You can reset the hash of meta tags included in logged out |
|
| 204 | + # pages: |
|
| 205 | + # config.meta_tags_for_logged_out_pages = {} |
|
| 206 | + |
|
| 207 | + # == Removing Breadcrumbs |
|
| 208 | + # |
|
| 209 | + # Breadcrumbs are enabled by default. You can customize them for individual |
|
| 210 | + # resources or you can disable them globally from here. |
|
| 211 | + # |
|
| 212 | + # config.breadcrumb = false |
|
| 213 | + |
|
| 214 | + # == Create Another Checkbox |
|
| 215 | + # |
|
| 216 | + # Create another checkbox is disabled by default. You can customize it for individual |
|
| 217 | + # resources or you can enable them globally from here. |
|
| 218 | + # |
|
| 219 | + # config.create_another = true |
|
| 220 | + |
|
| 221 | + # == Register Stylesheets & Javascripts |
|
| 222 | + # |
|
| 223 | + # We recommend using the built in Active Admin layout and loading |
|
| 224 | + # up your own stylesheets / javascripts to customize the look |
|
| 225 | + # and feel. |
|
| 226 | + # |
|
| 227 | + # To load a stylesheet: |
|
| 228 | + # config.register_stylesheet 'my_stylesheet.css' |
|
| 229 | + # |
|
| 230 | + # You can provide an options hash for more control, which is passed along to stylesheet_link_tag(): |
|
| 231 | + # config.register_stylesheet 'my_print_stylesheet.css', media: :print |
|
| 232 | + # |
|
| 233 | + # To load a javascript file: |
|
| 234 | + # config.register_javascript 'my_javascript.js' |
|
| 235 | + |
|
| 236 | + # == CSV options |
|
| 237 | + # |
|
| 238 | + # Set the CSV builder separator |
|
| 239 | + # config.csv_options = { col_sep: ';' } |
|
| 240 | + # |
|
| 241 | + # Force the use of quotes |
|
| 242 | + # config.csv_options = { force_quotes: true } |
|
| 243 | + |
|
| 244 | + # == Menu System |
|
| 245 | + # |
|
| 246 | + # You can add a navigation menu to be used in your application, or configure a provided menu |
|
| 247 | + # |
|
| 248 | + # To change the default utility navigation to show a link to your website & a logout btn |
|
| 249 | + # |
|
| 250 | + # config.namespace :admin do |admin| |
|
| 251 | + # admin.build_menu :utility_navigation do |menu| |
|
| 252 | + # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank } |
|
| 253 | + # admin.add_logout_button_to_menu menu |
|
| 254 | + # end |
|
| 255 | + # end |
|
| 256 | + # |
|
| 257 | + # If you wanted to add a static menu item to the default menu provided: |
|
| 258 | + # |
|
| 259 | + # config.namespace :admin do |admin| |
|
| 260 | + # admin.build_menu :default do |menu| |
|
| 261 | + # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: "_blank" } |
|
| 262 | + # end |
|
| 263 | + # end |
|
| 264 | + |
|
| 265 | + # == Download Links |
|
| 266 | + # |
|
| 267 | + # You can disable download links on resource listing pages, |
|
| 268 | + # or customize the formats shown per namespace/globally |
|
| 269 | + # |
|
| 270 | + # To disable/customize for the :admin namespace: |
|
| 271 | + # |
|
| 272 | + # config.namespace :admin do |admin| |
|
| 273 | + # |
|
| 274 | + # # Disable the links entirely |
|
| 275 | + # admin.download_links = false |
|
| 276 | + # |
|
| 277 | + # # Only show XML & PDF options |
|
| 278 | + # admin.download_links = [:xml, :pdf] |
|
| 279 | + # |
|
| 280 | + # # Enable/disable the links based on block |
|
| 281 | + # # (for example, with cancan) |
|
| 282 | + # admin.download_links = proc { can?(:view_download_links) } |
|
| 283 | + # |
|
| 284 | + # end |
|
| 285 | + |
|
| 286 | + # == Pagination |
|
| 287 | + # |
|
| 288 | + # Pagination is enabled by default for all resources. |
|
| 289 | + # You can control the default per page count for all resources here. |
|
| 290 | + # |
|
| 291 | + # config.default_per_page = 30 |
|
| 292 | + # |
|
| 293 | + # You can control the max per page count too. |
|
| 294 | + # |
|
| 295 | + # config.max_per_page = 10_000 |
|
| 296 | + |
|
| 297 | + # == Filters |
|
| 298 | + # |
|
| 299 | + # By default the index screen includes a "Filters" sidebar on the right |
|
| 300 | + # hand side with a filter for each attribute of the registered model. |
|
| 301 | + # You can enable or disable them for all resources here. |
|
| 302 | + # |
|
| 303 | + # config.filters = true |
|
| 304 | + # |
|
| 305 | + # By default the filters include associations in a select, which means |
|
| 306 | + # that every record will be loaded for each association (up |
|
| 307 | + # to the value of config.maximum_association_filter_arity). |
|
| 308 | + # You can enabled or disable the inclusion |
|
| 309 | + # of those filters by default here. |
|
| 310 | + # |
|
| 311 | + # config.include_default_association_filters = true |
|
| 312 | + |
|
| 313 | + # config.maximum_association_filter_arity = 256 # default value of :unlimited will change to 256 in a future version |
|
| 314 | + # config.filter_columns_for_large_association = [ |
|
| 315 | + # :display_name, |
|
| 316 | + # :full_name, |
|
| 317 | + # :name, |
|
| 318 | + # :username, |
|
| 319 | + # :login, |
|
| 320 | + # :title, |
|
| 321 | + # :email, |
|
| 322 | + # ] |
|
| 323 | + # config.filter_method_for_large_association = '_start' |
|
| 324 | + |
|
| 325 | + # == Head |
|
| 326 | + # |
|
| 327 | + # You can add your own content to the site head like analytics. Make sure |
|
| 328 | + # you only pass content you trust. |
|
| 329 | + # |
|
| 330 | + # config.head = ''.html_safe |
|
| 331 | + |
|
| 332 | + # == Footer |
|
| 333 | + # |
|
| 334 | + # By default, the footer shows the current Active Admin version. You can |
|
| 335 | + # override the content of the footer here. |
|
| 336 | + # |
|
| 337 | + # config.footer = 'my custom footer text' |
|
| 338 | + |
|
| 339 | + # == Sorting |
|
| 340 | + # |
|
| 341 | + # By default ActiveAdmin::OrderClause is used for sorting logic |
|
| 342 | + # You can inherit it with own class and inject it for all resources |
|
| 343 | + # |
|
| 344 | + # config.order_clause = MyOrderClause |
|
| 345 | + |
|
| 346 | + # == Webpacker |
|
| 347 | + # |
|
| 348 | + # By default, Active Admin uses Sprocket's asset pipeline. |
|
| 349 | + # You can switch to using Webpacker here. |
|
| 350 | + # |
|
| 351 | + # config.use_webpacker = true |
|
| 352 | +end |
config/initializers/devise.rb
| ... | ... | @@ -0,0 +1,313 @@ |
| 1 | +# frozen_string_literal: true |
|
| 2 | + |
|
| 3 | +# Assuming you have not yet modified this file, each configuration option below |
|
| 4 | +# is set to its default value. Note that some are commented out while others |
|
| 5 | +# are not: uncommented lines are intended to protect your configuration from |
|
| 6 | +# breaking changes in upgrades (i.e., in the event that future versions of |
|
| 7 | +# Devise change the default values for those options). |
|
| 8 | +# |
|
| 9 | +# Use this hook to configure devise mailer, warden hooks and so forth. |
|
| 10 | +# Many of these configuration options can be set straight in your model. |
|
| 11 | +Devise.setup do |config| |
|
| 12 | + # The secret key used by Devise. Devise uses this key to generate |
|
| 13 | + # random tokens. Changing this key will render invalid all existing |
|
| 14 | + # confirmation, reset password and unlock tokens in the database. |
|
| 15 | + # Devise will use the `secret_key_base` as its `secret_key` |
|
| 16 | + # by default. You can change it below and use your own secret key. |
|
| 17 | + # config.secret_key = 'fbbb04f476793e725869aff55174d9ca507a93c8d47382b74fc022d4a5c6f75c2f7196c7ecf141b2d903c5a7ea296971abec4e00cc2717609da66f1c6d508e03' |
|
| 18 | + |
|
| 19 | + # ==> Controller configuration |
|
| 20 | + # Configure the parent class to the devise controllers. |
|
| 21 | + # config.parent_controller = 'DeviseController' |
|
| 22 | + |
|
| 23 | + # ==> Mailer Configuration |
|
| 24 | + # Configure the e-mail address which will be shown in Devise::Mailer, |
|
| 25 | + # note that it will be overwritten if you use your own mailer class |
|
| 26 | + # with default "from" parameter. |
|
| 27 | + config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' |
|
| 28 | + |
|
| 29 | + # Configure the class responsible to send e-mails. |
|
| 30 | + # config.mailer = 'Devise::Mailer' |
|
| 31 | + |
|
| 32 | + # Configure the parent class responsible to send e-mails. |
|
| 33 | + # config.parent_mailer = 'ActionMailer::Base' |
|
| 34 | + |
|
| 35 | + # ==> ORM configuration |
|
| 36 | + # Load and configure the ORM. Supports :active_record (default) and |
|
| 37 | + # :mongoid (bson_ext recommended) by default. Other ORMs may be |
|
| 38 | + # available as additional gems. |
|
| 39 | + require 'devise/orm/active_record' |
|
| 40 | + |
|
| 41 | + # ==> Configuration for any authentication mechanism |
|
| 42 | + # Configure which keys are used when authenticating a user. The default is |
|
| 43 | + # just :email. You can configure it to use [:username, :subdomain], so for |
|
| 44 | + # authenticating a user, both parameters are required. Remember that those |
|
| 45 | + # parameters are used only when authenticating and not when retrieving from |
|
| 46 | + # session. If you need permissions, you should implement that in a before filter. |
|
| 47 | + # You can also supply a hash where the value is a boolean determining whether |
|
| 48 | + # or not authentication should be aborted when the value is not present. |
|
| 49 | + # config.authentication_keys = [:email] |
|
| 50 | + |
|
| 51 | + # Configure parameters from the request object used for authentication. Each entry |
|
| 52 | + # given should be a request method and it will automatically be passed to the |
|
| 53 | + # find_for_authentication method and considered in your model lookup. For instance, |
|
| 54 | + # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. |
|
| 55 | + # The same considerations mentioned for authentication_keys also apply to request_keys. |
|
| 56 | + # config.request_keys = [] |
|
| 57 | + |
|
| 58 | + # Configure which authentication keys should be case-insensitive. |
|
| 59 | + # These keys will be downcased upon creating or modifying a user and when used |
|
| 60 | + # to authenticate or find a user. Default is :email. |
|
| 61 | + config.case_insensitive_keys = [:email] |
|
| 62 | + |
|
| 63 | + # Configure which authentication keys should have whitespace stripped. |
|
| 64 | + # These keys will have whitespace before and after removed upon creating or |
|
| 65 | + # modifying a user and when used to authenticate or find a user. Default is :email. |
|
| 66 | + config.strip_whitespace_keys = [:email] |
|
| 67 | + |
|
| 68 | + # Tell if authentication through request.params is enabled. True by default. |
|
| 69 | + # It can be set to an array that will enable params authentication only for the |
|
| 70 | + # given strategies, for example, `config.params_authenticatable = [:database]` will |
|
| 71 | + # enable it only for database (email + password) authentication. |
|
| 72 | + # config.params_authenticatable = true |
|
| 73 | + |
|
| 74 | + # Tell if authentication through HTTP Auth is enabled. False by default. |
|
| 75 | + # It can be set to an array that will enable http authentication only for the |
|
| 76 | + # given strategies, for example, `config.http_authenticatable = [:database]` will |
|
| 77 | + # enable it only for database authentication. |
|
| 78 | + # For API-only applications to support authentication "out-of-the-box", you will likely want to |
|
| 79 | + # enable this with :database unless you are using a custom strategy. |
|
| 80 | + # The supported strategies are: |
|
| 81 | + # :database = Support basic authentication with authentication key + password |
|
| 82 | + # config.http_authenticatable = false |
|
| 83 | + |
|
| 84 | + # If 401 status code should be returned for AJAX requests. True by default. |
|
| 85 | + # config.http_authenticatable_on_xhr = true |
|
| 86 | + |
|
| 87 | + # The realm used in Http Basic Authentication. 'Application' by default. |
|
| 88 | + # config.http_authentication_realm = 'Application' |
|
| 89 | + |
|
| 90 | + # It will change confirmation, password recovery and other workflows |
|
| 91 | + # to behave the same regardless if the e-mail provided was right or wrong. |
|
| 92 | + # Does not affect registerable. |
|
| 93 | + # config.paranoid = true |
|
| 94 | + |
|
| 95 | + # By default Devise will store the user in session. You can skip storage for |
|
| 96 | + # particular strategies by setting this option. |
|
| 97 | + # Notice that if you are skipping storage for all authentication paths, you |
|
| 98 | + # may want to disable generating routes to Devise's sessions controller by |
|
| 99 | + # passing skip: :sessions to `devise_for` in your config/routes.rb |
|
| 100 | + config.skip_session_storage = [:http_auth] |
|
| 101 | + |
|
| 102 | + # By default, Devise cleans up the CSRF token on authentication to |
|
| 103 | + # avoid CSRF token fixation attacks. This means that, when using AJAX |
|
| 104 | + # requests for sign in and sign up, you need to get a new CSRF token |
|
| 105 | + # from the server. You can disable this option at your own risk. |
|
| 106 | + # config.clean_up_csrf_token_on_authentication = true |
|
| 107 | + |
|
| 108 | + # When false, Devise will not attempt to reload routes on eager load. |
|
| 109 | + # This can reduce the time taken to boot the app but if your application |
|
| 110 | + # requires the Devise mappings to be loaded during boot time the application |
|
| 111 | + # won't boot properly. |
|
| 112 | + # config.reload_routes = true |
|
| 113 | + |
|
| 114 | + # ==> Configuration for :database_authenticatable |
|
| 115 | + # For bcrypt, this is the cost for hashing the password and defaults to 12. If |
|
| 116 | + # using other algorithms, it sets how many times you want the password to be hashed. |
|
| 117 | + # The number of stretches used for generating the hashed password are stored |
|
| 118 | + # with the hashed password. This allows you to change the stretches without |
|
| 119 | + # invalidating existing passwords. |
|
| 120 | + # |
|
| 121 | + # Limiting the stretches to just one in testing will increase the performance of |
|
| 122 | + # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use |
|
| 123 | + # a value less than 10 in other environments. Note that, for bcrypt (the default |
|
| 124 | + # algorithm), the cost increases exponentially with the number of stretches (e.g. |
|
| 125 | + # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). |
|
| 126 | + config.stretches = Rails.env.test? ? 1 : 12 |
|
| 127 | + |
|
| 128 | + # Set up a pepper to generate the hashed password. |
|
| 129 | + # config.pepper = '0eedab96160f8a030f9aa055182bab0e7d1427040a01ccf4c324840206a9b0b947a04cb20c7d59c40ee91ccd896a7dbde00c46ef6fa7229c1c85d4248951d10b' |
|
| 130 | + |
|
| 131 | + # Send a notification to the original email when the user's email is changed. |
|
| 132 | + # config.send_email_changed_notification = false |
|
| 133 | + |
|
| 134 | + # Send a notification email when the user's password is changed. |
|
| 135 | + # config.send_password_change_notification = false |
|
| 136 | + |
|
| 137 | + # ==> Configuration for :confirmable |
|
| 138 | + # A period that the user is allowed to access the website even without |
|
| 139 | + # confirming their account. For instance, if set to 2.days, the user will be |
|
| 140 | + # able to access the website for two days without confirming their account, |
|
| 141 | + # access will be blocked just in the third day. |
|
| 142 | + # You can also set it to nil, which will allow the user to access the website |
|
| 143 | + # without confirming their account. |
|
| 144 | + # Default is 0.days, meaning the user cannot access the website without |
|
| 145 | + # confirming their account. |
|
| 146 | + # config.allow_unconfirmed_access_for = 2.days |
|
| 147 | + |
|
| 148 | + # A period that the user is allowed to confirm their account before their |
|
| 149 | + # token becomes invalid. For example, if set to 3.days, the user can confirm |
|
| 150 | + # their account within 3 days after the mail was sent, but on the fourth day |
|
| 151 | + # their account can't be confirmed with the token any more. |
|
| 152 | + # Default is nil, meaning there is no restriction on how long a user can take |
|
| 153 | + # before confirming their account. |
|
| 154 | + # config.confirm_within = 3.days |
|
| 155 | + |
|
| 156 | + # If true, requires any email changes to be confirmed (exactly the same way as |
|
| 157 | + # initial account confirmation) to be applied. Requires additional unconfirmed_email |
|
| 158 | + # db field (see migrations). Until confirmed, new email is stored in |
|
| 159 | + # unconfirmed_email column, and copied to email column on successful confirmation. |
|
| 160 | + config.reconfirmable = true |
|
| 161 | + |
|
| 162 | + # Defines which key will be used when confirming an account |
|
| 163 | + # config.confirmation_keys = [:email] |
|
| 164 | + |
|
| 165 | + # ==> Configuration for :rememberable |
|
| 166 | + # The time the user will be remembered without asking for credentials again. |
|
| 167 | + # config.remember_for = 2.weeks |
|
| 168 | + |
|
| 169 | + # Invalidates all the remember me tokens when the user signs out. |
|
| 170 | + config.expire_all_remember_me_on_sign_out = true |
|
| 171 | + |
|
| 172 | + # If true, extends the user's remember period when remembered via cookie. |
|
| 173 | + # config.extend_remember_period = false |
|
| 174 | + |
|
| 175 | + # Options to be passed to the created cookie. For instance, you can set |
|
| 176 | + # secure: true in order to force SSL only cookies. |
|
| 177 | + # config.rememberable_options = {} |
|
| 178 | + |
|
| 179 | + # ==> Configuration for :validatable |
|
| 180 | + # Range for password length. |
|
| 181 | + config.password_length = 6..128 |
|
| 182 | + |
|
| 183 | + # Email regex used to validate email formats. It simply asserts that |
|
| 184 | + # one (and only one) @ exists in the given string. This is mainly |
|
| 185 | + # to give user feedback and not to assert the e-mail validity. |
|
| 186 | + config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ |
|
| 187 | + |
|
| 188 | + # ==> Configuration for :timeoutable |
|
| 189 | + # The time you want to timeout the user session without activity. After this |
|
| 190 | + # time the user will be asked for credentials again. Default is 30 minutes. |
|
| 191 | + # config.timeout_in = 30.minutes |
|
| 192 | + |
|
| 193 | + # ==> Configuration for :lockable |
|
| 194 | + # Defines which strategy will be used to lock an account. |
|
| 195 | + # :failed_attempts = Locks an account after a number of failed attempts to sign in. |
|
| 196 | + # :none = No lock strategy. You should handle locking by yourself. |
|
| 197 | + # config.lock_strategy = :failed_attempts |
|
| 198 | + |
|
| 199 | + # Defines which key will be used when locking and unlocking an account |
|
| 200 | + # config.unlock_keys = [:email] |
|
| 201 | + |
|
| 202 | + # Defines which strategy will be used to unlock an account. |
|
| 203 | + # :email = Sends an unlock link to the user email |
|
| 204 | + # :time = Re-enables login after a certain amount of time (see :unlock_in below) |
|
| 205 | + # :both = Enables both strategies |
|
| 206 | + # :none = No unlock strategy. You should handle unlocking by yourself. |
|
| 207 | + # config.unlock_strategy = :both |
|
| 208 | + |
|
| 209 | + # Number of authentication tries before locking an account if lock_strategy |
|
| 210 | + # is failed attempts. |
|
| 211 | + # config.maximum_attempts = 20 |
|
| 212 | + |
|
| 213 | + # Time interval to unlock the account if :time is enabled as unlock_strategy. |
|
| 214 | + # config.unlock_in = 1.hour |
|
| 215 | + |
|
| 216 | + # Warn on the last attempt before the account is locked. |
|
| 217 | + # config.last_attempt_warning = true |
|
| 218 | + |
|
| 219 | + # ==> Configuration for :recoverable |
|
| 220 | + # |
|
| 221 | + # Defines which key will be used when recovering the password for an account |
|
| 222 | + # config.reset_password_keys = [:email] |
|
| 223 | + |
|
| 224 | + # Time interval you can reset your password with a reset password key. |
|
| 225 | + # Don't put a too small interval or your users won't have the time to |
|
| 226 | + # change their passwords. |
|
| 227 | + config.reset_password_within = 6.hours |
|
| 228 | + |
|
| 229 | + # When set to false, does not sign a user in automatically after their password is |
|
| 230 | + # reset. Defaults to true, so a user is signed in automatically after a reset. |
|
| 231 | + # config.sign_in_after_reset_password = true |
|
| 232 | + |
|
| 233 | + # ==> Configuration for :encryptable |
|
| 234 | + # Allow you to use another hashing or encryption algorithm besides bcrypt (default). |
|
| 235 | + # You can use :sha1, :sha512 or algorithms from others authentication tools as |
|
| 236 | + # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 |
|
| 237 | + # for default behavior) and :restful_authentication_sha1 (then you should set |
|
| 238 | + # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). |
|
| 239 | + # |
|
| 240 | + # Require the `devise-encryptable` gem when using anything other than bcrypt |
|
| 241 | + # config.encryptor = :sha512 |
|
| 242 | + |
|
| 243 | + # ==> Scopes configuration |
|
| 244 | + # Turn scoped views on. Before rendering "sessions/new", it will first check for |
|
| 245 | + # "users/sessions/new". It's turned off by default because it's slower if you |
|
| 246 | + # are using only default views. |
|
| 247 | + # config.scoped_views = false |
|
| 248 | + |
|
| 249 | + # Configure the default scope given to Warden. By default it's the first |
|
| 250 | + # devise role declared in your routes (usually :user). |
|
| 251 | + # config.default_scope = :user |
|
| 252 | + |
|
| 253 | + # Set this configuration to false if you want /users/sign_out to sign out |
|
| 254 | + # only the current scope. By default, Devise signs out all scopes. |
|
| 255 | + # config.sign_out_all_scopes = true |
|
| 256 | + |
|
| 257 | + # ==> Navigation configuration |
|
| 258 | + # Lists the formats that should be treated as navigational. Formats like |
|
| 259 | + # :html should redirect to the sign in page when the user does not have |
|
| 260 | + # access, but formats like :xml or :json, should return 401. |
|
| 261 | + # |
|
| 262 | + # If you have any extra navigational formats, like :iphone or :mobile, you |
|
| 263 | + # should add them to the navigational formats lists. |
|
| 264 | + # |
|
| 265 | + # The "*/*" below is required to match Internet Explorer requests. |
|
| 266 | + # config.navigational_formats = ['*/*', :html, :turbo_stream] |
|
| 267 | + |
|
| 268 | + # The default HTTP method used to sign out a resource. Default is :delete. |
|
| 269 | + config.sign_out_via = :delete |
|
| 270 | + |
|
| 271 | + # ==> OmniAuth |
|
| 272 | + # Add a new OmniAuth provider. Check the wiki for more information on setting |
|
| 273 | + # up on your models and hooks. |
|
| 274 | + # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' |
|
| 275 | + |
|
| 276 | + # ==> Warden configuration |
|
| 277 | + # If you want to use other strategies, that are not supported by Devise, or |
|
| 278 | + # change the failure app, you can configure them inside the config.warden block. |
|
| 279 | + # |
|
| 280 | + # config.warden do |manager| |
|
| 281 | + # manager.intercept_401 = false |
|
| 282 | + # manager.default_strategies(scope: :user).unshift :some_external_strategy |
|
| 283 | + # end |
|
| 284 | + |
|
| 285 | + # ==> Mountable engine configurations |
|
| 286 | + # When using Devise inside an engine, let's call it `MyEngine`, and this engine |
|
| 287 | + # is mountable, there are some extra configurations to be taken into account. |
|
| 288 | + # The following options are available, assuming the engine is mounted as: |
|
| 289 | + # |
|
| 290 | + # mount MyEngine, at: '/my_engine' |
|
| 291 | + # |
|
| 292 | + # The router that invoked `devise_for`, in the example above, would be: |
|
| 293 | + # config.router_name = :my_engine |
|
| 294 | + # |
|
| 295 | + # When using OmniAuth, Devise cannot automatically set OmniAuth path, |
|
| 296 | + # so you need to do it manually. For the users scope, it would be: |
|
| 297 | + # config.omniauth_path_prefix = '/my_engine/users/auth' |
|
| 298 | + |
|
| 299 | + # ==> Hotwire/Turbo configuration |
|
| 300 | + # When using Devise with Hotwire/Turbo, the http status for error responses |
|
| 301 | + # and some redirects must match the following. The default in Devise for existing |
|
| 302 | + # apps is `200 OK` and `302 Found` respectively, but new apps are generated with |
|
| 303 | + # these new defaults that match Hotwire/Turbo behavior. |
|
| 304 | + # Note: These might become the new default in future versions of Devise. |
|
| 305 | + config.responder.error_status = :unprocessable_entity |
|
| 306 | + config.responder.redirect_status = :see_other |
|
| 307 | + |
|
| 308 | + # ==> Configuration for :registerable |
|
| 309 | + |
|
| 310 | + # When set to false, does not sign a user in automatically after their password is |
|
| 311 | + # changed. Defaults to true, so a user is signed in automatically after changing a password. |
|
| 312 | + # config.sign_in_after_change_password = true |
|
| 313 | +end |
config/locales/active_admin.ru.yml
| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | +ru: |
|
| 2 | + active_admin: |
|
| 3 | + batch_actions: |
|
| 4 | + action_label: "%{title}" |
|
| 5 | + labels: |
|
| 6 | + approve: "Одобрить" |
|
| 7 | + decline: "Отклонить" |
|
| 8 | + rollback: "Сбросить" |
|
| 9 | + mark_as_paid: "Отметить как оплаченные" |
|
| 10 | + mark_as_cancelled: "Отметить как отмененные" |
|
| 11 | + settings: 'Настройки' |
|
| 12 | + intent: 'Интенты' |
|
| 13 | + bot_segments: |
|
| 14 | + segment_activated: 'Сегмент активирован' |
|
| 15 | + segment_hidden: 'Сегмент скрыт' |
|
| 16 | + users: |
|
| 17 | + link_created: 'Ссылка для установки пароля сгенерирована' |
|
| 18 | + confirmed: 'Подтвержден' |
|
| 19 | + bots: |
|
| 20 | + switched: 'Все интенты включены' |
|
| 21 | + finish_voice_acting: 'Бот готов к работе' |
|
| 22 | + change_segment: 'Сегмент изменен' |
|
| 23 | + replace_audio: 'Аудио заменено' |
|
| 24 | + blacklisted_phones: |
|
| 25 | + column_missing: "Колонка `phone` отсутствует в загруженном файле" |
|
| 26 | + select_xlsx: 'Пожалуйста, выберите файл типа XLSX' |
|
| 27 | + import_success: 'Абоненты загружены' |
|
| 28 | + reports: 'Отчёты' |
|
| 29 | + specifications: 'Спецификации' |
|
| 30 | + lookalikes_projects: 'LAL-отчет' |
|
| 31 | + recomendations: 'Пример отчёта' |
config/locales/datetime.ru.yml
| ... | ... | @@ -0,0 +1,100 @@ |
| 1 | +ru: |
|
| 2 | + date: |
|
| 3 | + formats: |
|
| 4 | + # Форматы указываются в виде, поддерживаемом strftime. |
|
| 5 | + # По умолчанию используется default. |
|
| 6 | + # Можно добавлять собственные форматы |
|
| 7 | + # |
|
| 8 | + # |
|
| 9 | + # Use the strftime parameters for formats. |
|
| 10 | + # When no format has been given, it uses default. |
|
| 11 | + # You can provide other formats here if you like! |
|
| 12 | + default: "%d.%m.%Y" |
|
| 13 | + short: "%d %b" |
|
| 14 | + long: "%d %B %Y" |
|
| 15 | + sql: "%Y-%m-%d" |
|
| 16 | + |
|
| 17 | + time: |
|
| 18 | + # Форматы времени |
|
| 19 | + formats: |
|
| 20 | + default: "%d.%m.%Y %H:%M" |
|
| 21 | + time: "%H:%M:%S" |
|
| 22 | + day_and_month: "%e %B" |
|
| 23 | + date: "%d.%m.%Y" |
|
| 24 | + short_full: "%d.%m.%Y %H:%M" |
|
| 25 | + short_date: "%d.%m.%Y" |
|
| 26 | + short_time: "%H:%M" |
|
| 27 | + long: "%e %B %Y %H:%M" |
|
| 28 | + full: "%d.%m.%Y %H:%M:%S" |
|
| 29 | + sql: "%Y-%m-%d %H:%M:%S" |
|
| 30 | + |
|
| 31 | + # am/pm решено перевести как "утра/вечера" :) |
|
| 32 | + am: "утра" |
|
| 33 | + pm: "вечера" |
|
| 34 | + |
|
| 35 | + datetime: |
|
| 36 | + distance_in_words: |
|
| 37 | + ago: 'назад' |
|
| 38 | + about_x_hours: |
|
| 39 | + few: около %{count} часов |
|
| 40 | + many: около %{count} часов |
|
| 41 | + one: около %{count} часа |
|
| 42 | + other: около %{count} часов |
|
| 43 | + about_x_months: |
|
| 44 | + few: около %{count} месяцев |
|
| 45 | + many: около %{count} месяцев |
|
| 46 | + one: около %{count} месяца |
|
| 47 | + other: около %{count} месяца |
|
| 48 | + about_x_years: |
|
| 49 | + few: около %{count} лет |
|
| 50 | + many: около %{count} лет |
|
| 51 | + one: около %{count} года |
|
| 52 | + other: около %{count} лет |
|
| 53 | + almost_x_years: |
|
| 54 | + one: почти 1 год |
|
| 55 | + few: почти %{count} года |
|
| 56 | + many: почти %{count} лет |
|
| 57 | + other: почти %{count} лет |
|
| 58 | + half_a_minute: меньше минуты |
|
| 59 | + less_than_x_minutes: |
|
| 60 | + few: меньше %{count} минут |
|
| 61 | + many: меньше %{count} минут |
|
| 62 | + one: меньше %{count} минуты |
|
| 63 | + other: меньше %{count} минут |
|
| 64 | + less_than_x_seconds: |
|
| 65 | + few: меньше %{count} секунд |
|
| 66 | + many: меньше %{count} секунд |
|
| 67 | + one: меньше %{count} секунды |
|
| 68 | + other: меньше %{count} секунды |
|
| 69 | + over_x_years: |
|
| 70 | + few: больше %{count} лет |
|
| 71 | + many: больше %{count} лет |
|
| 72 | + one: больше %{count} года |
|
| 73 | + other: больше %{count} лет |
|
| 74 | + x_days: |
|
| 75 | + few: ! '%{count} дня' |
|
| 76 | + many: ! '%{count} дней' |
|
| 77 | + one: ! '%{count} день' |
|
| 78 | + other: ! '%{count} дней' |
|
| 79 | + x_minutes: |
|
| 80 | + few: ! '%{count} минуты' |
|
| 81 | + many: ! '%{count} минут' |
|
| 82 | + one: ! '%{count} минуту' |
|
| 83 | + other: ! '%{count} минуты' |
|
| 84 | + x_months: |
|
| 85 | + few: ! '%{count} месяца' |
|
| 86 | + many: ! '%{count} месяцев' |
|
| 87 | + one: ! '%{count} месяц' |
|
| 88 | + other: ! '%{count} месяца' |
|
| 89 | + x_seconds: |
|
| 90 | + few: ! '%{count} секунды' |
|
| 91 | + many: ! '%{count} секунд' |
|
| 92 | + one: ! '%{count} секундy' |
|
| 93 | + other: ! '%{count} секунды' |
|
| 94 | + prompts: |
|
| 95 | + day: День |
|
| 96 | + hour: Часов |
|
| 97 | + minute: Минут |
|
| 98 | + month: Месяц |
|
| 99 | + second: Секунд |
|
| 100 | + year: Год |
config/locales/devise.en.yml
| ... | ... | @@ -0,0 +1,65 @@ |
| 1 | +# Additional translations at https://github.com/heartcombo/devise/wiki/I18n |
|
| 2 | + |
|
| 3 | +en: |
|
| 4 | + devise: |
|
| 5 | + confirmations: |
|
| 6 | + confirmed: "Your email address has been successfully confirmed." |
|
| 7 | + send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." |
|
| 8 | + send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." |
|
| 9 | + failure: |
|
| 10 | + already_authenticated: "You are already signed in." |
|
| 11 | + inactive: "Your account is not activated yet." |
|
| 12 | + invalid: "Invalid %{authentication_keys} or password." |
|
| 13 | + locked: "Your account is locked." |
|
| 14 | + last_attempt: "You have one more attempt before your account is locked." |
|
| 15 | + not_found_in_database: "Invalid %{authentication_keys} or password." |
|
| 16 | + timeout: "Your session expired. Please sign in again to continue." |
|
| 17 | + unauthenticated: "You need to sign in or sign up before continuing." |
|
| 18 | + unconfirmed: "You have to confirm your email address before continuing." |
|
| 19 | + mailer: |
|
| 20 | + confirmation_instructions: |
|
| 21 | + subject: "Confirmation instructions" |
|
| 22 | + reset_password_instructions: |
|
| 23 | + subject: "Reset password instructions" |
|
| 24 | + unlock_instructions: |
|
| 25 | + subject: "Unlock instructions" |
|
| 26 | + email_changed: |
|
| 27 | + subject: "Email Changed" |
|
| 28 | + password_change: |
|
| 29 | + subject: "Password Changed" |
|
| 30 | + omniauth_callbacks: |
|
| 31 | + failure: "Could not authenticate you from %{kind} because \"%{reason}\"." |
|
| 32 | + success: "Successfully authenticated from %{kind} account." |
|
| 33 | + passwords: |
|
| 34 | + no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." |
|
| 35 | + send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." |
|
| 36 | + send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." |
|
| 37 | + updated: "Your password has been changed successfully. You are now signed in." |
|
| 38 | + updated_not_active: "Your password has been changed successfully." |
|
| 39 | + registrations: |
|
| 40 | + destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." |
|
| 41 | + signed_up: "Welcome! You have signed up successfully." |
|
| 42 | + signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." |
|
| 43 | + signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." |
|
| 44 | + signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." |
|
| 45 | + update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address." |
|
| 46 | + updated: "Your account has been updated successfully." |
|
| 47 | + updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again." |
|
| 48 | + sessions: |
|
| 49 | + signed_in: "Signed in successfully." |
|
| 50 | + signed_out: "Signed out successfully." |
|
| 51 | + already_signed_out: "Signed out successfully." |
|
| 52 | + unlocks: |
|
| 53 | + send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." |
|
| 54 | + send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." |
|
| 55 | + unlocked: "Your account has been unlocked successfully. Please sign in to continue." |
|
| 56 | + errors: |
|
| 57 | + messages: |
|
| 58 | + already_confirmed: "was already confirmed, please try signing in" |
|
| 59 | + confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" |
|
| 60 | + expired: "has expired, please request a new one" |
|
| 61 | + not_found: "not found" |
|
| 62 | + not_locked: "was not locked" |
|
| 63 | + not_saved: |
|
| 64 | + one: "1 error prohibited this %{resource} from being saved:" |
|
| 65 | + other: "%{count} errors prohibited this %{resource} from being saved:" |
config/locales/ransack.ru.yml
| ... | ... | @@ -0,0 +1,70 @@ |
| 1 | +ru: |
|
| 2 | + ransack: |
|
| 3 | + search: "Поиск" |
|
| 4 | + predicate: "predicate" |
|
| 5 | + and: "и" |
|
| 6 | + or: "или" |
|
| 7 | + any: "любое" |
|
| 8 | + all: "все" |
|
| 9 | + combinator: "combinator" |
|
| 10 | + attribute: "аттрибут" |
|
| 11 | + value: "значение" |
|
| 12 | + condition: "условие" |
|
| 13 | + sort: "сортировка" |
|
| 14 | + asc: "по возрастанию" |
|
| 15 | + desc: "по убыванию" |
|
| 16 | + predicates: |
|
| 17 | + eq: "равный" |
|
| 18 | + eq_any: "равный любому" |
|
| 19 | + eq_all: "равный всем" |
|
| 20 | + not_eq: "не равный любому" |
|
| 21 | + not_eq_any: "не равный любому" |
|
| 22 | + not_eq_all: "не равный всем" |
|
| 23 | + matches: "совпадение" |
|
| 24 | + matches_any: "совпадение любому" |
|
| 25 | + matches_all: "совпадение всем" |
|
| 26 | + does_not_match: "не совпадение" |
|
| 27 | + does_not_match_any: "не совпадение любому" |
|
| 28 | + does_not_match_all: "не совпадение всем" |
|
| 29 | + lt: "меньше чем" |
|
| 30 | + lt_any: "меньше чем любое" |
|
| 31 | + lt_all: "меньше чем все" |
|
| 32 | + lteq: "меньше чем или равен" |
|
| 33 | + lteq_any: "меньше чем или равен любому" |
|
| 34 | + lteq_all: "меньше чем или равен всем" |
|
| 35 | + gt: "больше чем" |
|
| 36 | + gt_any: "больше чем любое" |
|
| 37 | + gt_all: "больше чем все" |
|
| 38 | + gteq: "больше чем или равен" |
|
| 39 | + gteq_any: "больше чем или равен любому" |
|
| 40 | + gteq_all: "больше чем или равен всем" |
|
| 41 | + in: "в" |
|
| 42 | + in_any: "в любом из" |
|
| 43 | + in_all: "во всех" |
|
| 44 | + not_in: "нет в" |
|
| 45 | + not_in_any: "не в каком из" |
|
| 46 | + not_in_all: "нет во всех" |
|
| 47 | + cont: "содержит" |
|
| 48 | + cont_any: "содержит любое" |
|
| 49 | + cont_all: "содержит все" |
|
| 50 | + not_cont: "не содержит" |
|
| 51 | + not_cont_any: "не содержит любое" |
|
| 52 | + not_cont_all: "не содержит все" |
|
| 53 | + start: "начинается с" |
|
| 54 | + start_any: "начинается с любого" |
|
| 55 | + start_all: "начинается с всего" |
|
| 56 | + not_start: "не начинается с" |
|
| 57 | + not_start_any: "не начинается с любого" |
|
| 58 | + not_start_all: "не начинается со всего" |
|
| 59 | + end: "кончается с" |
|
| 60 | + end_any: "кончается с любого" |
|
| 61 | + end_all: "кончается со всего" |
|
| 62 | + not_end: "не кончается с" |
|
| 63 | + not_end_any: "не кончается с любого" |
|
| 64 | + not_end_all: "не кончается со всего" |
|
| 65 | + 'true': "верно" |
|
| 66 | + 'false': "не верно" |
|
| 67 | + present: "настоящее" |
|
| 68 | + blank: "пусто" |
|
| 69 | + 'null': "нулевой" |
|
| 70 | + not_null: "не нулевой" |
config/routes.rb
| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | 1 | Rails.application.routes.draw do |
| 2 | + devise_for :admin_users, ActiveAdmin::Devise.config |
|
| 3 | + ActiveAdmin.routes(self) |
|
| 2 | 4 | require 'gollum/app' |
| 3 | 5 | |
| 4 | - Rails.application.routes.draw do |
|
| 5 | - wiki_options = {:universal_toc => false} |
|
| 6 | - Precious::App.set(:gollum_path, Rails.root.join('gollum').to_s) |
|
| 7 | - Precious::App.set(:default_markup, :markdown) # set your favorite markup language |
|
| 8 | - Precious::App.set(:wiki_options, wiki_options) |
|
| 9 | - mount Precious::App, at:'/' |
|
| 10 | - end |
|
| 6 | + wiki_options = {:universal_toc => false} |
|
| 7 | + Precious::App.set(:gollum_path, Rails.root.join('gollum').to_s) |
|
| 8 | + Precious::App.set(:default_markup, :markdown) # set your favorite markup language |
|
| 9 | + Precious::App.set(:wiki_options, wiki_options) |
|
| 10 | + mount Precious::App, at:'/' |
|
| 11 | 11 | end |
db/migrate/20250710010831_devise_create_admin_users.rb
| ... | ... | @@ -0,0 +1,44 @@ |
| 1 | +# frozen_string_literal: true |
|
| 2 | + |
|
| 3 | +class DeviseCreateAdminUsers < ActiveRecord::Migration[7.1] |
|
| 4 | + def change |
|
| 5 | + create_table :admin_users do |t| |
|
| 6 | + ## Database authenticatable |
|
| 7 | + t.string :email, null: false, default: "" |
|
| 8 | + t.string :encrypted_password, null: false, default: "" |
|
| 9 | + |
|
| 10 | + ## Recoverable |
|
| 11 | + t.string :reset_password_token |
|
| 12 | + t.datetime :reset_password_sent_at |
|
| 13 | + |
|
| 14 | + ## Rememberable |
|
| 15 | + t.datetime :remember_created_at |
|
| 16 | + |
|
| 17 | + ## Trackable |
|
| 18 | + # t.integer :sign_in_count, default: 0, null: false |
|
| 19 | + # t.datetime :current_sign_in_at |
|
| 20 | + # t.datetime :last_sign_in_at |
|
| 21 | + # t.string :current_sign_in_ip |
|
| 22 | + # t.string :last_sign_in_ip |
|
| 23 | + |
|
| 24 | + ## Confirmable |
|
| 25 | + # t.string :confirmation_token |
|
| 26 | + # t.datetime :confirmed_at |
|
| 27 | + # t.datetime :confirmation_sent_at |
|
| 28 | + # t.string :unconfirmed_email # Only if using reconfirmable |
|
| 29 | + |
|
| 30 | + ## Lockable |
|
| 31 | + # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts |
|
| 32 | + # t.string :unlock_token # Only if unlock strategy is :email or :both |
|
| 33 | + # t.datetime :locked_at |
|
| 34 | + |
|
| 35 | + |
|
| 36 | + t.timestamps null: false |
|
| 37 | + end |
|
| 38 | + |
|
| 39 | + add_index :admin_users, :email, unique: true |
|
| 40 | + add_index :admin_users, :reset_password_token, unique: true |
|
| 41 | + # add_index :admin_users, :confirmation_token, unique: true |
|
| 42 | + # add_index :admin_users, :unlock_token, unique: true |
|
| 43 | + end |
|
| 44 | +end |
db/migrate/20250710011800_create_active_admin_comments.rb
| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | +class CreateActiveAdminComments < ActiveRecord::Migration[7.1] |
|
| 2 | + def self.up |
|
| 3 | + create_table :active_admin_comments do |t| |
|
| 4 | + t.string :namespace |
|
| 5 | + t.text :body |
|
| 6 | + t.references :resource, polymorphic: true |
|
| 7 | + t.references :author, polymorphic: true |
|
| 8 | + t.timestamps |
|
| 9 | + end |
|
| 10 | + add_index :active_admin_comments, [:namespace] |
|
| 11 | + end |
|
| 12 | + |
|
| 13 | + def self.down |
|
| 14 | + drop_table :active_admin_comments |
|
| 15 | + end |
|
| 16 | +end |
db/schema.rb
| ... | ... | @@ -0,0 +1,43 @@ |
| 1 | +# This file is auto-generated from the current state of the database. Instead |
|
| 2 | +# of editing this file, please use the migrations feature of Active Record to |
|
| 3 | +# incrementally modify your database, and then regenerate this schema definition. |
|
| 4 | +# |
|
| 5 | +# This file is the source Rails uses to define your schema when running `bin/rails |
|
| 6 | +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to |
|
| 7 | +# be faster and is potentially less error prone than running all of your |
|
| 8 | +# migrations from scratch. Old migrations may fail to apply correctly if those |
|
| 9 | +# migrations use external dependencies or application code. |
|
| 10 | +# |
|
| 11 | +# It's strongly recommended that you check this file into your version control system. |
|
| 12 | + |
|
| 13 | +ActiveRecord::Schema[7.1].define(version: 2025_07_10_011800) do |
|
| 14 | + # These are extensions that must be enabled in order to support this database |
|
| 15 | + enable_extension "plpgsql" |
|
| 16 | + |
|
| 17 | + create_table "active_admin_comments", force: :cascade do |t| |
|
| 18 | + t.string "namespace" |
|
| 19 | + t.text "body" |
|
| 20 | + t.string "resource_type" |
|
| 21 | + t.bigint "resource_id" |
|
| 22 | + t.string "author_type" |
|
| 23 | + t.bigint "author_id" |
|
| 24 | + t.datetime "created_at", null: false |
|
| 25 | + t.datetime "updated_at", null: false |
|
| 26 | + t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author" |
|
| 27 | + t.index ["namespace"], name: "index_active_admin_comments_on_namespace" |
|
| 28 | + t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource" |
|
| 29 | + end |
|
| 30 | + |
|
| 31 | + create_table "admin_users", force: :cascade do |t| |
|
| 32 | + t.string "email", default: "", null: false |
|
| 33 | + t.string "encrypted_password", default: "", null: false |
|
| 34 | + t.string "reset_password_token" |
|
| 35 | + t.datetime "reset_password_sent_at" |
|
| 36 | + t.datetime "remember_created_at" |
|
| 37 | + t.datetime "created_at", null: false |
|
| 38 | + t.datetime "updated_at", null: false |
|
| 39 | + t.index ["email"], name: "index_admin_users_on_email", unique: true |
|
| 40 | + t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true |
|
| 41 | + end |
|
| 42 | + |
|
| 43 | +end |
db/seeds.rb
| ... | ... | @@ -7,3 +7,4 @@ |
| 7 | 7 | # ["Action", "Comedy", "Drama", "Horror"].each do |genre_name| |
| 8 | 8 | # MovieGenre.find_or_create_by!(name: genre_name) |
| 9 | 9 | # end |
| 10 | +AdminUser.create!(email: 'a.bukin@voicia.ru', password: 'gettherefast', password_confirmation: 'gettherefast') if Rails.env.development? |
|
| ... | ... | \ No newline at end of file |
test/fixtures/admin_users.yml
| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html |
|
| 2 | + |
|
| 3 | +# This model initially had no columns defined. If you add columns to the |
|
| 4 | +# model remove the "{}" from the fixture names and add the columns immediately |
|
| 5 | +# below each fixture, per the syntax in the comments below |
|
| 6 | +# |
|
| 7 | +one: {} |
|
| 8 | +# column: value |
|
| 9 | +# |
|
| 10 | +two: {} |
|
| 11 | +# column: value |
test/models/admin_user_test.rb
| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | +require "test_helper" |
|
| 2 | + |
|
| 3 | +class AdminUserTest < ActiveSupport::TestCase |
|
| 4 | + # test "the truth" do |
|
| 5 | + # assert true |
|
| 6 | + # end |
|
| 7 | +end |