Railsで簡単なアプリケーションを作成して練習しています。
CRUDの処理の実行と関連するページの作成ができ、ページのレイアウトを整えたいです。
bootstrapを実装するところまできて、もうちょっとカッコ良くしたいのですが、sass、scss,
lessなどの種類や、$ rails bootstrap~
などのコマンドで実装されるのか、よくわかりません。
bootstrapを実装すればデザインの方は勝手に変わってくれると思っていたのですが。
具体的には、出力された文字の並び方の変更と、リンクのボタンデザインに変更したいです。一緒にみてもらえないでしょうか。
以下はお手本にしている教材です。このようにしたいです。(scaffoldで作成されています)
現在自分で作成している課題
:追記
まずは出力された文字のレイアウトを整えたいのと、リンクのデザインをカッコ良くしたいです。
よろしくお願いします。
###index.html.erb
index.html.erb
1<h1>書籍一覧</h1> 2 3<%= link_to '新しい書籍を登録',new_book_path %> 4<table> 5 <tr> 6 <th>タイトル</th> 7 <th>テキスト</th> 8 <th colspan="3"></th> 9 </tr> 10 11 <% @books.each do |book| %> 12 <tr> 13 <td><%= book.title %></td> 14 <td><%= book.text %></td> 15 <td><%= link_to '表示',book_path(book) %></td> 16 <td><%= link_to '編集',edit_book_path(book) %></td> 17 <td><%= link_to '削除',book_path(book), 18 method: :delete, 19 data: {confirm: '本当に削除してもいいですか?'} %> 20 </td> 21 </tr> 22 <% end %> 23</table>
###gemfile
gem 'bootstrap', '~> 4.2.1' gem 'jquery-rails'
###application.scss
* 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_tree . *= require_self */ @import "bootstrap";
###application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's // vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. JavaScript code in this file should be added after the last require_* statement. // // 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 jquery3 //= require popper //= require bootstrap-sprockets
index.html.erb
<h1>書籍一覧</h1> <a href="#" class="btn btn-primary btn-lg active" role="button">Primary link</a>
回答1件
あなたの回答
tips
プレビュー