Reputation: 571
im trying to add a custom CSS table alignment in my rails application. But it just doesnt seem to work. Can anyone help me please? Im new to web developing. Im learning HTML, CSS and Rails simultaneously. Here is my app/assessts/stylesheets/custom.css
td {
vertical-align: middle;
}
And i've included style tag in my head tag. Here my app/views/layout/application.html.haml
!!!
%html
%head
%title
= content_for?(:title) ? yield(:title) : "GentelellaOnRails"
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
= stylesheet_link_tag 'custom'
= javascript_include_tag 'application', 'data-turbolinks-track' => true
= csrf_meta_tags
%meta{:content => "width=device-width, initial-scale=1", :name => "viewport"}/
%body.nav-md
.container.body
.main_container
- flash.each do |key, value|
#flash{:align => "center", :class => "alert alert-#{key}"}= value
= render "partials/sidenav"
= render "partials/topnav"
.right_col{:role => "main"}
= yield
= render "partials/footer"
= javascript_include_tag 'footermanifest', 'data-turbolinks-track' => true
And here's my index file :
%h1 Listing all patients
.x_panel
.x_content
= link_to 'New Patient', new_patient_path, class: "btn btn-primary"
%table.table.table-bordered
%thead
%tr
%th Id
%th Image
%th Name
%th Email
%th Address
%th Phone
%th Gender
%th Birthdate
%th Bloodgroup
%th Options
%tbody
- @patients.each do |patient|
%tr
%td= patient.id
%td= image_tag patient.image_url.to_s, :size => "100x80"
%td= patient.name
%td= patient.email
%td= patient.address
%td= patient.phone
%td= patient.gender
%td= patient.birthdate
%td= patient.bloodgroup
%td
= link_to edit_patient_path(patient), class: "btn btn-warning" do
= fa_icon 'pencil'
= link_to patient, :method => :delete, :data => { :confirm => 'Are you sure?' }, class: 'btn btn-danger' do
= fa_icon 'trash'
Upvotes: 0
Views: 75
Reputation: 4427
require custom.css
in application.css
eg
*= require custom
*= require_tree .
and remove line = stylesheet_link_tag 'custom'
from layouts.
Restart your server.
Upvotes: 1