Skip to content

Commit

Permalink
Змінені стилі, додані дрібні правки, додана посторінкова навігація, в…
Browse files Browse the repository at this point in the history
…иправлена помилка праці пошуку з посторінковою навігацією
  • Loading branch information
lakatoshv committed May 26, 2018
1 parent 1b4fbec commit 59cd3fd
Show file tree
Hide file tree
Showing 11 changed files with 1,549 additions and 145 deletions.
2 changes: 1 addition & 1 deletion app/controllers/books_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ def set_book

# Never trust parameters from the scary internet, only allow the white list through.
def book_params
params.require(:book).permit(:title, :auth, :zhanr, :pages_qty, :description, :image_url)
params.require(:book).permit(:title, :auth, :zhanr, :pages_qty, :description, :image_url, :mini_description)
end
end
2 changes: 1 addition & 1 deletion app/models/book.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Book < ApplicationRecord

validates :title, :auth, :zhanr, :pages_qty, :description, :image_url, :presence => true
validates :title, :auth, :zhanr, :pages_qty, :description, :image_url, :mini_description, :presence => true
def self.search(search)
where(['title LIKE ? OR auth LIKE ? OR zhanr LIKE ? OR description LIKE ? ', "%#{search}%", "%#{search}%", "%#{search}%", "%#{search}%"])

Expand Down
2 changes: 1 addition & 1 deletion app/views/books/_book.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
json.extract! book, :id, :title, :auth, :zhanr, :pages_qty, :description, :image_url, :created_at, :updated_at
json.extract! book, :id, :title, :auth, :zhanr, :pages_qty, :description, :image_url, :mini_description, :created_at, :updated_at
json.url book_url(book, format: :json)
8 changes: 8 additions & 0 deletions app/views/books/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:label_Z => "Жанр",
:label_Q => "Кількість сторінок",
:label_D => "Опис",
:label_MD => "Короткий опис",
:label_I => "Адреса до картинки",
:submit => "Підтвердити"
}
Expand All @@ -15,6 +16,7 @@
:label_Z => "Genre",
:label_Q => "Number of pages",
:label_D => "Description",
:label_MD => "Mini description",
:label_I => "Address to the picture",
:submit => "Submit"
}
Expand All @@ -25,6 +27,7 @@
:label_Z => "Жанр",
:label_Q => "Количество страниц",
:label_D => "Описание",
:label_MD => "Краткое описание",
:label_I => "Адрес к картинке",
:submit => "Подтвердить"
}
Expand Down Expand Up @@ -64,6 +67,11 @@
<%= f.text_field :pages_qty, :class => "form-control" %>
</div>

<div class="form-group">
<label class="col-xs-2 control-label"><%= text[:label_MD] %></label>
<%= f.text_area :mini_description, :class => "form-control" %>
</div>

<div class="form-group">
<label class="col-xs-2 control-label"><%= text[:label_D] %></label>
<%= f.text_area :description, :class => "form-control" %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/books/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
<i class="fa fa-desktop fa-3x"></i>
</div>
<p>
<%= book.description %>
<%= book.mini_description %><br/>
<%= link_to 'Видалити', book, method: :delete, data: { confirm: 'Ви впевнені?' } %>
</p>

</div>
</div>
</div>
Expand Down
Binary file modified db/development.sqlite3
Binary file not shown.
4 changes: 3 additions & 1 deletion db/migrate/20170429130500_create_books.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ def change
t.string :zhanr
t.string :pages_qty
t.text :description
t.text :mini_description
t.integer :likes_qty
t.integer :dislikes_qty
t.string :image_url

t.timestamps
end
end
Expand Down
7 changes: 5 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
t.string "zhanr"
t.string "pages_qty"
t.text "description"
t.text "mini_description"
t.integer "likes_qty"
t.integer "dislikes_qty"
t.string "image_url"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "line_items", force: :cascade do |t|
Expand Down
1,663 changes: 1,527 additions & 136 deletions log/development.log

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
I"~app/assets/stylesheets/application.scss?type=text/css&id=35e15a1cce284e45244954027d061a97bef85c97d52c4f6270aeb409e6d340fc:ET
I"~app/assets/stylesheets/application.scss?type=text/css&id=4ff89ab7ef0ed289feb5b62ae0a3da67bd96f088f999bede7cf21713cf1a4d01:ET

0 comments on commit 59cd3fd

Please sign in to comment.