From 3239ab12e92896f016665476a63eb9edb0b21bdf Mon Sep 17 00:00:00 2001 From: linhk <304431313@.com> Date: Mon, 18 Aug 2014 15:33:22 +0800 Subject: [PATCH 01/22] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=AF=84=E5=AE=A1=E6=8C=89=E9=92=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/views/code_review/_new_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/redmine_code_review/app/views/code_review/_new_form.html.erb b/plugins/redmine_code_review/app/views/code_review/_new_form.html.erb index 81feda16e..79d0e6f9f 100644 --- a/plugins/redmine_code_review/app/views/code_review/_new_form.html.erb +++ b/plugins/redmine_code_review/app/views/code_review/_new_form.html.erb @@ -107,7 +107,7 @@ <% submit_url = url_for(:controller => 'code_review', :action => 'new', :id=>@project) %> - <%= button_to_function l(:button_apply), "$('#review-form').load('#{submit_url}', $('#review_form').serialize2json())" %> + <%= button_to_function l(:label_button_ok), "$('#review-form').load('#{submit_url}', $('#review_form').serialize2json())" %> <%= preview_link({ :controller => 'code_review', :action => 'preview', :id => @project}, 'review_form') %> From 5fb1b220e570222d78f2d71f6544b1f8b16d0de7 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 18 Aug 2014 16:46:34 +0800 Subject: [PATCH 02/22] =?UTF-8?q?#1369=20=E4=BF=AE=E5=A4=8D=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index be27a71ea..047f7103e 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -488,6 +488,11 @@ class BidsController < ApplicationController if @bid.homework_type @homework = HomeworkAttach.new + if @bid.proportion + teacher_proportion = @bid.proportion * 1.0 / 100 + else + teacher_proportion = 1.0 + end #@homework_list = @bid.homeworks #增加作业按评分排序, #@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC") @@ -495,7 +500,7 @@ class BidsController < ApplicationController (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{@bid.author_id}) AS t_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> #{@bid.author_id}) AS s_score FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY - (CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{@bid.proportion * 1.0 / 100} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - @bid.proportion * 1.0 / 100} END) DESC,created_at ASC") + (CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{teacher_proportion} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - teacher_proportion} END) DESC,created_at ASC") if params[:student_id].present? @temp = [] @homework_list.each do |pro| From 4252e52d1d9955d2c726cf35a3fc67e93c99154b Mon Sep 17 00:00:00 2001 From: linhk <304431313@.com> Date: Mon, 18 Aug 2014 17:33:37 +0800 Subject: [PATCH 03/22] =?UTF-8?q?=E5=85=AC=E5=85=B1=E8=B4=B4=E5=90=A7?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb index 9f85dc49f..3059c23c9 100644 --- a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb +++ b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb @@ -43,8 +43,13 @@ module Redmine end def attachments_visible?(user=User.current) - (respond_to?(:visible?) ? visible?(user) : true) && - user.allowed_to?(self.class.attachable_options[:view_permission], self.project) + if self.respond_to?(:project) + (respond_to?(:visible?) ? visible?(user) : true) && + user.allowed_to?(self.class.attachable_options[:view_permission], self.project) + else + return true + end + end def attachments_deletable?(user=User.current) From bfe0299d40200f3f4e92160f71069a9e8b3934bd Mon Sep 17 00:00:00 2001 From: chenmin <19763783@qq.com> Date: Mon, 18 Aug 2014 17:44:37 +0800 Subject: [PATCH 04/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=B8=96=E5=AD=90=E5=86=85=E5=AE=B9=E6=98=BE=E7=A4=BA=E8=B6=85?= =?UTF-8?q?=E5=87=BA=E8=BE=B9=E6=A1=86=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_project_show.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index bb879e213..3bc9b6943 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -30,13 +30,14 @@ border-bottom: 1px dashed rgb(204, 204, 204); } .memo-content { + width: 82%; padding: 1%; margin: 1%; margin-bottom: 40px; background-color: #F6F6F6; white-space: normal; - /*word-break: break-all; */ - word-wrap: break-word; + word-break: break-all; + /*word-wrap: break-word;*/ } .memo-timestamp { position: absolute; From 5e600380c7834e26c5fa11544cd4446b9b8d8eec Mon Sep 17 00:00:00 2001 From: linhk <304431313@.com> Date: Tue, 19 Aug 2014 15:10:04 +0800 Subject: [PATCH 05/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=AE=9E=E8=B7=B5?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=AF=BE=E7=A8=8B=E5=90=8D=E7=A7=B0=E4=B8=8E?= =?UTF-8?q?=E5=AD=A6=E6=A0=A1=E8=B0=83=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/_course_list.html.erb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/views/welcome/_course_list.html.erb b/app/views/welcome/_course_list.html.erb index f590cf868..8d31f7c4c 100644 --- a/app/views/welcome/_course_list.html.erb +++ b/app/views/welcome/_course_list.html.erb @@ -6,11 +6,8 @@
- <% if (course.school == nil) %> -               - <% else %> - <%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %> - <% end %> + <%= link_to(course.name.truncate(30, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> + <%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %> @@ -19,7 +16,11 @@
[<%= get_course_term course %>] - <%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> + <% if (course.school == nil) %> +               + <% else %> + <%= link_to course.school.name.try(:gsub, /(.+)$/, '\1'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %> + <% end %> (<%= course.members.count %>人) <%# files_count = course.attachments.count.to_s %> (<%= link_to "#{course.attachments.count.to_s}份", course_files_path(course) %>资料) From a0a8868c249c474d808360922a37b439a2032641 Mon Sep 17 00:00:00 2001 From: linhk <304431313@.com> Date: Tue, 19 Aug 2014 15:44:02 +0800 Subject: [PATCH 06/22] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E8=AF=BE=E7=A8=8B=E9=A1=B9=E7=9B=AEtab=E9=A1=B5?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_base_header.html.erb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index 3116a9a68..b943cf565 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -44,6 +44,13 @@ <% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%> <% hasCourse=true%> + <% _bool=false %> + <% User.current.courses.each do |course| %> + <% if !course_endTime_timeout?(course) %> + <% _bool=true %> + <% end %> + <% end %> + <% if _bool %>
  • <%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id} %>
  • + <% end %> <% end -%> <% end %> -
  • <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %> + <% if User.current.projects.count>0 %> +
  • + <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %> <% if hasCourse %>
  • + <% end %>
  • <%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
  • From 80bd535b4f508ca0963137fc996ec5aea69367a9 Mon Sep 17 00:00:00 2001 From: chenmin <19763783@qq.com> Date: Wed, 20 Aug 2014 09:30:26 +0800 Subject: [PATCH 07/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E5=9B=9E=E5=A4=8D=E5=B8=96=E5=AD=90=E7=9A=84=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E5=A2=9E=E5=8A=A0=E5=88=A0=E9=99=A4=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=9B=20=E5=A2=9E=E5=8A=A0=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E7=BC=96=E8=BE=91=E8=87=AA=E5=B7=B1=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E7=9A=84=E5=8A=9F=E8=83=BD=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 12 ++++++++++-- app/models/message.rb | 8 ++++++++ app/views/messages/_course_show.html.erb | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index e840664b4..cdeb17e54 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -103,7 +103,11 @@ class MessagesController < ApplicationController # Edit a message def edit - (render_403; return false) unless @message.editable_by?(User.current) + if @project + (render_403; return false) unless @message.editable_by?(User.current) + else + (render_403; return false) unless @message.course_editable_by?(User.current) + end @message.safe_attributes = params[:message] if request.post? && @message.save attachments = Attachment.attach_files(@message, params[:attachments]) @@ -124,7 +128,11 @@ class MessagesController < ApplicationController # Delete a messages def destroy - (render_403; return false) unless @message.destroyable_by?(User.current) + if @project + (render_403; return false) unless @message.destroyable_by?(User.current) + else + (render_403; return false) unless @message.course_destroyable_by?(User.current) + end r = @message.to_param @message.destroy # modify by nwb diff --git a/app/models/message.rb b/app/models/message.rb index 62bfb34a5..0fdfc5b15 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -127,6 +127,14 @@ class Message < ActiveRecord::Base board.course end + def course_editable_by?(usr) + usr && usr.logged? && (usr.allowed_to?(:edit_messages, course) || (self.author == usr && usr.allowed_to?(:edit_own_messages, course))) + end + + def course_destroyable_by?(usr) + usr && usr.logged? && (usr.allowed_to?(:delete_messages, course) || (self.author == usr && usr.allowed_to?(:delete_own_messages, course))) + end + def editable_by?(usr) usr && usr.logged? && (usr.allowed_to?(:edit_messages, project) || (self.author == usr && usr.allowed_to?(:edit_own_messages, project))) end diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 4db903b88..5b8b629d4 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -148,7 +148,7 @@ "编辑", {:action => 'edit', :id => message}, :title => l(:button_edit) - ) if message.editable_by?(User.current) %> + ) if message.course_editable_by?(User.current) %> <%= link_to( #image_tag('delete.png'), "删除", @@ -156,7 +156,7 @@ :method => :post, :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete) - ) if message.destroyable_by?(User.current) %> + ) if message.course_destroyable_by?(User.current) %>
    From 4905511060f7540cff522eafbc615620d6c272e8 Mon Sep 17 00:00:00 2001 From: zhanghaitao <562681745@qq.com> Date: Wed, 20 Aug 2014 09:42:01 +0800 Subject: [PATCH 08/22] =?UTF-8?q?#=E8=AF=BE=E7=A8=8B=E8=B5=B7=E6=AD=A2?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BABug=E7=9A=84=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index d7d579dd1..a3412142b 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -2,7 +2,7 @@

    - <%= l(:label_date_from_to, :start => format_date(@date_from), :end => format_date(@date_to - 1)) %> + <%#= l(:label_date_from_to, :start => format_date(@date_from), :end => format_date(@date_to - 1)) %>

    <% @events_by_day.keys.sort.reverse.each do |day| %> From 4c57136a1d757102fac873beb442d6dcd8674dfc Mon Sep 17 00:00:00 2001 From: linhk <304431313@.com> Date: Wed, 20 Aug 2014 10:50:29 +0800 Subject: [PATCH 09/22] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=95=99=E8=A8=80?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 2 ++ app/controllers/words_controller.rb | 10 +++++++++- app/views/projects/feedback.html.erb | 17 ++++++++++++----- app/views/words/destroyJournal.js.erb | 3 +++ config/routes.rb | 2 ++ 5 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 app/views/words/destroyJournal.js.erb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ccbff8e50..ea37766b6 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -418,6 +418,8 @@ class ProjectsController < ApplicationController @jour = @jours[@offset, @limit] @state = false @base_courses_tag = @project.project_type + + respond_to do |format| format.html{render :layout => 'base_courses' if @base_courses_tag==1} format.api diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 110f81537..af850d626 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -88,7 +88,15 @@ class WordsController < ApplicationController #format.api { render_api_ok } end end - + + def destroyJournal + @journalP=JournalsForMessage.find(params[:object_id]) + @journalP.destroy + respond_to do |format| + format.js + end + end + def new @jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id] if @jour diff --git a/app/views/projects/feedback.html.erb b/app/views/projects/feedback.html.erb index 5de3ceb4a..13e123b35 100644 --- a/app/views/projects/feedback.html.erb +++ b/app/views/projects/feedback.html.erb @@ -72,13 +72,20 @@ function checkMaxLength() { <% if reply_allow %> <%= link_to l(:label_projects_feedback_respond),'#', - {:focus => 'project_respond', - :onclick => "toggleAndSettingWordsVal($('##{id}'), - $('##{id} textarea'), - '#{l(:label_reply_plural)} #{journal.user.name}: '); + {:focus => 'project_respond', + :onclick => "toggleAndSettingWordsVal($('##{id}'), + $('##{id} textarea'), + '#{l(:label_reply_plural)} #{journal.user.name}: '); return false;"} %> <% end %> - + + <% if User.current.logged? %> + <% if journal.user_id==User.current.id|| User.current.admin? %> + <%= link_to(l(:button_delete),{:controller => 'words', :action => 'destroyJournal', :object_id => journal.id}, + :remote => true, :title => l(:button_delete)) %> + <% end %> + <% end %> +
    <% if reply_allow %> diff --git a/app/views/words/destroyJournal.js.erb b/app/views/words/destroyJournal.js.erb new file mode 100644 index 000000000..5c91c6053 --- /dev/null +++ b/app/views/words/destroyJournal.js.erb @@ -0,0 +1,3 @@ +<% if @journalP!=nil %> + $(".message-for-user").children("#word_li_<%=@journalP.id%>").remove(); +<% end %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 9d9b9d13b..f93318c7d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -652,6 +652,7 @@ RedmineApp::Application.routes.draw do delete 'words/destroy', :to => 'words#destroy' get 'words/more', :to => 'words#more' get 'words/back', :to=> 'words#back' + get 'words/destroyJournal', :to => 'words#destroyJournal' ############## fq post 'calls/create', :to => 'bids#create' delete 'calls/destroy', :to => 'bids#destroy' @@ -746,6 +747,7 @@ RedmineApp::Application.routes.draw do match 'words/add_brief_introdution', :controller => 'words', :action => 'add_brief_introdution' + Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| file = File.join(plugin_dir, "config/routes.rb") if File.exists?(file) From 73537a30cbd220d181c8dc0933b6913a63866664 Mon Sep 17 00:00:00 2001 From: chenmin <19763783@qq.com> Date: Wed, 20 Aug 2014 11:39:41 +0800 Subject: [PATCH 10/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BA=BA=E4=B8=8D=E8=83=BD=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA=E5=8C=BA=E9=9D=9E=E5=85=AC?= =?UTF-8?q?=E5=BC=80=E8=B5=84=E6=BA=90=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 +- app/views/messages/_project_show.html.erb | 4 ++-- db/schema.rb | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 44d68de26..c58cd3f82 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -79,7 +79,7 @@ class AttachmentsController < ApplicationController else candown = @attachment.is_public == 1 end - if candown || User.current.admin? + if candown || User.current.admin? || User.current.id == @attachment.author_id @attachment.increment_download if stale?(:etag => @attachment.digest) diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index 3bc9b6943..ad91c72f8 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -156,10 +156,10 @@ :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete) ) if message.destroyable_by?(User.current) %> -
    + + -
    <%= textAreailizable message,:content,:attachments => message.attachments %> diff --git a/db/schema.rb b/db/schema.rb index 7d908db6f..cdedc6a2c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140814062455) do +ActiveRecord::Schema.define(:version => 20140812065417) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -448,14 +448,14 @@ ActiveRecord::Schema.define(:version => 20140814062455) do end create_table "forums", :force => true do |t| - t.string "name", :null => false - t.text "description" + t.string "name", :null => false + t.string "description", :default => "" t.integer "topic_count", :default => 0 t.integer "memo_count", :default => 0 t.integer "last_memo_id", :default => 0 - t.integer "creator_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "creator_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "groups_users", :id => false, :force => true do |t| From 9bd22b1b99592b646a72dd76d53b6d970bfa328e Mon Sep 17 00:00:00 2001 From: zhanghaitao <562681745@qq.com> Date: Wed, 20 Aug 2014 14:55:32 +0800 Subject: [PATCH 11/22] =?UTF-8?q?1.#1011=20=E5=BD=93=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=A0=87=E7=AD=BE=E4=B8=BA=E5=A4=9A=E4=B8=AA?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E2=80=9C=E6=96=B0=E5=A2=9E=E2=80=9D=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E8=A2=AB=E6=8E=A9=E7=9B=96=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=202.=E8=AF=BE=E7=A8=8B=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E8=AE=BE=E7=BD=AEJS=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_course_resources_html.erb | 32 +++++++++++++++ app/views/tags/_tag.html.erb | 42 +++++--------------- 2 files changed, 41 insertions(+), 33 deletions(-) create mode 100644 app/views/courses/_course_resources_html.erb diff --git a/app/views/courses/_course_resources_html.erb b/app/views/courses/_course_resources_html.erb new file mode 100644 index 000000000..8f706725d --- /dev/null +++ b/app/views/courses/_course_resources_html.erb @@ -0,0 +1,32 @@ +<% id = "course_resources_ul_" + obj.id.to_s%> + \ No newline at end of file diff --git a/app/views/tags/_tag.html.erb b/app/views/tags/_tag.html.erb index d6ea964b8..2e9b3d217 100644 --- a/app/views/tags/_tag.html.erb +++ b/app/views/tags/_tag.html.erb @@ -34,42 +34,18 @@
    <% elsif object_flag == '6' %> - <%#= image_tag("/images/sidebar/tags.png") %> + <%#= image_tag("/images/sidebar/tags.png") %> <%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);', :class => "tags_icona", :onclick=>"$('#put-tag-form-#{obj.class}-#{obj.id}').toggle(); readmore(this);" if User.current.logged? %> - <%#= toggle_link (image_tag "/images/sidebar/add.png"), "put-tag-form-#{obj.class}-#{obj.id}", {:focus => "put-tag-form-#{obj.class}-#{obj.id} #name"} if User.current.logged? %> + <%#= toggle_link (image_tag "/images/sidebar/add.png"), "put-tag-form-#{obj.class}-#{obj.id}", {:focus => "put-tag-form-#{obj.class}-#{obj.id} #name"} if User.current.logged? %> -    -
    - <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> -
    - +    +
    + <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
    + <% else %> <%= image_tag("/images/sidebar/tags.png") %> From c13eeee56d81b3b60d84e258c269c4892d95cf7e Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 20 Aug 2014 15:51:35 +0800 Subject: [PATCH 12/22] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E9=94=99=E8=AF=AF=202.=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/news/_course_form.html.erb | 2 +- app/views/news/_form.html.erb | 5 ++--- app/views/news/_news.html.erb | 10 +++++----- app/views/news/new.html.erb | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/views/news/_course_form.html.erb b/app/views/news/_course_form.html.erb index 1f2198a3b..ad2c7835c 100644 --- a/app/views/news/_course_form.html.erb +++ b/app/views/news/_course_form.html.erb @@ -5,7 +5,7 @@

    <%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %>

    - +

    <%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %>

    <%= render :partial => 'attachments/form', :locals => {:container => @news} %>

    diff --git a/app/views/news/_form.html.erb b/app/views/news/_form.html.erb index 0601ee25b..f92559903 100644 --- a/app/views/news/_form.html.erb +++ b/app/views/news/_form.html.erb @@ -1,11 +1,10 @@ <%= error_messages_for @news %>
    - <% str = @project ? l(:bale_news_notice) : l(:label_news_new) %> - <%= str %> + <%= @project ? l(:label_news_new) : l(:bale_news_notice) %>

    <%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %>

    - +

    <%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %>

    <%= render :partial => 'attachments/form', :locals => {:container => @news} %>

    diff --git a/app/views/news/_news.html.erb b/app/views/news/_news.html.erb index 704e0eef3..7684a5949 100644 --- a/app/views/news/_news.html.erb +++ b/app/views/news/_news.html.erb @@ -1,9 +1,9 @@ - + <%# unless news.summary.blank? %><%#=h news.summary %><%# end %> +<%#= authoring news.created_on, news.author %>

    --> diff --git a/app/views/news/new.html.erb b/app/views/news/new.html.erb index 68fad17f2..836d3b6ed 100644 --- a/app/views/news/new.html.erb +++ b/app/views/news/new.html.erb @@ -1,4 +1,4 @@ - + <% if @project %> <%= labelled_form_for @news, :url => project_news_index_path(@project), :html => {:id => 'news-form', :multipart => true} do |f| %> From 136c991060adcba8af9e86df0ad5a60b56c999dc Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 20 Aug 2014 16:28:04 +0800 Subject: [PATCH 13/22] =?UTF-8?q?#1413=20=E4=BF=AE=E5=A4=8D=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=90=8D=E7=A7=B0=E8=BF=87=E9=95=BF=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81=E9=A6=96=E9=A1=B5=E4=BC=9A?= =?UTF-8?q?=E8=B6=85=E5=87=BA=E8=BE=B9=E7=95=8C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index a3412142b..366ec0c39 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -1,6 +1,6 @@ <% if @events_by_day != nil && @events_by_day.size >0 %>
    - +

    <%#= l(:label_date_from_to, :start => format_date(@date_from), :end => format_date(@date_to - 1)) %>

    @@ -29,7 +29,7 @@ <%= l(:label_new_activity) %> - <%= link_to "#{eventToLanguageCourse(e.event_type, @course)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url %> + <%= link_to "#{eventToLanguageCourse(e.event_type, @course)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url,:style => "word-break:break-all;" %>
    From cc08cdc1400b495525bedeeebf376d066a6868b4 Mon Sep 17 00:00:00 2001 From: luguo Date: Wed, 20 Aug 2014 17:16:14 +0800 Subject: [PATCH 14/22] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=88=91=E7=9A=84?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=B8=8B=E9=9D=A2=E7=9A=84=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E5=B8=A6=E6=A0=BC=E5=BC=8F=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E5=B8=B8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_course_form.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/users/_course_form.html.erb b/app/views/users/_course_form.html.erb index 71a44f3c9..055dd7d6b 100644 --- a/app/views/users/_course_form.html.erb +++ b/app/views/users/_course_form.html.erb @@ -32,8 +32,9 @@ + <%= textilizable membership.course.short_description %> +

    + - <% @containers.each do |container| %> - <% next if container.attachments.empty? -%> - <% if container.is_a?(Version) -%> - + <%# @containers.each do |container| %> + <%# next if container.attachments.empty? -%> + <%# if container.is_a?(Version) -%> + + <%# end -%> + <% if @curse_attachments != nil %> + <% @curse_attachments.each do |file| %> <%if file.is_public == 0 && !User.current.member_of?(@project)%> <%next%> <%end%> @@ -75,10 +76,17 @@ <% end -%> - <% reset_cycle %> + <%# reset_cycle %> <% end -%>

    - <%= membership.course.short_description %> -

    From 66dfa1ce4f2dadcef019f15fa61f82d5b901bdf8 Mon Sep 17 00:00:00 2001 From: linhk <304431313@.com> Date: Thu, 21 Aug 2014 08:58:48 +0800 Subject: [PATCH 15/22] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=B8=BB=E7=95=99=E8=A8=80=E5=88=86=E9=A1=B5?= =?UTF-8?q?Url=E9=94=99=E8=AF=AF=E5=92=8C=E9=A1=B5=E6=95=B0=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 26 ++++++++++---- app/controllers/words_controller.rb | 29 +++++++++++++++ app/views/projects/feedback.html.erb | 8 +++-- app/views/words/_feedback.html.erb | 50 ++++++++++++++++++++++++++ app/views/words/destroyJournal.js.erb | 4 ++- 5 files changed, 107 insertions(+), 10 deletions(-) create mode 100644 app/views/words/_feedback.html.erb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ea37766b6..3fea454de 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -403,17 +403,29 @@ class ProjectsController < ApplicationController #Ended by young def feedback - page = params[:page] + @page = params[:page] + @page = @page.to_i # Find the page of the requested reply @jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @limit = 10 - if params[:r] && page.nil? - offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i]) - page = 1 + offset / @limit + @limit = 3 + + offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i]) + page = 1 + offset / @limit + if params[:r] && @page.nil? + @page = page end - + + puts @page + if @page < 0 + @page = 1 + end + if @page > page + @page = page + end + + @feedback_count = @jours.count - @feedback_pages = Paginator.new @feedback_count, @limit, page + @feedback_pages = Paginator.new @feedback_count, @limit, @page @offset ||= @feedback_pages.offset @jour = @jours[@offset, @limit] @state = false diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index af850d626..e31bb2738 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -90,8 +90,37 @@ class WordsController < ApplicationController end def destroyJournal + @journalP=JournalsForMessage.find(params[:object_id]) @journalP.destroy + + @page = params[:page] + @page = @page.to_i + @project = Project.find params[:project_id] + # Find the page of the requested reply + @jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @limit = 3 + + offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i]) + page = 1 + offset / @limit + if params[:r] && @page.nil? + @page = page + end + + if @page < 0 + @page = 1 + end + if @page > page + @page = page + end + + @feedback_count = @jours.count + @feedback_pages = Paginator.new @feedback_count, @limit, @page + @offset ||= @feedback_pages.offset + @jour = @jours[@offset, @limit] + @state = false + @base_courses_tag = @project.project_type + respond_to do |format| format.js end diff --git a/app/views/projects/feedback.html.erb b/app/views/projects/feedback.html.erb index 13e123b35..8e36b8c59 100644 --- a/app/views/projects/feedback.html.erb +++ b/app/views/projects/feedback.html.erb @@ -36,7 +36,8 @@ function checkMaxLength() { -<% reply_allow = JournalsForMessage.create_by_user? User.current %> + +

    <%= l(:label_user_response) %>

    @@ -59,6 +60,8 @@ function checkMaxLength() { <% end %>
    +
    + <% reply_allow = JournalsForMessage.create_by_user? User.current %> <% if @jour.size >0 %>
      <% for journal in @jour%> @@ -81,7 +84,7 @@ function checkMaxLength() { <% if User.current.logged? %> <% if journal.user_id==User.current.id|| User.current.admin? %> - <%= link_to(l(:button_delete),{:controller => 'words', :action => 'destroyJournal', :object_id => journal.id}, + <%= link_to(l(:button_delete),{:controller => 'words', :action => 'destroyJournal', :object_id => journal.id, :project_id=>@project.id, :page=>@page}, :remote => true, :title => l(:button_delete)) %> <% end %> <% end %> @@ -106,4 +109,5 @@ function checkMaxLength() {
        <%= pagination_links_full @feedback_pages %>
      +
    \ No newline at end of file diff --git a/app/views/words/_feedback.html.erb b/app/views/words/_feedback.html.erb new file mode 100644 index 000000000..774ee3b64 --- /dev/null +++ b/app/views/words/_feedback.html.erb @@ -0,0 +1,50 @@ +<% reply_allow = JournalsForMessage.create_by_user? User.current %> +<% if @jour.size >0 %> +
      + <% for journal in @jour%> +
    • + <%= image_tag(url_to_avatar(journal.user), :class => "avatar") %> + + <%= link_to journal.user, user_path(journal.user)%> + <%= textilizable journal.notes%> + <%= l :label_update_time %>: <%= format_time journal.created_on %> + <% id = 'project_respond_form_'+journal.id.to_s%> + + <% if reply_allow %> + <%= link_to l(:label_projects_feedback_respond),'#', + {:focus => 'project_respond', + :onclick => "toggleAndSettingWordsVal($('##{id}'), + $('##{id} textarea'), + '#{l(:label_reply_plural)} #{journal.user.name}: '); + return false;"} %> + <% end %> + + <% if User.current.logged? %> + <% if journal.user_id==User.current.id|| User.current.admin? %> + <%= link_to(l(:button_delete),{:controller => 'words', :action => 'destroyJournal', :object_id => journal.id, :project_id=>@project.id, :page=>@page}, + :remote => true, :title => l(:button_delete)) %> + <% end %> + <% end %> + + +
      + <% if reply_allow %> +
      + <%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %> +
      + <% end %> +
      +
      + <%= render :partial => "words/journal_reply", :locals => {:journal => journal } %> +
      +
    • + <% end %> +
    +<% end %> + + \ No newline at end of file diff --git a/app/views/words/destroyJournal.js.erb b/app/views/words/destroyJournal.js.erb index 5c91c6053..3600c3fd6 100644 --- a/app/views/words/destroyJournal.js.erb +++ b/app/views/words/destroyJournal.js.erb @@ -1,3 +1,5 @@ + <% if @journalP!=nil %> - $(".message-for-user").children("#word_li_<%=@journalP.id%>").remove(); + //$(".message-for-user").children("#word_li_<%#=@journalP.id%>").remove(); + $("#project_feedback").html("<%= escape_javascript(render :partial => 'words/feedback') %>"); <% end %> \ No newline at end of file From 075b43f836a3392666909dd0e5175efe0a4714ec Mon Sep 17 00:00:00 2001 From: luguo Date: Thu, 21 Aug 2014 09:18:10 +0800 Subject: [PATCH 16/22] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=89=88=E6=9D=83?= =?UTF-8?q?=E7=AC=A6=E5=8F=B7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_base_footer.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_base_footer.html.erb b/app/views/layouts/_base_footer.html.erb index 990a6d3c8..46fc0debd 100644 --- a/app/views/layouts/_base_footer.html.erb +++ b/app/views/layouts/_base_footer.html.erb @@ -10,7 +10,7 @@ <%=l(:label_organizers)%> <%= link_to l(:label_organizers_information),"http://www.nudt.edu.cn/ArticleShow.asp?ID=47",:target=>"_blank"%> <%= link_to l(:label_organizers_information_institute), "http://www.nudt.edu.cn/ArticleShow.asp?ID=41", :target => "_blank" %> - <%=l(:label_copyright)%>@2007~2014 + <%=l(:label_copyright)%>©2007~2014 <%= link_to l(:label_contact_us),"http://" + Setting.host_name + "/projects/2/member", :target=>"_blank" %> <%= link_to l(:label_record),"http://www.miibeian.gov.cn/", :target => "_blank" %> From a328a934c8a1640dfccbeb0c088702393d4b5304 Mon Sep 17 00:00:00 2001 From: chenmin <19763783@qq.com> Date: Thu, 21 Aug 2014 09:22:34 +0800 Subject: [PATCH 17/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=8D=95=E4=B8=AA=E7=AB=9E=E8=B5=9B=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E3=80=81=E7=BC=96=E8=BE=91=E7=AB=9E=E8=B5=9B?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E7=9A=84=E6=98=BE=E7=A4=BAbug=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/softapplications/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index b5e3e951c..34e254f3d 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -9,8 +9,8 @@
    - - + From 3a2754eb278d2d7802aa462f42ea33ff792afeac Mon Sep 17 00:00:00 2001 From: chenmin <19763783@qq.com> Date: Thu, 21 Aug 2014 10:16:01 +0800 Subject: [PATCH 18/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=8D=95=E4=B8=AA=E7=AB=9E=E8=B5=9B=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AF=E8=A2=AB?= =?UTF-8?q?=E9=81=AE=E4=BD=8F=E7=9A=84bug=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/softapplications/show.html.erb | 95 ++++++++++++------------ 1 file changed, 49 insertions(+), 46 deletions(-) diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index 34e254f3d..efc83dcbc 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -3,51 +3,54 @@
    -
    - - - +
    <%= @softapplication.name %> + <%= @softapplication.name %> <%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: {confirm: '您确定要删除吗?'} if @softapplication.destroyable_by? User.current %>  <%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %>
    - - - - - - - - - <% contest = @softapplication.contests.first %> - - - - - - - - - - - - - - - - - - -
    <%= @softapplication.name %> - <%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: {confirm: '您确定要删除吗?'} if @softapplication.destroyable_by? User.current %>  - <%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %> -
    <%=l(:label_attendingcontestwork_belongs_type)%>:<%= @softapplication.app_type_name %><%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %>
    <%=l(:label_attendingcontestwork_release_person)%>:<%= @softapplication.user.name %><%=l(:label_attendingcontestwork_adaptive_system)%>:<%= @softapplication.android_min_version_available %>
    - <%=l(:label_attendingcontestwork_download)%>: - - <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current)} %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> - - <%=l(:label_attendingcontestwork_developers)%>:<%= @softapplication.application_developers %>
    <%=l(:label_attendingcontestwork_average_scores)%>: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %><%=l(:label_attendingcontestwork_release_time)%>:<%=format_time @softapplication.created_at %>
    - <% if @project %> - <%=l(:label_attendingcontestwork_deposit_project)%>:<%= link_to "#@project", project_path(@project) %> - <% end %> -
    -
    + + + + +
    <%= @softapplication.name %> + <%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: {confirm: '您确定要删除吗?'} if @softapplication.destroyable_by? User.current %>  + <%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %> +
    + + +
    + + + + + <% contest = @softapplication.contests.first %> + + + + + + + + + + + + + + + + + + + + + + + + +
    <%=l(:label_attendingcontestwork_belongs_type)%>:<%= @softapplication.app_type_name %><%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %>
    <%=l(:label_attendingcontestwork_release_person)%>:<%= @softapplication.user.name %><%=l(:label_attendingcontestwork_adaptive_system)%>:<%= @softapplication.android_min_version_available %>
    <%=l(:label_attendingcontestwork_download)%>: + <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current)} %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> + <%=l(:label_attendingcontestwork_developers)%>:<%= @softapplication.application_developers %>
    <%=l(:label_attendingcontestwork_average_scores)%>:<%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %><%=l(:label_attendingcontestwork_release_time)%>:<%=format_time @softapplication.created_at %>
    + <% if @project %> + <%=l(:label_attendingcontestwork_deposit_project)%>:<%= link_to "#@project", project_path(@project) %> + <% end %> +
    @@ -56,7 +59,7 @@
    <%=l(:label_work_description)%>:
    -
    <%= @softapplication.description %>
    +
    <%= @softapplication.description %>
    From 532cb231416788d4a7d1a51bbfe7d373d2791e7a Mon Sep 17 00:00:00 2001 From: chenmin <19763783@qq.com> Date: Thu, 21 Aug 2014 10:19:46 +0800 Subject: [PATCH 19/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=92=8C=E5=86=85=E5=AE=B9=E4=B9=8B=E9=97=B4=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E5=A4=AA=E5=A4=9A=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/softapplications/show.html.erb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index efc83dcbc..2863d5bfd 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -18,30 +18,30 @@ - + <% contest = @softapplication.contests.first %> - + - + - + - - + - + - + From 16d86a1fbd2596a9e3381a84b5980c82cf85788a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 21 Aug 2014 10:37:53 +0800 Subject: [PATCH 21/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E3=80=81=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=A8=A1=E5=9D=97=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 23 +++++ app/models/attachment.rb | 6 +- .../_course_show_all_attachment.html.erb | 94 ++++++++++--------- app/views/files/_show_all_attachment.html.erb | 26 +++-- 4 files changed, 95 insertions(+), 54 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index c80ce6d69..666c39d30 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -38,6 +38,17 @@ class FilesController < ApplicationController @isproject = true @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] @containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort + + all_attachments = [] + @containers.each do |container| + all_attachments += container.attachments + end + @limit = 10 + @feedback_count = all_attachments.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @curse_attachments = all_attachments[@offset, @limit] + render :layout => !request.xhr? elsif params[:course_id] @isproject = false @@ -67,6 +78,18 @@ class FilesController < ApplicationController else @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on desc").find(@course.id)] end + + all_attachments = [] + @containers.each do |container| + all_attachments += container.attachments + end + + @limit = 10 + @feedback_count = all_attachments.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @curse_attachments = all_attachments[@offset, @limit] + render :layout => 'base_courses' end end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 8f3d68d02..e25434e6e 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -29,9 +29,9 @@ class Attachment < ActiveRecord::Base include UserScoreHelper validates_presence_of :filename, :author - validates_length_of :filename, :maximum => 255 - validates_length_of :disk_filename, :maximum => 255 - validates_length_of :description, :maximum => 255 + validates_length_of :filename, :maximum => 254 + validates_length_of :disk_filename, :maximum => 254 + validates_length_of :description, :maximum => 254 validate :validate_max_file_size diff --git a/app/views/files/_course_show_all_attachment.html.erb b/app/views/files/_course_show_all_attachment.html.erb index 76112bc78..f70142a05 100644 --- a/app/views/files/_course_show_all_attachment.html.erb +++ b/app/views/files/_course_show_all_attachment.html.erb @@ -25,60 +25,70 @@ - <% @containers.each do |container| %> - <% next if container.attachments.empty? -%> - <% if container.is_a?(Version) -%> - + <%# @containers.each do |container| %> + <%# next if container.attachments.empty? -%> + <%# if container.is_a?(Version) -%> + - - --> + <%# end -%> + <% if @curse_attachments != nil %> + <% @curse_attachments.each do |file| %> + <%if file.is_public == 0 && !User.current.member_of_course?(@course)%> + <%next%> + <%end%> + "> + + + + - - + + - - - - - - - - <% end -%> - <% reset_cycle %> + + + + + + + + <% end -%> + <% end %> + <%# reset_cycle %> + <%# end -%> + +
    <%=l(:label_attendingcontestwork_belongs_type)%>:<%= @softapplication.app_type_name %><%= @softapplication.app_type_name %><%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %><%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %>
    <%=l(:label_attendingcontestwork_release_person)%>:<%= @softapplication.user.name %><%= @softapplication.user.name %> <%=l(:label_attendingcontestwork_adaptive_system)%>:<%= @softapplication.android_min_version_available %><%= @softapplication.android_min_version_available %>
    <%=l(:label_attendingcontestwork_download)%>: + <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current)} %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> <%=l(:label_attendingcontestwork_developers)%>:<%= @softapplication.application_developers %><%= @softapplication.application_developers %>
    <%=l(:label_attendingcontestwork_average_scores)%>:<%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %><%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %> <%=l(:label_attendingcontestwork_release_time)%>:<%=format_time @softapplication.created_at %><%=format_time @softapplication.created_at %>
    From 3343e1c4135f29a07a70df51c75690fa92fb3ae2 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 21 Aug 2014 10:24:23 +0800 Subject: [PATCH 20/22] =?UTF-8?q?#1203=20=E4=BF=AE=E5=A4=8D=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=AF=84=E5=AE=A1=E5=BF=AB=E9=80=9F=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E6=96=B0=E5=BB=BAISSUE=E6=97=B6=E6=8A=A5=E9=94=99=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/code_review/_issues_show_details_bottom.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/redmine_code_review/app/views/code_review/_issues_show_details_bottom.html.erb b/plugins/redmine_code_review/app/views/code_review/_issues_show_details_bottom.html.erb index e60198fff..480119ca7 100644 --- a/plugins/redmine_code_review/app/views/code_review/_issues_show_details_bottom.html.erb +++ b/plugins/redmine_code_review/app/views/code_review/_issues_show_details_bottom.html.erb @@ -46,8 +46,8 @@ review = issue.code_review %> <%= l(:label_revision) + " "%> <%= link_to_revision(assignment.revision, repo) %> - <% elsif assignment.attachment %> - <%= link_to(assignment.attachment.filename, :controller => 'attachments', :action => 'show', :id => attachment.id) %> + <% elsif assignment.respond_to?("attachment") && assignment.attachment %> + <%= link_to(assignment.attachment.filename.to_s, :controller => 'attachments', :action => 'show', :id => assignment.attachment.id) %> <% end %>
    <%= number_to_human_size(file.filesize) %> - <%= file.attachmentstype.typeName unless file.attachmentstype.nil? %> +
    <%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %><%= number_to_human_size(file.filesize) %> + <%= file.attachmentstype.typeName unless file.attachmentstype.nil? %> <%= render :partial => 'attachments/course_type_edit', :locals => {:attachmenttypes => attachmenttypes, :attachment => file, :contentype => selContentType} %> - <%= file.show_suffix_type %> - <%= file.file_dense_str %> -   + <%= file.show_suffix_type %> + <%= file.file_dense_str %> +   <%= render :partial => 'course_file_dense_edit', :locals => {:file_dense_list => file.file_dense_list, :attachment => file} %> - <%= file.downloads %> - <%= link_to(image_tag('delete.png'), attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> -
    -
    - <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> - <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> -
    -
    - -
    <%= file.downloads %> + <%= link_to(image_tag('delete.png'), attachment_path(file), + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> +
    +
    + <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> + <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> +
    +
    + +
    + + diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb index 838153c78..043fe1183 100644 --- a/app/views/files/_show_all_attachment.html.erb +++ b/app/views/files/_show_all_attachment.html.erb @@ -25,16 +25,17 @@
    + + + From e303a3789a16ec98b99f71c4c529cf8380889170 Mon Sep 17 00:00:00 2001 From: chenmin <19763783@qq.com> Date: Thu, 21 Aug 2014 10:50:53 +0800 Subject: [PATCH 22/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=9B=E6=96=B0?= =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=B5=84=E6=BA=90=E6=90=9C=E7=B4=A2=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=B3=BB=E7=BB=9F=E6=94=AF=E6=8C=81=E8=BF=87=E9=95=BF?= =?UTF-8?q?=E9=81=AE=E4=BD=8F=E5=85=B6=E4=BB=96=E6=A0=87=E7=AD=BE=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/softapplications/_list.html.erb | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/app/views/softapplications/_list.html.erb b/app/views/softapplications/_list.html.erb index 4f99519b5..e31aedda7 100644 --- a/app/views/softapplications/_list.html.erb +++ b/app/views/softapplications/_list.html.erb @@ -9,9 +9,30 @@
    <%= softapplication.description.truncate(95, omission: '...') %>
    <%contest = softapplication.contests.first%> + + + + + + + + + + + + + + + + + + + +

    <%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%>

    -

    <%=l(:label_attendingcontestwork_belongs_type)%>:<%= softapplication.app_type_name.truncate(10, omission: '...') %>

    -

    <%=l(:label_attendingcontestwork_adaptive_system)%>:<%= softapplication.android_min_version_available %>

    +

    <%=l(:label_attendingcontestwork_belongs_type)%>:<%= softapplication.app_type_name.truncate(14, omission: '...') %>

    + <%strTitle = softapplication.android_min_version_available%> +

    <%=l(:label_attendingcontestwork_adaptive_system)%>:<%= strTitle.truncate(10,omisiion:'...') %>

    <%=l(:label_attendingcontestwork_developers)%>:<%= softapplication.application_developers %>