From: OHASHI, Norikazu Date: Sun, 7 Jul 2019 14:35:18 +0000 (+0900) Subject: 「副題」を入力出来るように対応 X-Git-Url: http://www.wald-der-katze.sakura.ne.jp/git/gitweb.cgi?a=commitdiff_plain;h=d439dc460de21e95b4004a37bd97426a19c929d6;p=book_server.git 「副題」を入力出来るように対応 --- diff --git a/create_table.sql b/create_table.sql index 05df03f..bffdd53 100644 --- a/create_table.sql +++ b/create_table.sql @@ -12,6 +12,7 @@ CREATE TABLE users ( CREATE TABLE books ( isbn VARCHAR(14) NOT NULL PRIMARY KEY, title VARCHAR(255) NOT NULL, + subtitle VARCHAR(255), volume INTEGER, series VARCHAR(255), author VARCHAR(127), diff --git a/readme.md b/readme.md index 224b1ea..15fd82c 100644 --- a/readme.md +++ b/readme.md @@ -36,12 +36,14 @@ setup.haml # setup book parameter view ``` +
+ ## テーブル設計 ### ユーザ管理テーブル (users) | 項番 | カラム名 | 型 | 属性 | 概要 | -| --: | --- | --- | --- | --- | +| --: | --- | --- | --- | --- | | 1 | user_id | INTEGER | NOT NULL, AUTO_INCREMENT, PRIMARY KEY | ユーザID | | 2 | user_name | VARCHAR(10) | NOT NULL, UNIQUE | ユーザ名 | | 3 | full_name | VARCHAR(127) | | ユーザフルネーム | @@ -82,7 +84,6 @@ | 6 | update_at | DATETIME | NOT NULL | 更新日時 | 注: isdn + user_id で複合キーとする。 - ### 書影管理テーブル (book\_covers) | 項番 | カラム名 | 型 | 属性 | 概要 | | --: | --- | --- | --- | --- | @@ -110,10 +111,10 @@ [openBD](https://openbd.jp) #### API仕様 - * 書誌情報取得: - /get?isbn=ISBN,ISBN - * 収録範囲の取得: - /coverage - * JSONスキーマの取得: - /schema +* 書誌情報の取得: + `/get?isbn=ISBN,ISBN` +* 収録範囲の取得: + `/coverage` +* JSONスキーマの取得: + `/schema` diff --git a/sinatra/app/controllers/web_gui.rb b/sinatra/app/controllers/web_gui.rb index 2edd129..457cc78 100644 --- a/sinatra/app/controllers/web_gui.rb +++ b/sinatra/app/controllers/web_gui.rb @@ -213,6 +213,7 @@ class WebGui < Sinatra::Base @id = id @username = user.full_name @book_info = Hash.new + @update_f = book_update_f rescue UserAccount::NotFoundInstanceError raise WebError.new(status: 404, message: "ユーザ情報が存在しません。") end @@ -234,6 +235,7 @@ class WebGui < Sinatra::Base @id = id @username = user.full_name @book_info = BookManager.getBookCollect(isbn, id) + @update_f = book_update_f rescue UserAccount::NotFoundInstanceError raise WebError.new(status: 404, message: "ユーザ情報が存在しません。") end @@ -243,6 +245,7 @@ class WebGui < Sinatra::Base # 蔵書の登録/編集 (POST) # @post_param isbn [String] ISBN # @post_param title [String] 書名 + # @post_param subtitle [String] 副題 # @post_param volume [Integer] 巻数 # @post_param series [String] 単行本シリーズ # @post_param author [String] 著者 diff --git a/sinatra/app/models/books_db.rb b/sinatra/app/models/books_db.rb index 282ae4b..46a5a27 100644 --- a/sinatra/app/models/books_db.rb +++ b/sinatra/app/models/books_db.rb @@ -121,6 +121,7 @@ class BookManager search_type: SEARCH_ON_BOOKS, isbn: book.isbn, title: book.title, + subtitle: book.subtitle, volume: book.volume, series: book.series, author: book.author, @@ -328,6 +329,7 @@ class BookManager { isbn: book[:isbn], title: book[:title], + subtitle: book[:subtitle], volume: book[:volume], series: book[:series], author: book[:author], diff --git a/sinatra/app/views/book_info.haml b/sinatra/app/views/book_info.haml index 321a4ac..d2a2dab 100644 --- a/sinatra/app/views/book_info.haml +++ b/sinatra/app/views/book_info.haml @@ -21,6 +21,12 @@ 書名 %td #{book_title} + - if book_info[:subtitle] != nil and book_info[:subtitle] != "" + %tr + %th + 副題 + %td + #{book_info[:subtitle]} - if book_info[:series] != nil and book_info[:series] != "" %tr %th diff --git a/sinatra/app/views/book_regist.haml b/sinatra/app/views/book_regist.haml index b730be4..eaa59ae 100644 --- a/sinatra/app/views/book_regist.haml +++ b/sinatra/app/views/book_regist.haml @@ -39,6 +39,12 @@ 巻数: %input{ :name => 'volume', :type => 'text', :class => 'input_text', :id => 'volume', :size => 3, :value => book_info[:volume]} + .item + %label{ :for => 'subtitle' } + %span + 副題: + %input{ :name => 'subtitle', :type => 'text', :class => 'input_text', :id => 'subtitle', :value => book_info[:subtitle]} + .item %label{ :for => 'series' } %span