質問編集履歴

1

ビューの追加

2020/05/30 12:35

投稿

kawa0tatsu
kawa0tatsu

スコア7

test CHANGED
File without changes
test CHANGED
@@ -132,6 +132,98 @@
132
132
 
133
133
    end
134
134
 
135
+
136
+
137
+ ビュー(show.html.erb)
138
+
139
+
140
+
141
+ <table>
142
+
143
+
144
+
145
+ <tr><%# Start of th %>
146
+
147
+ <% @instruments.each do |instrument| %>%# Start of instruments th %><%# 楽曲編成に応じてカラムを追加 %>
148
+
149
+ <% if instrument.name.include? 'orchestra' %><%# 管弦楽曲の場合、指揮者カラムを追加 %>
150
+
151
+ <th><%= sortable "conductor", "Conductor" %></th>
152
+
153
+ <% end %>
154
+
155
+
156
+
157
+ <% if instrument.name.include? "#{instrument.name}" %>
158
+
159
+ <th><%= sortable "#{instrument.name}","#{instrument.name}" %></th>
160
+
161
+ <% end %>
162
+
163
+ <% end %><%# End of instruments th %>
164
+
165
+
166
+
167
+ <% (1..@post.mov).each do |movnum| %><%# 楽章数に応じてカラム数が変化 %>
168
+
169
+ <th width="70"><%= sortable "Mov#{movnum}" %></th>
170
+
171
+ <% end %>
172
+
173
+ </tr><%# End of th %>
174
+
175
+
176
+
177
+
178
+
179
+ <% @post.recordings.each do |recording| %>
180
+
181
+
182
+
183
+ <tr>
184
+
185
+ <% @instruments.each do |instrument| %>
186
+
187
+
188
+
189
+ <% if instrument.name.include? 'orchestra' %>
190
+
191
+ <td><%= recording.conductor %></td>
192
+
193
+ <% end %>
194
+
195
+
196
+
197
+ <% if instrument.name.include? "#{instrument.name}" %>
198
+
199
+ <td><%=recording.send("#{instrument.name}") %></td>
200
+
201
+ <% end %>
202
+
203
+
204
+
205
+ <% end %><%# End of the loop of instruments %>
206
+
207
+
208
+
209
+ <% recording.durations.each do |duration| %><%# 楽章ごとの演奏時間 %>
210
+
211
+ <td><%=Time.at(duration.total_seconds).utc.strftime("%M:%S") %></td>
212
+
213
+ <% end %><%# End of durations %>
214
+
215
+
216
+
217
+ </tr>
218
+
219
+
220
+
221
+ <% end %><%# End of the loop of each recordings %>
222
+
223
+
224
+
225
+ </table>
226
+
135
227
  ```
136
228
 
137
229