2014-11-04 4 views
1

내 블로그보기를 변경하고 싶습니다. 모든 것이 프로그램되어 있고 프론트 엔드가 남아 있습니다. 나는 스타일링과 부트 스트랩을 완전히 이해하지 못한다. 탐색을 개선하기 위해 아카이브, 태그 및 기타 필요한 추가 블로그 기능을 표시하는 사이드 바가 있도록보기를 변경하려고합니다. 상단에 탐색 모음이 이미 있지만 기사 또는 주요 텍스트 옆에 왼쪽 또는 오른쪽에 세로 막대를 만들고 싶습니다. 어쨌든 내 응용 프로그램 레이아웃 파일에서 그리드 시스템을 사용하려고 할 때 기사의 상단 또는 사이드 바가 왼쪽이나 오른쪽이 아닌 아래쪽에 나타납니다. 여기 내 주하는 SCS 파일은 다음과 같습니다사이드 바를 어떻게 만듭니 까?

여기
@import "bootstrap-sprockets"; 
@import "bootstrap"; 
/* mixins, variables */ 
/* universal */ 
html { 
overflow-y: scroll; 
    } 
body { 
padding-top: 60px; 
    } 
section { 
    overflow: scroll; 
    } 
textarea { 
resize: vertical; 
} 
.center { 
text-align: center; 
h1 { 
margin-bottom: 10px; 
    } 
} 
/* typography */ 

h1, h2, h3, h4, h5, h6 { 
line-height: 1; 
} 
h1 { 
font-size: 3em; 
letter-spacing: -2px; 
margin-bottom: 30px; 
text-align: center; 
    } 
h2 { 
font-size: 1.2em; 
letter-spacing: -1px; 
margin-bottom: 30px; 
text-align: center; 
font-weight: normal; 
color: #777 
    } 
p { 
font-size: 1.1em; 
line-height: 1.7em; 
    } 
    /* 
    footer{ 
    position: fixed ; 
    height: 100px; 
    bottom: 0 ; 
    width: 100% 
    div ul li{ 
display:block; 
vertical-align: top; 
width: 50%; 
float: left; 
} 
} */ 
@mixin box_sizing { 
-moz-box-sizing: border-box; 
-webkit-box-sizing: border-box; 
box-sizing:   border-box; 
    } 
/* miscellaneous */ 
.debug_dump { 
    clear: both; 
    float: left; 
    width: 100%; 
    margin-top: 45px; 
@include box_sizing; 
    } 
/* forms */ 
    input, textarea, select, .uneditable-input { 
    border: 1px solid #bbb; 
    width: 100%; 
    margin-bottom: 15px; 
    @include box_sizing; 
    } 
    input { 
    height: auto !important; 
    } 
    #error_explanation { 
    color: red; 
    ul { 
    color: red; 
    margin: 0 0 30px 0; 
    } 
    } 
.field_with_errors { 
    @extend .has-error; 
.form-control { 
    color: $state-danger-text; 
    } 
    } 

내 레이아웃/apllication.html.erb 파일 /customstyling.css.scss (내가 <% = 수율 %>의 출력이 왼쪽 또는 오른쪽에 있어야 할 사이드 바 : 여기

<!DOCTYPE html> 
    <html> 
    <head> 
    <title><%= full_title(yield(:title)) %></title> 
    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> 
    <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> 
    <%= csrf_meta_tags %> 
    <%= render 'layouts/shim' %> 
    </head> 
     <body> 
     <%= render 'layouts/header' %> 
     <div class="container"> 
     <% flash.each do |message_type, message| %> 
     <div class="alert alert-<%= message_type %>"><%= message %></div> 
     <% end %> 
     <%= yield %> 
     <hr> 
     <h6> 
     <% if logged_in? %> 
     <%= "Logged in as #{current_user.email}" %> 
     <%= link_to "Log out", logout_path %> 
     <% else %> 
     <%= link_to "Log in", login_path %> if you are one of our bloggers 
     <% end %> 
      </h6> 
     </div> 
     <%= debug(params) if Rails.env.development? %> 
     </body> 
     </html> 

그리고 내 기사/index.html.erb의 <% = 수율 %> 내용의 한 예는 다음과 같습니다

<h1>All Articles</h1> 
<ul id="articles"> 
<% @articles.each do |article| %> 
<li> 
    <h4><%= link_to article.title, article_path(article) %></h4> 
<% if article.image.exists? %> 
<%= image_tag article.image.url %> 
<% end %> 
    <p> 
    <%= article.body %></p> 
    <p><small><strong> Date:</strong> <%= article.created_at.to_s %></p></small> 
</li> 
<% end %> 
</ul> 
<h3>Archives </h3> 
<% if @posts.to_a.empty? %> 
<div class="post"> 
<p>No articles found...</p> 
</div> 
<% else %> 
<% current_month = 0 %> 
<% current_year = 0 %> 
<% for article in @posts %> 
<% if (article.created_at.year != current_year) 
current_year = article.created_at.year %> 
<h3 class="archiveyear"><%= article.created_at.year%></h3> 
<% end %> 
<% if (article.created_at.month != current_month || article.created_at.year != current_year) 
current_month = article.created_at.month 
current_year = article.created_at.year %> 
<h4 class="archivemonth"><%= (Date::MONTHNAMES[article.created_at.month]) %></h4> 
<% end %> 
<div class="archivepost"> 
<%= link_to article.title, article_path(article) %> on <%= article.created_at.strftime('%A')%> - <%= article.created_at.strftime('%d') + "th"%> 
</div> 
<% end -%> 
<%end %> 
<hr> 
<h6> 
<% if logged_in? %> 
<%= link_to "Create a New Article", new_article_path, class: "new_article" %> 
<% end %> 
</h6> 

나는 부트 스트랩 그리드를 사용하여 시도했다. -체계 사이드 바는 span3이고 본체 내용은 span8의 네비게이션 바 아래에 있지만 사이드 바 및 본문 내용은 나란히 나타나지 않습니다. 대신 하나는 다른 하나의 상단에있었습니다. 내 맞춤 스타일링 파일이나 내 기사/index.html.erb 및 기타보기에서 문제가 있습니다. 도움을 주셔서 감사합니다. 무술

답변

0

최신 버전의 부트 스트랩을 사용한다고 가정하면 행에있는 내용을 마무리해야합니다. 이 시도 : 귀하의 경우 그래서

<div class="row"> 
    <div class="col-md-8"> 
    <!-- paste the regular page contents here --> 
    </div> 
    <div class="col-md-3"> 
    <!-- paste the sidebar contents here --> 
    </div> 
</div> 

을 :

<!DOCTYPE html> 


<html> 
    <head> 
    <title><%= full_title(yield(:title)) %></title> 
    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> 
    <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> 
    <%= csrf_meta_tags %> 
    <%= render 'layouts/shim' %> 
    </head> 
     <body> 
     <%= render 'layouts/header' %> 
     <div class="container"> 
     <% flash.each do |message_type, message| %> 
     <div class="alert alert-<%= message_type %>"><%= message %></div> 
     <% end %> 

     <div class="row"> 
     <div class="col-md-8"> 
      <%= yield %> 
     </div> 
     <div class="col-md-3"> 
      <!-- sidebar content goes here --> 
     </div> 
     </div> 

     <hr> 

     <h6> 
     <% if logged_in? %> 
     <%= "Logged in as #{current_user.email}" %> 
     <%= link_to "Log out", logout_path %> 
     <% else %> 
     <%= link_to "Log in", login_path %> if you are one of our bloggers 
     <% end %> 
     </h6> 
     </div> 
     <%= debug(params) if Rails.env.development? %> 
    </body> 
    </html> 

귀하의 들여 쓰기 종류의 재미, 그래서 미안 해요 조금 떨어져있어 경우입니다.

+0

보석 부트 스트랩 - 사스 3.2.0을 사용하고 있습니다. 최신 부트 스트랩 릴리스 겠지? – codigomonstruo

+0

고마워요. 닉. 나는 대신 span8과 span3을 사용하고 있었다고 생각합니다. – codigomonstruo

+0

기꺼이 도와 드리겠습니다. –