diff --git a/.gitignore b/.gitignore
index 18b43c9..3963d4f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,8 @@
# Ignore master key for decrypting credentials and more.
/config/master.key
+
+/config/database.yml
+/.idea
+/log/*
+/tmp/*
diff --git a/.idea/.generators b/.idea/.generators
deleted file mode 100644
index 1618976..0000000
--- a/.idea/.generators
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
diff --git a/.idea/.rakeTasks b/.idea/.rakeTasks
deleted file mode 100644
index c6865d9..0000000
--- a/.idea/.rakeTasks
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
diff --git a/.idea/garages.iml b/.idea/garages.iml
deleted file mode 100644
index c26a132..0000000
--- a/.idea/garages.iml
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index b0db9b0..0000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index ebba9e7..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 3971afe..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.rubocop.yml b/.rubocop.yml
new file mode 100644
index 0000000..ff312ca
--- /dev/null
+++ b/.rubocop.yml
@@ -0,0 +1,34 @@
+AllCops:
+ TargetRubyVersion: 2.5.1
+ Exclude:
+ - bundle/*
+ - bin/*
+ - vendor/*
+ - node_modules/*
+ - public/*
+ - db/*
+ - lib/*
+ - config/unicorn.rb
+
+Style/FrozenStringLiteralComment:
+ Exclude:
+ - db/migrate/*.rb
+ - config/**/*
+ - script/**
+
+Layout/DefEndAlignment:
+ AutoCorrect: true
+
+Documentation:
+ Enabled: false
+
+Metrics/LineLength:
+ Max: 100
+ Exclude:
+ - config/initializers/**
+ - config/environments/**
+ - config/schedule.rb
+
+Style/ClassAndModuleChildren:
+ Enabled: false
+
diff --git a/Gemfile b/Gemfile
index e10c878..17d31e2 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
@@ -18,8 +20,6 @@ gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
-# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
-gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
@@ -36,20 +36,49 @@ gem 'jbuilder', '~> 2.5'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false
+# Slim templates generator for Rails 3, 4 and 5
+gem 'slim-rails'
+
+# The AdminLTE Rails gem integrates AdminLTE theme with the Rails asset pipeline
+gem 'adminlte2-rails'
+
+# A gem to automate using jQuery with Rails
+gem 'bootstrap', '~> 4.3.1'
+gem 'jquery-rails'
+gem 'jquery-slimscroll-rails'
+gem 'jquery-ui-rails'
+
+# The EmailAddress Gem to work with and validate email addresses.
+gem 'validates_email_format_of'
+
+# A Scope & Engine based, clean, powerful, customizable and sophisticated paginator for Ruby webapps
+gem 'kaminari'
+
+# Validates whether the specified value is a valid email address.
+# Returns nil if the value is valid,otherwise returns an array
+gem 'email_format'
+
+# Russian language support for Ruby and Rails, using I18n library.
+gem 'russian', '~> 0.6.0'
+
+# Framework for handling and responding to web requests.
+# It provides mechanisms for routing, defining controllers that implement actions,
+# and generating responses by rendering views , which are templates of various formats.
+gem 'actionpack', '~> 5.0', '>= 5.0.0.1'
+
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
- gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
+ gem 'byebug', platforms: %i[mri mingw x64_mingw]
end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
- gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
+ gem 'web-console', '>= 3.3.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
-
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
-gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
+gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
diff --git a/Gemfile.lock b/Gemfile.lock
index d23a41c..9827054 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -2,15 +2,16 @@ GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.3)
- actionpack (= 5.2.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.3)
- actionpack (= 5.2.3)
- actionview (= 5.2.3)
activejob (= 5.2.3)
+ activesupport (= 5.2.3)
mail (~> 2.5, >= 2.5.4)
+ rack (~> 2.0)
+ rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionpack (5.2.3)
actionview (= 5.2.3)
activesupport (= 5.2.3)
@@ -34,7 +35,6 @@ GEM
activesupport (= 5.2.3)
arel (>= 9.0)
activestorage (5.2.3)
- actionpack (= 5.2.3)
activerecord (= 5.2.3)
marcel (~> 0.3.1)
activesupport (5.2.3)
@@ -42,10 +42,22 @@ GEM
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
+ adminlte2-rails (0.0.6)
+ bootstrap-sass (~> 3.3.4.1)
arel (9.0.0)
+ autoprefixer-rails (9.6.1)
+ execjs
+ bcrypt (3.1.13)
bindex (0.8.1)
bootsnap (1.4.4)
msgpack (~> 1.0)
+ bootstrap (4.3.1)
+ autoprefixer-rails (>= 9.1.0)
+ popper_js (>= 1.14.3, < 2)
+ sassc-rails (>= 2.0.0)
+ bootstrap-sass (3.3.4.1)
+ autoprefixer-rails (>= 5.0.0.1)
+ sass (>= 3.2.19)
builder (3.2.3)
byebug (11.0.1)
coffee-rails (4.2.2)
@@ -57,6 +69,15 @@ GEM
coffee-script-source (1.12.2)
concurrent-ruby (1.1.5)
crass (1.0.4)
+ bcrypt (~> 3.0)
+ orm_adapter (~> 0.1)
+ railties (>= 4.1.0, < 6.0)
+ responders
+ warden (~> 1.2.3)
+ email_format (1.0.0)
+ activemodel
+ email_regex
+ email_regex (0.0.1)
erubi (1.8.0)
execjs (2.7.0)
ffi (1.11.1)
@@ -66,6 +87,25 @@ GEM
concurrent-ruby (~> 1.0)
jbuilder (2.9.1)
activesupport (>= 4.2.0)
+ jquery-rails (4.3.5)
+ rails-dom-testing (>= 1, < 3)
+ railties (>= 4.2.0)
+ thor (>= 0.14, < 2.0)
+ jquery-slimscroll-rails (1.0.9)
+ jquery-ui-rails (6.0.1)
+ railties (>= 3.2.16)
+ kaminari (1.1.1)
+ activesupport (>= 4.1.0)
+ kaminari-actionview (= 1.1.1)
+ kaminari-activerecord (= 1.1.1)
+ kaminari-core (= 1.1.1)
+ kaminari-actionview (1.1.1)
+ actionview
+ kaminari-core (= 1.1.1)
+ kaminari-activerecord (1.1.1)
+ activerecord
+ kaminari-core (= 1.1.1)
+ kaminari-core (1.1.1)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
@@ -86,7 +126,9 @@ GEM
nio4r (2.4.0)
nokogiri (1.10.3)
mini_portile2 (~> 2.4.0)
+ orm_adapter (0.5.0)
pg (1.1.4)
+ popper_js (1.14.5)
puma (3.12.1)
rack (2.0.7)
rack-test (1.1.0)
@@ -94,7 +136,6 @@ GEM
rails (5.2.3)
actioncable (= 5.2.3)
actionmailer (= 5.2.3)
- actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
activemodel (= 5.2.3)
@@ -110,7 +151,6 @@ GEM
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.2.3)
- actionpack (= 5.2.3)
activesupport (= 5.2.3)
method_source
rake (>= 0.8.7)
@@ -119,7 +159,11 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
+ responders (2.4.1)
+ railties (>= 4.2.0, < 6.0)
ruby_dep (1.5.0)
+ russian (0.6.0)
+ i18n (>= 0.5.0)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
@@ -131,6 +175,21 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
+ sassc (2.0.1)
+ ffi (~> 1.9)
+ rake
+ sassc-rails (2.1.2)
+ railties (>= 4.0.0)
+ sassc (>= 2.0)
+ sprockets (> 3.0)
+ sprockets-rails
+ tilt
+ slim (4.0.1)
+ temple (>= 0.7.6, < 0.9)
+ tilt (>= 2.0.6, < 2.1)
+ slim-rails (3.2.0)
+ railties (>= 3.1)
+ slim (>= 3.0, < 5.0)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
@@ -140,21 +199,22 @@ GEM
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
- actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
+ temple (0.8.1)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.9)
- turbolinks (5.2.0)
- turbolinks-source (~> 5.2)
- turbolinks-source (5.2.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
+ validates_email_format_of (1.6.3)
+ i18n
+ warden (1.2.8)
+ rack (>= 2.0.6)
web-console (3.7.0)
- actionview (>= 5.0)
+ actionview (~> 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
@@ -166,20 +226,30 @@ PLATFORMS
ruby
DEPENDENCIES
+ actionpack (~> 5.0, >= 5.0.0.1)
+ adminlte2-rails
bootsnap (>= 1.1.0)
+ bootstrap (~> 4.3.1)
byebug
coffee-rails (~> 4.2)
+ email_format
jbuilder (~> 2.5)
+ jquery-rails
+ jquery-slimscroll-rails
+ jquery-ui-rails
+ kaminari
listen (>= 3.0.5, < 3.2)
pg (>= 0.18, < 2.0)
puma (~> 3.11)
rails (~> 5.2.3)
+ russian (~> 0.6.0)
sass-rails (~> 5.0)
+ slim-rails
spring
spring-watcher-listen (~> 2.0.0)
- turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
+ validates_email_format_of
web-console (>= 3.3.0)
RUBY VERSION
diff --git a/Rakefile b/Rakefile
index e85f913..488c551 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js
new file mode 100644
index 0000000..27df5d9
--- /dev/null
+++ b/app/assets/javascripts/admin.js
@@ -0,0 +1,3 @@
+//= require application
+//= require jquery.slimscroll.min
+//= require_tree ./admin
diff --git a/log/.keep b/app/assets/javascripts/admin/base.js
similarity index 100%
rename from log/.keep
rename to app/assets/javascripts/admin/base.js
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 82e6f0f..6f39966 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -10,7 +10,10 @@
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
-//= require rails-ujs
//= require activestorage
-//= require turbolinks
-//= require_tree .
+//= require cable
+//= require jquery
+//= require jquery-ui
+//= require jquery_ujs
+//= require bootstrap-sprockets
+//= require app
diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss
new file mode 100644
index 0000000..17cce7c
--- /dev/null
+++ b/app/assets/stylesheets/admin.scss
@@ -0,0 +1,20 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS 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/SCSS
+ * 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 application
+ *= require_tree ./admin
+ */
+
+@import "bootstrap-sprockets";
+@import "bootstrap";
+@import "AdminLTE/AdminLTE";
+@import "AdminLTE/skins/skin-blue";
diff --git a/tmp/.keep b/app/assets/stylesheets/admin/base.css
similarity index 100%
rename from tmp/.keep
rename to app/assets/stylesheets/admin/base.css
diff --git a/app/assets/stylesheets/admin_users.sass b/app/assets/stylesheets/admin_users.sass
new file mode 100644
index 0000000..c6011ee
--- /dev/null
+++ b/app/assets/stylesheets/admin_users.sass
@@ -0,0 +1,8 @@
+article.user
+ margin-bottom: 1em
+ padding: 1em 0
+ border-bottom: 1px solid lightblue
+h2
+ margin-bottom: 0
+ section.user-menu
+ padding: .5em 0
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.scss
similarity index 94%
rename from app/assets/stylesheets/application.css
rename to app/assets/stylesheets/application.scss
index d05ea0f..fa1f050 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.scss
@@ -10,6 +10,7 @@
* 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 jquery-ui
*= require_self
*/
+@import "bootstrap";
diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb
index d672697..9aec230 100644
--- a/app/channels/application_cable/channel.rb
+++ b/app/channels/application_cable/channel.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb
index 0ff5442..8d6c2a1 100644
--- a/app/channels/application_cable/connection.rb
+++ b/app/channels/application_cable/connection.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ApplicationCable
class Connection < ActionCable::Connection::Base
end
diff --git a/app/controllers/admin/base_controller.rb b/app/controllers/admin/base_controller.rb
new file mode 100644
index 0000000..3a71646
--- /dev/null
+++ b/app/controllers/admin/base_controller.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+class Admin::BaseController < ApplicationController
+ layout 'admin_lte_2'
+end
diff --git a/app/controllers/admin/main_controller.rb b/app/controllers/admin/main_controller.rb
new file mode 100644
index 0000000..ff4ac67
--- /dev/null
+++ b/app/controllers/admin/main_controller.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+class Admin::MainController < Admin::BaseController
+ def show; end
+end
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
new file mode 100644
index 0000000..378c9f5
--- /dev/null
+++ b/app/controllers/admin/users_controller.rb
@@ -0,0 +1,50 @@
+# frozen_string_literal: true
+
+class Admin::UsersController < Admin::BaseController
+ before_action :set_user, only: %i[show edit update destroy]
+
+ def index
+ @users = User.order(:name).page(params[:page]).per(6)
+ end
+
+ def show; end
+
+ def new
+ @user = User.new
+ end
+
+ def edit; end
+
+ def create
+ @user = User.new(user_params)
+ if @user.save
+ redirect_to admin_users_path
+ else
+ render :new
+ end
+ end
+
+ def update
+ @user = User.find(params[:id])
+ if @user.update(user_params)
+ redirect_to admin_users_path
+ else
+ render :index
+ end
+ end
+
+ def destroy
+ @user.destroy
+ redirect_to admin_users_path
+ end
+
+ private
+
+ def set_user
+ @user = User.find(params[:id])
+ end
+
+ def user_params
+ params.require(:user).permit(:name, :email)
+ end
+end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 09705d1..d56390e 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,2 +1,3 @@
-class ApplicationController < ActionController::Base
-end
+# frozen_string_literal: true
+
+class ApplicationController < ActionController::Base; end
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
new file mode 100644
index 0000000..0bad129
--- /dev/null
+++ b/app/controllers/welcome_controller.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+class WelcomeController < ApplicationController
+ def show; end
+end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index de6be79..15b06f0 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,2 +1,4 @@
+# frozen_string_literal: true
+
module ApplicationHelper
end
diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb
index a009ace..d92ffdd 100644
--- a/app/jobs/application_job.rb
+++ b/app/jobs/application_job.rb
@@ -1,2 +1,4 @@
+# frozen_string_literal: true
+
class ApplicationJob < ActiveJob::Base
end
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
index 286b223..d84cb6e 100644
--- a/app/mailers/application_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com'
layout 'mailer'
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
index 10a4cba..71fbba5 100644
--- a/app/models/application_record.rb
+++ b/app/models/application_record.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
diff --git a/app/models/user.rb b/app/models/user.rb
new file mode 100644
index 0000000..c2a299a
--- /dev/null
+++ b/app/models/user.rb
@@ -0,0 +1,6 @@
+# frozen_string_literal: true
+
+class User < ApplicationRecord
+ validates :email, :name, presence: true
+ validates :email, uniqueness: true, email_format: true
+end
diff --git a/app/views/admin/main/show.html.slim b/app/views/admin/main/show.html.slim
new file mode 100644
index 0000000..2a84b3c
--- /dev/null
+++ b/app/views/admin/main/show.html.slim
@@ -0,0 +1 @@
+| Admin
diff --git a/app/views/admin/users/create.html.erb b/app/views/admin/users/create.html.erb
new file mode 100644
index 0000000..5d0c6ce
--- /dev/null
+++ b/app/views/admin/users/create.html.erb
@@ -0,0 +1,16 @@
+
Добавление пользователя
+<%= form_for @user, url: admin_user_path do |f| %>
+
+
+ Имя
+ <%= f.text_field :name %>
+
+ Имэйл
+ <%= f.text_field :email %>
+
+
+ <%= f.submit 'Сохранить'%>
+
+
+<% end %>
+
diff --git a/app/views/admin/users/edit.html.erb b/app/views/admin/users/edit.html.erb
new file mode 100644
index 0000000..c7ca183
--- /dev/null
+++ b/app/views/admin/users/edit.html.erb
@@ -0,0 +1,21 @@
+Редактирование пользователя
+
+
+<%= form_for :user, url: admin_user_path, method: :patch do |form| %>
+
+ <%= form.label :name %>
+ <%= form.text_field :name %>
+
+
+
+ <%= form.label :email %>
+ <%= form.text_field :email %>
+
+
+
+ <%= form.submit 'Обновить' %>
+
+
+<% end %>
+
+<%= link_to 'Назад', admin_user_path %>
diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb
new file mode 100644
index 0000000..32a6499
--- /dev/null
+++ b/app/views/admin/users/index.html.erb
@@ -0,0 +1,24 @@
+Все пользователи
+
+<%= link_to 'На главную', home_path %>
+
+<%= link_to 'Новый пользователь', new_admin_user_path %>
+
+
+
+ Name |
+ Email |
+
+
+<% @users.each do |user| %>
+
+ <%= user.name %> |
+ <%= user.email %> |
+ <%= link_to ' Показать', admin_user_path(user) %> |
+
+ <% end %>
+
+
+<%= paginate @users %>
+
+
diff --git a/app/views/admin/users/index.js.erb b/app/views/admin/users/index.js.erb
new file mode 100644
index 0000000..dba62d8
--- /dev/null
+++ b/app/views/admin/users/index.js.erb
@@ -0,0 +1,7 @@
+$('#users').append('<%= j render(@users) %>');
+
+<% if @users.next_page %>
+ $('.pagination').replaceWith('<%= j will_paginate(@users, renderer: 'BootstrapPaginationHelper::LinkRenderer') %>');
+<% else %>
+ $('.pagintion').remove();
+<% end %>
\ No newline at end of file
diff --git a/app/views/admin/users/new.html.erb b/app/views/admin/users/new.html.erb
new file mode 100644
index 0000000..1f81839
--- /dev/null
+++ b/app/views/admin/users/new.html.erb
@@ -0,0 +1,29 @@
+ Новый пользователь
+
+<%= form_for @user, url: admin_users_path do |f| %>
+
+ <% if @user.errors.any? %>
+
+
+ <%= pluralize(@user.errors.count, 'ошибки') %>, запрет на сохранение:
+
+
+ <% @user.errors.full_messages.each do |msg| %>
+ - <%= msg %>
+ <% end %>
+
+
+ <% end %>
+
+
+ Имя
+ <%= f.text_field :name %>
+ Имэйл
+ <%= f.text_field :email %>
+
+
+ <%= f.submit 'Сохранить'%>
+
+ <% end %>
+
+<%= link_to 'Назад', admin_users_path %>
\ No newline at end of file
diff --git a/app/views/admin/users/show.html.erb b/app/views/admin/users/show.html.erb
new file mode 100644
index 0000000..e3700b8
--- /dev/null
+++ b/app/views/admin/users/show.html.erb
@@ -0,0 +1,19 @@
+Пользователь
+
+ Name:
+ <%= @user.name %>
+
+
+
+ Email:
+ <%= @user.email %>
+
+ <%= link_to 'Редактирование', edit_admin_user_path(@user), :class => 'btn btn-warning' %>
+
<%= link_to 'Удалить', admin_user_path,
+ method: :delete, data: { confirm: 'Вы уверены?'} %>
+
<%= link_to 'Назад', admin_users_path(@user),class: 'btn btn-outline-secondary' %>
+
+
+
diff --git a/app/views/layouts/_admin_lte_2_header.html.erb b/app/views/layouts/_admin_lte_2_header.html.erb
new file mode 100644
index 0000000..f570e3b
--- /dev/null
+++ b/app/views/layouts/_admin_lte_2_header.html.erb
@@ -0,0 +1,159 @@
+
+
diff --git a/app/views/layouts/_admin_lte_2_sidebar.html.erb b/app/views/layouts/_admin_lte_2_sidebar.html.erb
new file mode 100644
index 0000000..9ea996a
--- /dev/null
+++ b/app/views/layouts/_admin_lte_2_sidebar.html.erb
@@ -0,0 +1,33 @@
+
+
diff --git a/app/views/layouts/admin/_menu.html.slim b/app/views/layouts/admin/_menu.html.slim
new file mode 100644
index 0000000..e484c48
--- /dev/null
+++ b/app/views/layouts/admin/_menu.html.slim
@@ -0,0 +1,12 @@
+adul.sidebar-menu
+ li.header HEADER
+ li.active_
+ = link_to admin_users_path do
+ i.fa.fa-link
+ span users
+ li.active_
+ = link_to admin_users_path do
+ span users
+
+/ lavrik - remove not used
+
diff --git a/app/views/layouts/admin_lte_2.html.erb b/app/views/layouts/admin_lte_2.html.erb
new file mode 100644
index 0000000..317a59d
--- /dev/null
+++ b/app/views/layouts/admin_lte_2.html.erb
@@ -0,0 +1,136 @@
+
+
+
+
+ AdminLTE 2 | Dashboard
+
+
+
+ <%= stylesheet_link_tag 'admin', media: 'all' %>
+
+
+
+ <%= csrf_meta_tags %>
+
+
+
+
+
+ <%= render partial: 'layouts/admin_lte_2_header' %>
+
+ <%= render partial: 'layouts/admin_lte_2_sidebar' %>
+
+
+
+
+
+
+
+
+ <% if notice %>
+
+
+
+ <%= notice %>
+
+ <% end %>
+
+ <% if alert %>
+
+
+
+ <%= alert %>
+
+ <% end %>
+ <%= yield %>
+
+
+
+
+
+
+
+
+
+
+
+
+ <%= javascript_include_tag 'admin' %>
+
+
diff --git a/app/views/layouts/admin_lte_2_login.html.erb b/app/views/layouts/admin_lte_2_login.html.erb
new file mode 100644
index 0000000..efbe691
--- /dev/null
+++ b/app/views/layouts/admin_lte_2_login.html.erb
@@ -0,0 +1,55 @@
+
+
+
+
+ AdminLTE 2 | Log in
+
+
+
+ <%= stylesheet_link_tag 'application', media: 'all' %>
+
+
+
+ <%= csrf_meta_tags %>
+
+
+
+
+
+
Sign in to start your session
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
+
+ <%= f.text_field :email, class: 'form-control', autofocus: true %>
+
+
+
+
+ <%= f.password_field :password, class: 'form-control', autocomplete: 'off' %>
+
+
+
+
+
+ <%= f.submit 'Log in', class: 'btn btn-primary btn-block btn-flat' %>
+
+
+
+
+ <% end %>
+
+
+
+<%= javascript_include_tag 'application' %>
+
+
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 05c6a74..a799015 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -5,11 +5,13 @@
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
- <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
+ <%= stylesheet_link_tag 'application', media: 'all' %>
+ <%= javascript_include_tag 'application' %>
+
<%= yield %>
+