質問編集履歴
2
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,59 +8,73 @@
|
|
8
8
|
|
9
9
|
<div class="input-group">
|
10
10
|
|
11
|
-
<span class="input-group-btn">
|
11
|
+
<span class="input-group-btn">
|
12
12
|
|
13
|
-
<button class="btn" type="button"><span class="fui-calendar"></span></button>
|
13
|
+
<button class="btn" type="button"><span class="fui-calendar"></span></button>
|
14
14
|
|
15
|
-
|
15
|
+
</span>
|
16
16
|
|
17
|
-
|
17
|
+
<%= text_field_tag :limit_date, params[:limit_date],#ここでモデルと関連付いていないテキストフィールドを定義
|
18
18
|
|
19
|
-
|
19
|
+
data: {:default => Time.now + 14.day,
|
20
20
|
|
21
|
+
:start_year => Time.zone.now.year,
|
22
|
+
|
23
|
+
:end_year => Time.zone.now.year + 1, :minute_step => 10 },
|
24
|
+
|
25
|
+
autocomplete: "on",
|
26
|
+
|
27
|
+
class: 'form-control datepicker',
|
28
|
+
|
29
|
+
placeholder: '2016/09/28',
|
30
|
+
|
31
|
+
id:"datepicker-01"%>
|
32
|
+
|
21
|
-
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
</div>
|
22
36
|
|
23
37
|
|
24
38
|
|
25
39
|
|
26
40
|
|
27
|
-
<div class="
|
41
|
+
<div class="col-sm-9 col-md-4 col-lg-4">
|
28
42
|
|
29
|
-
<span class="input-group-btn">
|
30
43
|
|
31
|
-
<button class="btn" type="button"><span class="fui-time"></span></button></span>
|
32
44
|
|
33
|
-
|
45
|
+
<div class="input-group">
|
34
46
|
|
35
|
-
|
47
|
+
<span class="input-group-btn">
|
36
48
|
|
37
|
-
|
49
|
+
<button class="btn" type="button"><span class="fui-time"></span></button>
|
38
50
|
|
51
|
+
</span>
|
52
|
+
|
53
|
+
<%= text_field_tag :limit_time, params[:limit_time],
|
54
|
+
|
55
|
+
data: {:default => Time.now + 14.day,
|
56
|
+
|
57
|
+
:start_year => Time.zone.now.year,
|
58
|
+
|
59
|
+
:end_year => Time.zone.now.year + 1,
|
60
|
+
|
61
|
+
:minute_step => 10 },
|
62
|
+
|
63
|
+
autocomplete: "off",
|
64
|
+
|
65
|
+
placeholder: ' 12:30 PM',
|
66
|
+
|
67
|
+
class: 'form-control timepicker',
|
68
|
+
|
39
|
-
id:"timepicker-01"%>
|
69
|
+
id: "timepicker-01"%>
|
40
70
|
|
41
71
|
</div>
|
72
|
+
|
73
|
+
</div>
|
42
74
|
|
43
75
|
|
44
76
|
|
45
77
|
```
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
78
|
|
65
79
|
|
66
80
|
|
@@ -96,11 +110,13 @@
|
|
96
110
|
|
97
111
|
def create
|
98
112
|
|
99
|
-
@item
|
113
|
+
@item = current_user.items.build(item_params)
|
100
114
|
|
101
115
|
limit_day_str = "#{params[:limit_date]} #{params[:limit_time]}"
|
102
116
|
|
103
117
|
@item.limit_day = limit_day_str
|
118
|
+
|
119
|
+
|
104
120
|
|
105
121
|
|
106
122
|
|
@@ -135,9 +151,3 @@
|
|
135
151
|
end
|
136
152
|
|
137
153
|
```
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
![イメージ説明][WIDTH:250](28c4bb33af84988bf1a29ace6b6b0987.png)
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -42,10 +42,102 @@
|
|
42
42
|
|
43
43
|
|
44
44
|
|
45
|
+
```
|
45
46
|
|
46
47
|
|
47
48
|
|
48
49
|
|
49
50
|
|
50
51
|
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
```lang-<ruby>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
def new
|
88
|
+
|
89
|
+
@item = current_user.items.build
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
def create
|
98
|
+
|
99
|
+
@item.attributes = current_user.items.build(item_params)
|
100
|
+
|
101
|
+
limit_day_str = "#{params[:limit_date]} #{params[:limit_time]}"
|
102
|
+
|
103
|
+
@item.limit_day = limit_day_str
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
respond_to do |format|
|
108
|
+
|
109
|
+
if @item.save
|
110
|
+
|
111
|
+
format.html { redirect_to items_continue_url, notice: 'アイテムを登録しました' }
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
#@user = User.find_by(id: current_user.id)
|
116
|
+
|
117
|
+
# deliverメソッドを使って、メールを送信する
|
118
|
+
|
119
|
+
# ItemMailer.item_email(@user, @item).deliver
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
format.json { render :show, status: :created, location: @item }
|
124
|
+
|
125
|
+
else
|
126
|
+
|
127
|
+
format.html { render :new }
|
128
|
+
|
129
|
+
format.json { render json: @item.errors, status: :unprocessable_entity }
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
51
137
|
```
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
![イメージ説明][WIDTH:250](28c4bb33af84988bf1a29ace6b6b0987.png)
|