Skip to content

Commit ff504d3

Browse files
committed
Clean up course page
1 parent 9fd2fc8 commit ff504d3

File tree

6 files changed

+94
-53
lines changed

6 files changed

+94
-53
lines changed

app/assets/stylesheets/courses.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,8 @@ td.deadline-toggle-buttons a {
2828
padding: 20px;
2929
border-radius: 5px;
3030
}
31+
32+
.course-options-card {
33+
display: flex;
34+
justify-content: space-around;
35+
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<%= form_for @notifier, url: organization_course_course_notifications_path do |f| %>
2-
<%= f.label :topic %>
3-
<br />
4-
<%= f.text_field :topic %>
5-
<br />
6-
<%= f.label :message %>
7-
<br />
8-
<%= f.text_area :message %>
9-
<br />
10-
<%= f.submit 'Send email to every course participant', class: "btn btn-info", data: { confirm: "Do you really want to send this message to every participant?" } %>
2+
<div class="form-group">
3+
<%= f.label :topic %>
4+
<%= f.text_field :topic, class: 'form-control' %>
5+
</div>
6+
<div class="form-group">
7+
<%= f.label :message %>
8+
<%= f.text_area :message, class: 'form-control', rows: 10 %>
9+
</div>
10+
<%= f.submit 'Send email to every course participant', class: "btn btn-danger", data: { confirm: "Do you really want to send this message to every participant?" } %>
1111
<% end %>

app/views/courses/_list.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
<% end %>
1515

1616
<% if signed_in? %>
17-
<div class="alternative-format-links">[<%= link_to "json", "#{organization_courses_path organization_id: @organization.slug, format: :json, api_version: ApiVersion::API_VERSION}" %>]</div>
17+
<div class="alternative-options-links">[<%= link_to "json", "#{organization_courses_path organization_id: @organization.slug, format: :json, api_version: ApiVersion::API_VERSION}" %>]</div>
1818
<% end %>

app/views/courses/manage_exercises.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h1 class="float-left">Enable and disable exercises</h1>
1+
<h1 class="float-left">Enable or disable exercises</h1>
22
<div class="float-right" style="margin: 25px 20px 0 0">
33
<label><input type="checkbox" id="select-all"> Select all</label>
44
</div>

app/views/courses/show.html.erb

Lines changed: 76 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,90 @@
11
<div class="row">
22
<div class="col-md-12">
3+
<% if can? :edit, @course %>
4+
<%= link_to 'Edit details', edit_setup_organization_course_course_details_path(@organization, @course), class: "btn btn-primary pull-right" %>
5+
<% end %>
36
<h1><%= @course.title %></h1>
47

5-
<div>
6-
<% unless @course.initial_refresh_ready? %>
7-
<p class='course-initial-refresh-warning'><strong>
8-
Course is being updated and it is not fully functional yet! Please wait.</strong>
9-
<br>This operation usually takes about 15 minutes but it can take up to an hour.
10-
</p>
11-
<% end %>
8+
<div class="card">
9+
<div class="card-body">
1210
<% unless @course.description.blank? %>
13-
<p><%= @course.description %></p>
11+
<p class="card-text"><%= @course.description %></p>
1412
<% end %>
15-
<ul>
16-
<% unless @course.material_url.blank? %>
17-
<li><%= link_to 'Course material', @course.material_url, target: '_blank' %></li>
13+
</div>
14+
</div>
15+
<br>
16+
17+
<div class="course-options-card">
18+
<% unless @course.initial_refresh_ready? %>
19+
<p class='course-initial-refresh-warning'><strong>
20+
Course is being updated and it is not fully functional yet! Please wait.</strong>
21+
<br>This operation usually takes about 15 minutes but it can take up to an hour.
22+
</p>
23+
<% end %>
24+
25+
<% unless @course.material_url.blank? %>
26+
<%= link_to @course.material_url, target: '_blank', class: 'btn btn-primary' do %>
27+
<%= fa_icon 'book', text: 'Course material' %>
1828
<% end %>
19-
<% if @course.has_external_scoreboard_url? %>
20-
<% if can? :view_external_scoreboard_url, @course %>
21-
<li>
22-
<%= link_to 'View points', @course.parsed_external_scoreboard_url(@organization, @course, current_user), target: '_blank' %>
23-
</li>
24-
<% end %>
25-
<% else %>
26-
<% if can? :see_points, @course %>
27-
<li><%= link_to 'View points', organization_course_points_path(@organization, @course) %></li>
29+
<% end %>
30+
<% if @course.has_external_scoreboard_url? %>
31+
<% if can? :view_external_scoreboard_url, @course %>
32+
<%= link_to @course.parsed_external_scoreboard_url(@organization, @course, current_user), target: '_blank', class: 'btn btn-primary' do %>
33+
<%= fa_icon 'list', text: 'Points list' %>
34+
<% end %>
35+
<% end %>
36+
<% else %>
37+
<% if can? :see_points, @course %>
38+
<%= link_to organization_course_points_path(@organization, @course), class: 'btn btn-primary' do %>
39+
<%= fa_icon 'list', text: 'Points list' %>
2840
<% end %>
2941
<% end %>
30-
<li>
31-
<%= link_to 'View help page', organization_course_help_path(@organization, @course)%>
32-
</li>
33-
</ul>
42+
<% end %>
3443
</div>
44+
<br >
45+
46+
<% if @course.disabled? %>
47+
<div class="card text-danger border-danger mb-3">
48+
<div class="card-body">
49+
<h3 class="card-title"><%= fa_icon 'warning', text: 'This course is disabled' %></h3>
50+
<p class="card-text">
51+
It is not possible to start this course while it is disabled and the course is hidden from the course list.
52+
However, old results should still be visible.
53+
</p>
54+
<%= link_to 'Enable course', enable_organization_course_path(@organization, @course), method: :post, class: "btn btn-danger" if can? :teach, @course %>
55+
</div>
56+
</div>
57+
<% end %>
58+
59+
<% if can? :teach, @course %>
60+
<% if @course.hide_submission_results? %>
61+
<div class="card text-danger border-danger mb-3">
62+
<div class="card-body">
63+
<h3 class="card-title"><%= fa_icon 'warning', text: 'Submission results are hidden' %></h3>
64+
<p class="card-text">
65+
This is rarely a good idea as this feature is usually used only for exams.
66+
</p>
67+
<%= link_to 'Make submission results visible', toggle_submission_result_visibility_organization_course_path(@organization, @course), method: :post, class: "btn btn-danger" if can? :teach, @course %>
68+
</div>
69+
</div>
70+
<% end %>
71+
72+
<% if @course.hidden? %>
73+
<div class="card text-danger border-danger mb-3">
74+
<div class="card-body">
75+
<h3 class="card-title"><%= fa_icon 'warning', text: 'Course is hidden' %></h3>
76+
<p class="card-text">
77+
This is rarely a good idea. Consider disabling it instead.
78+
</p>
79+
<%= link_to 'Make course visible', toggle_hidden_organization_course_path(@organization, @course), method: :post, class: "btn btn-danger" if can? :teach, @course %>
80+
</div>
81+
</div>
82+
<% end %>
83+
<% end %>
3584

3685
<% if can? :teach, @course %>
3786
<div class="teacher-panel">
38-
<h4>Teacher functions</h4>
87+
<h4><%= fa_icon 'graduation-cap', text: 'Teacher functions' %></h4>
3988

4089
<% if @refresh_report && (can? :refresh, @course) %>
4190
<%= render :partial => 'courses/refresh_report', :locals => { :report => @refresh_report } %>
@@ -102,7 +151,7 @@
102151
<li>
103152
<% if can? :toggle_submission_result_visibility, @course %>
104153
<% if @course.hide_submission_results? %>
105-
<%= link_to 'Unhide submission results', toggle_submission_result_visibility_organization_course_path(@organization, @course), method: :post, class: "btn btn-primary btn-sm" %>
154+
<%= link_to 'Make submission results visible', toggle_submission_result_visibility_organization_course_path(@organization, @course), method: :post, class: "btn btn-primary btn-sm" %>
106155
<% else %>
107156
<%= link_to 'Hide submission results', toggle_submission_result_visibility_organization_course_path(@organization, @course), method: :post, class: "btn btn-warning btn-sm" %>
108157
<% end %>
@@ -119,15 +168,6 @@
119168
link_to 'Disable Course', disable_organization_course_path(@organization, @course), method: :post,
120169
class: "btn btn-danger btn-sm", data: { confirm: "Are you sure you want to disable the course?" } %>
121170
<% end %>
122-
<% if @course.hidden? %>
123-
<%=
124-
link_to 'Make Course visible', toggle_hidden_organization_course_path(@organization, @course), method: :post,
125-
class: "btn btn-info btn-sm" %>
126-
<% else %>
127-
<%=
128-
link_to 'Hide Course', toggle_hidden_organization_course_path(@organization, @course), method: :post,
129-
class: "btn btn-danger btn-sm", data: { confirm: "Are you sure you want to hide the course?" } %>
130-
<% end %>
131171
</li>
132172

133173
<% unlockables = @course.unlockable_exercises_for(current_user) %>
@@ -170,7 +210,7 @@
170210
171211
<% if current_user.administrator? %>
172212
<div class="admin-panel">
173-
<h4>Admin functions</h4>
213+
<h4><%= fa_icon 'exclamation-circle', text: 'Admin functions' %></h4>
174214
<ul>
175215
<% if current_user.administrator? %>
176216
<li>Source type: <%= @course.source_backend.upcase %> </li>
@@ -194,10 +234,6 @@
194234
</div>
195235
<% end %>
196236

197-
<% if signed_in? %>
198-
<div class="alternative-format-links">[<%= link_to 'json', "#{one_course_json_organization_course_path organization_id: @organization.slug, id: @course.id, api_version: ApiVersion::API_VERSION}" %>]</div>
199-
<% end %>
200-
201237
<h2>All exercises</h2>
202238
<div>
203239
<%=

app/views/feedback_answers/_numeric_feedback.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
</table>
2525

2626
<% if parent.is_a?(Course) %>
27-
<div class="alternative-format-links">[<%= link_to "json", "#{organization_course_feedback_answers_path @organization, @parent, :format => :json}" %>]</div>
27+
<div class="alternative-options-links">[<%= link_to "json", "#{organization_course_feedback_answers_path @organization, @parent, :format => :json}" %>]</div>
2828
<% elsif parent.is_a?(Exercise) %>
29-
<div class="alternative-format-links">[<%= link_to "json", "#{organization_exercise_feedback_answers_path @organization, @parent, :format => :json}" %>]</div>
29+
<div class="alternative-options-links">[<%= link_to "json", "#{organization_exercise_feedback_answers_path @organization, @parent, :format => :json}" %>]</div>
3030
<% end %>
3131

3232
<div class="footnote">

0 commit comments

Comments
 (0)