-1

레일 웹 앱에 부트 스트랩을 사용하는 데 몇 시간을 보냈지만 아무 일도하지 않았습니다! 나는 어떤 수업도 부를 수 없다! 심지어 존재하지 않는 것처럼Redmine 플러그인에서 부트 스트랩이 작동하지 않습니다

<div class="center"> 
    <h1>Welcome to the User Database</h1> 
</div> 

<div class="jumbotron"> 
    <h2> 
    This is the home page for the User Database. 
    </h2> 

    **<%= link_to "Add new entry", new_user_path, class: "btn btn-primary" %> 
    <%= button_to "Search", users_search_path, class: "button", :method => :get %>** 
</div> 

<!-- User Image --> 
<div class="center"> 
    <%= image_tag('user.jpg', :plugin => 'users') %> 
</div> 

<!-- Style sheet --> 
<% content_for :header_tags do %> 
<%= stylesheet_link_tag 'style', :plugin => 'users' %> 
<% end %> 

공지 굵게 표시된 코드 ...을 LINK_TO 라인이 완전히 부트 스트랩 클래스를 무시 :

여기 내 index.html.erb입니다! button_to 라인 (예, 나는 그것을 업데이트 이후 설치 번들 실행)

내 Gemfile는 부트 스트랩을 포함 ... 완전히 잘 작동 :

@import "bootstrap-sprockets"; 
@import "bootstrap"; 

/* mixins, variables, etc. */ 

/* universal */ 

body { 
    padding-top: 0px; 
} 

section { 
    overflow: auto; 
} 

... 
:

source 'https://rubygems.org' 

if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.5.0') 
    abort "Redmine requires Bundler 1.5.0 or higher (you're using #{Bundler::VERSION}).\nPlease update with 'gem update bundler'." 
end 

#Trying to get bootstrap...? 
gem 'bootstrap-sass', '3.3.6' 

gem "rails", "4.2.3" 
gem "jquery-rails", "~> 3.1.3" 

... 

또한, 내 CSS 파일은 가장 확실하게 부트 스트랩을 포함

나는 또한 심지어 내 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, vendor/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 jquery 
//= require jquery_ujs 
//= require turbolinks 
//= require bootstrap-sprockets 
//= require_tree . 

그것을 그냥 작동하지 않습니다! 내가 생각할 수있는 유일한 점은 Redmine을위한 플러그인의 일부로 레일 애플리케이션을 구축하고 있는데, 어떻게 든 모든 것을 망쳐 놓고 있다는 것입니다. 그러나 나는 어떻게 보이지 않습니다!

업데이트 : 시도

이 일을 :

<% content_for :header_tags do %> 
    <%= stylesheet_link_tag 'application', :plugin => 'users' %> 
<% end %> 

하지만이 비밀 오류!

ActionController::RoutingError (No route matches [GET] "/plugin_assets/users/stylesheets/bootstrap"): 

나는 그 의미를 이해하지 못합니다. 스타일 시트 디렉토리에서 부트 스트랩 파일을 찾는 이유는 무엇입니까 ?? Google은이 오류 메시지에 대해 들어 본 적이 없습니다!

+0

먼저,': plugin => 'users'가 무엇을 하려는지는 확실치 않지만 그것을 제거하십시오. 둘째, 레이아웃 파일에 부트 스트랩의 컨테이너 div를 설정 했습니까? – phillyslick

+0

내 응용 프로그램이 redmine 용 플러그인이기 때문에 해당 행이 필요합니다. 참조하십시오 : http://www.redmine.org/projects/redmine/wiki/Plugin_Tutorial#Improving-the-plugin-views 그리고 나는 모든 레이아웃 파일을 가지고 있지 않습니다. 부트 스트랩의 컨테이너 div가 ....인지 모르겠다. 나는이 물건에 완전한 noobie이다 – ineedahero

+0

아, 참으로. 죄송합니다. 컨테이너 div가 필요하지 않을 수 있습니다. 그러나 여기에서 문서를 확인하십시오. http://getbootstrap.com/css/ 'button_to'는 부트 스트랩 버튼으로 렌더링한다고 말합니까? – phillyslick

답변

2

실망스럽게 생각 합니다만, 부트 스트랩을 사용하여 Redmine 플러그인을 제작하고 있다면 잘못하고있는 것입니다. 플러그 - 인 (플랫폼에 상관없이)은 호스트 플랫폼 자체와 관련하여 원활한 사용자 경험을 제공해야합니다. Redmine은 부트 스트랩을 사용하지 않기 때문에 플러그인에 사용해야 할 이유가 없습니다.

대신 Redmine에서 app/views 디렉토리를보고 플러그인에서 동일한 HTML 요소를 사용해야합니다. 보다 원활한 UI와 사용자 정의 CSS에 대한 필요성이 줄어들 것입니다. 도움이 되었으면합니다.

+1

아, 아주 재미 있습니다. 통찰력 주셔서 감사합니다. 그들이 말한 것이 사실이라고 생각합니다. 스크류 드라이버를 사용하여 손톱을 망치로 사용하지 마십시오. :) – ineedahero

1

Redmine은 자산 파이프 라인을 지원하지 않습니다 (here, 4 년 된 대화 참조). 여기서 sass/scss 파일을 사용할 수 없습니다. 먼저 정규 CSS/js 파일을 가져 와서 각각의 파일을 수동으로 가져와야합니다.

정말로 부트 스트랩을 사용하고 싶다면 먼저 도우미를 제공하는 redmine_bootstrap_kit 플러그인을 설치하면 더 편리하게 사용할 수 있습니다 (본인이 아닙니다). assets 디렉토리가 자동으로 public/plugin_assets/your_plugin 폴더에 레드 마인을 실행할 때마다 복사

플러그인 : 내용

.

<%= stylesheet_link_tag 'style', :plugin => 'users' %> 은 일반적으로 .js.css 파일 추가 리소스 (이미지, 글꼴에 대한 링크를 포함하고 있습니다 public/plugin_assets/users/javascripts/script.js

에 위치한 script.js 파일을 찾을 것인가 public/plugin_assets/users/stylesheets/style.js

<%= javascript_include_tag 'script', :plugin => 'users' %> 에 위치한 style.css 파일을 찾을 것입니다. ..). 그런 다음이 리소스를 assets/images/assets/fonts ...에 포함하고 .js.css 파일에 언급 된 상대 경로가 유효한지 확인해야합니다.