如何安装bootstrap js?

时间:2016-07-10 14:07:36

标签: ruby-on-rails

我按照hartl rails book来安装bootstrap css文件,但我相信我错过了javascript。以下是这本书告诉我要做的事情:

  1. bootstrap-sass添加到Gemfile:gem 'bootstrap-sass'
  2. 运行捆绑安装
  3. 将以下内容添加到css:

    @import "bootstrap-sprockets";
    @import "bootstrap";
    
  4. 添加javascript部分还需要做些什么?我的application.js现在:

    //= require jquery
    //= require bootstrap
    //= require jquery_ujs
    //= require turbolinks
    //= require_tree .
    

1 个答案:

答案 0 :(得分:4)

来自docs

  

在app / assets / javascripts / application.js中需要Bootstrap Javascripts

所以在char[] newArray = ArrayUtils.addAll(word1, word2); 添加:

#include <stdio.h>
#include <math.h>
#include <stdint.h>

void increment(uint8_t * bytes, int size, int i) {

    if (i >= size) {
        // Number overflow, start at 0.
        return;
    }

    uint8_t b = bytes[i];

    // Check if byte will overflow.
    if (b == 0xFF) {
        // Byte overflow, carry overflow to next byte.
        b = 0;
        increment(bytes, size, i + 1);
    }
    else {
        // Increment byte.
        b ++;
    }

    bytes[i] = b;
}

int equal(const uint8_t * a, const uint8_t * b, int size) {

    for (int i = 0; i < size; i++) {
        if (a[i] != b[i]) {
            // At least one byte is different.
            return 0;
        }
    }

    // All bytes are the same.
    return 1;
}

void printBytes(const uint8_t * bytes, int size) {

    for (int i = 0; i < size; i++) {
        printf("%02x ", bytes[size - i - 1]);
    }

    printf("\n");
}

int main(int argc, const char * argv[]) {

    // Add more bytes here: { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
    uint8_t bytes[] = { 0, 0, 0 };
    uint8_t max[] = { 0xFF, 0xFF, 0xFF };
    int size = sizeof(bytes);

    while (!equal(bytes, max, size)) {

        printBytes(bytes, size);

        increment(bytes, size, 0);
    }

    return 0;
}

另外,请不要忘记在application.js之后重新启动服务器。