From 5d1d56fbb3b7371e55465f8b691380959475ad82 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 8 Mar 2016 16:44:03 +0800 Subject: [PATCH 001/116] =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=B8=8B=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E6=94=B9=E6=88=90https://www.=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 70 +++++++++++++++++++ .../_org_course_homework.html.erb | 4 +- .../organizations/_org_project_issue.html.erb | 4 +- .../organizations/_project_create.html.erb | 10 +-- .../organizations/_project_message.html.erb | 7 +- .../organizations/_show_org_document.html.erb | 2 +- app/views/users/_show_detail_info.html.erb | 2 +- 7 files changed, 84 insertions(+), 15 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c19c44935..2233aeb16 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2905,3 +2905,73 @@ def user_url_in_org(user_id) return "https://www.trustie.net/users/" + user_id.to_s end end + +def project_issues_url_in_org(project_id) + if Rails.env.development? + return "http://localhost:3000/projects/" + project_id.to_s + "/issues" + elsif Rails.env.test? + return "https://www.test.forge.trustie.net/projects/" + project_id.to_s + "/issues" + else + return "https://www.trustie.net/projects/" + project_id.to_s + "/issues" + end +end + +def issue_url_in_org(id) + if Rails.env.development? + return "http://localhost:3000/issues/" + id.to_s + elsif Rails.env.test? + return "https://www.test.forge.trustie.net/issues/" + id.to_s + else + return "https://www.trustie.net/issues/" + id.to_s + end +end + +def project_boards_url_in_org(id) + if Rails.env.development? + return "http://localhost:3000/projects/" + id.to_s + "/boards" + elsif Rails.env.test? + return "https://www.test.forge.trustie.net/projects/" + id.to_s + "/boards" + else + return "https://www.trustie.net/projects/" + id.to_s + "/boards" + end +end + +def board_message_url_in_org(board_id, message_id) + if Rails.env.development? + return "http://localhost:3000/boards/" + board_id.to_s + "/topics/" + message_id.to_s + elsif Rails.env.test? + return "https://www.test.forge.trustie.net/boards/" + board_id.to_s + "/topics/" + message_id.to_s + else + return "https://www.trustie.net/boards/" + board_id.to_s + "/topics/" + message_id.to_s + end +end + +def project_url_in_org(id) + if Rails.env.development? + return "http://localhost:3000/projects/" + id.to_s + elsif Rails.env.test? + return "https://test.forge.trustie.net/projects/" + id.to_s + else + return "https://www.trustie.net/projects/" + id.to_s + end +end + +def homework_common_index_url_in_org(course_id) + if Rails.env.development? + return "http://localhost:3000/homework_common?course=" + course_id.to_s + elsif Rails.env.test? + return "https://test.forge.trustie.net/homework_common?course=" + course_id.to_s + else + return "https://www.trustie.net/homework_common?course=" + course_id.to_s + end +end + +def student_work_index_url_in_org(homework_id) + if Rails.env.development? + return "http://localhost:3000/student_work?homework=" + homework_id.to_s + elsif Rails.env.test? + return "https://test.forge.trustie.net/student_work?homework=" + course_id.to_s + else + return "https://www.trustie.net/student_work?homework=" + course_id.to_s + end +end diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 0dd9fb725..8b28c7a60 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -12,10 +12,10 @@ <% else %> <%= link_to activity.try(:user).try(:realname), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%> + <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_url_in_org(activity.course.id), :class => "newsBlue ml15"%> <% if activity.homework_detail_manual%> <% if activity.homework_detail_manual.comment_status == 1%> diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index 855a8053c..9b7dbfa8f 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.html.erb @@ -11,10 +11,10 @@ <% else %> <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%> + <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_url_in_org(activity.project.id), :class => "newsBlue ml15"%>
- <%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %> + <%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :class => "postGrey" %> <%#= get_issue_priority(activity.priority_id)[1] %> diff --git a/app/views/organizations/_project_create.html.erb b/app/views/organizations/_project_create.html.erb index e13f4128b..5003fd0e2 100644 --- a/app/views/organizations/_project_create.html.erb +++ b/app/views/organizations/_project_create.html.erb @@ -3,21 +3,21 @@
- <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user.id), :alt => "用户头像" %> <%= render :partial => 'users/show_detail_info', :locals => {:user => user} %>
<% if user.try(:realname) == ' ' %> - <%= link_to user, user_url_in_org(user), :class => "newsBlue mr15" %> + <%= link_to user, user_url_in_org(user.id), :class => "newsBlue mr15" %> <% else %> - <%= link_to user.try(:realname), user_url_in_org(user), :class => "newsBlue mr15" %> + <%= link_to user.try(:realname), user_url_in_org(user.id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to project.to_s+" | 项目", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %> + <%= link_to project.to_s+" | 项目", project_url_in_org(project.id), :class => "newsBlue ml15" %>
- <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %> + <%= link_to project.name, project_url_in_org(project.id), :class => "postGrey" %>
创建时间:<%= format_time(project.created_on) %> diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb index 3b459f366..a818939d6 100644 --- a/app/views/organizations/_project_message.html.erb +++ b/app/views/organizations/_project_message.html.erb @@ -12,16 +12,15 @@ <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%> + <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_url_in_org(activity.project.id), :class => "newsBlue ml15 mr5"%>
<% if activity.parent_id.nil? %> - <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey" + <%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board.id,activity.id), :class=> "postGrey" %> <% else %> - <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey" - %> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board.id,activity.id), :class=> "postGrey" %> <% end %>
diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index 2584e4209..e3ed492a0 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -111,7 +111,7 @@
- <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current) %> + <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current.id) %>
diff --git a/app/views/users/_show_detail_info.html.erb b/app/views/users/_show_detail_info.html.erb index f2a2faeb3..3ebcab21e 100644 --- a/app/views/users/_show_detail_info.html.erb +++ b/app/views/users/_show_detail_info.html.erb @@ -1,6 +1,6 @@
- <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user), :alt => "用户头像", :target => '_blank' %> + <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user.id), :alt => "用户头像", :target => '_blank' %> <%#= image_tag(url_to_avatar(user), :width => "50", :height => "50") %>
From 713c28c0b59155c772c5e59a00aeb386d5c56849 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 9 Mar 2016 10:25:57 +0800 Subject: [PATCH 002/116] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E6=93=8D=E4=BD=9C=E8=AF=BE=E7=A8=8B/?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9A=84=E8=AE=BE=E7=BD=AE=E5=85=AC=E5=BC=80?= =?UTF-8?q?/=E7=A7=81=E6=9C=89=E5=B1=9E=E6=80=A7=EF=BC=8C=E7=A1=AE?= =?UTF-8?q?=E5=AE=9A=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=E8=A6=81?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/private_or_public.js.erb | 4 ++-- app/views/projects/set_public_or_private.js.erb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/courses/private_or_public.js.erb b/app/views/courses/private_or_public.js.erb index 10b787dd4..4e512a6a0 100644 --- a/app/views/courses/private_or_public.js.erb +++ b/app/views/courses/private_or_public.js.erb @@ -9,10 +9,10 @@ } <% else %> <% if @course.is_public? %> - $("#set_course_public_<%= @course.id %>").text("设为私有"); $("#show_course_<%= @course.id %>").attr("title","公开课程:<%= @course.name %>(<%= @course.time.to_s+ @course.term %>)"); <% else %> - $("#set_course_public_<%= @course.id %>").text("设为公开"); $("#show_course_<%= @course.id %>").attr("title","私有课程:<%= @course.name %>(<%= @course.time.to_s+ @course.term %>)"); <% end %> + $("#set_course_public_<%= @course.id %>").replaceWith('<%= escape_javascript(link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => "courses", :action => "private_or_public", :id => @course,:user_page => true}, + :id => "set_course_public_#{@course.id.to_s}",:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗") %>'); <% end %> \ No newline at end of file diff --git a/app/views/projects/set_public_or_private.js.erb b/app/views/projects/set_public_or_private.js.erb index dbca3f65c..282a17091 100644 --- a/app/views/projects/set_public_or_private.js.erb +++ b/app/views/projects/set_public_or_private.js.erb @@ -1,7 +1,7 @@ <% if @project.is_public? %> - $("#set_project_public_<%= @project.id %>").text("设为私有"); $("#show_project_<%= @project.id %>").attr("title","公开项目:<%= @project.name %>"); <% else %> - $("#set_project_public_<%= @project.id %>").text("设为公开"); $("#show_project_<%= @project.id %>").attr("title","私有项目:<%= @project.name %>"); -<% end %> \ No newline at end of file +<% end %> +$("#set_project_public_<%= @project.id %>").replaceWith('<%= escape_javascript(link_to @project.is_public? ? "设为私有" : "设为公开", {:controller => "projects", :action => "set_public_or_private", :id => @project.id,:user_page => true}, + :id => "set_project_public_"+ @project.id.to_s,:method => "post",:remote=>true,:confirm=>"您确定要设置为"+(@project.is_public? ? "私有" : "公开")+"吗") %>'); \ No newline at end of file From a51ca428be3e06b4c9222f8246d335b8103bace5 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 9 Mar 2016 18:06:28 +0800 Subject: [PATCH 003/116] =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B0=83=E6=95=B4=E6=A0=8F=E7=9B=AE=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=A1=BA=E5=BA=8F=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_subfields_controller.rb | 11 +- app/helpers/organizations_helper.rb | 4 + app/models/org_subfield.rb | 8 ++ app/models/organization.rb | 6 +- app/views/org_subfields/create.js.erb | 3 +- app/views/org_subfields/destroy.js.erb | 3 +- .../org_subfields/update_priority.js.erb | 2 + .../_org_left_subfield_list.html.erb | 129 +++++++++--------- .../organizations/_subfield_list.html.erb | 118 ++++++++++------ app/views/organizations/setting.html.erb | 3 +- config/routes.rb | 1 + ...09022930_set_priority_for_org_subfields.rb | 24 ++++ public/stylesheets/org.css | 1 + 13 files changed, 201 insertions(+), 112 deletions(-) create mode 100644 app/views/org_subfields/update_priority.js.erb create mode 100644 db/migrate/20160309022930_set_priority_for_org_subfields.rb diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index 9337c5fd2..ba4c1f18f 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -5,9 +5,8 @@ class OrgSubfieldsController < ApplicationController def create if OrgSubfield.where("organization_id=#{params[:organization_id]} and name=?",params[:name]).count == 0 @res = true - @subfield = OrgSubfield.create(:name => params[:name]) @organization = Organization.find(params[:organization_id]) - @organization.org_subfields << @subfield + @subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id],:priority => @organization.org_subfields.order("priority").last.priority + 1) if !params[:sub_dir].blank? sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+ "and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'" @@ -15,7 +14,7 @@ class OrgSubfieldsController < ApplicationController SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir]) end end - @subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type]) + @subfield.update_attributes(:field_type => params[:field_type]) else @res = false end @@ -125,6 +124,12 @@ class OrgSubfieldsController < ApplicationController end end + def update_priority + @org_subfield = OrgSubfield.find(params[:id]) + @org_subfield.update_attribute(:priority, params[:priority].to_i) + @organization = @org_subfield.organization + end + def show_attachments obj @attachments = [] obj.each do |container| diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 69c355313..2f98e6783 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -28,4 +28,8 @@ module OrganizationsHelper end end + def is_default_field? field + (field.name == 'activity' || field.name == 'course' || field.name == 'project') && field.field_type == 'default' + end + end diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb index c62cbf4f8..8cec49686 100644 --- a/app/models/org_subfield.rb +++ b/app/models/org_subfield.rb @@ -9,6 +9,7 @@ class OrgSubfield < ActiveRecord::Base has_many :news, :dependent => :destroy acts_as_attachable after_create :create_board_sync + after_destroy :update_priority # 创建资源栏目讨论区 def create_board_sync @board = self.boards.build @@ -25,4 +26,11 @@ class OrgSubfield < ActiveRecord::Base def project end + + def update_priority + OrgSubfield.where("organization_id=? and priority>?", self.organization_id, self.priority).each do |field| + field.decrement(:priority) + field.save + end + end end \ No newline at end of file diff --git a/app/models/organization.rb b/app/models/organization.rb index fcb777fb6..248783a26 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -16,8 +16,8 @@ class Organization < ActiveRecord::Base end def add_default_subfields - OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default') - OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default') - OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default') + OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default', :priority => 1) + OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default', :priority => 2) + OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default', :priority => 3) end end diff --git a/app/views/org_subfields/create.js.erb b/app/views/org_subfields/create.js.erb index d035ab5cd..84b69717a 100644 --- a/app/views/org_subfields/create.js.erb +++ b/app/views/org_subfields/create.js.erb @@ -1,8 +1,7 @@ <% if @res %> $("#org_subfield_list").html(""); $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', - :locals => {:default_fields => @organization.org_subfields.where("field_type='default'"), - :subfields => @organization.org_subfields.where("field_type != 'default'") }) %>"); + :locals => {:subfields => @organization.org_subfields.order("priority") }) %>"); $("#sub_field_left_lists").html(""); $("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); $("#subfield_name").val(""); diff --git a/app/views/org_subfields/destroy.js.erb b/app/views/org_subfields/destroy.js.erb index 2ba03fc36..d069b1cd8 100644 --- a/app/views/org_subfields/destroy.js.erb +++ b/app/views/org_subfields/destroy.js.erb @@ -1,6 +1,5 @@ $("#org_subfield_list").html(""); $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', - :locals => {:default_fields => @organization.org_subfields.where("field_type='default'"), - :subfields => @organization.org_subfields.where("field_type != 'default'") }) %>"); + :locals => {:subfields => @organization.org_subfields.order("priority") }) %>"); $("#sub_field_left_lists").html(""); $("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); \ No newline at end of file diff --git a/app/views/org_subfields/update_priority.js.erb b/app/views/org_subfields/update_priority.js.erb new file mode 100644 index 000000000..4f269da8f --- /dev/null +++ b/app/views/org_subfields/update_priority.js.erb @@ -0,0 +1,2 @@ +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields.order("priority")}) %>"); +$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>") \ No newline at end of file diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 449d95f4c..3db6ffb13 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -34,71 +34,76 @@ }) }) -<% org_activity_field = organization.org_subfields.where('field_type="default" and name="activity" and field_type="default"').first %> -<% org_course_field = organization.org_subfields.where('field_type="default" and name="course" and field_type="default"').first %> -<% org_project_field = organization.org_subfields.where('field_type="default" and name="project" and field_type="default"').first %> -
- <%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %> -
-
-
- 项目 - <% if User.current.logged? and User.current.admin_of_org?(organization) %> - <%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%> - <% end %> -
-
-
    - <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> -
-
-
-
-
- 课程 - <% if User.current.logged? and User.current.admin_of_org?(organization) %> - <%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%> - <% end %> -
-
-
    - <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> -
-
-
-<% organization.org_subfields.where("field_type != 'default'").each do |field| %> -
- <% if field.field_type == "Post" %> - <% if !field.subfield_subdomain_dir.nil? %> - <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", organization.id).map(&:subname).include?(request.subdomain) %> - <%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> +<% organization.org_subfields.order("priority").each do |field| %> + <% if is_default_field?(field) %> + <% case field.name %> + <% when 'activity' %> +
+ <%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %> +
+ <% when 'course' %> +
+
+ 课程 + <% if User.current.logged? and User.current.admin_of_org?(organization) %> + <%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%> + <% end %> +
+
+
    + <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> +
+
+
+ <% when 'project' %> +
+
+ 项目 + <% if User.current.logged? and User.current.admin_of_org?(organization) %> + <%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%> + <% end %> +
+
+
    + <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> +
+
+
+ <% end %> + <% else %> +
+ <% if field.field_type == "Post" %> + <% if !field.subfield_subdomain_dir.nil? %> + <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", organization.id).map(&:subname).include?(request.subdomain) %> + <%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% else %> + <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% end %> <% else %> - <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %> + <% end %> + <% if User.current.member_of_org?organization %> + <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%> <% end %> <% else %> - <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %> - <% end %> - <% if User.current.member_of_org?organization %> - <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%> - <% end %> - <% else %> - <% if !field.subfield_subdomain_dir.nil? %> - <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", organization.id).map(&:subname).include?(request.subdomain) %> - <%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> - <% else %> - <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% if !field.subfield_subdomain_dir.nil? %> + <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", organization.id).map(&:subname).include?(request.subdomain) %> + <%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% else %> + <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% end %> + <% else %> + <%= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %> + <% end %> + <% if User.current.member_of_org?organization %> + <%= link_to "", subfield_upload_file_org_subfield_files_path(field.id, :in_org => 1),:method => "post", :remote => true, :class => "homepageMenuSetting fr", :title => "上传资源" %> + + <% end %> + <% end %> - <% else %> - <%= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %> - <% end %> - <% if User.current.member_of_org?organization %> - <%= link_to "", subfield_upload_file_org_subfield_files_path(field.id, :in_org => 1),:method => "post", :remote => true, :class => "homepageMenuSetting fr", :title => "上传资源" %> - - <% end %> - - <% end %> -
- +
+ + <% end %> <% end %> \ No newline at end of file diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index eed0dabf6..b90ba7565 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -1,4 +1,5 @@
    +
  • 顺序
  • 已有栏目
  • 状态
  • 类型
  • @@ -6,48 +7,64 @@
-<% default_fields.each do |field| %> - <% name = get_default_name(field) %> - -<% end %> - <% subfields.each do |field| %> -
    -
  • -
    <%= field.name %>
    - -
  • -
  • 新增
  • -
  • <%= field.field_type == "Post" ? "帖子" : "资源" %>
  • -
+ <% end %> <% end %> --> +<%= javascript_include_tag 'attachments' %> + -->

@@ -66,7 +71,7 @@ <% end %>
- 确定 + 确定 <%= link_to "取消", student_work_index_path(:homework => @homework), :class => "fr mr10 mt3"%>
@@ -96,23 +101,129 @@ } function popupRegex(){ - if(regexStudentWorkName()&®exStudentWorkDescription()) - { - if($("#group_member_ids").length > 0) { - if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) { - $('#ajax-modal').html("

作品信息完整性校验中,请稍等...

"); - showModal('ajax-modal', '500px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); - $('#ajax-modal').parent().addClass("anonymos"); - } - } else { + if($("#group_member_ids").length > 0) { + if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) { $('#ajax-modal').html("

作品信息完整性校验中,请稍等...

"); showModal('ajax-modal', '500px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("anonymos"); } + } else { + $('#ajax-modal').html("

作品信息完整性校验中,请稍等...

"); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); + $('#ajax-modal').parent().addClass("anonymos"); + } + } + + function nh_check_field(params){ + var result=true; + if(!regexStudentWorkName()) { + result=false; + return result; + } + if(params.content!=undefined){ + if(params.content.isEmpty()){ + result=false; + } + if(params.content.html()!=params.textarea.html() || params.issubmit==true){ + params.textarea.html(params.content.html()); + params.content.sync(); + + if(params.content.isEmpty()){ + params.contentmsg.html('作品描述不能为空'); + }else{ + params.contentmsg.html(''); + } + } } + return result; + } + function init_homework_form(params){ + params.form.submit(function(){ + params.textarea.html(params.editor.html()); + params.editor.sync(); + var flag = false; + if(params.form.attr('data-remote') != undefined ){ + flag = true + } + var is_checked = nh_check_field({ + issubmit:true, + content:params.editor, + contentmsg:params.contentmsg, + textarea:params.textarea + }); + + if(is_checked){ + if(flag){ + popupRegex(); + return true; + }else{ + $(this)[0].submit(); + $("#ajax-indicator").hide(); + return false; + } + } + return false; + }); + } + function init_homework_editor(params){ + params.textarea.removeAttr('placeholder'); + var editor = params.kindutil.create(params.textarea, { + resizeType : 1,minWidth:"1px",width:"100%",minHeight:"30px",height:"30px", + items : ['code','emoticons','fontname', + 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|', + 'formatblock', 'fontsize', '|','indent', 'outdent', + '|','imagedirectupload','table', 'media', 'preview',"more" + ], + afterChange:function(){//按键事件 + var edit = this.edit; + var body = edit.doc.body; + //paramsHeight = params.kindutil.removeUnit(this.height); + edit.iframe.height(150); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, 150)); + }, + afterCreate:function(){ + //init + var edit = this.edit; + var body = edit.doc.body; + edit.iframe[0].scroll = 'no'; + body.style.overflowY = 'hidden'; + //reset height + var edit = this.edit; + var body = edit.doc.body; + edit.html(params.textarea.innerHTML); + //paramsHeight = params.kindutil.removeUnit(this.height); + edit.iframe.height(150); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150)); + + } + }).loadPlugin('paste'); + return editor; } + KindEditor.ready(function(K){ + $("div[nhname='student_work_form']").each(function(){ + var params = {}; + params.kindutil = K; + params.div_form = $(this); + params.form = $("form",params.div_form); + if(params.form==undefined || params.form.length==0){ + return; + } + params.textarea = $("textarea[nhname='student_work_textarea']",params.div_form); + params.contentmsg = $("#student_work_description_textarea"); + params.submit_btn = $("#new_message_submit_btn"); + if(params.textarea.data('init') == undefined) { + params.editor = init_homework_editor(params); + init_homework_form(params); + params.submit_btn.click(function () { + params.form.submit(); + $("#ajax-indicator").hide(); + }); + params.textarea.data('init', 1); + } + }); + }); \ No newline at end of file diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index 9391aab37..15958d870 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -1,4 +1,9 @@ +<% content_for :header_tags do %> + <%= import_ke(enable_at: true, prettify: false, init_activity: false) %> + <%= javascript_include_tag 'homework','baiduTemplate' %> +<% end %> +
@@ -110,7 +220,7 @@
-
+
<%= form_for(@student_work, :html => { :multipart => true }, :url => {:controller => 'student_work', @@ -132,11 +242,12 @@

- <%= f.text_area "description", :class => "InputBox W700 H150", :placeholder => "请输入作品描述", :onkeyup => "regexStudentWorkDescription();"%> - -->

@@ -167,9 +278,9 @@
-->
- 提交 + 提交 - <%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id), :class => "fr mr10 mt3"%> + <%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id),:id => 'new_message_cancel_btn', :class => "fr mr10 mt3"%>
<% end%> From e97690e2f2f43ae10e613fe6ea16894c99835826 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 15 Mar 2016 16:47:57 +0800 Subject: [PATCH 048/116] =?UTF-8?q?=E2=80=9C=E5=AF=BC=E5=85=A5=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E2=80=9D=E6=94=B9=E4=B8=BA=E2=80=9C=E4=BB=8E=E9=A2=98?= =?UTF-8?q?=E5=BA=93=E9=80=89=E7=94=A8=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_homework_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 8b72ec781..100ef0d37 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -150,7 +150,7 @@
- <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%> + <%= link_to("从题库选用", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%> <% unless edit_mode %> <% end %> From 69ec475752906a04a84f8886152f5e139093d67d Mon Sep 17 00:00:00 2001 From: linchun Date: Tue, 15 Mar 2016 16:59:32 +0800 Subject: [PATCH 049/116] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=80=92=E5=BA=8F=E6=8E=92=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index d93959996..8e0adffe2 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -390,7 +390,7 @@ class AdminController < ApplicationController #组织 def organization - @organizations = Organization.all + @organizations = Organization.find_by_sql("SELECT * FROM organizations ORDER BY created_at DESC") respond_to do |format| format.html end From 879f9a0ad5d58698225cf47c8a2c55ebdde7688e Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 15 Mar 2016 17:21:12 +0800 Subject: [PATCH 050/116] =?UTF-8?q?=E5=AF=B9=E5=B7=B2=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E4=B8=9A=E6=88=AA=E6=AD=A2=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E8=B0=83=E6=95=B4=E6=97=B6,=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E4=BD=9C=E4=B8=9A=E6=88=AA=E6=AD=A2=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=A4=A7=E4=BA=8E=E7=AD=89=E4=BA=8E=E5=8C=BF=E8=AF=84=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E6=97=B6=E9=97=B4=E4=B8=94=E5=8C=BF=E8=AF=84=E8=BF=98?= =?UTF-8?q?=E6=9C=AA=E5=BC=80=E5=90=AF=E5=88=99=E5=8C=BF=E8=AF=84=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E6=97=B6=E9=97=B4=E5=92=8C=E7=BB=93=E6=9D=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E9=83=BD=E7=9B=B8=E5=BA=94=E5=BE=80=E5=90=8E=E6=8E=A8?= =?UTF-8?q?=E8=BF=9F7=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 8 +++++--- app/views/users/_user_homework_form.html.erb | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index ba6c136bb..3532a9e4c 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -73,9 +73,11 @@ class HomeworkCommonController < ApplicationController if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0 homework_detail_manual.comment_status = 1 end - homework_detail_manual.evaluation_start = params[:evaluation_start].blank? ? @homework.end_time + 7 : params[:evaluation_start] - homework_detail_manual.evaluation_end = params[:evaluation_end].blank? ? homework_detail_manual.evaluation_start + 7 : params[:evaluation_end] - + eval_start = homework_detail_manual.evaluation_start + if eval_start <= @homework.end_time && homework_detail_manual.comment_status <= 1 + homework_detail_manual.evaluation_start = @homework.end_time + 7 + homework_detail_manual.evaluation_end = homework_detail_manual.evaluation_start + 7 + end @homework.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@homework) diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 100ef0d37..f1f29b0da 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -159,7 +159,7 @@ <% end %>
- <% if homework.homework_detail_manual.comment_status.to_i < 3 %> + <% if homework.homework_detail_manual.comment_status.to_i < 2 %> <%= calendar_for('homework_end_time')%> <% end %>
From 2ce2134f0bcc0ba5324a913881f8388ebd0bad77 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 15 Mar 2016 17:25:46 +0800 Subject: [PATCH 051/116] =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8tab=E7=9A=84?= =?UTF-8?q?title=EF=BC=8C=E6=98=BE=E7=A4=BA=E7=94=A8=E6=88=B7=E5=A7=93?= =?UTF-8?q?=E5=90=8D=EF=BC=8C=E4=B8=8D=E6=98=AF=E7=99=BB=E5=BD=95=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 477e18f41..29886b8ac 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1044,9 +1044,9 @@ module ApplicationHelper elsif @organization title << @organization.name elsif @user - title << @user.login + title << @user.try(:realname) else - title << User.current.login + title << User.current.try(:realname) end if first_page.nil? || first_page.web_title.nil? title << Setting.app_title unless Setting.app_title == title.last From 9aab10c05a6dbe3d2f8eef8495dc3fd7ed3dea88 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 15 Mar 2016 17:29:37 +0800 Subject: [PATCH 052/116] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 57 +++++++++++++++++------------ 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d1979bc84..68accdfd0 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -824,20 +824,33 @@ class UsersController < ApplicationController user_course_ids = User.current.courses.map { |c| c.id} user_project_ids = User.current.projects.map {|p| p.id} # user_org_ids = User.current.organizations.map {|o| o.id} - if(params[:type].blank? || params[:type] == "1") #全部 + if(params[:type].blank? || params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 - @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, params[:order]) - elsif params[:type] == "2" # 课程资源 - @attachments = get_course_resources(params[:id], user_course_ids, params[:order]) - elsif params[:type] == "3" # 项目资源 - @attachments = get_project_resources(params[:id], user_project_ids, params[:order]) - elsif params[:type] == "4" #附件 - @attachments = get_attch_resources params[:id], params[:order] - elsif params[:type] == "5" #用户资源 - @attachments = get_principal_resources params[:id], params[:order] + if params[:status] == "2" + @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) + elsif params[:status] == "3" + @attachments = get_project_resources(params[:id], user_project_ids, @order, @score) + elsif params[:status] == "4" + @attachments = get_attch_resources(params[:id], @order, @score) + elsif params[:status] == "5" + @attachments = get_principal_resources(params[:id], @order, @score) + else + # 公共资源库:所有公开资源或者我上传的私有资源 + @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + end elsif params[:type] == "6" # 公共资源 - # 公共资源库:所有公开资源或者我上传的私有资源 - @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order]) + if params[:status] == "2" + @attachments = get_course_resources_public( user_course_ids, @order, @score) + elsif params[:status] == "3" + @attachments = get_project_resources_public(user_project_ids, @order, @score) + elsif params[:status] == "4" + @attachments = get_attch_resources_public(@order, @score) + elsif params[:status] == "5" + @attachments = get_principal_resources_public(@order, @score) + else + # 公共资源库:所有公开资源或者我上传的私有资源 + @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) + end end @type = params[:type] @limit = 7 @@ -2503,16 +2516,19 @@ class UsersController < ApplicationController render_403 return end + @user = User.find(params[:id]) + @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" + @score = @b_sort == "desc" ? "asc" : "desc" user_course_ids = User.current.courses.map { |c| c.id} - user_project_ids = User.current.projects.map {|p| p.id} - # user_org_ids = User.current.organizations.map {|o| o.id} + user_project_ids = User.current.projects.map {|p| p.id} # user_org_ids = User.current.organizations.map {|o| o.id} if(params[:type].blank? || params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 - @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, params[:order]) + @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) elsif params[:type] == "6" # 公共资源 # 公共资源库:所有公开资源或者我上传的私有资源 - @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order]) + @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) end + @status = params[:status] @type = params[:type] @limit = 10 @is_remote = true @@ -2534,20 +2550,15 @@ class UsersController < ApplicationController render_403 return end - user_course_ids = User.current.courses.map { |c| c.id} - user_project_ids = User.current.projects.map {|p| p.id} - # user_org_ids = User.current.organizations.map {|o| o.id} if(params[:type].blank? || params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 user_course_ids = User.current.courses.map { |c| c.id} user_project_ids = User.current.projects.map {|p| p.id} # user_org_ids = User.current.organizations.map {|o| o.id} - @attachments = Attachment.where("((author_id = #{params[:id]} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ - "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" + - "or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)) and (filename like :p)" ,:p => search).order("#{params[:order].nil? ? 'created_on' : params[:order]} desc") + @attachments = get_my_resources_search(params[:id], user_course_ids, user_project_ids, @order, @score, search) elsif params[:type] == "6" # 公共资源 # 公共资源库:所有公开资源或者我上传的私有资源 - @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order]) + @attachments = get_public_resources_search(user_course_ids, user_project_ids, @order, @score, search) end @type = params[:type] @limit = 10 From 9bac560906abd2bc2016caf11fc3d33eae6b6dfe Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 16 Mar 2016 10:00:21 +0800 Subject: [PATCH 053/116] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E6=9C=89=E7=BC=96=E8=BE=91=E5=92=8C=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E7=9A=84=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/blog_comments_controller.rb | 8 ++++++-- app/views/blog_comments/edit.html.erb | 11 +++++------ app/views/blog_comments/show.html.erb | 6 +++--- app/views/blogs/_article.html.erb | 6 +++--- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index f5e3314bb..7220eec27 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -91,8 +91,12 @@ class BlogCommentsController < ApplicationController def edit @article = BlogComment.find(params[:id]) - respond_to do |format| - format.html {render :layout=>'new_base_user'} + if User.current.admin? || User.current.id == @article.author_id + respond_to do |format| + format.html { render :layout => 'new_base_user' } + end + else + render_403 end end diff --git a/app/views/blog_comments/edit.html.erb b/app/views/blog_comments/edit.html.erb index 704342fc0..1e29d0a14 100644 --- a/app/views/blog_comments/edit.html.erb +++ b/app/views/blog_comments/edit.html.erb @@ -1,6 +1,5 @@ -<% if User.current.logged? && User.current.id == @user.id %> - <%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage],:in_act => params[:in_act]},:method=>'PUT', - :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %> - <%= render :partial => 'blog_comments/edit', :locals => {:f => f, :article => @article, :edit_mode => true, :user => @user} %> - <% end %> -<% end %> \ No newline at end of file + +<%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage],:in_act => params[:in_act]},:method=>'PUT', + :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %> + <%= render :partial => 'blog_comments/edit', :locals => {:f => f, :article => @article, :edit_mode => true, :user => @user} %> +<% end %> diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index c80274db4..de7f1647d 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -38,7 +38,7 @@ <%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %>
- <% if @article.author.id == User.current.id%> + <% if @article.author.id == User.current.id || User.current.admin? %>
- <% if activity.author.id == User.current.id%> + <% if activity.author.id == User.current.id || User.current.admin? %> <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> + + + +
<%# 局部刷新:修改xissue属性 %> <% if User.current.member_of?(activity.project) %> <% unless params[:action] == "index" %> @@ -59,10 +63,7 @@
<% end %> <% end %> -
- - -
+
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
From 34c9f545101b42f771bb9580cd2d85a34db4381b Mon Sep 17 00:00:00 2001 From: linchun Date: Wed, 16 Mar 2016 15:24:41 +0800 Subject: [PATCH 059/116] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=86=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E7=95=8C=E9=9D=A2=E5=AD=A6=E6=A0=A1=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 22 ++++++------- app/helpers/school_helper.rb | 13 ++++++++ app/views/admin/schools.html.erb | 49 ++++++++++++++++++++--------- 3 files changed, 58 insertions(+), 26 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 8e0adffe2..66c35ed6b 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -24,7 +24,7 @@ class AdminController < ApplicationController before_filter :require_admin helper :sort helper :Users - helper :Settings + helper :Settings,SchoolHelper include SortHelper def index @@ -390,7 +390,8 @@ class AdminController < ApplicationController #组织 def organization - @organizations = Organization.find_by_sql("SELECT * FROM organizations ORDER BY created_at DESC") + #@organizations = Organization.find_by_sql("SELECT * FROM organizations ORDER BY created_at DESC") + @organizations = Organization.all.order("created_at desc") respond_to do |format| format.html end @@ -398,17 +399,14 @@ class AdminController < ApplicationController #学校列表 def schools - @school_name = params[:school_name] - if @school_name && @school_name != '' - @schools = School.where("name like '%#{@school_name}%'") - elsif @school_name.nil? - @schools = [] - else @school_name && @school_name == ' ' - @schools = School.where('1=1') - end + + @schools = School.find_by_sql("SELECT * FROM schools ORDER BY created_at DESC") @school_count = @schools.count - @school_pages = Paginator.new @school_count, 100, params['page'] || 1 - @schools = paginateHelper @schools,100 + + @school_pages = Paginator.new @school_count, 50, params['page'] || 1 + @schools = paginateHelper @schools,50 + + @page = (params['page'] || 1).to_i - 1 respond_to do |format| format.html end diff --git a/app/helpers/school_helper.rb b/app/helpers/school_helper.rb index 0528cb7ac..075d2b039 100644 --- a/app/helpers/school_helper.rb +++ b/app/helpers/school_helper.rb @@ -1,2 +1,15 @@ module SchoolHelper + def schoolMember_num school + count = student_num(school) + teacher_num(school) + count.to_s + end + + def student_num school + UserExtensions.find_by_sql("SELECT * FROM user_extensions WHERE occupation = '#{school.name}' AND identity = '1'").count + end + + def teacher_num school + UserExtensions.find_by_sql("SELECT * FROM user_extensions AS ue, schools AS s WHERE ue.school_id = s.id AND s.name = '#{school.name}' AND ue.identity = '0'").count + end + end diff --git a/app/views/admin/schools.html.erb b/app/views/admin/schools.html.erb index d19e9b3b9..f52d1f060 100644 --- a/app/views/admin/schools.html.erb +++ b/app/views/admin/schools.html.erb @@ -1,43 +1,64 @@

<%=l(:label_school_plural)%>

-<%= form_tag({:controller => 'admin', :action => 'schools' }, :method => :get,:id=>"search_course_form") do %> - <%= submit_tag "搜索",:style => "float: right;margin-right: 15px;"%> - -<% end %> + + + +
- - - - + + + - <% @schools.each do |school|%> + <% @count=@page * 30 %> + <% @schools.each do |school| %> "> - + + - + + @@ -50,4 +71,4 @@ <%= pagination_links_full @school_pages, @school_count ,:per_page_links => true, :remote => false, :flag => true %> -<% html_title(l(:label_project_plural)) -%> +<% html_title(l(:label_school_plural)) -%> From 4d82f0c959e2f3c0f7793bc6389894a359a8dd9b Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Wed, 16 Mar 2016 16:03:53 +0800 Subject: [PATCH 060/116] =?UTF-8?q?=E5=9C=A8=E4=B8=AA=E4=BA=BA=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E3=80=81=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E9=A1=B9=E7=9B=AE=E9=97=AE=E9=A2=98=E8=B7=9F=E8=B8=AA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E3=80=8Aissue=E5=8A=A8=E6=80=81=E8=A6=81?= =?UTF-8?q?=E5=8F=B3=E4=B8=8A=E8=A7=92=E6=98=BE=E7=A4=BA=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E3=80=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 3 +++ app/views/issues/show.html.erb | 3 +++ app/views/users/_project_issue.html.erb | 17 +++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index eb78c4c5b..f0148fc71 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -118,6 +118,9 @@ class IssuesController < ApplicationController end def show + # 打开编辑内容 + @is_edit = true unless params[:edit].nil? + # 当前用户查看指派给他的缺陷消息,则设置消息为已读 query = ForgeMessage.where("forge_message_type =? and user_id =? and forge_message_id =?", "Issue", User.current, @issue).first query.update_attribute(:viewed, true) unless query.nil? diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index b9d463855..4b82f8665 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -9,6 +9,9 @@ $(function(){ $("#RSide").removeAttr("id"); $("#Container").css("width","1000px"); + if(<%= @is_edit %>) { + issueEditShow(); + } });
diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 7f3d5b177..090098722 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -13,6 +13,23 @@ <% end %> TO <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%>
+
+
    +
  • +
      +
    • + <%= link_to l(:button_edit), issue_path(activity.id, :edit => 'true'), :class => 'postOptionLink', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %> +
    • +
    • + <%= link_to l(:button_delete), issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %> +
    • +
    • + <%= link_to l(:button_copy), project_copy_issue_path(activity.project, activity), :class => 'postOptionLink' if User.current.allowed_to?(:add_issues, activity.project) %> +
    • +
    +
  • +
+
<% case activity.tracker_id %> <% when 1%> From 0a881f14e81e7ff356465f6128abafb494f724c7 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 16 Mar 2016 17:06:11 +0800 Subject: [PATCH 061/116] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 10 ++++-- .../users/_import_resource_info.html.erb | 34 ++++++------------- .../users/_user_import_resource_list.html.erb | 19 +++++++++++ .../_user_import_resource_search.html.erb | 29 ++++++++++++++++ .../users/import_resources_search.js.erb | 28 ++------------- 5 files changed, 69 insertions(+), 51 deletions(-) create mode 100644 app/views/users/_user_import_resource_list.html.erb create mode 100644 app/views/users/_user_import_resource_search.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 7ba756806..cf591d6a8 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2544,7 +2544,11 @@ class UsersController < ApplicationController end def import_resources_search - search = "%#{params[:search].strip.downcase}%" + @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" + @score = @b_sort == "desc" ? "asc" : "desc" + @user = User.current + @switch_search = params[:name].nil? ? " " : params[:name] + search = "%#{@switch_search.strip.downcase}%" # 别人的资源库是没有权限去看的 if User.current.id.to_i != params[:id].to_i render_403 @@ -2567,10 +2571,10 @@ class UsersController < ApplicationController @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 @offset ||= @atta_pages.offset #@curse_attachments_all = @all_attachments[@offset, @limit] - @attachments = paginateHelper @attachments,10 + @attachments = paginateHelper @attachments, 10 respond_to do |format| format.js - format.html {render :layout => 'new_base'} + # format.html {render :layout => 'new_base'} end end diff --git a/app/views/users/_import_resource_info.html.erb b/app/views/users/_import_resource_info.html.erb index bc1152ce4..4ea56ad9f 100644 --- a/app/views/users/_import_resource_info.html.erb +++ b/app/views/users/_import_resource_info.html.erb @@ -26,11 +26,14 @@ 公共资源 我的资源 <% end %> - <%#= form_tag( url_for(:controller => 'users', :action => 'import_resources_search', :id => User.current.id, :type => 1), - :remote => true , :method => 'get', :id => 'resource_search_form') do %> + + - <%#= hidden_field_tag(:type,type.nil? ? 1 : type) %> - <%# end %> + + +
@@ -42,25 +45,10 @@
  • 上传者
  • 上传时间
  • - <%= form_tag( url_for({:controller => 'users', :action => 'import_into_container', - :mul_id => params[:project_id].nil? ? (params[:course_id].nil? ? params[:subfield_file_id] : params[:course_id]) : params[:project_id], - :mul_type => params[:project_id].nil? ? (params[:course_id].nil? ? "SubfieldFile" : "Course") : "Project"}), - :method => 'post', :id => 'resource_import_container_form') do %> - <% @attachments.each do |attach| %> -
      - -
    • <%= get_resource_type(attach.container_type)%>
    • - -
    • <%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %>
    • -
    • <%= format_date(attach.created_on) %>
    • -
    - <% end %> - <% end %> +
    + <%= render :partial => 'users/user_import_resource_list',:locals => {:project_id => params[:project_id], :subfield_file_id => params[:subfield_file_id], :course_id => params[:course_id]} %> +
    +
    diff --git a/app/views/users/_user_import_resource_list.html.erb b/app/views/users/_user_import_resource_list.html.erb new file mode 100644 index 000000000..57dac6ad0 --- /dev/null +++ b/app/views/users/_user_import_resource_list.html.erb @@ -0,0 +1,19 @@ +<%= form_tag( url_for({:controller => 'users', :action => 'import_into_container', + :mul_id => project_id.nil? ? (course_id.nil? ? subfield_file_id : course_id) : project_id, + :mul_type => project_id.nil? ? (course_id.nil? ? "SubfieldFile" : "Course") : "Project"}), + :method => 'post', :id => 'resource_import_container_form') do %> + <% @attachments.each do |attach| %> +
      + +
    • <%= get_resource_type(attach.container_type)%>
    • + +
    • <%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %>
    • +
    • <%= format_date(attach.created_on) %>
    • +
    + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/users/_user_import_resource_search.html.erb b/app/views/users/_user_import_resource_search.html.erb new file mode 100644 index 000000000..b048675dd --- /dev/null +++ b/app/views/users/_user_import_resource_search.html.erb @@ -0,0 +1,29 @@ + + \ No newline at end of file diff --git a/app/views/users/import_resources_search.js.erb b/app/views/users/import_resources_search.js.erb index 549cf6329..ea527ab6b 100644 --- a/app/views/users/import_resources_search.js.erb +++ b/app/views/users/import_resources_search.js.erb @@ -1,25 +1,3 @@ -//$("#resources_list").html('<%#= escape_javascript( render :partial => 'users/import_resource_info' ,:locals=>{ :attachments => @attachments, :type => @type})%>'); -//$("#pages").html('<%#= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); -//$("#res_all_count").html(<%#= @atta_count%>); -//$("#res_count").html(0); -//$("#checkboxAll").attr('checked',false); - - -<% if params[:project_id] %> -$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :project_id => params[:project_id]} ) %>'); -<% elsif params[:course_id] %> -$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :course_id => params[:course_id]} ) %>'); -<% elsif params[:subfield_file_id] %> -$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :subfield_file_id => params[:subfield_file_id]} ) %>'); -<% end %> -showModal('ajax-modal', '615px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -<% if params[:project_id] %> -$('#ajax-modal').parent().css("top","10%").css("left","34%").css("border","3px solid #269ac9"); -<% else %> -$('#ajax-modal').parent().css("top","20%").css("left","42%").css("border","3px solid #269ac9"); -<% end %> -$('#ajax-modal').parent().addClass("popbox_polls"); - - +$("#import_resource_info_list").html('<%= escape_javascript( render :partial => 'user_import_resource_list', + :locals => {:user => @user, :type => @type, :project_id => params[:project_id], :subfield_file_id => params[:subfield_file_id], :course_id => params[:course_id]} ) %>'); +$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); From 805784a8583ede2d014c3370a96a804562230351 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 17 Mar 2016 10:52:19 +0800 Subject: [PATCH 062/116] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=86=85=E7=9A=84?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E5=8A=A0=E4=B8=8ASetting.protocol?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organizations/_org_course_homework.html.erb | 12 ++++++------ app/views/organizations/_org_course_poll.html.erb | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 2bc00d6b1..e6af795a9 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -227,17 +227,17 @@
    • - <%= link_to l(:button_edit),Setting.host_name + "/homework_common/" + activity.id.to_s + "/edit?", :class => "postOptionLink"%> + <%= link_to l(:button_edit),Setting.protocol + "://" + Setting.host_name + "/homework_common/" + activity.id.to_s + "/edit?", :class => "postOptionLink"%>
    • - <%= link_to(l(:label_bid_respond_delete), Setting.host_name + "/homework_common/" + activity.id.to_s + "?is_in_course=-1&course_activity=" + course_activity.to_s,:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %> + <%= link_to(l(:label_bid_respond_delete), Setting.protocol + "://" + Setting.host_name + "/homework_common/" + activity.id.to_s + "?is_in_course=-1&course_activity=" + course_activity.to_s,:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
    • - <%= link_to("评分设置", Setting.host_name + "/homework_common/" + activity.id.to_s + "/score_rule_set?is_in_course=0&user_activity_id=" + user_activity_id.to_s,:class => "postOptionLink", :remote => true) %> + <%= link_to("评分设置", Setting.protocol + "://" + Setting.host_name + "/homework_common/" + activity.id.to_s + "/score_rule_set?is_in_course=0&user_activity_id=" + user_activity_id.to_s,:class => "postOptionLink", :remote => true) %>
    • <% if activity.anonymous_comment == 0 %>
    • - <%= link_to("匿评设置", Setting.host_name + "/homework_common/" + activity.id.to_s + "/start_evaluation_set",:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%> + <%= link_to("匿评设置", Setting.protocol + "://" + Setting.host_name + "/homework_common/" + activity.id.to_s + "/start_evaluation_set",:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
    • <%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %> @@ -251,11 +251,11 @@ <% end %> <% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
    • - <%= link_to("公开作品", Setting.host_name + "/homework_common/" + activity.id.to_s + "/alert_open_student_works?is_in_course=-1&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s,:class => "postOptionLink", :remote => true)%> + <%= link_to("公开作品", Setting.protocol + "://" + Setting.host_name + "/homework_common/" + activity.id.to_s + "/alert_open_student_works?is_in_course=-1&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s,:class => "postOptionLink", :remote => true)%>
    • <% elsif activity.is_open == 1 %>
    • - <%= link_to("取消公开", Setting.host_name + "/homework_common/" + activity.id.to_s + "/alert_open_student_works?is_in_course=-1&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s,:class => "postOptionLink", :remote => true)%> + <%= link_to("取消公开", Setting.protocol + "://" + Setting.host_name + "/homework_common/" + activity.id.to_s + "/alert_open_student_works?is_in_course=-1&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s,:class => "postOptionLink", :remote => true)%>
    • <% end %>
    diff --git a/app/views/organizations/_org_course_poll.html.erb b/app/views/organizations/_org_course_poll.html.erb index fff50786e..cfd2fcb65 100644 --- a/app/views/organizations/_org_course_poll.html.erb +++ b/app/views/organizations/_org_course_poll.html.erb @@ -16,7 +16,7 @@ <%= link_to activity.try(:user).try(:realname), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to Course.find(activity.polls_group_id).name.to_s+" | 问卷", Setting.host_name + "/poll?polls_type=Course&polls_group_id=" + activity.polls_group_id.to_s, :class => "newsBlue ml15" %> + <%= link_to Course.find(activity.polls_group_id).name.to_s+" | 问卷", Setting.protocol + "://" + Setting.host_name + "/poll?polls_type=Course&polls_group_id=" + activity.polls_group_id.to_s, :class => "newsBlue ml15" %>
    From 7ff946e488476d01e6fc77e6b465a84c8d803d49 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 17 Mar 2016 12:37:05 +0800 Subject: [PATCH 063/116] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=BA=93=E6=8F=90=E4=BE=9B=E5=8E=86=E5=8F=B2=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 9 ++++++ .../_attachment_history_download.html.erb | 31 +++++++++++++++++++ .../attachment_history_download.js.erb | 7 +++++ app/views/files/_resource_detail.html.erb | 27 +++++++++------- app/views/layouts/base_courses.html.erb | 2 +- config/routes.rb | 1 + public/javascripts/course.js | 1 + 7 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 app/views/attachments/_attachment_history_download.html.erb create mode 100644 app/views/attachments/attachment_history_download.js.erb diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index b878a14ac..e974f26b4 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -572,6 +572,15 @@ class AttachmentsController < ApplicationController end end + #找到文件的所有的历史版本及当前版本 + def attachment_history_download + @attachment = Attachment.find(params[:id]) + @attachment_histories = @attachment.attachment_histories + respond_to do |format| + format.js + end + end + private def find_project @attachment = Attachment.find(params[:id]) diff --git a/app/views/attachments/_attachment_history_download.html.erb b/app/views/attachments/_attachment_history_download.html.erb new file mode 100644 index 000000000..bdef2077c --- /dev/null +++ b/app/views/attachments/_attachment_history_download.html.erb @@ -0,0 +1,31 @@ + +选择版本 +

    注:该文件有历史版本,请选择您需要的文件,点击文件名下载。

    +

    版本及序号

    + +
    + + <%= link_to truncate(@attachment.filename,length: 35, omission: '...'), + download_named_attachment_path(@attachment.id, @attachment.filename), + :title => @attachment.filename+"\n"+@attachment.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f14 fb link_file_a2 fl" %> + + 版本号:当前 + + <% @attachment_histories.each do |history| %> + + <%= link_to truncate(history.filename,length: 35, omission: '...'), + download_history_attachment_path(history.id, history.filename), + :title => history.filename+"\n"+history.description.to_s, + :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f14 fb link_file_a2 fl" %> + + + 版本号:<%= history.version %> +
    + <% end %> +
    diff --git a/app/views/attachments/attachment_history_download.js.erb b/app/views/attachments/attachment_history_download.js.erb new file mode 100644 index 000000000..352a2ef93 --- /dev/null +++ b/app/views/attachments/attachment_history_download.js.erb @@ -0,0 +1,7 @@ +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/attachment_history_download' )%>'); +showModal('ajax-modal', '452px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","40%").css("left","50%"); +$('#ajax-modal').parent().addClass("resourceUploadPopup"); +$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); \ No newline at end of file diff --git a/app/views/files/_resource_detail.html.erb b/app/views/files/_resource_detail.html.erb index 317bb7dd8..20ffb1e50 100644 --- a/app/views/files/_resource_detail.html.erb +++ b/app/views/files/_resource_detail.html.erb @@ -6,9 +6,17 @@
    - <%= link_to truncate(file.filename,length: 35, omission: '...'), - download_named_attachment_path(file.id, file.filename), - :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %> + <%# 如果有历史版本则提供历史版本下载 %> + <% if file.attachment_histories.count == 0 %> + <%= link_to truncate(file.filename,length: 35, omission: '...'), + download_named_attachment_path(file.id, file.filename), + :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %> + <% else %> + <%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id), + :title => file.filename+"\n"+file.description.to_s, + :class => "linkGrey3 f_14", + :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :remote=>true %> + <% end %> <%= file_preview_eye(file, class: 'preview') %> <% if file.is_public? == false%> @@ -38,31 +46,28 @@ <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
    -
    • <% if User.current.logged? %> - <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
        -
      • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
      • <%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %>
      • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
      • <% if @course.is_public? %>
      • - - <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %> - + + <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %> +
      • <%end%>
      • <%= link_to( '删除资源', attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %> + :data => {:confirm => l(:text_are_you_sure)}, + :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
      - <% end %> <%else%>
        diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index f382a433c..7b19d2f9b 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -319,7 +319,7 @@ } }) - + //资源库上传附件 function course_files_upload(){ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>'); showModal('ajax-modal', '513px'); diff --git a/config/routes.rb b/config/routes.rb index bde12fa59..114fb6f96 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -876,6 +876,7 @@ RedmineApp::Application.routes.draw do # additional routes for having the file name at the end of url get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment' get 'attachments/attachment_versions/:id',:to=>'attachments#attachment_versions',:as=>'attachments_versions' + get 'attachments/attachment_history_download/:id',:to=>'attachments#attachment_history_download',:as=>'attachment_history_download' post 'attachments/upload_attachment_version',:to=>'attachments#upload_attachment_version',:as=>'upload_attachment_version' get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment' get 'attachments/download_history/:id/:filename', :to => 'attachments#download_history', :id => /\d+/, :filename => /.*/, :as => 'download_history_attachment' diff --git a/public/javascripts/course.js b/public/javascripts/course.js index fff30dec5..544c2bc33 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -1432,3 +1432,4 @@ function submit_course_feedback() { function show_more_tool(){ $('#navContentCourse').css('display', 'block'); } + From b3faef601b4faad63fee58d7cfcd766e3f601c0b Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 17 Mar 2016 12:43:35 +0800 Subject: [PATCH 064/116] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=BA=93=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_attachment_history_download.html.erb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/views/attachments/_attachment_history_download.html.erb b/app/views/attachments/_attachment_history_download.html.erb index bdef2077c..c805960f0 100644 --- a/app/views/attachments/_attachment_history_download.html.erb +++ b/app/views/attachments/_attachment_history_download.html.erb @@ -16,15 +16,14 @@ :title => @attachment.filename+"\n"+@attachment.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f14 fb link_file_a2 fl" %> 版本号:当前 - +
        <% @attachment_histories.each do |history| %> - + <%= link_to truncate(history.filename,length: 35, omission: '...'), - download_history_attachment_path(history.id, history.filename), - :title => history.filename+"\n"+history.description.to_s, - :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f14 fb link_file_a2 fl" %> - - + download_history_attachment_path(history.id, history.filename), + :title => history.filename+"\n"+history.description.to_s, + :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f14 fb link_file_a2 fl" %> + 版本号:<%= history.version %>
        <% end %> From c8eb2d9c954b8a10cfc1c50980d5dcadb88ec1c9 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 17 Mar 2016 12:49:00 +0800 Subject: [PATCH 065/116] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E3=80=81=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=B7=BB=E5=8A=A0=E8=B5=84=E6=BA=90=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_org_subfield_list.html.erb | 14 +++++++++++--- app/views/files/_project_list.html.erb | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb index 90ae3516d..b839128da 100644 --- a/app/views/files/_org_subfield_list.html.erb +++ b/app/views/files/_org_subfield_list.html.erb @@ -9,9 +9,17 @@
    - <%= link_to file.is_public? ? truncate(file.filename, length: 70) : truncate(file.filename,length: 50, omission: '...'), - download_named_attachment_path(file.id, file.filename), - :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14 f_l" %> + <%# 如果有历史版本则提供历史版本下载 %> + <% if file.attachment_histories.count == 0 %> + <%= link_to truncate(file.filename,length: 35, omission: '...'), + download_named_attachment_path(file.id, file.filename), + :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %> + <% else %> + <%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id), + :title => file.filename+"\n"+file.description.to_s, + :class => "linkGrey3 f_14", + :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :remote=>true %> + <% end %> <%= file_preview_eye(file, class: 'preview') %> <% if file.is_public? == false%> diff --git a/app/views/files/_project_list.html.erb b/app/views/files/_project_list.html.erb index a2a1670d1..2ee726d77 100644 --- a/app/views/files/_project_list.html.erb +++ b/app/views/files/_project_list.html.erb @@ -8,9 +8,17 @@
    - <%= link_to truncate(file.filename,length: 35, omission: '...'), - download_named_attachment_path(file.id, file.filename), - :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %> + <%# 如果有历史版本则提供历史版本下载 %> + <% if file.attachment_histories.count == 0 %> + <%= link_to truncate(file.filename,length: 35, omission: '...'), + download_named_attachment_path(file.id, file.filename), + :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %> + <% else %> + <%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id), + :title => file.filename+"\n"+file.description.to_s, + :class => "linkGrey3 f_14", + :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :remote=>true %> + <% end %> <%= file_preview_eye(file, class: 'preview') %> <% if file.is_public? == false%> From ab3fc0fb2cbb6606addb6764a50b4e3afdb4c234 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 17 Mar 2016 13:02:32 +0800 Subject: [PATCH 066/116] =?UTF-8?q?=E6=88=90=E5=91=98=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E7=9C=9F=E5=AE=9E=E5=A7=93=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/settings/_new_members.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/settings/_new_members.html.erb b/app/views/projects/settings/_new_members.html.erb index e82062e9b..733eacab4 100644 --- a/app/views/projects/settings/_new_members.html.erb +++ b/app/views/projects/settings/_new_members.html.erb @@ -21,7 +21,7 @@ <%= call_hook(:view_projects_settings_members_table_header, :project => @project) %> <% members.each do |member| %>
  • - <%= link_to_user_header member.principal,false,:class => "w140_h c_setting_blue fl" %> + <%= link_to_user_header member.principal, true, :class => "w140_h c_setting_blue fl" %> <% if User.current.language == "zh" %> From 0d1fc409d1b15641506558ab6080e4cc30058283 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 17 Mar 2016 13:58:55 +0800 Subject: [PATCH 067/116] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E5=90=8C=E4=B8=80=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/settings/_new_repositories.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb index 07b2896eb..be6330d9b 100644 --- a/app/views/projects/settings/_new_repositories.html.erb +++ b/app/views/projects/settings/_new_repositories.html.erb @@ -4,6 +4,9 @@ $("#pro_st_edit_ku").toggle(); } +<% unless @project.repositories.any? %> +

    温馨提示:<%= l(:label_repository_no_data) %>

    +<% end %> <%= str = error_messages_for 'repository' %> <% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %> <% ip = RepositoriesHelper::REPO_IP_ADDRESS %> @@ -87,8 +90,6 @@ <% end %>
  • + 序号 + LOGO + 学校名称 + 用户数 + + 创建时间 + + 编辑高校信息 +
    - <%= school.id %> + + + <% @count +=1 %> + + <%=@count %> <%= image_tag(school.logo_link,width:40,height:40) %> + - <%= link_to school.name,"http://#{Setting.host_course}/?school_id=#{school.id}" %> + <%= link_to school.name,"http://#{Setting.host_name}/?school_id=#{school.id}" %> + + <%= schoolMember_num(school) %> + + <%= format_time(school.created_at) %> + <%= link_to("修改", upload_logo_school_path(school.id,:school_name => @school_name), :class => 'icon icon-copy') %> <%#= link_to(l(:button_delete), organization_path(school.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
    -<% else %> -

    温馨提示:<%= l(:label_repository_no_data) %>

    <% end %> From ee40255d7edb65824fcf8dcd849aea2d867c2fea Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 17 Mar 2016 14:09:13 +0800 Subject: [PATCH 068/116] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93bytes?= =?UTF-8?q?=E6=94=B9=E6=88=90b?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_resources_list.html.erb | 2 +- app/views/users/_user_import_resource_list.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index f679f9c8c..a545038f1 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -16,7 +16,7 @@
  • <%= attach.quotes.nil? ? 0 : attach.quotes %>
  • <%= attach.downloads %>
  • <%= attach.author_id %>
  • -
  • <%= number_to_human_size(attach.filesize) %>
  • +
  • <%= (number_to_human_size(attach.filesize)).gsub("ytes", "") %>
  • <%= get_resource_type(attach.container_type)%>
  • diff --git a/app/views/users/_user_import_resource_list.html.erb b/app/views/users/_user_import_resource_list.html.erb index 57dac6ad0..af4f951e0 100644 --- a/app/views/users/_user_import_resource_list.html.erb +++ b/app/views/users/_user_import_resource_list.html.erb @@ -11,7 +11,7 @@
  • <%= get_resource_type(attach.container_type)%>
  • - +
  • <%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %>
  • <%= format_date(attach.created_on) %>
  • From a4e2fd741e671fb4e5d0320f5b174e44a0f8e185 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Thu, 17 Mar 2016 14:13:29 +0800 Subject: [PATCH 069/116] =?UTF-8?q?=E5=88=A0=E9=99=A4issue=EF=BC=8C?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E9=A1=B5=E9=9D=A2=E4=B8=8D=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 1 + app/controllers/issues_controller.rb | 9 ++++++++- app/helpers/routes_helper.rb | 14 +++++++++++--- app/views/projects/_project_activities.html.erb | 2 +- app/views/users/_project_issue.html.erb | 8 +++++++- app/views/users/_user_activities.html.erb | 2 +- app/views/users/show.html.erb | 3 +-- 7 files changed, 30 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index c739e1085..645c7b849 100644 --- a/Gemfile +++ b/Gemfile @@ -36,6 +36,7 @@ gem 'chinese_pinyin' # gem 'progress_bar' gem 'ansi' +gem 'debugger' gem 'kaminari' gem 'elasticsearch-model' gem 'elasticsearch-rails' diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index f0148fc71..44f0d15f4 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -390,6 +390,9 @@ class IssuesController < ApplicationController end def destroy + # 增加删除页面类型,如果是个人主页,则返回该主页,项目动态则返回项目动态页眉 + page_classify = params[:page_classify] unless params[:page_classify].nil? + page_id = params[:page_id] unless params[:page_id].nil? @hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f if @hours > 0 case params[:todo] @@ -418,7 +421,11 @@ class IssuesController < ApplicationController end end respond_to do |format| - format.html { redirect_back_or_default _project_issues_path(@project) } + if page_classify + format.html { redirect_back_or_default _project_issues_path(@project, page_classify, page_id) } + else + format.html { redirect_back_or_default _project_issues_path(@project) } + end format.api { render_api_ok } end end diff --git a/app/helpers/routes_helper.rb b/app/helpers/routes_helper.rb index 15c809964..8d08f22da 100644 --- a/app/helpers/routes_helper.rb +++ b/app/helpers/routes_helper.rb @@ -22,10 +22,18 @@ module RoutesHelper # Returns the path to project issues or to the cross-project # issue list if project is nil def _project_issues_path(project, *args) - if project - project_issues_path(project, *args) + if args[0].to_s.include? '_page' + if args[0].to_s == "user_page" + user_activities_path(args[1].to_i) + else + project_path(project) + end else - issues_path(*args) + if project + project_issues_path(project, *args) + else + issues_path(*args) + end end end diff --git a/app/views/projects/_project_activities.html.erb b/app/views/projects/_project_activities.html.erb index c036633a5..dd9935634 100644 --- a/app/views/projects/_project_activities.html.erb +++ b/app/views/projects/_project_activities.html.erb @@ -66,7 +66,7 @@ <%= render :partial => 'projects/project_create', :locals => {:activity => activity, :user_activity_id => activity.id} %> <% when "Issue" %> - <%= render :partial => 'users/project_issue', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id} %> + <%= render :partial => 'users/project_issue', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %> <% when "Message" %> diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 090098722..5d472497d 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -21,7 +21,13 @@ <%= link_to l(:button_edit), issue_path(activity.id, :edit => 'true'), :class => 'postOptionLink', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
  • - <%= link_to l(:button_delete), issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %> + <% if !defined?(project_id) && !defined?(user_id) %> + <%= link_to l(:button_delete), issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %> + <% elsif defined?(project_id) %> + <%= link_to l(:button_delete), issue_path(activity.id, :page_classify => "project_page", :page_id => project_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %> + <% elsif defined?(user_id) %> + <%= link_to l(:button_delete), issue_path(activity.id, :page_classify => "user_page", :page_id => user_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %> + <% end %>
  • <%= link_to l(:button_copy), project_copy_issue_path(activity.project, activity), :class => 'postOptionLink' if User.current.allowed_to?(:add_issues, activity.project) %> diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 0e55c246c..01711ace3 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -89,7 +89,7 @@ <% if act %> <% case user_activity.act_type.to_s %> <% when 'Issue' %> - <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id, :user_id => user_id} %> <% when 'Message' %> <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %> <% when 'ProjectCreateInfo'%> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index a56ca7b48..fa4eaacbe 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -45,5 +45,4 @@ <% homepage = BlogComment.find(@user.blog.homepage_id) %> <%= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %> <% end %> - -<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type} %> +<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id)} %> From 9265186307db170492b41d7f181a4d394673fd47 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Thu, 17 Mar 2016 14:36:05 +0800 Subject: [PATCH 070/116] =?UTF-8?q?=E4=BF=AE=E6=94=B9user=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E4=B8=ADissue=E8=A1=8C=E9=AB=98=EF=BC=8C=E4=BD=BF?= =?UTF-8?q?=E4=B9=8B=E4=B8=8Eproject=E4=B8=AD=E7=9A=84=E4=B8=80=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/new_user.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 4669d043e..8aa15d0f7 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -845,7 +845,7 @@ a.sortArrowActiveU {background:url(images/post_image_list.png) -17px -20px no-re .postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} .postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} -.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 23px !important;} +.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;} .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} .postDetailReply { margin-top:28px; color:#888888; float:right;display: inline} From 84470af2ff68b41e9e9780590050900435ee9c42 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 17 Mar 2016 14:47:14 +0800 Subject: [PATCH 071/116] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=9A=84=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E5=92=8C=E9=A1=B9=E7=9B=AE=E4=B8=8D=E5=9C=A8=E5=8F=91?= =?UTF-8?q?=E9=80=81=E4=B8=AD=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index cf591d6a8..06b2df862 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1674,10 +1674,10 @@ class UsersController < ApplicationController if !params[:search].nil? search = "%#{params[:search].to_s.strip.downcase}%" @course = @user.courses.where(" #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search) - .select { |course| @user.allowed_to?(:as_teacher,course)} + .select { |course| @user.allowed_to?(:as_teacher,course) and course.is_delete == 0 } else @course = @user.courses - .select { |course| @user.allowed_to?(:as_teacher,course)} + .select { |course| @user.allowed_to?(:as_teacher,course) and course.is_delete == 0 } end @search = params[:search] #这里仅仅是传递需要发送的资源id @@ -1695,7 +1695,7 @@ class UsersController < ApplicationController search = "%#{params[:search].to_s.strip.downcase}%" @projects = @user.projects.where(" #{Project.table_name}.id = #{params[:search].to_i } or #{Project.table_name}.name like :p",:p=>search) else - @projects = @user.projects + @projects = @user.projects.visible end @search = params[:search] #这里仅仅是传递需要发送的资源id From a8780be9b4a5f18437ceca9359c3885cb756404c Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 17 Mar 2016 15:03:34 +0800 Subject: [PATCH 072/116] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E3=80=81=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A=E3=80=81=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E8=AF=BE=E7=A8=8B=E5=B8=96=E5=AD=90=E3=80=81=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=96=87=E7=AB=A0=E5=AE=9E=E7=8E=B0=E6=AF=8F=E9=9A=94?= =?UTF-8?q?10=E7=A7=92=E8=87=AA=E5=8A=A8=E4=BF=9D=E5=AD=98=E5=B8=96?= =?UTF-8?q?=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_course_new.html.erb | 129 +++++++++++++++++- app/views/boards/_course_show.html.erb | 2 + app/views/messages/edit.html.erb | 3 +- app/views/org_document_comments/_new.html.erb | 2 + app/views/org_document_comments/edit.html.erb | 2 + app/views/org_document_comments/new.html.erb | 2 + app/views/student_work/edit.html.erb | 5 +- app/views/student_work/new.html.erb | 9 +- app/views/users/_user_homework_form.html.erb | 5 +- public/javascripts/application.js | 47 +++++++ public/javascripts/des_kindEditor.js | 4 +- 11 files changed, 199 insertions(+), 11 deletions(-) diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index 31cdf41eb..3deb04f6c 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -1,7 +1,123 @@ <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: true, prettify: false) %> + <%= import_ke(enable_at: true, prettify: false, init_activity: false) %> <% end %> - + <%= error_messages_for 'message' %>
    @@ -25,7 +141,7 @@ <%= text_area :quote,:quote,:style => 'display:none' %> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= f.kindeditor :content, :editor_id => 'message_content_editor', + <%#= f.kindeditor :content, :editor_id => 'message_content_editor', :owner_id => topic.nil? ? 0: topic.id, :owner_type => OwnerTypeHelper::MESSAGE, :width => '100%', @@ -37,8 +153,11 @@ :maxlength => 5000 }, at_id: topic.id, at_type: topic.class.to_s %> +

    +

    +

    @@ -49,11 +168,11 @@
    <%if !edit_mode %> - 确定 + 确定 取消 <% else %> - 确定 + 确定 <%= link_to "取消",board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "fr mr10 mt3"%> <% end %> diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 16b4fcd3d..d33b75f82 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -25,11 +25,13 @@ 课程问答区
    +
    <% if User.current.logged? %> <%= labelled_form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'course_new', :locals => {:f => f, :topic => @message, :edit_mode => false, :course => @board.course} %> <% end %> <% end %> +
    <%= render :partial=> 'course_show_detail',:locals =>{:topics => @topics, :page => 0} %>
    diff --git a/app/views/messages/edit.html.erb b/app/views/messages/edit.html.erb index 89fe71c65..324b1edf1 100644 --- a/app/views/messages/edit.html.erb +++ b/app/views/messages/edit.html.erb @@ -12,6 +12,7 @@ <% end %> <% elsif @message.course %> +
    <%= form_for @message, { :as => :message, :url => {:action => 'edit',:is_course=>@is_course,:is_board=>@is_board}, @@ -22,7 +23,7 @@ <%= render :partial => 'boards/course_message_edit', :locals => {:f => f, :edit_mode => true, :topic => @message, :course => @message.course} %> <% end %> - +
    <% elsif @message.board.org_subfield %> <%= form_for @message, { :as => :message, diff --git a/app/views/org_document_comments/_new.html.erb b/app/views/org_document_comments/_new.html.erb index 9e77d3fa8..f462df2c9 100644 --- a/app/views/org_document_comments/_new.html.erb +++ b/app/views/org_document_comments/_new.html.erb @@ -50,6 +50,8 @@
  • +

    +

    diff --git a/app/views/org_document_comments/edit.html.erb b/app/views/org_document_comments/edit.html.erb index ed7413850..3ad388bd2 100644 --- a/app/views/org_document_comments/edit.html.erb +++ b/app/views/org_document_comments/edit.html.erb @@ -39,6 +39,8 @@

    +

    +

    diff --git a/app/views/org_document_comments/new.html.erb b/app/views/org_document_comments/new.html.erb index 2a261bd5f..fea89459b 100644 --- a/app/views/org_document_comments/new.html.erb +++ b/app/views/org_document_comments/new.html.erb @@ -46,6 +46,8 @@

    +

    +

    diff --git a/app/views/student_work/edit.html.erb b/app/views/student_work/edit.html.erb index 14da74a34..8e1a2a546 100644 --- a/app/views/student_work/edit.html.erb +++ b/app/views/student_work/edit.html.erb @@ -58,6 +58,8 @@ -->

    +

    +

    @@ -198,7 +200,7 @@ //paramsHeight = params.kindutil.removeUnit(this.height); edit.iframe.height(150); this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150)); - + elocalStorage(editor2,'student_work_<%=@work.id %>'); } }).loadPlugin('paste'); return editor; @@ -217,6 +219,7 @@ params.submit_btn = $("#new_message_submit_btn"); if(params.textarea.data('init') == undefined) { params.editor = init_homework_editor(params); + editor2 = params.editor; init_homework_form(params); params.submit_btn.click(function () { params.form.submit(); diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index 15958d870..c43482299 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -79,6 +79,10 @@ } } + var KE = { + MDU: "1234455",//当前文章标识符 + }; + function nh_check_field(params){ var result=true; if(!regexStudentWorkName()) { @@ -159,7 +163,7 @@ //paramsHeight = params.kindutil.removeUnit(this.height); edit.iframe.height(150); this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150)); - + elocalStorage(editor2,'student_work_<%=@homework.id %>'); } }).loadPlugin('paste'); return editor; @@ -178,6 +182,7 @@ params.submit_btn = $("#new_message_submit_btn"); if(params.textarea.data('init') == undefined) { params.editor = init_homework_editor(params); + editor2 = params.editor; init_homework_form(params); params.submit_btn.click(function () { params.form.submit(); @@ -250,6 +255,8 @@ -->

    +

    +

    diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index f1f29b0da..f23d01d3c 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -16,7 +16,6 @@ $("#GroupPopupBox a.group_save_btn").click(); <% end %> }); - var homework_description_editor; function checked_val() { if ($("#anonymous_comment").is(":checked")) { $("#anonymous_comment").val(1); @@ -106,7 +105,7 @@ //paramsHeight = params.kindutil.removeUnit(this.height); edit.iframe.height(150); this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150)); - + elocalStorage(homework_description_editor,'homework_<%=User.current.id %>'); } }).loadPlugin('paste'); return editor; @@ -199,6 +198,8 @@ <%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w709",:value => "请选择发布作业的课程"} %>

    +

    +

    diff --git a/public/javascripts/application.js b/public/javascripts/application.js index fe829f7a8..e481dae32 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1152,3 +1152,50 @@ function disable_down(source, des, hint){ } } + +//自动保存草稿 +var editor2; +function elocalStorage(editor,mdu){ + if (window.sessionStorage){ + editor2 = editor; + var oc = window.sessionStorage.getItem('content'+mdu); + if(oc !== null ){ + var h = '您上次有已保存的数据,是否恢复 ? / 不恢复'; + $('#e_tips').html(h); + } + setInterval(function() { + d = new Date(); + var h = d.getHours(); + var m = d.getMinutes(); + var s = d.getSeconds(); + h = h < 10 ? '0' + h : h; + m = m < 10 ? '0' + m : m; + s = s < 10 ? '0' + s : s; + if(!editor.isEmpty()){ + add_data("content",mdu,editor.html()); + $('#e_tip').html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 "); + $('#e_tips').html(""); + } + },10000); + + }else{ + $('.ke-edit').after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!'); + } +} +function add_data(k,mdu,d){ + window.sessionStorage.setItem(k+mdu,d); +} +function rec_data(k,mdu){ + if(window.sessionStorage.getItem(k+mdu) !== null){ + editor2.html(window.sessionStorage.getItem(k+mdu)); + clear_data(k,mdu); + } +} +function clear_data(k,mdu){ + window.sessionStorage.removeItem(k+mdu); + if(k == 'content'){ + $("#e_tips").html(""); + }else{ + $("#e_tip").html(""); + } +} diff --git a/public/javascripts/des_kindEditor.js b/public/javascripts/des_kindEditor.js index f8aff0be7..3a05c909d 100644 --- a/public/javascripts/des_kindEditor.js +++ b/public/javascripts/des_kindEditor.js @@ -1,3 +1,4 @@ +var editor2; function init_des_editor(params){ // var minHeight; //最小高度 var paramsHeight = params.height; //设定的高度 @@ -32,7 +33,7 @@ function init_des_editor(params){ paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight; edit.iframe.height(paramsHeight); this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight), paramsHeight)); - + elocalStorage(editor2,'org_document'); } }).loadPlugin('paste'); return editor; @@ -123,6 +124,7 @@ function init_des_data(){ params.width = width; if (params.textarea.data('init') == undefined) { params.editor = init_des_editor(params); + editor2 = params.editor; init_form(params); params.cancel_btn.click(function () { nh_reset_form(params); From 52af5e43033df2c5a101ea13f2cfd74c7088e7f2 Mon Sep 17 00:00:00 2001 From: linchun Date: Thu, 17 Mar 2016 15:05:14 +0800 Subject: [PATCH 073/116] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E7=95=8C=E9=9D=A2=E5=A4=9A=E4=B8=AA=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=9A=84=E9=A2=98=E7=9B=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 4 ++-- app/views/admin/course_resource_list.html.erb | 4 +++- app/views/admin/excellent_courses.html.erb | 4 +++- app/views/admin/latest_login_teachers.html.erb | 2 ++ app/views/admin/organization.html.erb | 2 +- app/views/admin/project_resource_list.html.erb | 4 +++- config/locales/en.yml | 3 +++ config/locales/zh.yml | 1 + 8 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 66c35ed6b..416088e9a 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -390,8 +390,8 @@ class AdminController < ApplicationController #组织 def organization - #@organizations = Organization.find_by_sql("SELECT * FROM organizations ORDER BY created_at DESC") - @organizations = Organization.all.order("created_at desc") + @organizations = Organization.find_by_sql("SELECT * FROM organizations ORDER BY created_at DESC") + #@organizations = Organization.all.order("created_at desc") respond_to do |format| format.html end diff --git a/app/views/admin/course_resource_list.html.erb b/app/views/admin/course_resource_list.html.erb index fdca986c9..2e83a96aa 100644 --- a/app/views/admin/course_resource_list.html.erb +++ b/app/views/admin/course_resource_list.html.erb @@ -61,4 +61,6 @@ \ No newline at end of file +
    + +<% html_title(l(:label_course_resource_list)) -%> \ No newline at end of file diff --git a/app/views/admin/excellent_courses.html.erb b/app/views/admin/excellent_courses.html.erb index e21ba32aa..59426455a 100644 --- a/app/views/admin/excellent_courses.html.erb +++ b/app/views/admin/excellent_courses.html.erb @@ -72,4 +72,6 @@ <% end %> -
    \ No newline at end of file +
    + +<% html_title(l(:label_excellent_courses_list)) -%> \ No newline at end of file diff --git a/app/views/admin/latest_login_teachers.html.erb b/app/views/admin/latest_login_teachers.html.erb index 3c4eb3c5b..c1889bce1 100644 --- a/app/views/admin/latest_login_teachers.html.erb +++ b/app/views/admin/latest_login_teachers.html.erb @@ -88,3 +88,5 @@ + +<% html_title(l(:label_latest_login_teacher_list)) -%> \ No newline at end of file diff --git a/app/views/admin/organization.html.erb b/app/views/admin/organization.html.erb index 582b8b44a..fe5fdb391 100644 --- a/app/views/admin/organization.html.erb +++ b/app/views/admin/organization.html.erb @@ -40,4 +40,4 @@
    -<% html_title(l(:label_project_plural)) -%> + diff --git a/app/views/admin/project_resource_list.html.erb b/app/views/admin/project_resource_list.html.erb index e82831546..8e8bd8c92 100644 --- a/app/views/admin/project_resource_list.html.erb +++ b/app/views/admin/project_resource_list.html.erb @@ -61,4 +61,6 @@ \ No newline at end of file +
    + +<% html_title(l(:label_project_resource_list)) -%> \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index a82c6b502..033f12ad2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1523,6 +1523,9 @@ en: label_excellent_courses_list: excellent_courses label_course_resource_list: course_resource_list label_project_resource_list: project_resource_list + label_organization_list: organzation_list + label_latest_login_teacher_list: latest_login_teacher_list + label_latest_login_user_list: latest_login_teacher_list #api label_recently_updated_notification: Recently updated notification diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 1e4bdd90e..d36117556 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -563,6 +563,7 @@ zh: label_overall_activity: 活动概览 label_new: 新建 label_latest_login_user_list: 最近登录用户列表 + label_latest_login_teacher_list: 最近登录教师列表 label_logged_as: 登录为 label_environment: 环境 From 8e41b19563c392533e62eb39a8bc128b3ba7cdbb Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Thu, 17 Mar 2016 15:09:08 +0800 Subject: [PATCH 074/116] =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=8F=96=E6=B6=88tip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_at_message.html.erb | 12 +- app/views/users/_user_message_course.html.erb | 147 ++++++++++-------- app/views/users/_user_message_forge.html.erb | 75 +++++---- app/views/users/_user_message_forum.html.erb | 14 +- app/views/users/_user_message_system.html.erb | 7 +- .../_user_message_userfeedaback.html.erb | 6 +- 6 files changed, 143 insertions(+), 118 deletions(-) diff --git a/app/views/users/_user_at_message.html.erb b/app/views/users/_user_at_message.html.erb index d8649cabe..089171c3d 100644 --- a/app/views/users/_user_at_message.html.erb +++ b/app/views/users/_user_at_message.html.erb @@ -8,15 +8,15 @@ <% if ma.at_message_type == "Message" && !ma.at_message.course.nil? %> <%= link_to ma.subject.html_safe, course_boards_path(ma.at_message.course, :parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id), - :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}", - :onmouseover =>"message_titile_show($(this),event)", - :onmouseout => "message_titile_hide($(this))" %> + :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}" %> + + <% elsif ma.at_message_type == "Message" && !ma.at_message.project.nil? %> <%= link_to ma.subject.html_safe, project_boards_path(ma.at_message.project, :parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id), - :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}", - :onmouseover =>"message_titile_show($(this),event)", - :onmouseout => "message_titile_hide($(this))" %> + :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}" %> + + <% else %> <%= link_to ma.subject.html_safe, ma.url, :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}", :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %> <% end %> diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 62568d505..458ba4551 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -5,9 +5,10 @@
  • <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">发布了通知:
  • <%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id }, - :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", - :onmouseover =>"message_titile_show($(this),event)", - :onmouseout => "message_titile_hide($(this))" %>
  • + :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %> + + +