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
> Successfully installed Yarn 1.7.0! Please open another terminal where the `yarn` command will now be available. | |
[ec2-user@ip-172-31-32-152 chat-space]$ rails assets:precompile | |
Yarn executable was not detected in the system. | |
Download Yarn at https://yarnpkg.com/en/docs/install | |
[ec2-user@ip-172-31-32-152 chat-space]$ source ~/.bashrc | |
[ec2-user@ip-172-31-32-152 chat-space]$ yarn -v | |
1.7.0 | |
[ec2-user@ip-172-31-32-152 chat-space]$ rails assets:precompile | |
yarn install v1.7.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
.container.proto-new | |
= form_for @prototype do |f| | |
= f.hidden_field :user_id, value: current_user.id | |
.col-md-8.col-md-offset-2 | |
%header.row.user-nav.row | |
.col-md-12 | |
%h4 Title | |
.proto-new-title | |
= f.text_field :title, required: true, autofocus: true, placeholder: "Input Title" | |
.row |
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
//略 | |
$(function (){ | |
//type属性がfileのinputタグに変化があった(=ファイルが選択された)ら発火 | |
$('input[type="file"]').on('change',function previewFile(e) { | |
//変更があった要素の1個前のimg要素をpreviewとする | |
var preview = $(this).prev('img')[0] | |
//のちのち消します | |
console.log($(this).prev('img')[0]); | |
//この2行は定型の書き方で、Filereaderを使って選択されたファイルを取得 | |
var file = e.target.files[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
[2] pry(#<PrototypesController>)> @prototype.captured_images | |
CapturedImage Load (0.6ms) SELECT `captured_images`.* FROM `captured_images` WHERE `captured_images`.`prototype_id` = 5 | |
=> [#<CapturedImage:0x007ffaa7ab15b8 | |
id: 8, | |
content: "b2_02.jpg", | |
status: 0, | |
prototype_id: 5, | |
order: 0>, | |
#<CapturedImage:0x007ffaa7ab13d8 | |
id: 9, |
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
.container.proto-new | |
= form_for @prototype do |f| | |
= f.hidden_field :user_id, value: current_user.id | |
.col-md-8.col-md-offset-2 | |
%header.row.user-nav.row | |
.col-md-12 | |
%h4 Title | |
.proto-new-title | |
= f.text_field :title, required: true, autofocus: true, placeholder: "Input Title" | |
.row |
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
.pulldown { | |
width: 300px; | |
margin: 0 0 10px 20px; | |
} | |
.pulldown-head { | |
background-color: lightgreen; | |
height: 40px; | |
} |
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
$(document).on('turbolinks:load', function() { | |
$(function (){ | |
$('#prototype_captured_images_attributes_0_content').on('change',function previewFile(e) { | |
var preview = $("#selected_image") | |
var file = e.target.files[0]; | |
var reader = new FileReader(); | |
reader.onloadend = function () { | |
preview.src = reader.result; | |
$("#selected_image").attr("src", preview.src); |
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
.container.proto-new | |
= form_for @prototype do |f| | |
= f.hidden_field :user_id, value: current_user.id | |
.col-md-8.col-md-offset-2 | |
%header.row.user-nav.row | |
.col-md-12 | |
%h4 Title | |
.proto-new-title | |
= f.text_field :title, required: true, autofocus: true, placeholder: "Input Title" | |
.row |
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
Started GET "/prototypes/1/edit" for ::1 at 2018-06-30 14:43:15 +0900 | |
Processing by PrototypesController#edit as HTML | |
Parameters: {"id"=>"1"} | |
Prototype Load (6.5ms) SELECT `prototypes`.* FROM `prototypes` WHERE `prototypes`.`id` = 1 LIMIT 1 | |
CapturedImage Load (0.3ms) SELECT `captured_images`.* FROM `captured_images` WHERE `captured_images`.`prototype_id` = 1 AND `captured_images`.`id` = 1 LIMIT 1 | |
User Load (0.8ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1 | |
CapturedImage Load (0.3ms) SELECT `captured_images`.* FROM `captured_images` WHERE `captured_images`.`prototype_id` = 1 | |
Rendered prototypes/edit.html.haml within layouts/application (9.3ms) | |
Rendered shared/_header.html.haml (1.5ms) | |
Rendered shared/_messages.html.haml (0.1ms) |
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
function get_english_date() { | |
const month_english_list = ['Jan.','Feb.','Mar.','Apr.','May','June','July','Aug.','Sept.','Oct.','Nov.','Dec.'] | |
//月の英語表記を配列に定義。省略形は不規則で、①Mayは3文字だからカンマはいらない、②June, Julyは4文字のまま、③9月は4文字でSept. 初めて知った。 | |
var date = new Date() | |
//Dateオブジェクトで日付を取得(引数を持たせなければ現在時刻を取得する) | |
var month = date.getMonth() | |
//dateから月を取り出してmonthに代入 | |
var month_english = month_english_list[month] |