diff --git a/app/models/student_assignment.rb b/app/models/student_assignment.rb index 5227cff..6dbd248 100644 --- a/app/models/student_assignment.rb +++ b/app/models/student_assignment.rb @@ -2,7 +2,7 @@ class StudentAssignment include Mongoid::Document include Mongoid::Timestamps include Slug - field :assignment_content, as: :slug_title, type: String, localize: true, default: "" + field :assignment_content, as: :slug_title, type: String, default: "" has_many :student_assignment_files, :dependent => :destroy, :autosave => true accepts_nested_attributes_for :student_assignment_files, :allow_destroy => true belongs_to :course_assignment @@ -14,6 +14,10 @@ class StudentAssignment self.updated_at.strftime("%Y-%m-%d %H:%M") end def display_student_assignment_files - self.student_assignment_files.map{|f| "#{f.title}"}.join("
").html_safe + self.student_assignment_files.map{ |f| + next if f.file.file.nil? + title = (f.title.blank? ? f.file.file.original_filename : f.title) + "#{title}" + }.join("
").html_safe end end \ No newline at end of file diff --git a/app/views/admin/selected_courses/_form_assignment.html.erb b/app/views/admin/selected_courses/_form_assignment.html.erb index c165187..727b999 100644 --- a/app/views/admin/selected_courses/_form_assignment.html.erb +++ b/app/views/admin/selected_courses/_form_assignment.html.erb @@ -20,6 +20,9 @@ <% if @student_assignment.new_record? %> <%= f.hidden_field :course_assignment_id,:value=>@course_assignment.id.to_s %> <% end %> +<% if params[:type] == "view" %> + <% @closed = true %> +<% end %>
<%= @course_assignment.course.title rescue "" %>-<%= @course_assignment.name rescue "" %> @@ -71,6 +74,7 @@
+
<% @site_in_use_locales.each_with_index do |locale, i| %>
"> -
- -
- <% if !@closed %> - <%= f.fields_for :assignment_content_translations do |f| %> - <%= f.text_area locale, class: "input-block-level ckeditor", placeholder: t("personal_selected_course.assignment_content"), value: (@student_assignment.assignment_content_translations[locale] rescue nil) %> - <% end %> - <% else %> - <%= @student_assignment.assignment_content_translations[locale] rescue nil %> - <% end %> -
-
+
<% end %> -
+
-->