-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Додані моделі критики авторів, жанрів
- Loading branch information
Showing
206 changed files
with
2,094 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the Auth controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the Zhanr controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
class AuthController < ApplicationController | ||
before_action :set_auth, only: [:show, :edit, :update, :destroy] | ||
|
||
# GET /books | ||
# GET /books.json | ||
def index | ||
@auths = Auth.all | ||
end | ||
|
||
|
||
|
||
# GET /books/1 | ||
# GET /books/1.json | ||
def show | ||
|
||
end | ||
|
||
# GET /books/new | ||
def new | ||
@auth = Auth.new | ||
end | ||
|
||
# GET /books/1/edit | ||
def edit | ||
end | ||
|
||
# POST /books | ||
# POST /books.json | ||
def create | ||
@auth = Auth.new(book_params) | ||
|
||
respond_to do |format| | ||
if @auth.save | ||
format.html { redirect_to @auth, notice: 'Автор успішно доданий' } | ||
format.json { render :show, status: :created, location: @auth } | ||
else | ||
format.html { render :new } | ||
format.json { render json: @auth.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /books/1 | ||
# PATCH/PUT /books/1.json | ||
def update | ||
respond_to do |format| | ||
if @book.update(book_params) | ||
format.html { redirect_to @auth, notice: 'Автор успішно змінений' } | ||
format.json { render :show, status: :ok, location: @auth } | ||
else | ||
format.html { render :edit } | ||
format.json { render json: @auth.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /books/1 | ||
# DELETE /books/1.json | ||
def destroy | ||
@book.destroy | ||
respond_to do |format| | ||
format.html { redirect_to auths_url, notice: 'Книга успішно видалена' } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_book | ||
@book = Auth.find(params[:id]) | ||
end | ||
|
||
# Never trust parameters from the scary internet, only allow the white list through. | ||
def book_params | ||
params.require(:auth).permit(:auth, :book) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,11 @@ def index | |
else | ||
@books = Book.all | ||
end | ||
|
||
end | ||
|
||
|
||
|
||
# GET /books/1 | ||
# GET /books/1.json | ||
def show | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class ZhanrController < ApplicationController | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module AuthHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module ZhanrHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Auth < ApplicationRecord | ||
validates :auth, :book, :presence => true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class Zhanr < ApplicationRecord | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
json.extract! book, :id, :auth, :book | ||
json.url book_url(book, format: :json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<% if session[:lang] == "ua" | ||
text ={ | ||
:auth => "Назва", | ||
:book => "Автор", | ||
:submit => "Підтвердити" | ||
} | ||
elsif session[:lang] == "en" | ||
text ={ | ||
:auth => "Name", | ||
:book => "Author", | ||
:submit => "Submit" | ||
} | ||
elsif session[:lang] == "ru" | ||
text ={ | ||
:auth => "Название", | ||
:book => "Автор", | ||
:submit => "Подтвердить" | ||
} | ||
end | ||
%> | ||
<div class="col-md-4 col-md-offset-4"> | ||
<%= form_for(auth) do |f| %> | ||
<% if auth.errors.any? %> | ||
<div id="error_explanation"> | ||
<h2><%= pluralize(auth.errors.count, "error") %> prohibited this auth from being saved:</h2> | ||
|
||
<ul> | ||
<% auth.errors.full_messages.each do |message| %> | ||
<li><%= message %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div class="form-group"> | ||
<label class="col-xs-2 control-label"><%= text[:auth] %></label> | ||
<%= f.text_field :auth, :class => "form-control" %> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label class="col-xs-2 control-label"><%= text[:book] %></label> | ||
<%= f.text_field :book, :class => "form-control" %> | ||
</div> | ||
<div class="actions"> | ||
<input type="submit" name="submit" class="btn" value=<%= text[:submit] %>> | ||
</div> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<% if session[:lang] == "ua" | ||
text ={ | ||
:h1 => "Редагування книги", | ||
:show => "Показати", | ||
:back => "Назад" | ||
} | ||
elsif session[:lang] == "en" | ||
text ={ | ||
:h1 => "Editing a book", | ||
:show => "Show", | ||
:back => "Back" | ||
} | ||
elsif session[:lang] == "ru" | ||
text ={ | ||
:h1 => "Редактирования книги", | ||
:show => "Показать", | ||
:back => "Назад" | ||
} | ||
end | ||
%> | ||
<div class="back"> | ||
<h1 class="col-md-6 col-md-offset-3 text-center back"><%= text[:h1] %></h1> | ||
|
||
<%= render 'form', book: @book %> | ||
|
||
<%= link_to text[:show], @book %> | | ||
<%= link_to text[:back], books_path %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<% if session[:lang] == "ua" | ||
text ={ | ||
:label_T => "Назва", | ||
:label_A => "Автор", | ||
:label_Z => "Жанр", | ||
:label_Q => "Кількість сторінок", | ||
:label_D => "Опис", | ||
:label_I => "Адреса до картинки", | ||
:h1 => "Книги", | ||
:show => "Показати", | ||
:edit => "Редагувати", | ||
:delete => "Видалити", | ||
:question => "Ви впевнені?", | ||
:new => "Додати нову книгу", | ||
:back => "Назад" | ||
} | ||
elsif session[:lang] == "en" | ||
text ={ | ||
:label_T => "Name", | ||
:label_A => "Author", | ||
:label_Z => "Genre", | ||
:label_Q => "Number of pages", | ||
:label_D => "Description", | ||
:label_I => "Address to the picture", | ||
:h1 => "Books", | ||
:show => "Show", | ||
:edit => "Edit", | ||
:delete => "Remove", | ||
:question => "Are you sure?", | ||
:new => "Add new book", | ||
:back => "Back" | ||
} | ||
elsif session[:lang] == "ru" | ||
text ={ | ||
:label_T => "Название", | ||
:label_A => "Автор", | ||
:label_Z => "Жанр", | ||
:label_Q => "Количество страниц", | ||
:label_D => "Описание", | ||
:label_I => "Адрес к картинке", | ||
:h1 => "Книги", | ||
:show => "Показать", | ||
:edit => "Редактировать", | ||
:delete => "Удалить", | ||
:question => "Вы уверены?", | ||
:new => "Добавить новую книгу", | ||
:back => "Назад" | ||
} | ||
end | ||
%> | ||
|
||
<p id="notice"><%= notice %></p> | ||
|
||
<h1 class="col-md-6 col-md-offset-3 text-center back"><%= text[:h1] %></h1> | ||
<div class="container"> | ||
<div class="row"> | ||
<% @books.each do |book| %> | ||
<div class="col-lg-3"> | ||
<div class="box"> | ||
<div class="box-gray aligncenter"> | ||
<h3><%= link_to book.title, book, :class => "product" %></h3> | ||
<h4><%= book.auth %></h4> | ||
<div class="icon"> | ||
|
||
<i class="fa fa-desktop fa-3x"></i> | ||
</div> | ||
<p> | ||
<%= book.mini_description %><br/> | ||
<%= link_to 'Видалити', book, method: :delete, data: { confirm: 'Ви впевнені?' } %> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
json.array! @books, partial: 'books/book', as: :book |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<% if session[:lang] == "ua" | ||
text ={ | ||
:h1 => "Додати нову книгу", | ||
:back => "Назад" | ||
} | ||
elsif session[:lang] == "en" | ||
text ={ | ||
:h1 => "Add new book", | ||
:back => "Back" | ||
} | ||
elsif session[:lang] == "ru" | ||
text ={ | ||
:h1 => "Добавить новую книгу", | ||
:back => "Назад" | ||
} | ||
end | ||
%> | ||
<div class="back"> | ||
<h1 class="col-md-6 col-md-offset-3 text-center back"><%= text[:h1] %></h1> | ||
|
||
<%= render 'form', auth: @auth %> | ||
|
||
<%= link_to text[:back], auths_path %> | ||
</div> |
Oops, something went wrong.