This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
# ruby 2.2.1p85 | |
gem 'rails', '4.2.1' | |
gem 'pg', '~> 0.17.1' | |
gem 'sass-rails', '~> 5.0' | |
gem 'uglifier', '~> 2.7.1' | |
gem 'coffee-rails', '~> 4.1.0' | |
gem 'jquery-rails', '~> 4.0.3' | |
gem 'turbolinks', '~> 2.5.3' | |
gem 'jbuilder', '~> 2.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-# デフォルト:#tabs_table_all_itemsがactive. | |
-# MovingItemsControllerからレンダリングされた場合のみ例外的に#tabs_add_formをactiveにする。 | |
-# クラスのリスト | |
- tab_active = "active" | |
- tab_default = "" | |
- content_default = %w[tab-pane fade] | |
- content_active = %w[tab-pane fade active in] | |
-# クラス交換機 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
# kv_names: 配列 [key名, value名] | |
# collection: hash { key1: value1, key2: value2, ... } | |
def kv_table_for(kv_names, collection={}) | |
thead = content_tag(:thead) do | |
content_tag(:tr) do | |
tags = kv_names.map { |column| content_tag(:th, column, class: "text-center") } | |
safe_join tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Records = React.createClass | |
#... | |
render: -> | |
<div> | |
<table className='table table-bordered'> | |
<thead> | |
<tr> | |
<th>Name</th> | |
<th>Vol</th> | |
<th>Qty</th> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NewMovingRecordForm = React.createClass | |
# 元の状態 | |
getInitialState: -> | |
name: "" | |
volume: "" | |
quantity: "" | |
room: "" | |
category: "" | |
description: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
R = React.DOM | |
# Canvases for charts | |
PieChartCanvas = React.createClass | |
render: -> | |
R.canvas | |
style: { height: 200, width: 200 } | |
BarChartCanvas = React.createClass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "Bar"を引数とすると、Bar Chartを作ります。 | |
React.createElement CustomChart("Bar"), | |
name: "barChart" # 固有の名前 | |
data: @dataForBarChart() # グラフタイプに対応したデータ構造であること | |
height: 200 | |
width: 400 | |
# "Pie"を引数とすると、Pie Chartを作ります。 | |
React.createElement CustomChart("Pie"), | |
name: "pieChart" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IngredientsController < ApplicationController | |
before_action :search_ingredients, only: :index # indexアクションのみ | |
def index | |
end | |
... | |
private |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SearchForm | |
include ActiveModel::Model | |
attr_accessor :q | |
end |
OlderNewer