Sfoglia il codice sorgente

Move lectures panel to separate file

Frans Bergman 7 anni fa
parent
commit
f0a789981a
2 ha cambiato i file con 30 aggiunte e 29 eliminazioni
  1. 29 0
      app/views/courses/_lectures_panel.html.erb
  2. 1 29
      app/views/courses/show.html.erb

+ 29 - 0
app/views/courses/_lectures_panel.html.erb

@@ -0,0 +1,29 @@
+<div class="panel panel-default">
+  <div class="panel-heading">
+    Lectures
+  </div>
+  <table class="panel-body table table-striped table-bordered table-hover">
+    <tbody>
+      <% for lecture in @course.lectures do %>
+        <tr>
+          <td>
+            <%= link_to lecture.starts_at, lecture %>
+          </td>
+          <td>
+            <%= lecture.location %>
+          </td>
+          <td>
+            <%= truncate(lecture.description, length: 70) %>
+          </td>
+          <% if current_user.is_course_teacher?(@course) %>
+            <td>
+              <%= link_to edit_lecture_path(lecture), class: "btn btn-primary" do %>
+                <%= fa_icon "edit", text: "Edit" %>
+              <% end %>
+            </td>
+          <% end %>
+        </tr>
+      <% end %>
+    </tbody>
+  </table>
+</div>

+ 1 - 29
app/views/courses/show.html.erb

@@ -7,35 +7,7 @@
 <div class="row">
   <div class="col-md-6">
     <%= render partial: 'participants_panel' %>
-    <div class="panel panel-default">
-      <div class="panel-heading">
-        Lectures
-      </div>
-      <table class="panel-body table table-striped table-bordered table-hover">
-        <tbody>
-          <% for lecture in @course.lectures do %>
-            <tr>
-              <td>
-                <%= link_to lecture.starts_at, lecture %>
-              </td>
-              <td>
-                <%= lecture.location %>
-              </td>
-              <td>
-                <%= truncate(lecture.description, length: 70) %>
-              </td>
-              <% if current_user.is_course_teacher?(@course) %>
-                <td>
-                  <%= link_to edit_lecture_path(lecture), class: "btn btn-primary" do %>
-                    <%= fa_icon "edit", text: "Edit" %>
-                  <% end %>
-                </td>
-              <% end %>
-            </tr>
-          <% end %>
-        </tbody>
-      </table>
-    </div>
+    <%= render partial: 'lectures_panel' %>
   </div>
   <div class="col-md-6">
     <%= render partial: 'data_files/file_panel', locals: { repository: @course } %>