【问题标题】:Twitter Bootstrap Grail plugin is not workingTwitter Bootstrap Grail 插件不起作用
【发布时间】:2013-07-05 15:44:42
【问题描述】:

我是 Grails 的新手。我在 3 天前开始学习 Grails。我想在我的示例 Grail 应用程序中使用 twitter 引导程序。我正在关注这个tutorial

我在我的 grails-app/conf/BuildConfig 文件中添加了runtime ':twitter-bootstrap:2.3.2'

这是我要使用引导程序的 list.gsp 文件。

<%@ page contentType="text/html;charset=UTF-8" %>
<html>
  <head>
    <title>My Posts</title>
    <r:require modules="bootstrap"/>
  </head>
  <body>
  <g:link controller="post" action="edit">
        Create a new post
  </g:link>
  <div class="well"> 
  <h1>My Posts</h1>

  <g:each in="${posts}" var="post">
    <div>
      <h2>${post.title}</h2>
      <p>${post.teaser}</p>
      <p>Last Updated: ${post.lastUpdated}</p>
      <g:link controller="post" action="edit" id="${post.id}">
            Edit this post
      </g:link>
      <g:link controller="post" action="view" id="${post.id}">
         View this post
      </g:link>
  </div>
  </g:each>
 </div>
 </body>
 </html>

这是我的插件列表

plugins {
    runtime ":hibernate:$grailsVersion"
    runtime ":jquery:1.8.3"
    runtime ":resources:1.2"
    runtime ':twitter-bootstrap:2.3.2'

    // Uncomment these (or add new ones) to enable additional resources capabilities
    //runtime ":zipped-resources:1.0"
    //runtime ":cached-resources:1.0"
    //runtime ":yui-minify-resources:0.1.5"

    build ":tomcat:$grailsVersion"

    runtime ":database-migration:1.3.2"

    compile ':cache:1.0.1'
}

它不工作。我是 Grails 的新手。我不知道为什么它不起作用。请帮忙..

【问题讨论】:

  • 你能显示已安装插件的列表,控制台的输出吗?
  • @baxxabit 我更新了我的问题。请检查。它没有显示任何错误。插件安装成功,但我的 gsp 页面没有显示任何引导功能
  • 您正在编辑主布局吗? github.com/groovydev/…
  • 我通过更改我的 UrlMapping.groovy 文件 "/"(view:"/post/list") 将 list.gsp 作为根
  • 尝试更改 layouts 文件夹中的 main.gsp 并重新启动应用程序

标签: grails twitter-bootstrap grails-plugin grails-2.0


【解决方案1】:

添加到 list.gsp

<meta name="layout" content="main"/>

并更改布局文件夹中的 main.gsp,如 this example

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-14
    • 2023-03-15
    • 2014-06-15
    • 2013-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多