「副題」を入力出来るように対応
authorOHASHI, Norikazu <katz@neko-mori.sakura.ne.jp>
Sun, 7 Jul 2019 14:35:18 +0000 (23:35 +0900)
committerOHASHI, Norikazu <katz@neko-mori.sakura.ne.jp>
Sun, 7 Jul 2019 14:35:18 +0000 (23:35 +0900)
create_table.sql
readme.md
sinatra/app/controllers/web_gui.rb
sinatra/app/models/books_db.rb
sinatra/app/views/book_info.haml
sinatra/app/views/book_regist.haml

index 05df03f..bffdd53 100644 (file)
@@ -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),
index 224b1ea..15fd82c 100644 (file)
--- a/readme.md
+++ b/readme.md
         setup.haml         # setup book parameter view
 ```
 
+<div style="page-break-before:always"></div>
+
 ## テーブル設計
 
 ### ユーザ管理テーブル (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)
 | 項番 | カラム名 | 型 | 属性 | 概要 |
 | --: | --- | --- | --- | --- |
 [openBD](https://openbd.jp)
 
 #### API仕様
- * 書誌情報取得:
-   /get?isbn=ISBN,ISBN
- * 収録範囲の取得:
-   /coverage
- * JSONスキーマの取得:
-   /schema
+* 書誌情報の取得:
+  `/get?isbn=ISBN,ISBN`
+* 収録範囲の取得:
+  `/coverage`
+* JSONスキーマの取得:
+  `/schema`
  
index 2edd129..457cc78 100644 (file)
@@ -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] 著者
index 282ae4b..46a5a27 100644 (file)
@@ -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],
index 321a4ac..d2a2dab 100644 (file)
         書名
       %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
index b730be4..eaa59ae 100644 (file)
           巻数:
         %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