diff --git a/app/assets/stylesheets/models/activities.css.scss b/app/assets/stylesheets/models/activities.css.scss index 37d47c35e6..e0453265d8 100644 --- a/app/assets/stylesheets/models/activities.css.scss +++ b/app/assets/stylesheets/models/activities.css.scss @@ -129,7 +129,7 @@ center img { // editor #editor-text .cm-editor { - height: 300px; + height: 775px; } // white background for transparent images diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index c55b68f742..cf06460a01 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -106,6 +106,12 @@ def available end def show + @repository = @activity.repository + @config = @activity.ok? ? @activity.merged_config : {} + @config_locations = @activity.ok? ? @activity.merged_config_locations : {} + @courses_series = policy_scope(@activity.series).group_by(&:course).sort do |a, b| + [b.first.year, a.first.name] <=> [a.first.year, b.first.name] + end flash.now[:alert] = I18n.t('activities.show.not_a_member') if @course && !current_user&.member_of?(@course) # Double check if activity still exists within this course (And throw a 404 when it does not) diff --git a/app/views/activities/_info.html.erb b/app/views/activities/_info.html.erb new file mode 100644 index 0000000000..a0f3aff7c3 --- /dev/null +++ b/app/views/activities/_info.html.erb @@ -0,0 +1,219 @@ +<% content_for :javascripts do %> + <%= javascript_include_tag 'submission' %> +<% end %> +<% + solutions = if @activity.exercise? + @activity.solutions.sort(&method(:compare_solutions)) + end +%> +
+
+
+
+

+ <%= activity_icon(@activity, 24) %> + <%= @activity.numbered_name(@series) %> +

+ <% if @activity.labels.any? %> +
+ <% @activity.labels.each do |label| %> + <%= link_to label_path(label) do %> + <%= label.name %> + <% end %> + <% end %> +
+ <% end %> +
+
+
+
+
+
+ <% if (contact_info = @config['contact'] || @repository.first_admin&.pretty_email) %> +
+

+ + <%= mail_to(contact_info) %> +

+ <% end %> + <% if @activity.exercise? %> +
+

+ + <% if policy(@activity.judge).show? %> + <%= link_to @activity.judge.name, judge_path(@activity.judge) %> + <% else %> + <%= @activity.judge.name %> + <% end %> +

+ <% end %> +
+

+ + <% if policy(@repository).show? %> + <%= link_to @repository.name, repository_path(@repository) %> + <% else %> + <%= @repository.name %> + <% end %> +

+
+ <% if current_user&.repository_admin?(@repository) %> +

+ + <%= github_link @repository, @activity.path %> + <% end %> +

+
+
+
+
+
+
+ <% if @activity.exercise? %> +
+

<%= @activity.programming_language ? @activity.programming_language.name.titlecase : "n/a" %>

+ <%= t '.programming_language' %> +
+ <% end %> +
+

<%= @activity.description_languages.join(', ') %>

+ <%= t '.natural_language' %> +
+ <% if @activity.exercise? %> +
+

<%= @config.dig('evaluation', 'time_limit') || SubmissionRunner.default_config['time_limit'] %>s

+ <%= t '.time_limit' %> +
+
+

+ <%= human_bytes (@config.dig('evaluation', 'memory_limit') || SubmissionRunner.default_config['memory_limit']).to_i %> +

+ <%= t '.memory_limit' %> +
+
+ <% + if @config.dig('evaluation', 'network_enabled') + network_icon = 'mdi-wan' + network_config_name = t('.network_enabled') + else + network_icon = 'mdi-lan-disconnect' + network_config_name = t('.network_disabled') + end + %> +

+ +

+ <%= network_config_name %> +
+
+

<%= number_with_delimiter @activity.submissions.count, delimiter: " " %>

+ <%= t '.submission_count' %> +
+ <% end %> +
+
+
+ <%= raw t('.config_info', doc_site: link_to(t('.doc_site'), 'https://docs.dodona.be/references/exercise-config/')) %> +
+
+
+ +
+
+
+

README

+
+ <% if @activity.about.present? %> + <%= markdown @activity.about %> + <% else %> + <%= t '.no_readme_present' %> + <% if current_user&.repository_admin?(@repository) && @repository.github_url.present? %> + <%= github_link @repository, + "?filename=#{@activity.path}/readme.#{I18n.locale.to_s}.md", + name: t('.click_here_to_create_one'), + mode: 'new' %> + <% end %> + <% end %> +
+
+<% if @activity.exercise? %> +
+
+

<%= t ".sample_solutions" %>

+ <% if solutions.any? %> +
+ +
+
+ <%= t '.sample_solutions_hint' %> +
+ <% solutions.each_with_index do |(fname, code), i| %> + + <% end %> +
+
+ <% else %> + <%= t '.no_solutions' %> + <% end %> +
+<% end %> + +
+ +
+

<%= t ".usage" %>

+

<%= t('.courses_using_this_activity', count: @courses_series.count) %>

+ <% if @courses_series.any? %> +
+ + + + + + + + + + + + + + <% @courses_series.each do |course, series| %> + + + + + + + + + + <% end %> + +
<%= Course.human_attribute_name("name") %><%= Course.human_attribute_name("series") %><%= Course.human_attribute_name("teacher") %><%= Course.human_attribute_name("year") %><%= Course.human_attribute_name("institution") %><%= t 'courses.index.users' %>
+ <%= link_to course.name, course %> + + <%= raw series.map{ |s| link_to(s.name, s, class: "course-link", title: s.name).html_safe }.to_sentence %> + <%= course.teacher %><%= course.formatted_year %><%= course.institution&.short_name || t('courses.form.no_institution') %><%= course.subscribed_members_count %> + <% if policy(course).edit? %> + <%= link_to edit_course_path(course), class: "btn btn-icon" do %> + + <% end %> + <% end %> +
+
+
+ <% end %> diff --git a/app/views/activities/show.html.erb b/app/views/activities/show.html.erb index 4d05e73359..2d3db102c3 100644 --- a/app/views/activities/show.html.erb +++ b/app/views/activities/show.html.erb @@ -8,7 +8,8 @@ <% end %> <% end %> -<%= render 'navbar_links' %> +<% content_for :container_class do %>container-fluid<% end %> + <% if @not_registered && @lti_launch %> <%= render 'courses/not_a_member_dialog' %> @@ -38,106 +39,76 @@ end %> <% end %>
- <% if @activity.exercise? %> -
- <%= link_to '#submission-card', class: "btn btn-lg btn-down d-none d-md-block hidden-print", title: t('.handin') do %> - <%= t('.handin') %>
- - <% end %> -
- <% else %> -
 
- <% end %> -
-
-
-

- <%= activity_icon(@activity, 24) %> -   - <%= @activity.numbered_name(@series) %> -

- <% if @series.present? %> -
- <%= link_to previous_link, class: 'btn btn-icon btn-icon-inverted', title: previous_tooltip, data: {'bs-toggle': 'tooltip', placement: 'top'} do %> - - <% end %> - <%= link_to next_link, class: 'btn btn-icon btn-icon-inverted', title: next_tooltip, data: {'bs-toggle': 'tooltip', placement: 'top', title: next_tooltip_actionable}, id: 'next-exercise-link' do %> - - <% end %> -
- <% end %> -
- <%= description_iframe @activity %> -
-
- <% if @series.present? %> -
-<% if @activity.exercise? %> -
- -
-
-
- <% if policy(@activity).submit? %> -
- - -
+
+

+ <%= activity_icon(@activity, 24) %> + <%= @activity.numbered_name(@series) %> +

+ <%= description_iframe @activity %> +
+
+
+
-
-
-
- <% if !user_signed_in? %> -
<%= t ".not_logged_in_html", :url => sign_in_path %>
- <% end %> - <% if policy(@activity).submit? || !user_signed_in? %> - <% if @series.present? && @series.deadline.present? %> - - + + + + +
+
+
+
+ <% if !user_signed_in? %> +
<%= t ".not_logged_in_html", :url => sign_in_path %>
<% end %> - <% if !@edit_submission && !@solution && @last_submission %> -
- <%= t ".preloaded_info" %> - - <%= t(@activity.boilerplate ? ".preloaded_restore" : ".preloaded_clear") %> - + <% if policy(@activity).submit? || !user_signed_in? %> + <% if @series.present? && @series.deadline.present? %> + + + <% end %> + <% if !@edit_submission && !@solution && @last_submission %> + + <% end %> +
+
<%= @code %>
- <% end %> -
-
<%= @code %>
-
-
- <%= t ".hand_in_info" %> - <% if @activity.exercise? && @activity.programming_language&.name == 'python' %> +
<%= t ".hand_in_info" %>
+
+ <% if @activity.exercise? && @activity.programming_language&.name == 'python' %> <%= t '.to_sandbox' %> - + + + <% end %> +
+ <% end %> +
+
+ <%= render partial: 'layouts/searchbar', locals: {statuses: Submission.statuses.keys, refresh_element: "#refresh_element"} %> +
+ <% if !user_signed_in? %> +
<%= t ".not_logged_in_html", :url => sign_in_path %>
+ <% elsif @submissions.length > 0 %> + <%= render partial: 'submissions/submissions_table', locals: {submissions: @submissions, exercise: @activity, course: @course, user: current_user} %> + <% else %> +
<%= t ".hand_in_tooltip" %>
<% end %>
- <% end %> -
-
-
- <% if !user_signed_in? %> -
<%= t ".not_logged_in_html", :url => sign_in_path %>
- <% elsif @submissions.length > 0 %> - <%= render partial: 'submissions/submissions_table', locals: {submissions: @submissions, exercise: @activity, course: @course, user: current_user} %> - <% else %> -
<%= t ".hand_in_tooltip" %>
- <% end %>
-
-
-
-
+<% if @activity.exercise? %> + <% elsif @activity.content_page? %>