From cc42511a38df7cccea58bf10bbd658fcf9dd90f2 Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 31 Oct 2014 09:16:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9base=5Fhomwwork=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_links.html.erb | 2 +- app/views/layouts/base_homework.html.erb | 82 +++--------------------- config/locales/zh.yml | 1 + 3 files changed, 12 insertions(+), 73 deletions(-) diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index d5359185e..ce7b2db59 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -2,7 +2,7 @@ <% for attachment in attachments %>

- <%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true -%> + <%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true,:id => 'attachment_' -%> <% if attachment.is_text? %> <%= link_to image_tag('magnifier.png'), diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 4fb97bf24..3d8a76537 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -105,66 +105,26 @@ - <%= l(:label_new_course_description) %> : + <%= l(:label_homework_description) %> : - <%= textilizable course.description %> - - - - - - <%= l(:label_create_time) %> : - - - <%= format_time course.created_at %> + <%= textilizable @bid.description %> - <%= l(:lable_course_teacher) %> : + <%= l(:label_limit_time) %>: + - <%= link_to(course.teacher.lastname+course.teacher.firstname, user_path(course.teacher)) %> + <%= @bid.deadline %> - - - - <%= l(:label_class_period) %> : - - - <%= course.class_period.to_s %>  - <%= l(:label_class_hour) %> - - - - - - <%= l(:label_main_term) %> : - - - <%= course.time.to_s %> - <%= course.term %> - - - - - - <%= l(:label_teacher_work_unit) %> : - - - <% unless @user.user_extensions.nil? || @user.user_extensions.school.nil? %> - - <%= link_to @user.user_extensions.school,"http://#{Setting.host_course}/?school_id=#{@user.user_extensions.school.id}" %> - - <% end %> -

@@ -174,8 +134,10 @@ @@ -183,33 +145,9 @@ <%#= @bid.homework_type==Bid::HomeworkFile ? "提交文件" : "提交项目" %> - <% unless @bid.parent_id.nil? %> - - - - <% end %> +
- <%= l(:label_limit_time) %>: - <%= @bid.deadline %> + <% if @bid.attachments.any?%> + <% options = {:author => true,:deletable => (@bid.author.id == User.current.id || User.current.admin? ? true : false)} %> + <%= render :partial => 'attachments/links', :locals => {:attachments => @bid.attachments, :options => options} %> + <% end %>
-
- <% author=Bid.find(@bid.parent_id).author %> - 作业来源于<%= link_to(author.lastname+author.firstname, user_path(Bid.find(@bid.parent_id).author)) %> - 的需求:<%= link_to(Bid.find(@bid.parent_id).name, respond_path(Bid.find(@bid.parent_id))) %> -
-
- - -
-
- - - - -
- <%= render :partial => 'tags/tag', :locals => {:obj => @bid, :object_flag => "4"} %> -
- -
-
diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 68b60d31a..d32ebb04b 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1894,6 +1894,7 @@ zh: label_new_course_password: 课程密码 label_new_course_school: 开课学校 label_new_course_description: 课程描述 + label_homework_description: 作业描述 label_new_join_order: 请输入课程密码 label_task_submit_form_accessory: 作业最终以附件形式提交 label_task_submit_form_project: 作业最终以项目形式提交 From f5e9528b124d1e5a20068a08f1f459659a7c9ee0 Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 31 Oct 2014 11:03:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9base=5Fhomework=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 3 ++- app/views/attachments/_links.html.erb | 16 +++++++++++++--- app/views/layouts/base_homework.html.erb | 15 +++++++++++---- config/locales/en.yml | 3 ++- config/locales/zh.yml | 1 + public/stylesheets/application.css | 9 +++++++++ 6 files changed, 38 insertions(+), 9 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ccc9a884c..4be91c9b4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -127,7 +127,8 @@ module ApplicationHelper # * :text - Link text (default to attachment filename) # * :download - Force download (default: false) def link_to_short_attachment(attachment, options={}) - text = h(truncate(options.delete(:text) || attachment.filename, length: 23, omission: '...')) + length = options[:length] ? options[:length]:23 + text = h(truncate(options.delete(:text) || attachment.filename, length: length, omission: '...')) route_method = options.delete(:download) ? :download_named_attachment_path : :named_attachment_path html_options = options.slice!(:only_path) url = send(route_method, attachment, attachment.filename, options) diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index ce7b2db59..9326b32ec 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -1,8 +1,13 @@
<% for attachment in attachments %>

- - <%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true,:id => 'attachment_' -%> + + <% if options[:length] %> + <%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true,:length => options[:length] -%> + <% else %> + <%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true -%> + <% end %> + <% if attachment.is_text? %> <%= link_to image_tag('magnifier.png'), @@ -12,9 +17,10 @@ :filename => attachment.filename%> <% end %> - <%= h(truncate(" - #{attachment.description}", length: 15, omission: '...')) unless attachment.description.blank? %> + <%= h(truncate(" - #{attachment.description}", length: options[:length] ? options[:length]:15, omission: '...')) unless attachment.description.blank? %> (<%= number_to_human_size attachment.filesize %>) + <% if options[:deletable] %> <% if attachment.container_type == 'HomeworkAttach' %> <%= link_to image_tag('delete.png'), {:controller => 'attachments', :action => 'delete_homework', :id => attachment.id}, @@ -32,6 +38,10 @@ :title => l(:button_delete) %> <% end %> <% end %> + <% if options[:wrap] %> +
+   + <% end %> <% if options[:author] %> <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author) %>, diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 3d8a76537..75d3a8949 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -111,8 +111,8 @@ - - <%= textilizable @bid.description %> + + <%= textilizable truncate(@bid.description, length: 200, omission: '...') %> @@ -133,9 +133,16 @@

- + + + diff --git a/config/locales/en.yml b/config/locales/en.yml index e886683f0..7bd6b8184 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1842,4 +1842,5 @@ en: label_select_province: Please select the provinces label_search_conditions_not_null: The search conditions can not be empty lable_school_list: List of schools - button_delete_file: delete \ No newline at end of file + button_delete_file: delete + label_attachment: attachment \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index d32ebb04b..96584e8ac 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2177,3 +2177,4 @@ zh: label_without_score: 未评分 label_homework_list: 作品列表 label_time: 时间 + label_attachment: 附件 diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 8f0ed1ca7..d6a5e22cd 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2520,6 +2520,14 @@ a.close-icon:hover {background-image:url('../images/close_hl.png');} .version-overdue a, .issue-overdue a, .project-overdue a {color: #f00;} /***** Icons *****/ +#sidebar #attachment_ a { + background-position: 0% 50%; + background-repeat: no-repeat; + font-family: '微软雅黑'; /*modify by men*/ + padding-left: 20px !important; + padding-top: 2px !important; + padding-bottom: 3px !important; +} .icon { background-position: 0% 50%; background-repeat: no-repeat; @@ -2528,6 +2536,7 @@ a.close-icon:hover {background-image:url('../images/close_hl.png');} padding-top: 2px; padding-bottom: 3px; } + .icon_enterprise { background-position: 0% 50%; background-repeat: no-repeat;
+ + + <%= l(:label_attachment) %> : + +
<% if @bid.attachments.any?%> - <% options = {:author => true,:deletable => (@bid.author.id == User.current.id || User.current.admin? ? true : false)} %> + <% options = {:author => true,:deletable => (@bid.author.id == User.current.id || User.current.admin? ? true : false),:wrap => true,:length => 7} %> <%= render :partial => 'attachments/links', :locals => {:attachments => @bid.attachments, :options => options} %> <% end %>