From 0564ddb6eafb81edd4a1420f8e0b07feb52cf9c0 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 25 Jul 2016 13:56:26 +0800 Subject: [PATCH 01/52] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=A4=A7=E7=BA=B2?= =?UTF-8?q?=E7=9A=84=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 5 + app/controllers/words_controller.rb | 33 +++ app/views/layouts/_base_course_old.html.erb | 278 ------------------ app/views/layouts/_base_syllabus_old.html.erb | 151 ---------- app/views/syllabuses/show.html.erb | 2 +- app/views/users/_all_replies.html.erb | 39 --- app/views/users/_news_replies.html.erb | 14 + app/views/users/_reply_banner.html.erb | 2 +- app/views/users/_reply_to.html.erb | 9 + app/views/users/all_journals.js.erb | 4 +- app/views/words/destroy.js.erb | 5 +- app/views/words/reply_to_syllabus.js.erb | 2 + config/routes.rb | 1 + 13 files changed, 71 insertions(+), 474 deletions(-) delete mode 100644 app/views/layouts/_base_course_old.html.erb delete mode 100644 app/views/layouts/_base_syllabus_old.html.erb delete mode 100644 app/views/users/_all_replies.html.erb create mode 100644 app/views/words/reply_to_syllabus.js.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5e968e854..30f78d9a5 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -149,6 +149,9 @@ class UsersController < ApplicationController @user_activity_id = params[:user_activity_id] @activity_id = params[:activity_id] @type = 'Issue' + when 'Syllabus' + @reply = JournalsForMessage.find params[:reply_id] + @type = 'Syllabus' end respond_to do |format| format.js @@ -3342,6 +3345,8 @@ class UsersController < ApplicationController when 'Syllabus' obj = Syllabus.where('id = ?', params[:id].to_i).first @journals = obj.journals_for_messages.reorder("created_on desc") + @type = 'Syllabus' + @user_activity_id = params[:div_id].to_i if params[:div_id] when 'JournalsForMessage' obj = JournalsForMessage.where('id = ?', params[:id].to_i).first journals = [] diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 828739cc4..499272706 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -112,6 +112,10 @@ class WordsController < ApplicationController end @is_in_course = params[:is_in_course].to_i @course_activity = params[:course_activity].to_i + elsif @journal_destroyed.jour_type == 'Syllabus' + @syllabus = Syllabus.find @journal_destroyed.jour_id + @count = @syllabus.journals_for_messages.count + @comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3) end respond_to do |format| format.js @@ -352,6 +356,35 @@ class WordsController < ApplicationController render_403 end end + + #课程大纲的二级回复 + def reply_to_syllabus + if User.current.logged? + @user = User.current + reply = JournalsForMessage.find params[:id].to_i + @syllabus = Syllabus.find reply.jour_id + if params[:reply_message].size>0 && User.current.logged? && @user + options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i} + feedback = Syllabus.add_syllabus_jour(@user, params[:reply_message], reply.jour_id, options) + if (feedback.errors.empty?) + if params[:asset_id] + ids = params[:asset_id].split(',') + update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE + end + @syllabus.update_column('updated_at', Time.now) + @count = @syllabus.journals_for_messages.count + @comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3) + respond_to do |format| + format.js + end + else + flash[:error] = feedback.errors.full_messages[0] + end + end + else + render_403 + end + end def add_brief_introdution user = User.current diff --git a/app/views/layouts/_base_course_old.html.erb b/app/views/layouts/_base_course_old.html.erb deleted file mode 100644 index 4b2077cf8..000000000 --- a/app/views/layouts/_base_course_old.html.erb +++ /dev/null @@ -1,278 +0,0 @@ -<%# course_model %> -<% course_file_num = visable_attachemnts_incourse(@course).count%> -<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> -<% homework_num = visable_course_homework @course %> - - - - - - - <%= h html_title %> - - - - <%= csrf_meta_tag %> - <%= favicon %> - <%= javascript_heads %> - <%= heads_for_theme %> - <%= call_hook :view_layouts_base_html_head %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup'%> - <%= javascript_include_tag "course","sy_public", "syllabus","header","attachments",'prettify' %> - - <%= yield :header_tags -%> - - - - - - - - - - - -
-
-
-
-
- <%=render :partial=>'layouts/project_info' %> -
- -
-
    -
  • <%= l(:label_main_teacher)%> :  <%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %>
  • -
  • <%= l(:label_class_period)%> :  <%= @course.class_period %> <%= l(:label_class_hour) %>
  • -
  • <%= l(:label_main_term)%> :  <%= current_time_and_term @course %>
  • - <% if @course.school%> -
  • <%= l(:label_course_organizers)%> :  <%= @course.school%>
  • - <% end%> -
-
- - <%# 更新访问数,刷新的时候更新访问次数 %> - <% update_visiti_count @course %> - <%# over %> - - - <%# 课程活跃度 %> -
- <%= render :partial => 'courses/course_activity_users', :locals => {:course => @course} %> - <%# 课程英雄榜 %> - <%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %> - - <% if @course.description && !@course.description.blank? %> -
-
-

<%= l(:label_course_brief_introduction)%>:

-
- <%= textilizable(@course.description) if @course.description && !@course.description.blank? %> -
-
-
- - - - -
-
- <% end %> -
-

<%= l(:label_tag)%>:

-
- <%= render :partial => 'tags/new_tag', :locals => {:obj => @course, :object_flag => "9"} %> -
-
-
- - <%= render :partial => 'courses/recommendation', :locals => {:course => @course} %> -
访问计数 <%= @course.visits.to_i %> (自2016年5月)
-
- -
- <%= yield %> - <%#= render_flash_messages %> - <%#= call_hook :view_layouts_base_content %> -
- -
- -
-
- -
-<%= render :partial => 'layouts/footer' %> -
- -<%= render :partial => 'layouts/new_feedback' %> - - -<%= call_hook :view_layouts_base_body_bottom %> - - - - \ No newline at end of file diff --git a/app/views/layouts/_base_syllabus_old.html.erb b/app/views/layouts/_base_syllabus_old.html.erb deleted file mode 100644 index 45e77dbad..000000000 --- a/app/views/layouts/_base_syllabus_old.html.erb +++ /dev/null @@ -1,151 +0,0 @@ - - - - - <%= h html_title %> - - - <%= csrf_meta_tag %> - <%= favicon %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'syllabus','css/common','css/public','css/structure','css/courses','css/popup','prettify',:media => 'all' %> - <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> - <%= javascript_heads %> - <%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus'%> - <%= heads_for_theme %> - <%= call_hook :view_layouts_base_html_head %> - <%= yield :header_tags -%> - - - - - - - -<% is_current_user = User.current.logged?%> - -
-
-
-
-
- <%=render :partial => 'layouts/syllabus_info' %> -
- <% update_visiti_count @syllabus %> - -
- <%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %> -
- -
-
- <%=link_to '班级', {:controller => "syllabuses", :action => "syllabus_courselist", :id => @syllabus.id}, :class => 'homepageMenuText' %> - <% if is_current_user%> - <% if User.current == @syllabus.user && User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%> -
-
    -
  • -
      -
    • - <%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "menuGrey", :target => '_blank'%> -
    • -
    • - <%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "menuGrey",:method => "post"%> -
    • -
    -
  • -
-
- <% else%> - <%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%> - <% end%> - <% end%> -
- <% if User.current == @syllabus.user || User.current.admin? - all_courses = @syllabus.courses.where("is_delete = 0").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc") - else - all_courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc") - end %> - <% courses = all_courses.limit(5) %> - <% all_count = all_courses.count%> -
-
-
    - <%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => User.current,:all_count => all_count,:type =>'Syllabus',:page => 0} %> -
-
- <% if !courses.empty? %> -
- -
- <% end %> -
-
- -
-

标签:

-
- <%= render :partial => 'tags/syllabus_tag', :locals => {:obj => @syllabus,:object_flag => "11"}%> -
-
-
-
访问计数 <%=@syllabus.visits %> (自2016年7月)
- -
-
- <%= yield %> -
-
- <%= render :partial => 'layouts/new_feedback' %> -
-
-<%= render :partial => 'layouts/footer' %> -
- - - - - - diff --git a/app/views/syllabuses/show.html.erb b/app/views/syllabuses/show.html.erb index 9b1bdafc5..062b9aeb4 100644 --- a/app/views/syllabuses/show.html.erb +++ b/app/views/syllabuses/show.html.erb @@ -53,7 +53,7 @@ <% comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3) %> <% if count > 0 %>
- <%= render :partial => 'users/all_replies', :locals => {:comments => comments}%> + <%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'Syllabus'} %>
<% end %>
diff --git a/app/views/users/_all_replies.html.erb b/app/views/users/_all_replies.html.erb deleted file mode 100644 index a74acc77c..000000000 --- a/app/views/users/_all_replies.html.erb +++ /dev/null @@ -1,39 +0,0 @@ - \ No newline at end of file diff --git a/app/views/users/_news_replies.html.erb b/app/views/users/_news_replies.html.erb index a4732af8c..1da4bc85e 100644 --- a/app/views/users/_news_replies.html.erb +++ b/app/views/users/_news_replies.html.erb @@ -76,6 +76,20 @@ :class => 'fr mr20', :title => l(:button_delete) ) if comment.user_id == User.current.id %> + <% elsif type == 'Syllabus' %> + + <%= link_to( + l(:button_reply), + {:controller => 'users', :action => 'reply_to', :reply_id => comment.id, :type => type}, + :remote => true, + :method => 'get', + :title => l(:button_reply)) %> + + + <% if User.current.admin? || User.current == Syllabus.find(activity_id).user || comment.user == User.current%> + <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %> + <% end %> <% end %>
diff --git a/app/views/users/_reply_banner.html.erb b/app/views/users/_reply_banner.html.erb index 43aebb89c..4f2094899 100644 --- a/app/views/users/_reply_banner.html.erb +++ b/app/views/users/_reply_banner.html.erb @@ -1,4 +1,4 @@ -
+
回复 ︿ diff --git a/app/views/users/_reply_to.html.erb b/app/views/users/_reply_to.html.erb index aa519a5da..24c1ce77a 100644 --- a/app/views/users/_reply_to.html.erb +++ b/app/views/users/_reply_to.html.erb @@ -82,6 +82,15 @@

<% end %> + <% elsif @type == 'Syllabus' %> + <%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_syllabus', :id => reply.id},:method => "post", :remote => true) do |f| %> + +
+ + +
+

+ <% end%> <% end %>
diff --git a/app/views/users/all_journals.js.erb b/app/views/users/all_journals.js.erb index cc36ef3b3..d43768f1e 100644 --- a/app/views/users/all_journals.js.erb +++ b/app/views/users/all_journals.js.erb @@ -8,8 +8,6 @@ $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :p $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i, :homepage => @homepage}) %>'); <% elsif params[:type] == 'OrgDocumentComment' %> $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>'); -<% elsif params[:type] == 'News' || params[:type] == 'Issue' %> +<% elsif params[:type] == 'News' || params[:type] == 'Issue' || params[:type] == 'Syllabus' %> $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>'); -<% else %> -$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/all_replies', :locals => {:comments => @journals}) %>'); <% end %> diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index c527474cd..76ec9e319 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -1,6 +1,6 @@ <% if @journal_destroyed.nil? %> alert('<%=l(:notice_failed_delete)%>'); -<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%> +<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon','Syllabus'].include? @journal_destroyed.jour_type)%> <% if @is_user%> <% if @activity %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); @@ -18,6 +18,9 @@ <% else %> <% if @bid && @jours_count %> $('#jours_count').html("<%= @jours_count %>"); + <% elsif @syllabus %> + $("#reply_banner_<%=@syllabus.id %>").replaceWith("<%=escape_javascript(render :partial => 'users/reply_banner', :locals => {:count => @count, :activity => @syllabus, :user_activity_id => @syllabus.id}) %>"); + $("#reply_div_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @comments, :type => 'Syllabus', :user_activity_id => @syllabus.id, :activity_id => @syllabus.id}) %>"); <% elsif @course && @jours_count%> <% if @user_activity_id %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); diff --git a/app/views/words/reply_to_syllabus.js.erb b/app/views/words/reply_to_syllabus.js.erb new file mode 100644 index 000000000..ece0843d4 --- /dev/null +++ b/app/views/words/reply_to_syllabus.js.erb @@ -0,0 +1,2 @@ +$("#reply_banner_<%=@syllabus.id %>").replaceWith("<%=escape_javascript(render :partial => 'users/reply_banner', :locals => {:count => @count, :activity => @syllabus, :user_activity_id => @syllabus.id}) %>"); +$("#reply_div_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @comments, :type => 'Syllabus'}) %>"); diff --git a/config/routes.rb b/config/routes.rb index 1124080b7..5439da9f4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1232,6 +1232,7 @@ RedmineApp::Application.routes.draw do post 'words/:id/leave_syllabus_message', :to => 'words#leave_syllabus_message', :as => "leave_syllabus_message" post 'words/:id/leave_homework_message', :to => 'words#leave_homework_message', :as => "leave_homework_message" post 'words/:id/reply_to_homework', :to => 'words#reply_to_homework', :as => "reply_to_homework" + post 'words/:id/reply_to_syllabus', :to => 'words#reply_to_syllabus', :as => "reply_to_syllabus" post 'join_in/join', :to => 'courses#join', :as => 'join' delete 'join_in/join', :to => 'courses#unjoin' From be88914e3905f02fe2b8499c11faeb20f5d745e3 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 25 Jul 2016 13:59:10 +0800 Subject: [PATCH 02/52] =?UTF-8?q?=E5=8E=BB=E6=8E=89id=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 7 ------- app/models/user.rb | 5 ----- 2 files changed, 12 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 58622a089..d64d95223 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -33,13 +33,6 @@ module ApplicationHelper extend Forwardable def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter - def user_path(resource, parameters = {}) - if Fixnum === resource - resource = User.find(resource) - end - super - end - # def user_blogs_path(resource,parameters={}) # super # end diff --git a/app/models/user.rb b/app/models/user.rb index 7e592248e..996aa9be7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -311,11 +311,6 @@ class User < Principal ) end - # id 转换成 登录名 - def to_param - Fixnum === self.login ? id : login - end - # ====================================================================== def my_workplace self.user_extensions.try(:occupation).to_s From 84d1adbf259678134c2941daefde22c1b461e298 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 25 Jul 2016 14:36:52 +0800 Subject: [PATCH 03/52] =?UTF-8?q?=E7=94=9F=E6=88=90=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/project.rb | 17 + app/views/layouts/base_projects.html.erb | 2 +- config/locales/projects/zh.yml | 1 + ...160725062343_add_invite_code_to_project.rb | 5 + db/schema.rb | 429 +++++++++++++++++- 5 files changed, 443 insertions(+), 11 deletions(-) create mode 100644 db/migrate/20160725062343_add_invite_code_to_project.rb diff --git a/app/models/project.rb b/app/models/project.rb index bbc639f3d..3333c805b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -904,6 +904,23 @@ class Project < ActiveRecord::Base User.find(self.user_id) end + # 延迟生成邀请码 + def invite_code + return generate_invite_code + end + + # 生成邀请码 + CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z) + def generate_invite_code + code = read_attribute(:invite_code) + if !code || code.size <5 + code = CODES.sample(5).join + return generate_invite_code if Project.where(invite_code: code).present? + update_attribute(:invite_code, code) + end + code + end + private def after_parent_changed(parent_was) diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index a19295233..f68f4c86f 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -53,7 +53,7 @@ <%= image_tag(url_to_avatar(@project), :width => "60", :height => "60") %>
- <%= l(:label_project_id)%><%= @project.id %> + <%= l(:label_project_ivite_code)%><%= @project.generate_invite_code %>
diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 076b905c3..5d2520b19 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -48,6 +48,7 @@ zh: # 左边栏 # label_project_id: "项目ID:" + label_project_ivite_code: "邀请码:" label_agree_join_project: 同意加入 label_apply_project: "+申请加入" diff --git a/db/migrate/20160725062343_add_invite_code_to_project.rb b/db/migrate/20160725062343_add_invite_code_to_project.rb new file mode 100644 index 000000000..5eb8beace --- /dev/null +++ b/db/migrate/20160725062343_add_invite_code_to_project.rb @@ -0,0 +1,5 @@ +class AddInviteCodeToProject < ActiveRecord::Migration + def change + add_column :projects, :invite_code, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 3a92d4fc0..fbdbb29a9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160720094503) do +ActiveRecord::Schema.define(:version => 20160725062343) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -52,6 +52,28 @@ ActiveRecord::Schema.define(:version => 20160720094503) do add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" + create_table "application_settings", :force => true do |t| + t.integer "default_projects_limit" + t.boolean "signup_enabled" + t.boolean "signin_enabled" + t.boolean "gravatar_enabled" + t.text "sign_in_text" + t.datetime "created_at" + t.datetime "updated_at" + t.string "home_page_url" + t.integer "default_branch_protection", :default => 2 + t.boolean "twitter_sharing_enabled", :default => true + t.text "restricted_visibility_levels" + t.boolean "version_check_enabled", :default => true + t.integer "max_attachment_size", :default => 10, :null => false + t.integer "default_project_visibility" + t.integer "default_snippet_visibility" + t.text "restricted_signup_domains" + t.boolean "user_oauth_applications", :default => true + t.string "after_sign_out_path" + t.integer "session_expire_delay", :default => 10080, :null => false + end + create_table "applied_projects", :force => true do |t| t.integer "project_id", :null => false t.integer "user_id", :null => false @@ -168,6 +190,20 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.string "typeName", :limit => 50 end + create_table "audit_events", :force => true do |t| + t.integer "author_id", :null => false + t.string "type", :null => false + t.integer "entity_id", :null => false + t.string "entity_type", :null => false + t.text "details" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "audit_events", ["author_id"], :name => "index_audit_events_on_author_id" + add_index "audit_events", ["entity_id", "entity_type"], :name => "index_audit_events_on_entity_id_and_entity_type" + add_index "audit_events", ["type"], :name => "index_audit_events_on_type" + create_table "auth_sources", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false t.string "name", :limit => 60, :default => "", :null => false @@ -265,6 +301,17 @@ ActiveRecord::Schema.define(:version => 20160720094503) do add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" add_index "boards", ["project_id"], :name => "boards_project_id" + create_table "broadcast_messages", :force => true do |t| + t.text "message", :null => false + t.datetime "starts_at" + t.datetime "ends_at" + t.integer "alert_type" + t.datetime "created_at" + t.datetime "updated_at" + t.string "color" + t.string "font" + end + create_table "bug_to_osps", :force => true do |t| t.integer "osp_id" t.integer "relative_memo_id" @@ -294,14 +341,16 @@ ActiveRecord::Schema.define(:version => 20160720094503) do add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" create_table "changesets", :force => true do |t| - t.integer "repository_id", :null => false - t.string "revision", :null => false + t.integer "repository_id", :null => false + t.string "revision", :null => false t.string "committer" - t.datetime "committed_on", :null => false + t.datetime "committed_on", :null => false t.text "comments" t.date "commit_date" t.string "scmid" t.integer "user_id" + t.integer "project_id" + t.integer "type", :default => 0 end add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" @@ -395,6 +444,17 @@ ActiveRecord::Schema.define(:version => 20160720094503) do add_index "comments", ["author_id"], :name => "index_comments_on_author_id" add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" + create_table "commits", :force => true do |t| + t.integer "repository_id" + t.string "version" + t.string "committer" + t.text "comments" + t.datetime "committed_on" + t.integer "project_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "contest_notifications", :force => true do |t| t.text "title" t.text "content" @@ -570,8 +630,11 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.string "qrcode" end + add_index "courses", ["id"], :name => "id", :unique => true add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true add_index "courses", ["syllabus_id"], :name => "index_courses_on_syllabus_id" + add_index "courses", ["tea_id"], :name => "tea_id" + add_index "courses", ["visits"], :name => "visits" create_table "custom_fields", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false @@ -634,6 +697,15 @@ ActiveRecord::Schema.define(:version => 20160720094503) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" + create_table "deploy_keys_projects", :force => true do |t| + t.integer "deploy_key_id", :null => false + t.integer "project_id", :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id" + create_table "discuss_demos", :force => true do |t| t.string "title" t.text "body" @@ -683,6 +755,16 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.datetime "created_at" end + create_table "emails", :force => true do |t| + t.integer "user_id", :null => false + t.string "email", :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "emails", ["email"], :name => "index_emails_on_email", :unique => true + add_index "emails", ["user_id"], :name => "index_emails_on_user_id" + create_table "enabled_modules", :force => true do |t| t.integer "project_id" t.string "name", :null => false @@ -705,6 +787,25 @@ ActiveRecord::Schema.define(:version => 20160720094503) do add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + create_table "events", :force => true do |t| + t.string "target_type" + t.integer "target_id" + t.string "title" + t.text "data" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "action" + t.integer "author_id" + end + + add_index "events", ["action"], :name => "index_events_on_action" + add_index "events", ["author_id"], :name => "index_events_on_author_id" + add_index "events", ["created_at"], :name => "index_events_on_created_at" + add_index "events", ["project_id"], :name => "index_events_on_project_id" + add_index "events", ["target_id"], :name => "index_events_on_target_id" + add_index "events", ["target_type"], :name => "index_events_on_target_type" + create_table "exercise_answers", :force => true do |t| t.integer "user_id" t.integer "exercise_question_id" @@ -807,6 +908,15 @@ ActiveRecord::Schema.define(:version => 20160720094503) do add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type" add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at" + create_table "forked_project_links", :force => true do |t| + t.integer "forked_to_project_id", :null => false + t.integer "forked_from_project_id", :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "forked_project_links", ["forked_to_project_id"], :name => "index_forked_project_links_on_forked_to_project_id", :unique => true + create_table "forums", :force => true do |t| t.string "name", :null => false t.text "description" @@ -936,6 +1046,17 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.datetime "updated_at", :null => false end + create_table "identities", :force => true do |t| + t.string "extern_uid" + t.string "provider" + t.integer "user_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "identities", ["created_at", "id"], :name => "index_identities_on_created_at_and_id" + add_index "identities", ["user_id"], :name => "index_identities_on_user_id" + create_table "invite_lists", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1082,6 +1203,20 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.integer "private", :default => 0 end + create_table "keys", :force => true do |t| + t.integer "user_id" + t.datetime "created_at" + t.datetime "updated_at" + t.text "key" + t.string "title" + t.string "type" + t.string "fingerprint" + t.boolean "public", :default => false, :null => false + end + + add_index "keys", ["created_at", "id"], :name => "index_keys_on_created_at_and_id" + add_index "keys", ["user_id"], :name => "index_keys_on_user_id" + create_table "kindeditor_assets", :force => true do |t| t.string "asset" t.integer "file_size" @@ -1093,6 +1228,27 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.integer "owner_type", :default => 0 end + create_table "label_links", :force => true do |t| + t.integer "label_id" + t.integer "target_id" + t.string "target_type" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "label_links", ["label_id"], :name => "index_label_links_on_label_id" + add_index "label_links", ["target_id", "target_type"], :name => "index_label_links_on_target_id_and_target_type" + + create_table "labels", :force => true do |t| + t.string "title" + t.string "color" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "labels", ["project_id"], :name => "index_labels_on_project_id" + create_table "member_roles", :force => true do |t| t.integer "member_id", :null => false t.integer "role_id", :null => false @@ -1143,6 +1299,47 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.integer "viewed_count", :default => 0 end + create_table "merge_request_diffs", :force => true do |t| + t.string "state" + t.text "st_commits", :limit => 2147483647 + t.text "st_diffs", :limit => 2147483647 + t.integer "merge_request_id", :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "merge_request_diffs", ["merge_request_id"], :name => "index_merge_request_diffs_on_merge_request_id", :unique => true + + create_table "merge_requests", :force => true do |t| + t.string "target_branch", :null => false + t.string "source_branch", :null => false + t.integer "source_project_id", :null => false + t.integer "author_id" + t.integer "assignee_id" + t.string "title" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "milestone_id" + t.string "state" + t.string "merge_status" + t.integer "target_project_id", :null => false + t.integer "iid" + t.text "description" + t.integer "position", :default => 0 + t.datetime "locked_at" + end + + add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id" + add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id" + add_index "merge_requests", ["created_at", "id"], :name => "index_merge_requests_on_created_at_and_id" + add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at" + add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id" + add_index "merge_requests", ["source_branch"], :name => "index_merge_requests_on_source_branch" + add_index "merge_requests", ["source_project_id"], :name => "index_merge_requests_on_source_project_id" + add_index "merge_requests", ["target_branch"], :name => "index_merge_requests_on_target_branch" + add_index "merge_requests", ["target_project_id", "iid"], :name => "index_merge_requests_on_target_project_id_and_iid", :unique => true + add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title" + create_table "message_alls", :force => true do |t| t.integer "user_id" t.integer "message_id" @@ -1177,6 +1374,39 @@ ActiveRecord::Schema.define(:version => 20160720094503) do add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" add_index "messages", ["parent_id"], :name => "messages_parent_id" + create_table "milestones", :force => true do |t| + t.string "title", :null => false + t.integer "project_id", :null => false + t.text "description" + t.date "due_date" + t.datetime "created_at" + t.datetime "updated_at" + t.string "state" + t.integer "iid" + end + + add_index "milestones", ["created_at", "id"], :name => "index_milestones_on_created_at_and_id" + add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date" + add_index "milestones", ["project_id", "iid"], :name => "index_milestones_on_project_id_and_iid", :unique => true + add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id" + + create_table "namespaces", :force => true do |t| + t.string "name", :null => false + t.string "path", :null => false + t.integer "owner_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "type" + t.string "description", :default => "", :null => false + t.string "avatar" + end + + add_index "namespaces", ["created_at", "id"], :name => "index_namespaces_on_created_at_and_id" + add_index "namespaces", ["name"], :name => "index_namespaces_on_name", :unique => true + add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id" + add_index "namespaces", ["path"], :name => "index_namespaces_on_path", :unique => true + add_index "namespaces", ["type"], :name => "index_namespaces_on_type" + create_table "news", :force => true do |t| t.integer "project_id" t.string "title", :limit => 60, :default => "", :null => false @@ -1202,6 +1432,31 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.datetime "updated_at", :null => false end + create_table "notes", :force => true do |t| + t.text "note" + t.string "noteable_type" + t.integer "author_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "project_id" + t.string "attachment" + t.string "line_code" + t.string "commit_id" + t.integer "noteable_id" + t.boolean "system", :default => false, :null => false + t.text "st_diff", :limit => 2147483647 + end + + add_index "notes", ["author_id"], :name => "index_notes_on_author_id" + add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id" + add_index "notes", ["created_at", "id"], :name => "index_notes_on_created_at_and_id" + add_index "notes", ["created_at"], :name => "index_notes_on_created_at" + add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type" + add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type" + add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type" + add_index "notes", ["project_id"], :name => "index_notes_on_project_id" + add_index "notes", ["updated_at"], :name => "index_notes_on_updated_at" + create_table "notificationcomments", :force => true do |t| t.string "notificationcommented_type" t.integer "notificationcommented_id" @@ -1211,6 +1466,49 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.datetime "updated_at", :null => false end + create_table "oauth_access_grants", :force => true do |t| + t.integer "resource_owner_id", :null => false + t.integer "application_id", :null => false + t.string "token", :null => false + t.integer "expires_in", :null => false + t.text "redirect_uri", :null => false + t.datetime "created_at", :null => false + t.datetime "revoked_at" + t.string "scopes" + end + + add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true + + create_table "oauth_access_tokens", :force => true do |t| + t.integer "resource_owner_id" + t.integer "application_id" + t.string "token", :null => false + t.string "refresh_token" + t.integer "expires_in" + t.datetime "revoked_at" + t.datetime "created_at", :null => false + t.string "scopes" + end + + add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true + add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id" + add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true + + create_table "oauth_applications", :force => true do |t| + t.string "name", :null => false + t.string "uid", :null => false + t.string "secret", :null => false + t.text "redirect_uri", :null => false + t.string "scopes", :default => "", :null => false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "owner_id" + t.string "owner_type" + end + + add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type" + add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true + create_table "onclick_times", :force => true do |t| t.integer "user_id" t.datetime "onclick_time" @@ -1368,6 +1666,23 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.integer "allow_teacher", :default => 0 end + create_table "permissions", :force => true do |t| + t.string "controller", :limit => 30, :default => "", :null => false + t.string "action", :limit => 30, :default => "", :null => false + t.string "description", :limit => 60, :default => "", :null => false + t.boolean "is_public", :default => false, :null => false + t.integer "sort", :default => 0, :null => false + t.boolean "mail_option", :default => false, :null => false + t.boolean "mail_enabled", :default => false, :null => false + end + + create_table "permissions_roles", :id => false, :force => true do |t| + t.integer "permission_id", :default => 0, :null => false + t.integer "role_id", :default => 0, :null => false + end + + add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id" + create_table "phone_app_versions", :force => true do |t| t.string "version" t.text "description" @@ -1450,6 +1765,11 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.datetime "updated_at", :null => false end + create_table "project_import_data", :force => true do |t| + t.integer "project_id" + t.text "data" + end + create_table "project_infos", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1527,6 +1847,7 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.integer "boards_reply_count", :default => 0 t.integer "visits", :default => 0 t.integer "hot", :default => 0 + t.string "invite_code" end add_index "projects", ["lft"], :name => "index_projects_on_lft" @@ -1540,6 +1861,16 @@ ActiveRecord::Schema.define(:version => 20160720094503) do add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" + create_table "protected_branches", :force => true do |t| + t.integer "project_id", :null => false + t.string "name", :null => false + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "developers_can_push", :default => false, :null => false + end + + add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id" + create_table "quality_analyses", :force => true do |t| t.integer "project_id" t.string "author_login" @@ -1688,6 +2019,25 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.integer "is_teacher_score", :default => 0 end + create_table "services", :force => true do |t| + t.string "type" + t.string "title" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "active", :default => false, :null => false + t.text "properties" + t.boolean "template", :default => false + t.boolean "push_events", :default => true + t.boolean "issues_events", :default => true + t.boolean "merge_requests_events", :default => true + t.boolean "tag_push_events", :default => true + t.boolean "note_events", :default => true, :null => false + end + + add_index "services", ["created_at", "id"], :name => "index_services_on_created_at_and_id" + add_index "services", ["project_id"], :name => "index_services_on_project_id" + create_table "settings", :force => true do |t| t.string "name", :default => "", :null => false t.text "value" @@ -1726,6 +2076,26 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.datetime "updated_at", :null => false end + create_table "snippets", :force => true do |t| + t.string "title" + t.text "content", :limit => 2147483647 + t.integer "author_id", :null => false + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "file_name" + t.datetime "expires_at" + t.string "type" + t.integer "visibility_level", :default => 0, :null => false + end + + add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id" + add_index "snippets", ["created_at", "id"], :name => "index_snippets_on_created_at_and_id" + add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at" + add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at" + add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id" + add_index "snippets", ["visibility_level"], :name => "index_snippets_on_visibility_level" + create_table "softapplications", :force => true do |t| t.string "name" t.text "description" @@ -1806,9 +2176,9 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.integer "absence_penalty", :default => 0 t.float "system_score", :default => 0.0 t.boolean "is_test", :default => false + t.float "work_score" t.integer "simi_id" t.integer "simi_value" - t.float "work_score" t.integer "work_status", :default => 0 end @@ -1857,13 +2227,13 @@ ActiveRecord::Schema.define(:version => 20160720094503) do create_table "sub_domains", :force => true do |t| t.integer "org_subfield_id" - t.integer "priority", :default => 0 + t.integer "priority" t.string "name" t.string "field_type" - t.integer "hide", :default => 0 - t.integer "status", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "hide" + t.integer "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "subfield_subdomain_dirs", :force => true do |t| @@ -1873,6 +2243,17 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.datetime "updated_at", :null => false end + create_table "subscriptions", :force => true do |t| + t.integer "user_id" + t.integer "subscribable_id" + t.string "subscribable_type" + t.boolean "subscribed" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id"], :name => "subscriptions_user_id_and_ref_fields", :unique => true + create_table "syllabuses", :force => true do |t| t.string "title" t.text "description" @@ -2133,6 +2514,17 @@ ActiveRecord::Schema.define(:version => 20160720094503) do add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" add_index "users", ["type"], :name => "index_users_on_type" + create_table "users_star_projects", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "users_star_projects", ["project_id"], :name => "index_users_star_projects_on_project_id" + add_index "users_star_projects", ["user_id", "project_id"], :name => "index_users_star_projects_on_user_id_and_project_id", :unique => true + add_index "users_star_projects", ["user_id"], :name => "index_users_star_projects_on_user_id" + create_table "versions", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "name", :default => "", :null => false @@ -2184,6 +2576,23 @@ ActiveRecord::Schema.define(:version => 20160720094503) do t.datetime "updated_at", :null => false end + create_table "web_hooks", :force => true do |t| + t.string "url" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "type", :default => "ProjectHook" + t.integer "service_id" + t.boolean "push_events", :default => true, :null => false + t.boolean "issues_events", :default => false, :null => false + t.boolean "merge_requests_events", :default => false, :null => false + t.boolean "tag_push_events", :default => false + t.boolean "note_events", :default => false, :null => false + end + + add_index "web_hooks", ["created_at", "id"], :name => "index_web_hooks_on_created_at_and_id" + add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id" + create_table "wechat_logs", :force => true do |t| t.string "openid", :null => false t.text "request_raw" From 812481d5fa3f388905eff2792236d5463a67d8ed Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 25 Jul 2016 14:49:08 +0800 Subject: [PATCH 04/52] =?UTF-8?q?=E9=9D=9E=E7=8F=AD=E7=BA=A7=E6=88=90?= =?UTF-8?q?=E5=91=98=E9=82=80=E8=AF=B7=E7=A0=81=E6=98=BE=E7=A4=BA=E4=B8=BA?= =?UTF-8?q?*****?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_course_base_info.html.erb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb index 04162fc9c..d364f84e1 100644 --- a/app/views/layouts/_course_base_info.html.erb +++ b/app/views/layouts/_course_base_info.html.erb @@ -28,7 +28,15 @@ <%= image_tag(url_to_avatar(@course), :width => "110", :height => "110", :alt => "班级logo") %>
-

邀请码
<%=@course.generate_invite_code %>

+

邀请码
+ + <% if User.current.admin? || User.current.member_of_course?(@course) %> + <%=@course.generate_invite_code %> + <% else %> + ***** + <% end %> + +

From 1e0ed2bfba62ff62ea954d63f86e08e689dce632 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 25 Jul 2016 14:54:57 +0800 Subject: [PATCH 05/52] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=92=8C=E7=8F=AD=E7=BA=A7=E6=97=B6=E7=9A=84=E5=8D=A0=E4=BD=8D?= =?UTF-8?q?=E7=AC=A6=E9=9C=80=E8=A6=81=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/new.html.erb | 4 ++-- app/views/syllabuses/new.html.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb index fe6b3e596..f53c8c716 100644 --- a/app/views/courses/new.html.erb +++ b/app/views/courses/new.html.erb @@ -17,13 +17,13 @@
  • - +
  • - +
  • diff --git a/app/views/syllabuses/new.html.erb b/app/views/syllabuses/new.html.erb index 3c0a39bf1..ced8a3d66 100644 --- a/app/views/syllabuses/new.html.erb +++ b/app/views/syllabuses/new.html.erb @@ -6,13 +6,13 @@ <%= labelled_form_for @syllabus do |f| %>
  • - +
  • - +
  • From 774650c819b5f64044219addf384cd8358ddcdda Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 25 Jul 2016 15:22:34 +0800 Subject: [PATCH 06/52] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E7=A0=81=E7=9B=B4=E6=8E=A5=E6=95=B0=E6=8D=AE=E5=BA=93=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=EF=BC=8C=E6=9D=83=E9=99=90=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/project.rb | 1 + app/views/layouts/_join_exit_project.html.erb | 2 -- app/views/layouts/base_projects.html.erb | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 3333c805b..520407589 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -910,6 +910,7 @@ class Project < ActiveRecord::Base end # 生成邀请码 + # 如果已有改邀请码,则重新生成 CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z) def generate_invite_code code = read_attribute(:invite_code) diff --git a/app/views/layouts/_join_exit_project.html.erb b/app/views/layouts/_join_exit_project.html.erb index 35d8f87ef..e893949f4 100644 --- a/app/views/layouts/_join_exit_project.html.erb +++ b/app/views/layouts/_join_exit_project.html.erb @@ -2,9 +2,7 @@ <% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %> <%= watcher_link_for_project(@project, User.current) %> - <% end %> - <% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %> <%= join_in_project_link(@project, User.current) %> <% end %> diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index f68f4c86f..e7b23b3b5 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -53,7 +53,8 @@ <%= image_tag(url_to_avatar(@project), :width => "60", :height => "60") %>
    - <%= l(:label_project_ivite_code)%><%= @project.generate_invite_code %> + <%= l(:label_project_ivite_code)%> + <%= (User.current.member_of?(@project) || User.current.admin?) ? @project.invite_code : "******" %>
    From 463c09f02ce609ad4c64ca209a62ff4c4997989c Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 26 Jul 2016 08:55:07 +0800 Subject: [PATCH 07/52] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- app/controllers/applied_project_controller.rb | 75 +++++++------- app/helpers/watchers_helper.rb | 29 +++--- .../_applied_join_project.html.erb | 28 ++++++ .../applied_join_project.js.erb | 21 ++-- config/routes.rb | 4 +- public/images/sy/sy_icons_close02.png | Bin 0 -> 18724 bytes public/javascripts/application.js | 16 +++ public/stylesheets/css/common.css | 31 ++++++ public/stylesheets/css/popup.css | 93 +++++++++++++++++- public/stylesheets/sy_public.css | 56 +++++------ 11 files changed, 261 insertions(+), 94 deletions(-) create mode 100644 app/views/applied_project/_applied_join_project.html.erb create mode 100644 public/images/sy/sy_icons_close02.png diff --git a/Gemfile b/Gemfile index 03dbb5785..a94f1b33b 100644 --- a/Gemfile +++ b/Gemfile @@ -51,7 +51,7 @@ gem 'elasticsearch-rails' ### profile -gem 'oneapm_rpm' +# gem 'oneapm_rpm' group :development do gem 'grape-swagger' diff --git a/app/controllers/applied_project_controller.rb b/app/controllers/applied_project_controller.rb index b9824976b..39491c0e6 100644 --- a/app/controllers/applied_project_controller.rb +++ b/app/controllers/applied_project_controller.rb @@ -2,44 +2,45 @@ class AppliedProjectController < ApplicationController #申请加入项目 def applied_join_project - @user_id = params[:user_id] - @project = Project.find_by_id(params[:project_id]) - if params[:project_join] - if @project - user = User.find @user_id - if user.member_of?(@project) - @status = 3 - else - @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) - if @applieds.count == 0 - appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) - Mailer.run.applied_project(appliedproject) - @status = 2 - else - @status = 1 - end - end - else - @status = 0 - end - respond_to do |format| - format.js - end - return - end - @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) - if @applieds.count == 0 - appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) - Mailer.run.applied_project(appliedproject) - end - - #redirect_to project_path(params[:project_id]) - #redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true} - respond_to do |format| - format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} - format.js { render :partial => 'set_applied'} - end + # @user_id = params[:user_id] + # @project = Project.find_by_id(params[:project_id]) + # if params[:project_join] + # if @project + # user = User.find @user_id + # if user.member_of?(@project) + # @status = 3 + # else + # @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) + # if @applieds.count == 0 + # appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) + # Mailer.run.applied_project(appliedproject) + # @status = 2 + # else + # @status = 1 + # end + # end + # else + # @status = 0 + # end + # respond_to do |format| + # format.js + # end + # return + # end + # + # @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) + # if @applieds.count == 0 + # appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) + # Mailer.run.applied_project(appliedproject) + # end + # + # #redirect_to project_path(params[:project_id]) + # #redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true} + # respond_to do |format| + # format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} + # format.js { render :partial => 'set_applied'} + # end end #取消申请 diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 52f2ea119..823fe534b 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -366,20 +366,27 @@ module WatchersHelper #申请加入项目 def join_in_project_link(project, user, options=[]) - return '' unless user && user.logged? applied = project.applied_projects.find_by_user_id(user.id) text = applied ? l(:label_unapply_project) : l(:label_apply_project) - @applied_flag = project.instance_of?(Project) - if applied - appliedid = applied.id - end - id = applied_css(project) - url = appliedproject_path( - :id=>appliedid, - :user_id => user.id, - :project_id => project.id) + url = applied ? unapplied_join_project_path(:object_id => project.id) : applied_join_project_path(:object_id => project.id) method = applied ? 'delete' : 'post' - link_to text, url, :remote => true, :method => method , :class => "pr_join_a",:id => id + @applied_flag = project.instance_of?(Project) + if applied + link = link_to(text, url, :remote => true, :method => method, :class => "sy_btn_grey fl", :id => "#{project.id}") + else + link = link_to(text, url, :remote => true, :method => method, :id => "#{project.id}", :class => "sy_btn_grey fl") + end + link.html_safe + # if applied + # appliedid = applied.id + # end + # id = applied_css(project) + # url = appliedproject_path( + # :id=>appliedid, + # :user_id => user.id, + # :project_id => project.id) + # method = applied ? 'delete' : 'post' + # link_to text, url, :remote => true, :method => method , :class => "pr_join_a",:id => id end def paginateHelper obj, pre_size=20 diff --git a/app/views/applied_project/_applied_join_project.html.erb b/app/views/applied_project/_applied_join_project.html.erb new file mode 100644 index 000000000..baa49ef01 --- /dev/null +++ b/app/views/applied_project/_applied_join_project.html.erb @@ -0,0 +1,28 @@ + +
    +

    欢迎加入项目

    + +
    +
    +
    +
      +
    • + + +
      +
    • +
    • + + 管理人员 + 开发人员 + 报告人员 +
      +
    • +
    • + + 确  定 + 取  消 +
      +
    • +
    +
    diff --git a/app/views/applied_project/applied_join_project.js.erb b/app/views/applied_project/applied_join_project.js.erb index ae9d3f467..f79e9ac20 100644 --- a/app/views/applied_project/applied_join_project.js.erb +++ b/app/views/applied_project/applied_join_project.js.erb @@ -1,14 +1,7 @@ -// @status: 0 该项目不存在;1 不重复加入;2 成功加入; 3 已是项目成员;其它 加入失败 -<% if @status == 0%> - alert("<%= l('project.join.tips.notexist') %>"); -<% elsif @status == 1%> - alert("<%= l('project.join.tips.repeat') %>"); -<% elsif @status == 2%> - alert("<%= l('project.join.tips.success') %>"); - hideModal($("#popbox")); - $("#applied_project_link_<%= @project.id%>").replaceWith("<%=escape_javascript(link_to '取消申请',appliedproject_applied_path(:project_id => @project.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{@project.id}")%>"); -<% elsif @status == 3%> - alert("<%= l('project.join.tips.has') %>"); -<%else%> - alert("<%= l('project.join.tips.fail') %>"); -<%end%> \ No newline at end of file +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'applied_join_project', locals: { :course => @course}) %>'); +showModal('ajax-modal', '500px'); + +$('#ajax-modal').siblings().remove(); + +$('#ajax-modal').parent().css("top","").css("left",""); + diff --git a/config/routes.rb b/config/routes.rb index 1124080b7..4b9027335 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -721,8 +721,8 @@ RedmineApp::Application.routes.draw do post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue' delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue' - post 'appliedproject/applied', :to => 'applied_project#applied_join_project', :as => 'appliedproject' - delete 'appliedproject/applied', :to => 'applied_project#unapplied_join_project' + post 'applied_project/applied_join', :to => 'applied_project#applied_join_project', :as => 'applied_join_project' + delete 'applied_project/applied', :to => 'applied_project#unapplied_join_project', :as => 'unapplied_join_project' resources :projects do member do diff --git a/public/images/sy/sy_icons_close02.png b/public/images/sy/sy_icons_close02.png new file mode 100644 index 0000000000000000000000000000000000000000..456f2ea67183dcba533dfed2c7591e2b37b9c787 GIT binary patch literal 18724 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 literal 0 HcmV?d00001 diff --git a/public/javascripts/application.js b/public/javascripts/application.js index b7468366a..e86ad8ddc 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1492,6 +1492,22 @@ function pop_up_box(value,tWidth,tTop,tLeft){ } } +// 公共弹框样式 +// title +function pop_box_new(value, tWidth, tTop, tLeft){ + $("#ajax-modal").html(value); + showModal('ajax-modal', tWidth + "px"); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before(""); + $('#ajax-modal').parent().css("top", tTop+"%").css("left", tLeft+"%").css("padding-top", "10px").css("position", "fixed"); + $('#ajax-modal').parent().addClass("resourceUploadPopup"); + $('#ajax-modal').css("padding-left", "16px").css("padding-bottom", "16px"); + + function hideModal(){ + $('#ajax-modal').hide(); + } +} + //显示的时候根据当前网址是http 还是https 选择视频显示方式直接显示还是弹框 function autoMedia(id){ var rootPath = getRootPath(); diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index b72a8ef56..888cb3ca3 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -542,6 +542,37 @@ a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;} .borderRadius {border-radius:5px;} a.Blue-btn{ display:block; margin-right:15px;width:65px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} a:hover.Blue-btn{ background:#3598db; color:#fff;} + +/*20160725 项目申请按钮*/ +a.sy_btn_grey{ + color: #333; + background: #e1e1e1; + text-align: center; + font-size: 12px; + padding:0 15px; + height: 30px; + line-height: 30px; + -webkit-border-radius:3px; + -moz-border-radius:3px; + -o-border-radius:3px; + border-radius:3px; +} +a:hover.sy_btn_grey{ background: #c3c3c3;} +a.sy_btn_blue{ + display:block; + width:80px; + height: 30px; + text-align:center; + color: #fff; + background: #3b94d6; + font-size: 12px; + line-height: 30px; + -webkit-border-radius:3px; + -moz-border-radius:3px; + -o-border-radius:3px; + border-radius:3px; +} +a:hover.sy_btn_blue{ background: #2788d0;} /* commonpic */ .pic_date{ display:block; background:url(/images/public_icon.png) -31px 0 no-repeat; width:16px; height:15px; } .pic_add{ display:block; background:url(/images/public_icon.png) -31px -273px no-repeat; width:16px; height:15px; } diff --git a/public/stylesheets/css/popup.css b/public/stylesheets/css/popup.css index ea2034a5e..c9f8ccf09 100644 --- a/public/stylesheets/css/popup.css +++ b/public/stylesheets/css/popup.css @@ -332,4 +332,95 @@ a.contributor_course{float: right; color: #888; font-size: 12px; font-weight: no .relatePWrap{max-height: 210px;overflow:hidden;} /*20160622代码分析弹窗*/ -.analysis-option-box {width:100%; border:1px solid #ccc; padding:3px 5px;} \ No newline at end of file +.analysis-option-box {width:100%; border:1px solid #ccc; padding:3px 5px;} + +/*公共弹框*/ +/* 按钮*/ + + + + + +/* 加入班级弹窗 */ +#sy_popup_box{ + width:460px; + background:#fff; + padding-bottom:30px; + -webkit-border-radius:5px; + -moz-border-radius:5px; + -o-border-radius:5px; + border-radius:5px; + box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); +} +.sy_popup_top{ + background:#3b94d6; + height:40px; + -webkit-border-radius: 5px 5px 0px 0px; + -moz-border-radius: 5px 5px 0px 0px; + -o-border-radius: 5px 5px 0px 0px; + border-radius: 5px 5px 0px 0px; +} +.sy_popup_top h3{ + font-size:18px; + color:#fff; + font-weight:normal; + line-height:40px; + padding-left:10px; +} +a.sy_icons_close{ + width:20px; + height:20px; + display:block; + background: url(../images/sy/sy_icons_close.png) 0 0px no-repeat; + margin:8px 10px 0 0; +} +a:hover.sy_icons_close{ + background: url(../images/sy/sy_icons_close.png) -40px 0px no-repeat; +} +.sy_popup_con{ + margin:30px auto 0; + font-size:14px; + width:330px; +} +.sy_popup_add label{ + display:block; + float:left; + width:85px; + text-align:right; + line-height:40px; +} +.sy_popup_add li{ + line-height:40px; +} +.sy_input_txt{ + border:1px solid #dedede; + height:36px; + background:#fff; + padding:0 5px; + width:220px; +} +.sy_popup_con02{ + margin:30px auto 0; + font-size:14px; + text-align:center; + width:360px; +} +.sy_popup_con02 ul li p{ + margin-bottom:15px; + text-align:center; + font-size:14px; + color:#616161; +} +.sy_popup_con02 a{ margin:0 auto;} +.sy_popup_top_tishi{ background:#ededed; } +.sy_popup_top_tishi h3{color:#616161; font-size:16px;} +a.sy_icons_close02{ + width:20px; + height:20px; + display:block; + background: url(../images/sy/sy_icons_close02.png) 0 0px no-repeat; + margin:8px 10px 0 0; +} +a:hover.sy_icons_close02{ + background: url(../images/sy/sy_icons_close02.png) -40px 0px no-repeat; +} \ No newline at end of file diff --git a/public/stylesheets/sy_public.css b/public/stylesheets/sy_public.css index 7c79bf6e6..77c782698 100644 --- a/public/stylesheets/sy_public.css +++ b/public/stylesheets/sy_public.css @@ -62,34 +62,34 @@ a.sy_btn_green{ border-radius:3px; } a:hover.sy_btn_green{ background: #51a74f;} -a.sy_btn_grey{ - color: #333; - background: #e1e1e1; - text-align: center; - font-size: 12px; - padding:0 15px; - height: 30px; - line-height: 30px; - -webkit-border-radius:3px; - -moz-border-radius:3px; - -o-border-radius:3px; - border-radius:3px; -} -a:hover.sy_btn_grey{ background: #c3c3c3;} -a.sy_btn_blue{ - color: #fff; - background: #3b94d6; - text-align: center; - font-size: 12px; - padding:0 15px; - height: 30px; - line-height: 30px; - -webkit-border-radius:3px; - -moz-border-radius:3px; - -o-border-radius:3px; - border-radius:3px; -} -a:hover.sy_btn_blue{ background: #2788d0;} +/*a.sy_btn_grey{*/ + /*color: #333;*/ + /*background: #e1e1e1;*/ + /*text-align: center;*/ + /*font-size: 12px;*/ + /*padding:0 15px;*/ + /*height: 30px;*/ + /*line-height: 30px;*/ + /*-webkit-border-radius:3px;*/ + /*-moz-border-radius:3px;*/ + /*-o-border-radius:3px;*/ + /*border-radius:3px;*/ +/*}*/ +/*a:hover.sy_btn_grey{ background: #c3c3c3;}*/ +/*a.sy_btn_blue{*/ + /*color: #fff;*/ + /*background: #3b94d6;*/ + /*text-align: center;*/ + /*font-size: 12px;*/ + /*padding:0 15px;*/ + /*height: 30px;*/ + /*line-height: 30px;*/ + /*-webkit-border-radius:3px;*/ + /*-moz-border-radius:3px;*/ + /*-o-border-radius:3px;*/ + /*border-radius:3px;*/ +/*}*/ +/*a:hover.sy_btn_blue{ background: #2788d0;}*/ /* 排序 */ .sy_category{ height: 50px; From feb45a07bf3a5a690d001b62bf91c958d415d7eb Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 26 Jul 2016 16:45:36 +0800 Subject: [PATCH 08/52] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=88=86=E4=B8=BA=E6=88=91=E5=88=9B=E5=BB=BA=E7=9A=84=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E5=92=8C=E6=88=91=E5=8A=A0=E5=85=A5=E7=9A=84=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 78 +++++++--- app/helpers/users_helper.rb | 14 ++ app/views/users/_courses_list.html.erb | 28 ++++ .../users/_syllabus_course_list.html.erb | 61 ++++++++ .../users/_user_join_syllabus_list.html.erb | 3 + app/views/users/_user_syllabus_list.html.erb | 135 +----------------- app/views/users/expand_courses.js.erb | 5 + app/views/users/sort_syllabus_list.js.erb | 5 + app/views/users/user_courselist.html.erb | 36 ++++- config/routes.rb | 3 + public/images/syllabus/icons_syllabus.png | Bin 21845 -> 22951 bytes 11 files changed, 214 insertions(+), 154 deletions(-) create mode 100644 app/views/users/_courses_list.html.erb create mode 100644 app/views/users/_syllabus_course_list.html.erb create mode 100644 app/views/users/_user_join_syllabus_list.html.erb create mode 100644 app/views/users/expand_courses.js.erb create mode 100644 app/views/users/sort_syllabus_list.js.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 30f78d9a5..45330b236 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -41,7 +41,7 @@ class UsersController < ApplicationController :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource, :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction, - :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist] + :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list] before_filter :auth_user_extension, only: :show #before_filter :rest_user_score, only: :show #before_filter :select_entry, only: :user_projects @@ -3228,7 +3228,35 @@ class UsersController < ApplicationController end def user_courselist - @order, @c_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1 + @order, @c_sort, @type, @list_type = 1, 2, 1, 1 + + @my_syllabuses = @user.syllabuses + + sy_courses = @user.courses.visible.where("is_delete =? and tea_id != ?", 0, @user.id) + syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")" + @join_syllabuses = Syllabus.where("id in #{syllabus_ids} and user_id != #{@user.id}") + + @my_syllabuses = syllabus_course_list_sort @my_syllabuses + @join_syllabuses = syllabus_course_list_sort @join_syllabuses + @my_syllabuses = @my_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]} + @join_syllabuses = @join_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]} + + #分页 + # @limit = 10 + # @is_remote = true + # @atta_count = @syllabus.count + # @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 + # @offset ||= @atta_pages.offset + # @syllabus = paginateHelper @syllabus,@limit + + respond_to do |format| + format.html {render :layout => 'new_base_user'} + end + end + + #课程列表的排序 + def sort_syllabus_list + @order, @c_sort, @type, @list_type = params[:order] || 1, params[:sort] || 1, params[:type] || 1, params[:list_type] || 1 #确定 sort_type if @order.to_i == @type.to_i @@ -3238,40 +3266,48 @@ class UsersController < ApplicationController end sort_name = "updated_at" - sort_type = @c_sort == 1 ? "asc" : "desc" - @courses = @user.courses.visible.where("is_delete =?", 0) - syllabus_ids = @courses.empty? ? '(-1)' : "(" + @courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")" - @syllabus = Syllabus.where("id in #{syllabus_ids} or user_id = #{User.current.id}").order("#{sort_name} #{sort_type}") + if @list_type.to_i == 1 + @syllabuses = @user.syllabuses.order("updated_at desc") + else + sy_courses = @user.courses.visible.where("is_delete =? and tea_id != ?", 0, @user.id) + syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")" + @syllabuses = Syllabus.where("id in #{syllabus_ids} and user_id != #{@user.id}").order("updated_at desc") + end - #根据 作业+资源数排序 - if @order.to_i == 2 + if @order.to_i == 1 #根据 班级更新时间排序 + @syllabuses = syllabus_course_list_sort @syllabuses + @c_sort == 1 ? (@syllabuses = @syllabuses.sort{|x,y| x[:last_update] <=> y[:last_update] }) : (@syllabuses = @syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]}) + @type = 1 + elsif @order.to_i == 2 #根据 作业+资源数排序 @type = 2 - @syllabus.each do |syllabus| + @syllabuses.each do |syllabus| count = 0 - courses = @courses.where("syllabus_id = #{syllabus.id}") + courses = syllabus.courses.not_deleted courses.each do |c| count += (User.current.admin? || User.current.allowed_to?(:as_teacher,c)) ? (c.homework_commons.count + visable_attachemnts_incourse(c).count) : (c.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(c).count) end syllabus[:infocount] = count end - @c_sort == 1 ? (@syllabus = @syllabus.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@syllabus = @syllabus.sort{|x,y| y[:infocount] <=> x[:infocount]}) - @syllabus = sortby_time_countcommon_nosticky @syllabus,sort_name + @c_sort == 1 ? (@syllabuses = @syllabuses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@syllabuses = @syllabuses.sort{|x,y| y[:infocount] <=> x[:infocount]}) + @syllabuses = sortby_time_countcommon_nosticky @syllabuses,sort_name else @type = 1 end - #分页 - @limit = 10 - @is_remote = true - @atta_count = @syllabus.count - @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 - @offset ||= @atta_pages.offset - @syllabus = paginateHelper @syllabus,@limit - respond_to do |format| format.js - format.html {render :layout => 'new_base_user'} + end + end + + #展开课程下的班级 + def expand_courses + @syllabus = Syllabus.where("id = #{params[:syllabus_id]}").first + unless @syllabus.nil? + @courses = @syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") + respond_to do |format| + format.js + end end end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 98b993183..6493993b0 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -690,4 +690,18 @@ module UsersHelper end result_ids end + + #课程的班级列表最近更新时间 + def syllabus_course_list_sort syllabuses + syllabuses.each do |sy| + updated_at = sy.updated_at + courses = sy.courses.not_deleted + unless courses.empty? + course_ids = "(" + courses.map { |course| course.id}.join(",") + ")" + updated_at = CourseActivity.where("course_id in #{course_ids}").order("updated_at desc").first.updated_at + end + sy[:last_update] = updated_at + end + syllabuses + end end diff --git a/app/views/users/_courses_list.html.erb b/app/views/users/_courses_list.html.erb new file mode 100644 index 000000000..29983bf34 --- /dev/null +++ b/app/views/users/_courses_list.html.erb @@ -0,0 +1,28 @@ +<% unless courses.nil? %> + <% courses.each_with_index do |course, i| %> +
  • + + +
    +
    +

    <%=course.name %>

    + +
    +
    +
    +

    更新:<%=format_date Time.at(course.updatetime) %>学期:<%=current_time_and_term(course) %>

    +

    <%=studentCount course %>学生|<%=visable_course_homework course %>作业|<%=visable_attachemnts_incourse(@course).count %>资源

    +
    +
    +
    + +
    +
    +
  • + <% end %> + <% if courses.count > 3 %> +
  • + 共<%=courses.count %>个班级,点击全部展开 +
  • + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/users/_syllabus_course_list.html.erb b/app/views/users/_syllabus_course_list.html.erb new file mode 100644 index 000000000..06dff2b49 --- /dev/null +++ b/app/views/users/_syllabus_course_list.html.erb @@ -0,0 +1,61 @@ +
    + <% if @type.to_i == 2 %> + <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :style => "margin-right: 5px;", :remote => true %> + <% else %> + <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortdownbtn sort_no fr", :style => "margin-right: 5px;", :remote => true %> + <% end %> + <%= link_to "人气", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt fr", :remote => true %> + <% if @type.to_i == 1 %> + <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :remote => true %> + <% else %> + <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fr", :remote => true %> + <% end %> + <%= link_to "时间", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fr", :remote => true %> + 我<%= list_type == 1 ? "创建" : "加入"%>的课程 +
    +
    + +<% if syllabuses.any? %> + <% syllabuses.each_with_index do |syllabus, index|%> +
    + <% course_count = syllabus.courses.not_deleted.count %> +
    +
    + +

    <%=syllabus.title %>

    +
    +

    更新时间:<%=format_date syllabus.updated_at %> + 创建老师:<%=syllabus.user.show_name %> + 班级:<%=course_count %> +

    +
    +
    + +
    +
      + <% if index == 0 %> + <% courses = syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") %> + <%= render :partial => 'users/courses_list', :locals => {:courses => courses, :syllabus => syllabus}%> + <% end %> +
    +
    + +
    +
      +
    • +
        +
      • + <%=link_to '查看课程', syllabus_path(syllabus.id), :class => 'postOptionLink',:target =>'_blank', :title => '查看课程' %> +
      • + <% if User.current == syllabus.user %> +
      • <%=link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :class => 'postOptionLink', :remote => 'true'%>
      • + <% end %> +
      +
    • +
    +
    +
    + <% end %> +<% else %> +

    <%= l(:label_no_data) %>

    +<% end %> \ No newline at end of file diff --git a/app/views/users/_user_join_syllabus_list.html.erb b/app/views/users/_user_join_syllabus_list.html.erb new file mode 100644 index 000000000..7faab0017 --- /dev/null +++ b/app/views/users/_user_join_syllabus_list.html.erb @@ -0,0 +1,3 @@ +
    + <%= render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @join_syllabuses, :list_type => 2} %> +
    diff --git a/app/views/users/_user_syllabus_list.html.erb b/app/views/users/_user_syllabus_list.html.erb index 9fa93c76e..b6c767771 100644 --- a/app/views/users/_user_syllabus_list.html.erb +++ b/app/views/users/_user_syllabus_list.html.erb @@ -1,132 +1,3 @@ -
    -

    课程列表

    -
    - 排序: - <%= link_to "时间", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fl", :remote => true %> - <% if @type.to_i == 1 %> - <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fl", :remote => true %> - <% else %> - <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fl", :remote => true %> - <% end %> - <%= link_to "人气", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt fl", :remote => true %> - <% if @type.to_i == 2 %> - <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fl", :remote => true %> - <% else %> - <%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortdownbtn sort_no fl", :remote => true %> - <% end %> -
    -
    - - <% if @syllabus.any? %> - <% @syllabus.each_with_index do |syllabus, index|%> -
    - <% courses = @courses.where("syllabus_id = #{syllabus.id}").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("time desc") %> -
    -
    - -

    <%=syllabus.title %>

    -
    -

    更新时间:<%=format_date syllabus.updated_at %> - 创建老师:<%=syllabus.user.show_name %> - 班级:<%=courses.count %> -

    -
    -
    - - - -
    -
      -
    • -
        -
      • - <%=link_to '查看课程', syllabus_path(syllabus.id), :class => 'postOptionLink',:target =>'_blank', :title => '查看课程' %> -
      • - <% if User.current == syllabus.user %> -
      • <%=link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :class => 'postOptionLink', :remote => 'true'%>
      • - <% end %> -
      -
    • -
    -
    -
    - <% end %> -
    -
      - <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %> -
    -
    -
    - <% else %> -

    <%= l(:label_no_data) %>

    - <% end %> -
    - - \ No newline at end of file +
    + <%= render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @my_syllabuses, :list_type => 1} %> +
    \ No newline at end of file diff --git a/app/views/users/expand_courses.js.erb b/app/views/users/expand_courses.js.erb new file mode 100644 index 000000000..3b2291e1d --- /dev/null +++ b/app/views/users/expand_courses.js.erb @@ -0,0 +1,5 @@ +<% unless @courses.empty? %> + $("#syllabus_course_ul_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/courses_list', :locals => {:courses => @courses, :syllabus => @syllabus}) %>"); + $("#syllabus_course_ul_<%=@syllabus.id %>").parent().show(); + $("#syllabus_course_ul_<%=@syllabus.id %>").parent().prev().children(":first-child").children(":first-child").toggleClass("icons_sy_close").toggleClass("icons_sy_open"); +<% end %> \ No newline at end of file diff --git a/app/views/users/sort_syllabus_list.js.erb b/app/views/users/sort_syllabus_list.js.erb new file mode 100644 index 000000000..e353109f4 --- /dev/null +++ b/app/views/users/sort_syllabus_list.js.erb @@ -0,0 +1,5 @@ +<% if @list_type.to_i == 1 %> +$("#user_syllabus_list").html('<%= escape_javascript(render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @syllabuses, :list_type => 1}) %>'); +<% else %> +$("#user_join_syllabus_list").html('<%= escape_javascript(render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @syllabuses, :list_type => 2}) %>'); +<% end %> \ No newline at end of file diff --git a/app/views/users/user_courselist.html.erb b/app/views/users/user_courselist.html.erb index 148cc1703..25bf2354d 100644 --- a/app/views/users/user_courselist.html.erb +++ b/app/views/users/user_courselist.html.erb @@ -1 +1,35 @@ -<%= render :partial => 'users/user_syllabus_list'%> +
    +

    课程列表

    + + <%= render :partial => 'users/user_syllabus_list'%> +
    + <%= render :partial => 'users/user_join_syllabus_list'%> +
    + + + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 5439da9f4..6c16dbd7d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -563,6 +563,7 @@ RedmineApp::Application.routes.draw do post "user_commit_homework" post 'user_select_homework' get 'all_journals' + get 'expand_courses' end member do @@ -619,6 +620,8 @@ RedmineApp::Application.routes.draw do match 'user_courselist', :to => 'users#user_courselist', :via => :get, :as => "user_courselist" match 'user_projectlist', :to => 'users#user_projectlist', :via => :get, :as => "user_projectlist" + match 'sort_syllabus_list', :to => 'users#sort_syllabus_list', :via => :get, :as => "sort_syllabus_list" + get 'edit_brief_introduction' get "user_resource" get "import_resources" diff --git a/public/images/syllabus/icons_syllabus.png b/public/images/syllabus/icons_syllabus.png index 7f6c4987cc280922e84f6cc32ed3750b0af87e52..4afdb729f96ffa021e9e40a271718a7ea3883b63 100644 GIT binary patch delta 2548 zcmbW1dpMN&0>@`C4Pql~CDu@p+PB`@yze^*b1{wkX|aTjxf<=(xGaaTGdf*Z(qw9N zL@p_tA`z>LODVCV?26E;BbQ{^C6|Owd#2j+&pyxYbDs12>v#EnKi}`~dEe*PT}Cdg zCRZNQ*V;Z=t@GsYIMaR-Tz6cda{c6LrBL;b@i{S=d~R8BAGz!Ad(3qMGjF?*_X0d zsVvF?gvCOPE))T}Ko|(XzzHE86Nz931N#d*#wQR6!bJb49hZnu6ekb>#s%Wv(;-3# z5SS3g7<3%s!-OW?o(3WW2thas;xLF25Ja#c)Qv+R3z6J&}XZ>&z-~cPk1zumz3roU~$)Fd>!8F5&PK-GuBDR6IG9j z&s7(l7~%400%Os!OSvW4Hb(nt6Gz`f6`2QbHn!$b*40LBXfC(#+|wKwpQOjS#&b5Q z_S&;J^rmH7?EL-q`q;_#`*HHHy7v6*qy3ZZ3;i>%@?+!6I>*qm?{~O-C(pQ?H8K`- zcebGBybp-^o-%U-^w00aUB;Q}|5LZm+oOLx# z^GN0R1(y2g1FVtp{^fw26*;<#W7rlraF83kpdZTDkyiEVKN+v=DIYN7>ZYXWHTfD0 z>J)-nFReFOiqF3V+8a@dKcV$hEDQZSOq#Siu<-SKOKGIxj({M;bh~m%c=?SKhZAWv zIjx)2ROuxijain+3rGgQTZGll;>nOL1=5Gggido^C$Z^Dc~e?KXRy{q&kcecR#nU# z`5V%>!t;dgdP+&E?a;q7wHExi`x@{0nG+PRDEHcB30qEIIiwZfh6zunC@whHKh9)0 z#x){W0?4^Xj(x&w)S6M88a`>)W6R4m=3Wm=ciwQpI(oD@)W+9ju%qdUzfJtZx|h*T zk$b4|s9qgBlL(zU(s9ITk6SYSFK5?~v)#&=S?l`f zjwiGB=DhwNWw%GzqmIe*$cvJ>%C0SnrI9$}C=0@No!nAE&2);*c(u17MRB#>umm4e z&MTNP4VzA1sV!Z38IWWe`3Cu!;<%9<5^VFc$6R{6g#hzy>1s3IUUk;m zEC1v@x!lyr+tpSHorjF>eM7f5@QpxK-m z`|;JFo2f+}so%c)6O_82D|94#<);kWskYi@E|n?87bZ3#ncP87c(9|rX zoE)0|&LMo|)cThbWBT@W0{<-qJbdRoNgg(`vE(Dj^arw2(1A;*d{<3XSR7_gr=!ZB zDp$Q3Pad|ix%WNCDlujusHr+;Lhq(sr|TklGTfKF)O}>yf5p`E9Cc}9v@=-fJDl2{ zeZMBioBGkTvLe*^7GcYa?#J2%<6XYFV=ImO21`)i)Nj*=T&7uHYEM?)Q!Pf+A7 zZBcPm)W*yXvjK~~%~?HbMsa2Rc>wVKRDM*$fIW8M+8s+b?w)E=QwE++Es&+Hs=epb zHIJK2HRrObvP`=lFTEbN&+#4poVV(48TC2#GcG27S4$)6JR8nTFP6V3`EBgx)}dJH z)OGDH8TX!4b*}9I*ne2lcR~fp-;~Fgc1jcTWucDGt;1R(3ZqwKzENMidM2iSXrRVm z{R2^o>8*O_S*2}32W9B>q(W1w%J7v#Q%VEXdG7s1V<<~5>G#c|k1lUQni@aqd^U6S zi@Y%X=O&4?f7T|ZcKFO})$3}QIcAsRyR9-ftHnt3Rdm8Hc*znX<)6lr=g9@8Psg7j z<_SBpqOBJ=@yErxFPT0JP0U{V{Ir1+zo)g|59zL%Kdp71x%O}mn zbyJYr*B*TNjZw?TRp05&F=&pY4^h)6ulJVp8FxmkJ_GL4iX>;-|B7J%}B3{d0#`q&!8Z#`-?~NT&uI%jrA3|6hk%wDz8Ma77c*j zrF5&Yaj?DVhs=jAwE2pgXS9Ty%c@A^x-|*R!A$#@Jx6EP0M-u;PHd-@ZMiBjz9 dUtjtgm6Y~)ONCkAnrxD0xV!mqDp=wB{{wkeF=qe( delta 1877 zcma)5XHb)g7X4D_U0_2~`Ua6K5CRg!5K0h~8iIg46{HE$T&WUBA}v6Czy@*Y0#X7Y zs35Q+CJsdbsUa(6DK0t-p_fpE^*wgp{@P#f&fFjO&Y648oqKLw3y9YMdX_H^wi9Zh zi}ymL%n(Qv!PwLSdENqPL=Tci|D)3=9i(G~@()4=BmEIU#^$#WC^QO*K%@PUh+vZd zv%rABTLD4-CM_tL4AK7!NuPt6|AS=Y)L_fH(mt3zqAp5rIpavjsXNj?o@A(oW6P07 zjxjXUG#XFO#v79EI@(zi5~f#6BdCg=O7BQ_GE@x$n|@&a;=gNMhb;6amiUb7-MgYY zEwjgPCZ?AZ$U$us(o(`JmAuc%SIQ{sJ?~|CuU@@y=R273U@g_b!D~xb3Tncb$wW7X zglx+hqQysJpY9Zi0ckvX`Ay1KeiE?2vN z3$99~isM8y-S7Zj66>wk3y2m#v6mHzvITe{L$@l%@I2#4V*dJ;%k|RlCHz)?ZHmSB zoQ>gYfwWF(fbA6OJYbGea$>UoD+?af9?9#(XqnpSV4+k8a-hd~Tex+OTaCs36P(^M z>9>H1JiO2u)VRLq0$AIc?#W!}mQKo1e9dvFlo0(@P`+)XPUXp!&otGuK8ga686=6K$`kDYiDNtWrX)M&#}zk&|+sd+lE!DXB>{t_Wn!m~WM zX|~zE;ssB3@IT1M{T`VI63=@2mAzV9Qw!ImflHJ_F;4CdsP6y>B^?B&Om>QOu!iH! z(TmwZou>=e{#{>f3!1Ln{+CFbj=f-DysQ{Va&69oAku*H2Xz`t`N*uq1IwOv^^ z4~k)3Q|8R;T-C)++#cwDV^ap9N~VaGPv|QW5I^~ zf?Blw!x-Rd*hl6=($=ij5pV~t`abZ3?VM0>{Z845M00etYlXIV+XeYa24>i;n>(k2 zX@G3(4B^H%`}Zt+>V!D%gK_adMPutb%Ju2@a4CdaHRH#lr#Ec%$1=kSr}?Dmv^8u# z(W+j|*LtYFkq4jIk?l$xw}E#iPqjUjwHPa@`w7ESuplwABd{kc-%gJo?pGeVyP+tn zcY1Mg#TD?8sq9&T4`QZRnxXnD=Q3X0d!7x?_}gSUSR`{<-f3bTD1?jvS17-5tiq1V zMKB=Y($c$#ti#RCXgzfSYw2Zvx8l*g1W!ckB>uAE}X}lA?X0RRmQZnk3=mIJ_ zZQH=jdC7w-LC`8<csH1V~%SVGQoE7yE)*2-KCY%Cc! z^ge39h*sRJNopj^Cp5+kQiNj-yh7oGa+E-LQ*DmqTaGXdG@zxBKY4gfk&aKTAF{j7 zzhsn$_^SGtHCN)kECbRtyOPb|9C9Yv+Ap15JMoi!2;YP^Grv984x4<;_D0?FnlUg# zlwVYtPEhJ7wV|gsD5r8#IsNW>FMkW{l5AB&$HtOulz^jcm@+0-@%7K#J%x(J2M?n0 z*2>W0u*3qM^yb*s6$)&X{iyEZmyj*n#LhxWE9jW{m4+YRZhiDAF&Gf=i75z(SQD}@ z;}7sn@IHj?F2w#|QiR}l$(+3b| z0rO6TS~_JQ30)JiBzyx}&Wcs~+T&Ky#2z_t9;>!!@>8=R$Y}ua5JN^{pVp(jGQP#gZ~0Pk5q~P From a0f2f518cfb389986af841916523be99fba3f761 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 26 Jul 2016 17:45:59 +0800 Subject: [PATCH 09/52] =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E4=BB=96=E4=BA=BA?= =?UTF-8?q?=E7=9A=84=E5=8D=9A=E5=AE=A2=E9=A6=96=E9=A1=B5=E4=B8=8D=E5=BA=94?= =?UTF-8?q?=E8=B7=B3=E5=88=B0=E8=87=AA=E5=B7=B1=E7=9A=84=E5=8D=9A=E5=AE=A2?= =?UTF-8?q?=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 ++ app/views/blog_comments/destroy.js.erb | 2 +- app/views/blogs/_homepage.html.erb | 2 +- app/views/users/_message_replies.html.erb | 4 ++-- app/views/users/_reply_to.html.erb | 2 +- app/views/users/all_journals.js.erb | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 45330b236..4efa05a1e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -133,6 +133,7 @@ class UsersController < ApplicationController @user_activity_id = params[:user_activity_id] @activity_id = params[:activity_id] @homepage = params[:homepage] + @user_id = params[:user_id] @type = 'BlogComment' when 'OrgDocumentComment' @reply = OrgDocumentComment.find params[:reply_id] @@ -3399,6 +3400,7 @@ class UsersController < ApplicationController @user_activity_id = params[:div_id].to_i if params[:div_id] @homepage = params[:homepage].to_i @type = 'BlogComment' + @user_id = obj.author_id comments = [] @journals = get_all_children(comments, obj) when 'HomeworkCommon' diff --git a/app/views/blog_comments/destroy.js.erb b/app/views/blog_comments/destroy.js.erb index c34986977..52ecbb925 100644 --- a/app/views/blog_comments/destroy.js.erb +++ b/app/views/blog_comments/destroy.js.erb @@ -1,5 +1,5 @@ <% if @in_user_homepage %> - <% homepage = BlogComment.find(User.current.blog.homepage_id) %> + <% homepage = BlogComment.find(@user.blog.homepage_id) %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/homepage', :locals => {:activity => @blog_comment, :user_activity_id => homepage.id}) %>"); <% else%> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @blog_comment,:user_activity_id =>@user_activity_id}) %>"); diff --git a/app/views/blogs/_homepage.html.erb b/app/views/blogs/_homepage.html.erb index a16547836..91a77203d 100644 --- a/app/views/blogs/_homepage.html.erb +++ b/app/views/blogs/_homepage.html.erb @@ -57,7 +57,7 @@ <% comments = get_all_children(all_comments, activity)[0..2] %> <% if count > 0 %>
    - <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1}%> + <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1, :user_id => activity.author_id}%>
    <% end %> diff --git a/app/views/users/_message_replies.html.erb b/app/views/users/_message_replies.html.erb index 9ef2d146d..994c5c64e 100644 --- a/app/views/users/_message_replies.html.erb +++ b/app/views/users/_message_replies.html.erb @@ -82,7 +82,7 @@ <%= link_to( l(:button_reply), - {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id, :homepage => homepage}, + {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id, :homepage => homepage, :user_id => user_id}, :remote => true, :method => 'get', :title => l(:button_reply)) if !comment.root.locked? %> @@ -91,7 +91,7 @@ <% if comment.author == User.current %> <%= link_to( l(:button_delete), - {:controller => 'blog_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id, :homepage => homepage}, + {:controller => 'blog_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id, :homepage => homepage, :user_id => user_id}, :method => :delete, :remote => true, :class => 'fr mr20', diff --git a/app/views/users/_reply_to.html.erb b/app/views/users/_reply_to.html.erb index 24c1ce77a..8752de30b 100644 --- a/app/views/users/_reply_to.html.erb +++ b/app/views/users/_reply_to.html.erb @@ -42,7 +42,7 @@

    <% end%> <% elsif @type == 'BlogComment' %> - <%= form_for('new_form', :url => {:controller => 'blog_comments',:action => 'reply', :id => reply.id, :blog_id => reply.blog.id, :user_id => User.current.id}, :method => "post", :remote => true) do |f| %> + <%= form_for('new_form', :url => {:controller => 'blog_comments',:action => 'reply', :id => reply.id, :blog_id => reply.blog.id, :user_id => @user_id}, :method => "post", :remote => true) do |f| %> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>@user_activity_id %> <%= hidden_field_tag 'parent_id', params[:parent_id], :value => reply.id %> diff --git a/app/views/users/all_journals.js.erb b/app/views/users/all_journals.js.erb index d43768f1e..a5fca2a60 100644 --- a/app/views/users/all_journals.js.erb +++ b/app/views/users/all_journals.js.erb @@ -5,7 +5,7 @@ $('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :part <% elsif params[:type] == 'Message' %> $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i,:is_course => @is_course, :is_board => @is_board}) %>'); <% elsif params[:type] == 'BlogComment' %> -$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i, :homepage => @homepage}) %>'); +$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i, :homepage => @homepage, :user_id => @user_id}) %>'); <% elsif params[:type] == 'OrgDocumentComment' %> $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>'); <% elsif params[:type] == 'News' || params[:type] == 'Issue' || params[:type] == 'Syllabus' %> From 76eca767287ddd6951b48ba437fe22a05377302e Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 27 Jul 2016 09:39:42 +0800 Subject: [PATCH 10/52] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=97=B6=E8=B5=84=E6=BA=90=E5=BA=93=E7=9A=84=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_homework_attachment.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index 669e7aa91..6051d8de9 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -70,7 +70,7 @@
    上传附件 - <%= link_to "资源库", user_ref_resource_search_user_path(User.current.id, :homework_id => container.id), :class => "FilesBtn fl mt3 mr15", :title => "请从资源库中选择文件作为作品的附件", :remote => true %> + <%= link_to "资源库", user_ref_resource_search_user_path(User.current.id, :homework_id => container.id), :class => "FilesBtn fl mt3 mr15", :title => "请从资源库中选择文件作为作业的附件", :remote => true %> <% if defined?(has_program) && has_program %>
    编程 From 4422bb1bc0828373b07fa12142a45ebb4f747745 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 27 Jul 2016 10:11:00 +0800 Subject: [PATCH 11/52] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E7=A7=81=E6=9C=89=E7=8F=AD=E7=BA=A7=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E8=AE=BF=E9=97=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_courses_list.html.erb | 4 +++- app/views/users/_syllabus_course_list.html.erb | 2 +- public/stylesheets/syllabus.css | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/views/users/_courses_list.html.erb b/app/views/users/_courses_list.html.erb index 29983bf34..9187008ee 100644 --- a/app/views/users/_courses_list.html.erb +++ b/app/views/users/_courses_list.html.erb @@ -1,11 +1,13 @@ <% unless courses.nil? %> <% courses.each_with_index do |course, i| %>
  • - + <% allow_visit = User.current.member_of_course?(course) || User.current.admin? || course.is_public == 1 %> + " target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问"%>">

    <%=course.name %>

    + <%=course.is_public == 0 ? '私有' : '公开' %>
    diff --git a/app/views/users/_syllabus_course_list.html.erb b/app/views/users/_syllabus_course_list.html.erb index 06dff2b49..993192978 100644 --- a/app/views/users/_syllabus_course_list.html.erb +++ b/app/views/users/_syllabus_course_list.html.erb @@ -11,7 +11,7 @@ <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fr", :remote => true %> <% end %> <%= link_to "时间", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fr", :remote => true %> - 我<%= list_type == 1 ? "创建" : "加入"%>的课程 + <%=@user == User.current ? "我" : "他" %><%= list_type == 1 ? "创建" : "加入"%>的课程
    diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index 3b856ad67..926c41525 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -110,7 +110,7 @@ input.syllabus_input_min{ .syllabus_class_list_more{padding:8px; text-align:center;border-left:1px solid #e7e7e7;border-bottom:1px solid #e7e7e7;} .syllabus_class_list_more:hover{ background:#ececec;} .syllabus_class_list_more a{ color:#ff7e00;} -.syllabus_class_title{ font-size:14px; color:#333; width:500px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } +.syllabus_class_title{ font-size:14px; color:#333; max-width:480px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .syllabus_class_w{ width:650px;} .dis {display:block;} .undis {display:none;} From aafe0aa4aee3e6b326b87232dd35c556f7908e82 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 27 Jul 2016 10:20:27 +0800 Subject: [PATCH 12/52] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E7=95=99=E8=A8=80=E6=97=B6=E5=B7=A6=E4=BE=A7=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=A0=8F=E7=9A=84=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 --- app/views/courses/_tool_expand.html.erb | 2 +- app/views/layouts/base_courses.html.erb | 4 ++-- app/views/words/destroy.js.erb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/courses/_tool_expand.html.erb b/app/views/courses/_tool_expand.html.erb index c41edf680..5f9e512d7 100644 --- a/app/views/courses/_tool_expand.html.erb +++ b/app/views/courses/_tool_expand.html.erb @@ -29,7 +29,7 @@ <% if show_nav?(course_feedback_count) %>
  • 留言 - <%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%> + <%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}"%>
  • <% end %> <% if show_nav?(course_poll_count) %> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 7a9f5ac5e..2972045aa 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -91,8 +91,8 @@ <% end %> <% unless show_nav?(course_feedback_count) %>
  • - 留言<%=course_feedback_count %> - <%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%> + 留言<%=course_feedback_count %> + <%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}"%>
  • <% end %> <% unless show_nav?(course_poll_count) %> diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index 76ec9e319..00be899cc 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -26,7 +26,7 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); sd_create_editor_from_data('<%= @user_activity_id%>', "", "100%", "UserActivity"); <% else %> - $('#course_jour_count').html("(<%= @jours_count %>)"); + $('#course_jour_count').html("<%= @jours_count %>"); <% end %> <% elsif @user && @jours_count%> $('#jour_count').html("<%= @jours_count %>"); From a1149c1104ba5decbe6f6e945eb3151f72420721 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 27 Jul 2016 14:07:16 +0800 Subject: [PATCH 13/52] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E5=85=AC=E5=BC=80=E7=A7=81=E6=9C=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_course_base_info.html.erb | 2 +- .../syllabuses/_syllabus_course_list.html.erb | 2 +- app/views/syllabuses/show.html.erb | 2 +- app/views/users/_courses_list.html.erb | 2 +- app/views/users/_user_blog.html.erb | 2 +- public/images/sy/icons_sy.png | Bin 26008 -> 27375 bytes public/stylesheets/syllabus.css | 21 ++++++++++++++++++ 7 files changed, 26 insertions(+), 5 deletions(-) diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb index d364f84e1..8994dab10 100644 --- a/app/views/layouts/_course_base_info.html.erb +++ b/app/views/layouts/_course_base_info.html.erb @@ -41,7 +41,7 @@

    <%=@course.name %>

    - <%=@course.is_public == 0 ? '私有' : '公开' %> +

    教师:<%= course_teacher_link teacher_num %> 学生:<%= course_student_link student_num %> diff --git a/app/views/syllabuses/_syllabus_course_list.html.erb b/app/views/syllabuses/_syllabus_course_list.html.erb index cdb566412..4384ba2ee 100644 --- a/app/views/syllabuses/_syllabus_course_list.html.erb +++ b/app/views/syllabuses/_syllabus_course_list.html.erb @@ -24,7 +24,7 @@ <%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "sy_classlist_title fl", :style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+"("+current_time_and_term(course)+")"%> <% end %> - <%=course.is_public? ? '公开' : '私有' %> +

    主讲老师:<%=link_to course.teacher.show_name, user_path(course.teacher), :class => 'sy_cblue' %> diff --git a/app/views/syllabuses/show.html.erb b/app/views/syllabuses/show.html.erb index 062b9aeb4..e39d538ce 100644 --- a/app/views/syllabuses/show.html.erb +++ b/app/views/syllabuses/show.html.erb @@ -53,7 +53,7 @@ <% comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3) %> <% if count > 0 %>

    - <%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'Syllabus'} %> + <%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'Syllabus', :activity_id => @syllabus.id} %>
    <% end %>
    diff --git a/app/views/users/_courses_list.html.erb b/app/views/users/_courses_list.html.erb index 9187008ee..1abe77b81 100644 --- a/app/views/users/_courses_list.html.erb +++ b/app/views/users/_courses_list.html.erb @@ -7,7 +7,7 @@

    <%=course.name %>

    - <%=course.is_public == 0 ? '私有' : '公开' %> +
    diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index b6cd9ebc3..5361a37ad 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -50,7 +50,7 @@ <% comments = get_all_children(all_comments, activity)[0..2] %> <% if count > 0 %>
    - <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 0}%> + <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 0, :user_id => activity.author_id}%>
    <% end %> diff --git a/public/images/sy/icons_sy.png b/public/images/sy/icons_sy.png index 09cdd32cbcc3bab0db48f1a836702db4bb94b0a6..645dc4e35f263393b16d105b32d4c982aa838a27 100644 GIT binary patch delta 6461 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 delta 5084 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 diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index 926c41525..6978e1c55 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -403,6 +403,27 @@ a.postOptionLink:hover { padding-left:10px; line-height: 22px; } +.hw_icon_private{ + display:block; + width:30px; + height:22px; + background:url(../images/sy/icons_sy.png) 0 -458px no-repeat; + color:#fff; + font-size:12px; + padding-left:10px; + line-height: 22px; +} +.hw_icon_open{ + display:block; + width:30px; + height:22px; + background:url(../images/sy/icons_sy.png) 0 -436px no-repeat; + color:#fff; + font-size:12px; + padding-left:10px; + line-height: 22px; +} + .sy_class_titbox{margin-bottom:5px; padding-top:10px; } a.sy_btn_orange{ display:block; From 52475099dcea28595e3a57a9c666ba750ca259c8 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 27 Jul 2016 14:36:46 +0800 Subject: [PATCH 14/52] =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E8=AE=BE=E4=B8=BA?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E5=90=8E=EF=BC=8C=E6=96=87=E5=AD=97=E6=95=B4?= =?UTF-8?q?=E4=B8=AA=E5=AE=B9=E5=99=A8=E5=AE=BD=E5=BA=A6=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=EF=BC=9B=E7=8F=AD=E7=BA=A7=E9=85=8D=E7=BD=AE=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E8=8F=9C=E5=8D=95css=E5=86=B2=E7=AA=81=E5=A4=84=E7=90=86?= =?UTF-8?q?=EF=BC=9B=E5=A4=A7=E7=BA=B2=E6=A0=B7=E5=BC=8F=E5=86=B2=E7=AA=81?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blogs/_homepage.html.erb | 3 -- app/views/layouts/_course_base_info.html.erb | 14 ++++---- public/stylesheets/css/common.css | 5 ++- public/stylesheets/css/courses.css | 2 -- public/stylesheets/css/org.css | 2 -- public/stylesheets/css/public.css | 7 ++-- public/stylesheets/css/structure.css | 5 ++- public/stylesheets/sy_public.css | 1 - public/stylesheets/syllabus.css | 38 +++++--------------- 9 files changed, 24 insertions(+), 53 deletions(-) diff --git a/app/views/blogs/_homepage.html.erb b/app/views/blogs/_homepage.html.erb index a16547836..ea83b9576 100644 --- a/app/views/blogs/_homepage.html.erb +++ b/app/views/blogs/_homepage.html.erb @@ -1,6 +1,5 @@
    -
    <% if activity.author.id == User.current.id%> <%end%> -
    <% all_comments = []%> diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb index 06e24e0c2..761b79297 100644 --- a/app/views/layouts/_course_base_info.html.erb +++ b/app/views/layouts/_course_base_info.html.erb @@ -11,15 +11,15 @@

    <% if is_teacher %> -
    +
      -
    • -
        -
      • <%= link_to "班级配置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "postOptionLink" %>
      • -
      • <%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "postOptionLink" %>
      • -
      • <%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "postOptionLink" %>
      • +
      • +
          +
        • <%= link_to "班级配置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "sy_class_option" %>
        • +
        • <%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "sy_class_option" %>
        • +
        • <%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "sy_class_option" %>
        • <% if @course.syllabus %> -
        • <%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "postOptionLink", :target => "_blank" %>
        • +
        • <%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "sy_class_option", :target => "_blank" %>
        • <% end %>
      • diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index b72a8ef56..07e824d40 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -51,6 +51,10 @@ a.btn_message_free{ background:#ff5722; display:block; text-align:center; color .break_word{word-break: break-all;word-wrap: break-word;} .break_word_firefox{white-space: pre-wrap !important;word-break: break-all;} +/*显隐*/ +.undis {display:none;} +.dis {display:inline-block;} + /* font & color */ h2{ font-size:18px;} /*color:#269ac9;*/ h3{ font-size:14px;}/* color:#e8770d;*/ @@ -520,7 +524,6 @@ a:hover.bgreen_n_btn{background:#08a384;} .upbtn{ margin:40px 0 0 15px; display:block; padding:2px 5px; border:1px solid #eaeaea;} .upbtn:hover{color:#64bdd9;cursor: pointer;} .upload_file{margin-left: -60px;margin-top: 40px;width: 50px;position: absolute;height: 24px;opacity: 0;cursor: pointer} -.undis{display:none;} .red_btn_cir{ background:#e74c3c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;white-space:nowrap;} .green_btn_cir{ background:#28be6c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;white-space:nowrap;} .green_homework_btn_cir{ background:#28be6c; padding:1px 3px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;white-space:nowrap;} diff --git a/public/stylesheets/css/courses.css b/public/stylesheets/css/courses.css index ccf161725..a5bb95fa1 100644 --- a/public/stylesheets/css/courses.css +++ b/public/stylesheets/css/courses.css @@ -54,8 +54,6 @@ a:hover.UsersApBtn{border:1px solid #888888; } /* 代码查重弹框 */ a.Blue-btn{ display:block; margin-right:15px;width:65px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} a:hover.Blue-btn{ background:#3598db; color:#fff;} -.fl{ float:left;} -.fr{ float:right;} .blue-border-box{ width:500px; padding:20px; margin:0 auto; background:#fff;} .box-con h4{ font-size:14px; font-weight: bold; width:450px; text-align:center;} .box-con{ width:450px; margin:0 auto; text-align:center;} diff --git a/public/stylesheets/css/org.css b/public/stylesheets/css/org.css index 028254e04..3677c8bd8 100644 --- a/public/stylesheets/css/org.css +++ b/public/stylesheets/css/org.css @@ -27,8 +27,6 @@ a.saveBtn:hover {background-color:#297fb8;} .orgMemContainer {width:268px;} .orgMemberAdd {float:right;} .orgAddSearch {border:1px solid #dddddd; outline:none; width:180px; height:22px; color:#9b9b9b;} -.undis {display:none;} -.dis {display:inline-block;} a.org_member_btn{ padding:1px 5px; background:#15bccf; color:#fff;} diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index 82e27aa1f..51f9831b4 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -471,8 +471,6 @@ a:hover.AnnexBtn{background: url(../images/homepage_icon2.png) -90px -343px no-r a.postRouteLink {font-weight:bold; color:#484848;} a.postRouteLink:hover {text-decoration:underline;} -.homepagePostSetting {position:absolute; width:20px; height:20px; right:0px; top:0px;} -.homepagePostSetting ul li:hover ul {display:block;} .resourceSendO {width:65px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-48px; top:20px; padding:2px 0px; display:none;} .ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;} @@ -499,7 +497,6 @@ ul.wlist li a:hover{ background:#15bccf; color:#fff; text-decoration:none;} .wlist_select a{background-color: #64bdd9;cursor: default;} /*博客列表界面样式*/ -a{text-decoration:none} .listbox{ width:730px; background-color:#fff; border:1px solid #ddd; padding:10px; } /*.bloglistbox{ min-height:690px;}*/ .list-h2{ font-size:16px; font-weight:bold; color:#000; padding-bottom:5px;} @@ -543,8 +540,6 @@ a:hover.st_img { border:1px solid #1c9ec7; } .searchCourseImage {width:75px; margin-right:10px;} .searchContentDes {width:883px;} .searchTag {font-size:12px; color:#ffffff; background-color:#7ec8e4; height:16px; min-height:16px; max-height:16px; float:left; line-height:16px; padding:0px 3px;} -.undis {display:none;} -.dis {display:inline-block;} .numRed {color:#FF6600;} .pageRoll {float:right; border-left:1px solid #dddddd; margin-top:15px;} .pageCell {border:1px solid #dddddd; padding:5px 12px; float:left; margin-left:-1px; position:relative;} @@ -977,6 +972,8 @@ a:hover.pr_join_a{ background:#298fbd;} .lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;} /****标签(和资源库的tag样式一致)***/ .project_Label{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; margin-bottom:10px;} +/*.project_Label{ width:218px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; margin-bottom:10px; border:1px solid #dddddd;}*/ +.project_Label_New {width:218px; padding-left:10px; background:#fff; margin-top:15px; margin-bottom:10px;} a.yellowBtn{ display:inline-block;color:#0d90c3; height:22px;} .submit{height:21px;border:0; cursor:pointer; background:url(../images/btn.png) no-repeat 0 0;width:42px; margin-top:2px; margin-left:3px; } .isTxt{background:#fbfbfb url(../images/inputBg.png) repeat-x left top;height:22px;line-height:22px;border:1px solid #c1c1c1;padding:0 5px;color:#666666;} diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css index be8bbc65b..5993d824d 100644 --- a/public/stylesheets/css/structure.css +++ b/public/stylesheets/css/structure.css @@ -239,9 +239,9 @@ a.postReplyCancel:hover {color:#ffffff;} .whiteSettingIcon {background:url(/images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;} .whiteSettingIcon:hover {background:url(/images/homepage_icon.png) -93px -44px no-repeat;} a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;text-align:center;} -a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;} +a.postOptionLink:hover {color:#ffffff; background-color:#3b94d6;} a.postOptionLink2 {color:#616060; display:block; width:35px; padding:0px 15px;} -a.postOptionLink2:hover {color:#ffffff; background-color:#269ac9;} +a.postOptionLink2:hover {color:#ffffff; background-color:#3b94d6;} .homepagePostReplyPortrait {float:left; width:33px;} .imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;} .homepagePostReplyDes {float:left; width:642px; margin-left:15px;} @@ -337,7 +337,6 @@ a.projectsLineGrey:hover {color:#ffffff;} a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;} a.homepageMenuControl {float:left; width:180px;} .homepageLeftLabelContainer {width:238px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px;} -.project_Label_New {width:218px; padding-left:10px; background:#fff; margin-top:15px; margin-bottom:10px;} .homepageLabelText {color:#484848; font-size:16px; margin-left:10px; margin-bottom:12px; display:block;} .homepageRightBanner {width:718px; margin:0px auto; float:right; background-color: #ffffff; padding:10px 15px; border:1px solid #dddddd;} .homepageRightBannerImg{width:1000px; margin:0px auto; height: 60px; margin-top: 10px; background:url(/images/TeachersDay.jpg)} diff --git a/public/stylesheets/sy_public.css b/public/stylesheets/sy_public.css index 7c79bf6e6..f31737bfc 100644 --- a/public/stylesheets/sy_public.css +++ b/public/stylesheets/sy_public.css @@ -140,7 +140,6 @@ a.pages-big{ } .pages{ width:330px; - margin:20px auto 10px; } /* 输入框 */ diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index 3b856ad67..848f874d1 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -1,13 +1,3 @@ -/****标签(和资源库的tag样式一致)***/ -.project_Label{ width:218px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; margin-bottom:10px; border:1px solid #dddddd;} -.project_Label_New {width:218px; padding-left:10px; background:#fff; margin-top:15px; margin-bottom:10px;} -a.yellowBtn{ display:inline-block;color:#0d90c3; height:22px;} -.submit{height:21px;border:0; cursor:pointer; background:url(../images/btn.png) no-repeat 0 0;width:42px; margin-top:2px; margin-left:3px; } -.isTxt{background:#fbfbfb url(../images/inputBg.png) repeat-x left top;height:22px;line-height:22px;border:1px solid #c1c1c1;padding:0 5px;color:#666666;} -.re_tag{ width: auto; padding:0 5px; padding-top:2px; border:1px solid #f8df8c; background:#fffce6; margin-right:5px; } -.re_tag a{ color:#0d90c3;} -.tag_h{ } -.tag_h span,.tag_h a{ margin-bottom:5px;} /*信息*/ .project_info{ background:#fff; padding:10px 8px; width:222px; margin-bottom:10px; border:1px solid #dddddd;} .pr_info_id{ width:130px; color:#5a5a5a; font-size:14px; margin-top:5px;} @@ -112,14 +102,11 @@ input.syllabus_input_min{ .syllabus_class_list_more a{ color:#ff7e00;} .syllabus_class_title{ font-size:14px; color:#333; width:500px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .syllabus_class_w{ width:650px;} -.dis {display:block;} -.undis {display:none;} /*班级列表界面(用的博客列表的样式)*/ .listbox{ width:730px; background-color:#fff; border:1px solid #ddd; padding:10px; } .bloglistbox{ min-height:690px;} .list-h2{ font-size:16px; font-weight:bold; color:#000; padding-bottom:5px;} -.category2{ } .list_title{padding:10px 0; border-bottom:1px solid #ddd;} .category2 a,.category2 span{ float:left; margin-right:5px;} .grayTxt{ color:#9093a6;} @@ -131,7 +118,6 @@ a.sort_no{ background: url(../images/syllabus/icons_syllabus.png) -16px -12px no .item_list{ display:block; width:5px; height:5px;-webkit-border-radius: 25px;border-radius:25px; background-color:#adadad; margin:10px 10px 0 0;} a.list-title{ font-size:14px; font-weight: bold; color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block;} a:hover.list-title{ color:#269ac9;} -.c_red{ font-weight:normal; font-size:12px;} .list-file{ padding:10px 0; border-bottom:1px dashed #ddd;} .list-file li{ line-height:1.9;} .list-info span{ margin-left:5px;} @@ -208,12 +194,6 @@ a:hover.course-title{ color:#269ac9;} .sy_tab_nomal { border-bottom:none; } -.undis { - display:none; -} -.dis { - display:block; -} /* 课程大纲 */ .icons_tishi{ width: 110px; @@ -324,22 +304,22 @@ a:hover.sy_teachers_name{ border:1px solid #e5e5e5; position: relative; } -.homepagePostSetting { +.sy_class_setting { position:absolute; width:20px; height:20px; right:10px; top:10px; } -.homepagePostSetting ul li:hover ul { +.sy_class_setting ul li:hover ul { display:block; } -.homepagePostSettingIcon { - background:url(../images/sy/icons_sy.png) 1px -408px no-repeat; +.sy_class_setting_icon { + background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px; } -.homepagePostSettiongText { +.sy_class_setting_text { width:75px; text-align: center; line-height:2; @@ -355,16 +335,16 @@ a:hover.sy_teachers_name{ display:none; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); } -.homepagePostSettingIcon:hover { - background:url(../images/sy/icons_sy.png) -28px -408px no-repeat; +.sy_class_setting_icon:hover { + background:url(../images/homepage_icon.png) -93px -44px no-repeat; } -a.postOptionLink { +a.sy_class_option { color:#616060; display:block; width:55px; padding:0px 10px; } -a.postOptionLink:hover { +a.sy_class_option:hover { color:#fff; background-color:#3b94d6; } From b1f69140c73737bcc53462ff9e5cc1d063de8072 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 27 Jul 2016 14:47:13 +0800 Subject: [PATCH 15/52] =?UTF-8?q?issue=E7=94=A8=E6=88=B7=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=EF=BC=8Cissue=E9=93=BE=E6=8E=A5=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_project_file_links.html.erb | 2 +- app/views/issues/_detail.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/attachments/_project_file_links.html.erb b/app/views/attachments/_project_file_links.html.erb index 0f7e8a012..759a9a735 100644 --- a/app/views/attachments/_project_file_links.html.erb +++ b/app/views/attachments/_project_file_links.html.erb @@ -92,7 +92,7 @@ <% end %> <% if options[:author] %> - <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>, + <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "link-blue" %>, <%= format_time(attachment.created_on) %> <% end %> diff --git a/app/views/issues/_detail.html.erb b/app/views/issues/_detail.html.erb index ec9a0bc54..ac912a71c 100644 --- a/app/views/issues/_detail.html.erb +++ b/app/views/issues/_detail.html.erb @@ -20,7 +20,7 @@ <%= get_issue_priority(@issue.priority_id)[1] %>


        - 由<%= @issue.author %>添加于 <%= format_time(@issue.created_on).html_safe %> + 由<%=link_to @issue.author, user_path(@issue.author), :class => "link-blue" %>添加于 <%= format_time(@issue.created_on).html_safe %>
    From 9d7fa86cb6cf3a26d2979d047a0e820ca1aa8081 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 27 Jul 2016 16:33:27 +0800 Subject: [PATCH 16/52] =?UTF-8?q?syllabus.css=E6=A0=B7=E5=BC=8F=E9=87=8D?= =?UTF-8?q?=E7=94=A8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/css/courses.css | 4 ---- public/stylesheets/css/public.css | 20 ++++++++++++++----- public/stylesheets/sy_public.css | 16 +-------------- public/stylesheets/syllabus.css | 31 ------------------------------ 4 files changed, 16 insertions(+), 55 deletions(-) diff --git a/public/stylesheets/css/courses.css b/public/stylesheets/css/courses.css index a5bb95fa1..7a1a0dabb 100644 --- a/public/stylesheets/css/courses.css +++ b/public/stylesheets/css/courses.css @@ -136,10 +136,6 @@ span.author { font-size: 0.9em; color: #888; } .ReplyToMessageInputContainer {width: 582px;float: left;} .ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;} -/*课程列表界面样式*/ -a.course-title{ font-size:14px; font-weight: bold; color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; width:590px;} -a:hover.course-title{ color:#269ac9;} - /*我的课程*/ .courses_top{ height:27px; border-bottom:3px solid #ebebeb;} .courses_h2{ font-size:16px; font-weight:bold; color:#64bddb; border-bottom:3px solid #64bddb; padding-bottom:3px; padding-right:3px;} diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css index 51f9831b4..a16bbce5b 100644 --- a/public/stylesheets/css/public.css +++ b/public/stylesheets/css/public.css @@ -514,11 +514,21 @@ a:hover.list-title{ color:#269ac9;} .list-file{ padding:10px 0; border-bottom:1px dashed #ddd;} .list-file li{ line-height:1.9;} .list-info span{ margin-left:5px;} -.pages a{ display:block; border:1px solid #d1d1d1; color:#000; float:left; width:30px; text-align:center; padding:3px 0; line-height:1.9; margin-right:5px; } -.pages a:hover{ background-color:#269ac9; color:#fff;} +.pages a{ display:block; border:1px solid #d1d1d1; color:#888; float:left; width:30px; text-align:center; padding:3px 0; line-height:1.9; margin-right:5px; } +.pages a:hover{ background-color:#3b94d6; border:1px solid #3b94d6; color:#fff;} a.pages-big{ width:50px;} -.pages .active{ background-color:#269ac9; color:#fff;} +.pages .active{ background-color:#3b94d6; border:1px solid #3b94d6; color:#fff;} .pages{width:330px; margin:20px auto 10px;} + /*20160727大纲新增样式*/ +.list_title{padding:10px 0; border-bottom:1px solid #ddd;} +.sortTxt{ color:#000;} +.sortTxt:hover{ color:#28be6c;} +a.sort_no{ background: url(/images/syllabus/icons_syllabus.png) -16px -12px no-repeat; width:12px; height:17px; display:block;cursor:pointer; } +a.list-title{ font-size:14px; font-weight: bold; color:#000; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block;} + +/*课程列表界面样式*/ +a.course-title{ font-size:14px; font-weight: bold; color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; width:590px;} +a:hover.course-title{ color:#269ac9;} /*视频播放默认图标*/ .mediaIco{margin: 30px 0 30px 20px;width: 200px;} @@ -933,10 +943,10 @@ a:hover.member_btn{ background:#329cbd;} .search_form_course{margin-top:8px;margin-left:8px;} /*信息*/ -.project_info{ background:#fff; padding:10px; padding-right:0px;width:222px; padding-right:8px; margin-bottom:10px;} +.project_info{ background:#fff; padding:10px 8px; width:224px; margin-bottom:10px;} .pr_info_id{ width:137px; color:#5a5a5a; font-size:14px; margin-top:5px;} .pr_info_logo{ border:1px solid #eaeaea; width:60px; height:60px; padding:1px;} -.pr_info_logo:hover{ border:1px solid #64bdd9; } +.pr_info_logo:hover{ border:1px solid #297fb8; } .pr_info_join{} a.pr_join_a{ color:#fff; display:block; padding:0 5px 0 3px; padding-top:2px; height:20px; margin-right:5px; float:left; text-align:center; background-color:#269ac9; float:left; } a.pr_join_a_quit{ color:#fff; display:block; padding:0 2px 0 3px; padding-top:2px; height:20px; margin-right:5px; float:left; text-align:center; background-color:#269ac9; float:left; } diff --git a/public/stylesheets/sy_public.css b/public/stylesheets/sy_public.css index f31737bfc..26a229fb7 100644 --- a/public/stylesheets/sy_public.css +++ b/public/stylesheets/sy_public.css @@ -98,21 +98,7 @@ a:hover.sy_btn_blue{ background: #2788d0;} border-bottom:1px solid #ddd; } .sy_category span{ float: left;} -a.sortupbtn{ - background: url(../images/sy/liststyle.png) 0 3px no-repeat; - width:12px; - height:17px; - display:block; - margin-right:10px; - cursor:pointer; -} -a.sortdownbtn{ - background: url(../images/sy/liststyle.png) 0 -12px no-repeat; - width:12px; - height:17px; - display:block; - cursor:pointer; -} + /* 翻页 */ .pages a{ display:block; diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index 848f874d1..08cd55e3d 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -1,9 +1,3 @@ -/*信息*/ -.project_info{ background:#fff; padding:10px 8px; width:222px; margin-bottom:10px; border:1px solid #dddddd;} -.pr_info_id{ width:130px; color:#5a5a5a; font-size:14px; margin-top:5px;} -.pr_info_logo{ border:1px solid #eaeaea; width:60px; height:60px; padding:1px;} -.pr_info_logo:hover{ border:1px solid #297fb8; } - /*课程大纲*/ input.syllabus_input{ border:none; @@ -103,31 +97,6 @@ input.syllabus_input_min{ .syllabus_class_title{ font-size:14px; color:#333; width:500px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .syllabus_class_w{ width:650px;} -/*班级列表界面(用的博客列表的样式)*/ -.listbox{ width:730px; background-color:#fff; border:1px solid #ddd; padding:10px; } -.bloglistbox{ min-height:690px;} -.list-h2{ font-size:16px; font-weight:bold; color:#000; padding-bottom:5px;} -.list_title{padding:10px 0; border-bottom:1px solid #ddd;} -.category2 a,.category2 span{ float:left; margin-right:5px;} -.grayTxt{ color:#9093a6;} -.sortTxt{ color:#000;} -.sortTxt:hover{ color:#28be6c;} -a.sortupbtn{ background: url(../images/syllabus/icons_syllabus.png) 0 3px no-repeat; width:12px; height:17px; display:block; margin-right:10px; cursor:pointer;} -a.sortdownbtn{ background: url(../images/syllabus/icons_syllabus.png) 0 -12px no-repeat; width:12px; height:17px; display:block;cursor:pointer; } -a.sort_no{ background: url(../images/syllabus/icons_syllabus.png) -16px -12px no-repeat; width:12px; height:17px; display:block;cursor:pointer; } -.item_list{ display:block; width:5px; height:5px;-webkit-border-radius: 25px;border-radius:25px; background-color:#adadad; margin:10px 10px 0 0;} -a.list-title{ font-size:14px; font-weight: bold; color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block;} -a:hover.list-title{ color:#269ac9;} -.list-file{ padding:10px 0; border-bottom:1px dashed #ddd;} -.list-file li{ line-height:1.9;} -.list-info span{ margin-left:5px;} -.pages a{ display:block; border:1px solid #d1d1d1; color:#888; float:left; width:30px; text-align:center; padding:3px 0; line-height:1.9; margin-right:5px; } -.pages a:hover{ background-color:#3b94d6; border:1px solid #3b94d6; color:#fff;} -a.pages-big{ width:50px;} -.pages .active{ background-color:#3b94d6; border:1px solid #3b94d6; color:#fff;} -.pages{width:330px; margin:20px auto 10px;} -a.course-title{ font-size:14px; font-weight: bold; color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; width:590px;} -a:hover.course-title{ color:#269ac9;} /*新建页面*/ .name_input{ border:1px solid #64bdd9; height:16px; width:310px; background:#fff; margin-bottom:10px; padding:5px;} From 0dfc887f74125e358fdc6cbf1385a5cfd40b28e6 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 27 Jul 2016 16:43:27 +0800 Subject: [PATCH 17/52] =?UTF-8?q?=E5=A4=8D=E5=88=B6=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E4=B8=AD=E8=B5=84=E6=BA=90=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_copy_course.html.erb | 2 +- ...20160727065357_add_column_to_member_role.rb | 16 ++++++++++++++++ db/schema.rb | 18 +++++++++++++++--- 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20160727065357_add_column_to_member_role.rb diff --git a/app/views/courses/_copy_course.html.erb b/app/views/courses/_copy_course.html.erb index 55217017b..9f45172bc 100644 --- a/app/views/courses/_copy_course.html.erb +++ b/app/views/courses/_copy_course.html.erb @@ -114,7 +114,7 @@ - 复制到新班级的资源将在1个月后发布,请您调整资源的发布时间,否则学生可能看不到资源。 + 复制到新班级的资源将在1个月后发布,请您调整资源的发布时间,否则学生将看不到资源。 - <%= join_in_project_link(@project, User.current) %> + + <%= join_in_project_link(@project, User.current) %> + <% end %> <% if User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) %> diff --git a/app/views/users/_user_message_applied.html.erb b/app/views/users/_user_message_applied.html.erb index dc3e51b4d..efd2bf8da 100644 --- a/app/views/users/_user_message_applied.html.erb +++ b/app/views/users/_user_message_applied.html.erb @@ -14,5 +14,22 @@
  • <%= time_tag(ma.created_at).html_safe %>
  • + <% elsif ma && ma.applied_type == "AppliedProject" %> + <% end %> <% end %> \ No newline at end of file diff --git a/db/migrate/20160728075947_add_role_to_applied_project.rb b/db/migrate/20160728075947_add_role_to_applied_project.rb new file mode 100644 index 000000000..964af6f19 --- /dev/null +++ b/db/migrate/20160728075947_add_role_to_applied_project.rb @@ -0,0 +1,5 @@ +class AddRoleToAppliedProject < ActiveRecord::Migration + def change + add_column :applied_projects, :role, :integer, :default => 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 123d474f4..4747a74e3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160728041943) do +ActiveRecord::Schema.define(:version => 20160728075947) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -85,8 +85,9 @@ ActiveRecord::Schema.define(:version => 20160728041943) do end create_table "applied_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.integer "role", :default => 0 end create_table "apply_add_schools", :force => true do |t| From 848c56d54ef985a1e747d3e89b7de373a1530b59 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jul 2016 14:34:42 +0800 Subject: [PATCH 22/52] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E8=BA=AB=E4=BB=BD=E5=88=87=E6=8D=A2=E3=80=81=E6=88=90=E5=91=98?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=A4=9A=E9=87=8D?= =?UTF-8?q?=E8=BA=AB=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 15 ++++++++ app/controllers/members_controller.rb | 11 ++++-- app/helpers/courses_helper.rb | 25 ++++++++++-- app/models/member.rb | 10 ++++- app/models/member_role.rb | 1 + app/models/user.rb | 8 +++- app/views/courses/_course_members.html.erb | 36 +++++++++++++++++- app/views/courses/_member.html.erb | 38 ++++++++++++++++++- app/views/layouts/_course_base_info.html.erb | 11 +++++- config/routes.rb | 1 + ...0160727065357_add_column_to_member_role.rb | 13 +------ db/schema.rb | 2 +- 12 files changed, 144 insertions(+), 27 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 21dac6ada..8fa46bda5 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1133,6 +1133,21 @@ class CoursesController < ApplicationController end end + #切换身份 + def switch_role + members = @course.members.where("user_id = #{params[:user_id]}") + unless members.blank? + #role = MemberRole.where("member_id = #{members.first.id} and role_id = #{params[:role]}").first + curr_role = MemberRole.find_by_member_id_and_role_id(members.first.id, params[:curr_role]) + tar_role = MemberRole.find_by_member_id_and_role_id(members.first.id, params[:tar_role]) + unless (curr_role.nil? || tar_role.nil?) + curr_role.update_column('is_current', 0) + tar_role.update_column('is_current', 1) + end + end + redirect_to course_path(@course) + end + private def update_quotes attachment if attachment.copy_from diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 4dc2c52f5..9c6f606f6 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -154,9 +154,11 @@ class MembersController < ApplicationController user_ids = attrs.delete(:user_ids) user_ids.each do |user_id| member = Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id) - role = Role.find_by_id(params[:membership][:role_ids]) + + role_ids = attrs.delete(:role_ids) + #role = Role.find(params[:membership][:role_ids]) # 这里的判断只能通过角色名,可以弄成常量 - if role && (role.name == "学生" || role.name == "Student") + if role_ids && !role_ids.include?("9") && role_ids.include?("10") StudentsForCourse.create(:student_id => user_id, :course_id =>@course.id) end @@ -252,7 +254,10 @@ class MembersController < ApplicationController if (params[:membership][:role_ids]) role = Role.find(params[:membership][:role_ids][0]) # 这里的判断只能通过角色名,可以弄成常量 - if role.name == "学生" || role.name == "Student" + attrs = params[:membership].dup + role_ids = attrs.delete(:role_ids) + + if role_ids && !role_ids.include?("9") && role_ids.include?("10") StudentsForCourse.create(:student_id => @member.user_id, :course_id =>@course.id) else joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 42511f218..46ad4bb1c 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -274,14 +274,19 @@ module CoursesHelper #searchPeopleByRoles(project, TeacherRoles) members = [] project.members.includes(:user).each do |m| - members << m if m && m.user && m.user.allowed_to?(:as_teacher,project) + #members << m if m && m.user && m.user.allowed_to?(:as_teacher,project) + members << m if m && m.user && m.user.has_teacher_role(project) end members end def TeacherAndAssistantCount course - students_count = course.student.count - number = course.members.count - students_count + #students_count = course.student.count + #number = course.members.count - students_count + member_ids = course.members.includes(:user).blank? ? "(-1)" : "(" + course.members.includes(:user).map { |mem| mem.id}.join(",") + ")" + role_ids = "(3, 7, 9)" + number = MemberRole.where("member_id in #{member_ids} and role_id in #{role_ids}").count + #number = (searchTeacherAndAssistant course).count end def search_student_in_group(project, course_group_id) @@ -811,6 +816,10 @@ module CoursesHelper result = l(:label_student) elsif role == "Manager" result = l(:field_admin) + elsif role.include?("TeachingAsistant") && role.include?("Student") + result = l(:label_TA) + " " + l(:label_student) + elsif role.include?("Teacher") && role.include?("Student") + result = l(:label_teacher) + " " + l(:label_student) end result end @@ -894,5 +903,15 @@ module CoursesHelper resource_num*5 + journal_num + homework_journal_num ) desc limit 3;") end + #用户在该课程是否具有某个角色 + def get_user_member_roles_course course, user, role + members = course.members.where("user_id = #{user.id}") + result = false + unless members.blank? + m_roles = MemberRole.where("member_id = #{members.first.id} and role_id = #{role}") + end + result = !m_roles.blank? + result + end end diff --git a/app/models/member.rb b/app/models/member.rb index 3cb70a8fe..cb15e067b 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -53,7 +53,15 @@ class Member < ActiveRecord::Base new_role_ids = ids - role_ids # Add new roles - new_role_ids.each {|id| member_roles << MemberRole.new(:role_id => id) } + if new_role_ids.include?(7) && new_role_ids.include?(10) + member_roles << MemberRole.new(:role_id => 7) + member_roles << MemberRole.new(:role_id => 10, :is_current => 0) + elsif new_role_ids.include?(9) && new_role_ids.include?(10) + member_roles << MemberRole.new(:role_id => 9) + member_roles << MemberRole.new(:role_id => 10, :is_current => 0) + else + new_role_ids.each {|id| member_roles << MemberRole.new(:role_id => id) } + end # Remove roles (Rails' #role_ids= will not trigger MemberRole#on_destroy) member_roles_to_destroy = member_roles.select {|mr| !ids.include?(mr.role_id)} if member_roles_to_destroy.any? diff --git a/app/models/member_role.rb b/app/models/member_role.rb index 4d493cb27..799720833 100644 --- a/app/models/member_role.rb +++ b/app/models/member_role.rb @@ -16,6 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class MemberRole < ActiveRecord::Base + # multi_role 课程中的多重角色 0:单角色/学生,1:管理员&学生,2:教师&学生,3:教辅&学生 belongs_to :member belongs_to :role diff --git a/app/models/user.rb b/app/models/user.rb index 996aa9be7..afd45e08b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -823,7 +823,7 @@ class User < Principal # Find course membership membership = coursemembership(course) if membership - roles = membership.roles + roles = membership.roles.where("is_current = 1") else @role_non_member ||= Role.non_member roles << @role_non_member @@ -918,6 +918,12 @@ class User < Principal end end + #是否具有老师角色 + def has_teacher_role(course) + member = course.members.where("user_id = #{self.id}").first + role = MemberRole.where("member_id = #{member.id} and role_id in (3, 7, 9)") + !role.blank? + end # Return true if the user is allowed to do the specified action on a specific context # Action can be: diff --git a/app/views/courses/_course_members.html.erb b/app/views/courses/_course_members.html.erb index 9f15405dc..563cbfff3 100644 --- a/app/views/courses/_course_members.html.erb +++ b/app/views/courses/_course_members.html.erb @@ -36,7 +36,7 @@ <% @roles.each do |role| %>
  • - <%= radio_button_tag 'membership[role_ids][]', role.id, role.name == "学生" || role.name == "Student" %> + <%= check_box_tag 'membership[role_ids][]', role.id, role.name == "学生" || role.name == "Student", :id => "add_member_checkbox_#{role.id}" %>
  • <% end %> @@ -47,4 +47,36 @@
    <% end%> -
    \ No newline at end of file +
    + + \ No newline at end of file diff --git a/app/views/courses/_member.html.erb b/app/views/courses/_member.html.erb index 1bfe3cbd7..f23a74063 100644 --- a/app/views/courses/_member.html.erb +++ b/app/views/courses/_member.html.erb @@ -10,7 +10,7 @@ ) do |f| %> <% @roles.each do |role| %>
      - <%= radio_button_tag 'membership[role_ids][]', role.id, member.roles.include?(role), + <%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role), :id => "edit_member_role_#{member.id}_#{role.id}", :disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
    @@ -35,4 +35,38 @@ :data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {confirm: l(:label_delete_confirm)}) if member.deletable? %> <% end%> -<% end%> \ No newline at end of file + + +<% end%> diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb index 8994dab10..a6d267d76 100644 --- a/app/views/layouts/_course_base_info.html.erb +++ b/app/views/layouts/_course_base_info.html.erb @@ -55,8 +55,15 @@ 学期:<%= current_time_and_term @course %> 单位:<%= get_occupation_from_user(@course.teacher).blank? ? '无' : get_occupation_from_user(@course.teacher) %>

    - - <% unless is_teacher %> + <% is_TA = get_user_member_roles_course @course, User.current, 7 %> + <% is_TE = get_user_member_roles_course @course, User.current, 9 %> + <% is_ST = get_user_member_roles_course @course, User.current, 10 %> + <% if !is_teacher && (is_TA || is_TE) %> + <%= link_to '教师身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => 10, :tar_role => (is_TA ? 7 : 9)), :class => "sy_btn_orange mr10 fl" %> + <% elsif is_teacher && is_ST %> + <%= link_to '学生身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => (is_TA ? 7 : 9), :tar_role => 10), :class => "sy_btn_orange mr10 fl" %> + <% end %> + <% unless (is_teacher || is_TA || is_TE) %>
    <%= join_in_course_header(@course, User.current) %>
    <% end %>
    diff --git a/config/routes.rb b/config/routes.rb index 6c16dbd7d..cc75f8dab 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1151,6 +1151,7 @@ RedmineApp::Application.routes.draw do get "homework_search" get "show_comparecode" get "statistics_course" + get "switch_role" end collection do match 'join_private_courses', :via => [:get, :post] diff --git a/db/migrate/20160727065357_add_column_to_member_role.rb b/db/migrate/20160727065357_add_column_to_member_role.rb index b551c18bd..861a32e27 100644 --- a/db/migrate/20160727065357_add_column_to_member_role.rb +++ b/db/migrate/20160727065357_add_column_to_member_role.rb @@ -1,16 +1,5 @@ class AddColumnToMemberRole < ActiveRecord::Migration def change - add_column :member_roles, :multi_role, :integer, :default => 0 - - count = MemberRole.all.count / 30 + 2 - transaction do - for i in 1 ... count do i - MemberRole.page(i).per(30).each do |mr| - if mr.role_id == 3 - mr.update_column('multi_role', 1) - end - end - end - end + add_column :member_roles, :is_current, :integer, :default => 1 end end diff --git a/db/schema.rb b/db/schema.rb index ac6ea0ca8..b8352dde1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1108,7 +1108,7 @@ ActiveRecord::Schema.define(:version => 20160727065357) do t.integer "member_id", :null => false t.integer "role_id", :null => false t.integer "inherited_from" - t.integer "multi_role", :default => 0 + t.integer "is_current", :default => 1 end add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" From c07677ef996237ddc06254baa475a33df8278c8f Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 29 Jul 2016 14:49:37 +0800 Subject: [PATCH 23/52] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E6=A1=86=E6=9E=B6=20=E6=8B=92=E7=BB=9D=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/applied_project_controller.rb | 6 +- app/controllers/members_controller.rb | 58 ++++++++++++++++++- app/helpers/users_helper.rb | 33 ++++++++++- app/models/applied_message.rb | 2 +- app/models/applied_project.rb | 2 +- app/models/project.rb | 4 +- .../applied_project_info.js.erb | 3 +- .../members/allow_to_join_project.js.erb | 6 ++ .../refused_allow_to_join_project.js.erb | 1 + .../_user_message_applide_action.html.erb | 12 ++++ .../_user_message_applide_users.html.erb | 2 + .../users/_user_message_applied.html.erb | 9 +-- config/routes.rb | 2 + ..._add_applied_user_id_to_applied_message.rb | 5 ++ public/javascripts/application.js | 1 + 15 files changed, 129 insertions(+), 17 deletions(-) create mode 100644 app/views/members/allow_to_join_project.js.erb create mode 100644 app/views/members/refused_allow_to_join_project.js.erb create mode 100644 app/views/users/_user_message_applide_action.html.erb create mode 100644 app/views/users/_user_message_applide_users.html.erb create mode 100644 db/migrate/20160729020903_add_applied_user_id_to_applied_message.rb diff --git a/app/controllers/applied_project_controller.rb b/app/controllers/applied_project_controller.rb index 117d022d6..b726ea504 100644 --- a/app/controllers/applied_project_controller.rb +++ b/app/controllers/applied_project_controller.rb @@ -1,5 +1,5 @@ class AppliedProjectController < ApplicationController - + helper :watchers #申请加入项目 def applied_join_project @project = Project.find_by_id(params[:object_id]) @@ -43,7 +43,7 @@ class AppliedProjectController < ApplicationController end # @flage:提示语标志(1:邀请码错误;2:已经是项目成员; 3:角色没有选择; 4:申请成功) - # role:成员角色 => 0(1:管理人员;2:开发人员;3:报告人员) + # role:成员角色 => 0(4:管理人员;5:开发人员;6:报告人员) # 申请成功则发送消息 def applied_project_info @project = Project.find(params[:project_id]) @@ -55,7 +55,7 @@ class AppliedProjectController < ApplicationController @flag = 3 else @flag = 4 - role = params[:member] == "member_manager" ? 1 : (params[:member] = "member_developer" ? 2 : 3) + role = params[:member] == "member_manager" ? 4 : (params[:member] = "member_developer" ? 5 : 6) applied_project = AppliedProject.create(:user_id => User.current.id, :project_id => params[:project_id], :role => role) # 申请成功则给项目管理员发送邮件及发送消息 Mailer.run.applied_project(applied_project) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 4dc2c52f5..dca6c6dd0 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -17,10 +17,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class MembersController < ApplicationController + helper :users model_object Member - before_filter :find_model_object, :except => [:index, :create, :autocomplete] + before_filter :find_model_object, :except => [:index, :create, :autocomplete, :allow_to_join_project, :refused_allow_to_join_project] #before_filter :find_model_object_contest, :except => [:index, :create, :autocomplete] - before_filter :find_project_from_association, :except => [:index, :create, :autocomplete] + before_filter :find_project_from_association, :except => [:index, :create, :autocomplete, :allow_to_join_project, :refused_allow_to_join_project] before_filter :find_project_by_project_id, :only => [:index, :create, :autocomplete] before_filter :authorize accept_api_auth :index, :show, :create, :update, :destroy @@ -49,6 +50,59 @@ class MembersController < ApplicationController end end + # 同意消息中申请加入项目 + # 之所以role不在参数中传送是考虑到安全问题 + # status(1:申请的消息;2:已操作过该消息(包括同意或者拒绝,消息状态更新);3:决绝消息;4:被拒人收到消息;5:拒绝者收到消息;6:同意后申请人收到消息;7:同意后批准人收到消息) + def allow_to_join_project + @applied_message = AppliedMessage.find(params[:applied_message_id]) + applied_project = @applied_message.applied + user = User.find(@applied_message.applied_user_id) + project = Project.find(applied_project.project_id) + + # applied_project = AppliedProject.where(:project_id => params[:project_id], :user_id => params[:user_id]).first + # @applied_message = AppliedMessage.find(params[:applied_id]) + if user.member_of?(project) + @flash_message = "您已经是项目成员了" + @applied_message.update_attribute(:status, 2) + else + ap_role = applied_project.try(:role) + if ap_role + begin + members = [] + user_grades = [] + project_info = [] + members << Member.new(:role_ids => ["#{ap_role}"], :user_id => params[:user_id]) + user_grades << UserGrade.new(:user_id => params[:user_id], :project_id => params[:project_id]) + role = Role.find(ap_role) + project_info << ProjectInfo.new(:project_id => params[:project_id], :user_id => params[:user_id]) if role.allowed_to?(:is_manager) + project.members << members + project.project_infos << project_info + project.user_grades << user_grades unless user_grades.first.user_id.nil? + # 添加成功后,申请人收到消息 + AppliedMessage.create(:user_id => params[:send_id], :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 6, :viewed => true, :applied_user_id => params[:user_id]) + # 添加成功后,批准人收到消息 + AppliedMessage.create(:user_id => params[:user_id], :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 7, :viewed => true, :applied_user_id => params[:send_id]) + rescue Exception => e + puts e + end + end + end + end + + # 同意消息中拒绝加入项目 + # params[:user_id]为申请者ID + # params[:send_id]为拒绝人ID + # status(1:申请的消息;2:已操作过该消息(包括同意或者拒绝,消息状态更新);3:拒绝消息;4:被拒人收到消息;5:拒绝者收到消息;6:同意后申请人收到消息;7:同意后批准人收到消息) + def refused_allow_to_join_project + @applied_message = AppliedMessage.find(params[:applied_message_id]) + @applied_message.update_attribute(:status, 3) + applied_project = @applied_message.applied + # 发送消息给被拒者,user_id对应的收到信息的用户 + AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4, :viewed => true, :applied_user_id => @applied_message.user_id) + # 发送消息给拒绝者 + AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5, :viewed => true, :applied_user_id => @applied_message.applied_user_id) + end + def create if params[:refusal_button] members = [] diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index e9abe43a3..6d6c83d4a 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -57,15 +57,42 @@ module UsersHelper # 获取消息角色 def applied_project_message_type role case role - when 1 + when 4 "管理员" - when 2 + when 5 "开发人员" - when 3 + when 6 "报告人员" end end + # 判断当前用户能否对消息进行操作 + def allow_to_show applied_message + (User.current.id == applied_message.user_id && applied_message.status == 1) ? true : false + end + + # 项目申请消息通过状态判断用户 + # status(1:申请的消息;2:已操作过该消息(包括同意或者拒绝,消息状态更新);3:拒绝消息;4:被拒人收到消息;5:拒绝者收到消息;6:同意后申请人收到消息;7:同意后批准人收到消息) + def applied_project_users applied_message + case applied_message.status + when 3,2,1,5,4 + user = User.find(applied_message.applied_user_id) + when 6 + user = User.find(applied_message.user_id) + + end + end + + # 项目申请消息通过状态判断tip描述 + def applied_project_tip applied_message + case applied_message.status + when 4 + "拒绝申请加入项目:" + when 5,3,2,1 + "申请加入项目:" + end + end + def get_resource_origin attach type = attach.container_type content = attach.container diff --git a/app/models/applied_message.rb b/app/models/applied_message.rb index 1c6b3a8e7..0175fcf47 100644 --- a/app/models/applied_message.rb +++ b/app/models/applied_message.rb @@ -1,6 +1,6 @@ class AppliedMessage < ActiveRecord::Base # status: 0表示未批准; status:1表示已批准; status: 2表示已拒绝 - attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed + attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id belongs_to :applied ,:polymorphic => true belongs_to :apply_add_schools belongs_to :user diff --git a/app/models/applied_project.rb b/app/models/applied_project.rb index 8dbed9cda..fdc9a602e 100644 --- a/app/models/applied_project.rb +++ b/app/models/applied_project.rb @@ -10,7 +10,7 @@ class AppliedProject < ActiveRecord::Base # 仅仅给项目管理人员发送消息 def send_appliled_message self.project.managers.each do |member| - self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => true, :viewed => false) + self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => true, :viewed => false, :applied_user_id => self.user_id) end # end end diff --git a/app/models/project.rb b/app/models/project.rb index edeee4f33..dcc01eb09 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -919,8 +919,8 @@ class Project < ActiveRecord::Base CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z) def generate_invite_code code = read_attribute(:invite_code) - if !code || code.size <5 - code = CODES.sample(5).join + if !code || code.size <6 + code = CODES.sample(6).join return generate_invite_code if Project.where(invite_code: code).present? update_attribute(:invite_code, code) end diff --git a/app/views/applied_project/applied_project_info.js.erb b/app/views/applied_project/applied_project_info.js.erb index 1ac627b3e..7fff1b516 100644 --- a/app/views/applied_project/applied_project_info.js.erb +++ b/app/views/applied_project/applied_project_info.js.erb @@ -1,3 +1,4 @@ -var htmlvalue = "<%= escape_javascript(render :partial => 'applied_project/applied_project_tip', locals: {:project_id => @project.id}) %>"; +var htmlvalue = "<%= escape_javascript(render :partial => 'applied_project/applied_project_tip') %>"; pop_box_new(htmlvalue,380,40,50); + //$("#join_in_project").attr('href','<%#= join_in_project_link(@project, User.current) %>'); diff --git a/app/views/members/allow_to_join_project.js.erb b/app/views/members/allow_to_join_project.js.erb new file mode 100644 index 000000000..df3ac6de3 --- /dev/null +++ b/app/views/members/allow_to_join_project.js.erb @@ -0,0 +1,6 @@ +<% if @flash_message %> + alert("<%= @flash_message %>"); +<% else%> + $("#applied_project_<%= @applied_message.id %>").html('<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => @applied_message} %>'); +<% end%> + diff --git a/app/views/members/refused_allow_to_join_project.js.erb b/app/views/members/refused_allow_to_join_project.js.erb new file mode 100644 index 000000000..109ed3a62 --- /dev/null +++ b/app/views/members/refused_allow_to_join_project.js.erb @@ -0,0 +1 @@ +$("#applied_project_<%= @applied_message.id %>").html('<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => @applied_message} %>'); \ No newline at end of file diff --git a/app/views/users/_user_message_applide_action.html.erb b/app/views/users/_user_message_applide_action.html.erb new file mode 100644 index 000000000..24f2471b5 --- /dev/null +++ b/app/views/users/_user_message_applide_action.html.erb @@ -0,0 +1,12 @@ +<% if allow_to_show(ma) %> + :<%= link_to "同意", allow_to_join_project_project_memberships_path(:project_id => ma.applied.project, :applied_message_id => ma.id), :remote => true, :method => :post %> | + <%= link_to "拒绝", refused_allow_to_join_project_project_memberships_path(:project_id => ma.applied.project, :applied_message_id => ma.id), :remote => true, :method => :get %> +<% elsif ma.status == 4 %> + 被拒绝 +<% elsif ma.status == 5 %> + 您已拒绝 +<% elsif ma.status == 6 %> + 已通过 +<% elsif ma.status == 7 %> + 您已同意 +<% end %> \ No newline at end of file diff --git a/app/views/users/_user_message_applide_users.html.erb b/app/views/users/_user_message_applide_users.html.erb new file mode 100644 index 000000000..18539c628 --- /dev/null +++ b/app/views/users/_user_message_applide_users.html.erb @@ -0,0 +1,2 @@ +<%=link_to applied_project_users(ma), user_path(applied_project_users(ma)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> +<%= applied_project_tip(ma) %> \ No newline at end of file diff --git a/app/views/users/_user_message_applied.html.erb b/app/views/users/_user_message_applied.html.erb index efd2bf8da..a2eff7189 100644 --- a/app/views/users/_user_message_applied.html.erb +++ b/app/views/users/_user_message_applied.html.erb @@ -20,13 +20,14 @@ <%=link_to image_tag(url_to_avatar(ma.applied.user), :width => "30", :height => "30"), user_path(ma.applied.user), :target => '_blank' %>
  • - <%=link_to ma.applied.user, user_path(ma.applied.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> - ">申请加入项目: + <%= render :partial => "users/user_message_applide_users", :locals =>{:ma => ma} %>
  • 以“<%= applied_project_message_type(ma.applied.role) %>”身份加入 - <%= link_to ma.applied.project, settings_project_path(:id => ma.applied.project.id, :tab => "members"), :class => "link-blue", :target => '_blank' %> - :同意 | 拒绝 + <%= link_to ma.applied.project, project_path(ma.applied.project), :class => "link-blue", :target => '_blank' %> + + <%= render :partial => "users/user_message_applide_action", :locals =>{:ma => ma} %> +
  • <%= time_tag(ma.created_at).html_safe %>
  • diff --git a/config/routes.rb b/config/routes.rb index 52b7bab94..20fe203fa 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -767,6 +767,8 @@ RedmineApp::Application.routes.draw do collection do get 'autocomplete' get 'appliedproject' + post 'allow_to_join_project' + get 'refused_allow_to_join_project' end end diff --git a/db/migrate/20160729020903_add_applied_user_id_to_applied_message.rb b/db/migrate/20160729020903_add_applied_user_id_to_applied_message.rb new file mode 100644 index 000000000..480123b05 --- /dev/null +++ b/db/migrate/20160729020903_add_applied_user_id_to_applied_message.rb @@ -0,0 +1,5 @@ +class AddAppliedUserIdToAppliedMessage < ActiveRecord::Migration + def change + add_column :applied_messages, :applied_user_id, :integer + end +end diff --git a/public/javascripts/application.js b/public/javascripts/application.js index d2cd50d0e..b4ccd1533 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1499,6 +1499,7 @@ function pop_box_new(value, Width, Top, Left){ $('#ajax-modal').siblings().remove(); $('#ajax-modal').parent().css({"top": Top+"%","left": Left+"%","transform":"translate(-50%,-50%)","padding":"0","border":"none"}); $('#ajax-modal').css({"padding":"0"}); + } // 公共提示弹框样式 From 450217e7c27c06ec770d9ca3e2e6d7656f5f33d7 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 29 Jul 2016 15:58:24 +0800 Subject: [PATCH 24/52] =?UTF-8?q?=E5=90=8C=E6=84=8F=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=8F=91=E9=80=81=EF=BC=8C=E5=8F=8A=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=88=90=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/applied_project_controller.rb | 2 +- app/controllers/members_controller.rb | 15 +++++++------ app/helpers/users_helper.rb | 21 +++++++++---------- .../members/allow_to_join_project.js.erb | 1 - 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/app/controllers/applied_project_controller.rb b/app/controllers/applied_project_controller.rb index b726ea504..221adc7bc 100644 --- a/app/controllers/applied_project_controller.rb +++ b/app/controllers/applied_project_controller.rb @@ -55,7 +55,7 @@ class AppliedProjectController < ApplicationController @flag = 3 else @flag = 4 - role = params[:member] == "member_manager" ? 4 : (params[:member] = "member_developer" ? 5 : 6) + role = params[:member] == "member_manager" ? 3 : (params[:member] = "member_developer" ? 4 :5) applied_project = AppliedProject.create(:user_id => User.current.id, :project_id => params[:project_id], :role => role) # 申请成功则给项目管理员发送邮件及发送消息 Mailer.run.applied_project(applied_project) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index dca6c6dd0..6d3cf6aa5 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -58,9 +58,6 @@ class MembersController < ApplicationController applied_project = @applied_message.applied user = User.find(@applied_message.applied_user_id) project = Project.find(applied_project.project_id) - - # applied_project = AppliedProject.where(:project_id => params[:project_id], :user_id => params[:user_id]).first - # @applied_message = AppliedMessage.find(params[:applied_id]) if user.member_of?(project) @flash_message = "您已经是项目成员了" @applied_message.update_attribute(:status, 2) @@ -71,17 +68,18 @@ class MembersController < ApplicationController members = [] user_grades = [] project_info = [] - members << Member.new(:role_ids => ["#{ap_role}"], :user_id => params[:user_id]) - user_grades << UserGrade.new(:user_id => params[:user_id], :project_id => params[:project_id]) + members << Member.new(:role_ids => ["#{ap_role}"], :user_id => @applied_message.applied_user_id) + user_grades << UserGrade.new(:user_id => @applied_message.applied_user_id, :project_id => project.id) role = Role.find(ap_role) - project_info << ProjectInfo.new(:project_id => params[:project_id], :user_id => params[:user_id]) if role.allowed_to?(:is_manager) + project_info << ProjectInfo.new(:project_id => project.id, :user_id => @applied_message.applied_user_id) if role.allowed_to?(:is_manager) project.members << members project.project_infos << project_info project.user_grades << user_grades unless user_grades.first.user_id.nil? + @applied_message.update_attribute(:status, 2) # 添加成功后,申请人收到消息 - AppliedMessage.create(:user_id => params[:send_id], :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 6, :viewed => true, :applied_user_id => params[:user_id]) + AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 6, :viewed => true, :applied_user_id => @applied_message.user_id) # 添加成功后,批准人收到消息 - AppliedMessage.create(:user_id => params[:user_id], :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 7, :viewed => true, :applied_user_id => params[:send_id]) + AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id) rescue Exception => e puts e end @@ -101,6 +99,7 @@ class MembersController < ApplicationController AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4, :viewed => true, :applied_user_id => @applied_message.user_id) # 发送消息给拒绝者 AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5, :viewed => true, :applied_user_id => @applied_message.applied_user_id) + # applied_project.delete end def create diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 6d6c83d4a..a8427c326 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -57,11 +57,11 @@ module UsersHelper # 获取消息角色 def applied_project_message_type role case role - when 4 + when 3 "管理员" - when 5 + when 4 "开发人员" - when 6 + when 5 "报告人员" end end @@ -74,13 +74,10 @@ module UsersHelper # 项目申请消息通过状态判断用户 # status(1:申请的消息;2:已操作过该消息(包括同意或者拒绝,消息状态更新);3:拒绝消息;4:被拒人收到消息;5:拒绝者收到消息;6:同意后申请人收到消息;7:同意后批准人收到消息) def applied_project_users applied_message - case applied_message.status - when 3,2,1,5,4 - user = User.find(applied_message.applied_user_id) - when 6 - user = User.find(applied_message.user_id) - - end + # case applied_message.status + # when 3,2,1,5,4,7,6 + user = User.find(applied_message.applied_user_id) + # end end # 项目申请消息通过状态判断tip描述 @@ -88,8 +85,10 @@ module UsersHelper case applied_message.status when 4 "拒绝申请加入项目:" - when 5,3,2,1 + when 5,3,2,1,7 "申请加入项目:" + when 6 + "同意申请加入项目" end end diff --git a/app/views/members/allow_to_join_project.js.erb b/app/views/members/allow_to_join_project.js.erb index df3ac6de3..cbd37e188 100644 --- a/app/views/members/allow_to_join_project.js.erb +++ b/app/views/members/allow_to_join_project.js.erb @@ -3,4 +3,3 @@ <% else%> $("#applied_project_<%= @applied_message.id %>").html('<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => @applied_message} %>'); <% end%> - From 769a07bd9449429e64aee9324029b6828afbaedf Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 29 Jul 2016 16:00:46 +0800 Subject: [PATCH 25/52] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=88=90=E5=91=98=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projects/settings/_new_members.html.erb | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/app/views/projects/settings/_new_members.html.erb b/app/views/projects/settings/_new_members.html.erb index b73ef647f..0773f7732 100644 --- a/app/views/projects/settings/_new_members.html.erb +++ b/app/views/projects/settings/_new_members.html.erb @@ -92,32 +92,6 @@ <% if roles.any? %>
    - <% if @project.applied_projects.any? %> -
    -

    <%= l(:label_apply_project) %>

    - <%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %> -
    - <%= render_principals_for_applied_members_new(@project) %> -
    -
      -
    • <%= l(:label_role_plural) %>:
    • - <% roles.each do |role| %> -
    • - <%= check_box_tag 'membership[role_ids][]', role.id %> - -
    • - <% end %> -
    - - <%= l(:label_approve) %> - - - <%= l(:label_refusal) %> - - <% end %> -
    -
    - <% end %>

    <%= l(:label_member_new) %>

    From 18862fdee9b035f6013e706469a51f23e73dd8f1 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 29 Jul 2016 16:06:30 +0800 Subject: [PATCH 26/52] =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=96=87=E5=AD=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/edit_class.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/assets/wechat/edit_class.html b/public/assets/wechat/edit_class.html index 62022566b..68b84aee6 100644 --- a/public/assets/wechat/edit_class.html +++ b/public/assets/wechat/edit_class.html @@ -3,9 +3,9 @@
    管理课程
    -
    课程
    +
    课程名称
    -
    班级删除
    +
    班级名称删除
    完成
    From 43498e79e8e4d57b8a42e98d96f0c23fe29ad049 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 29 Jul 2016 16:09:55 +0800 Subject: [PATCH 27/52] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AF=B4=E6=98=8E?= =?UTF-8?q?=E5=B1=85=E4=B8=AD=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/new_project.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/public/assets/wechat/new_project.html b/public/assets/wechat/new_project.html index a59904e14..f121a281a 100644 --- a/public/assets/wechat/new_project.html +++ b/public/assets/wechat/new_project.html @@ -5,7 +5,7 @@
    项目名称
    完成 -
    +
    项目功能特性(微信版)
    • 创建项目、加入项目
    • @@ -13,8 +13,6 @@
    • 浏览、回复项目动态
    • 点赞、分享项目动态
    -
    -
    更多项目特性(浏览器版)
    • 发布任务、问题跟踪
    • From 3d7b7b513b1d11a03dd0e2084da6a26fc1e34009 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 29 Jul 2016 16:11:43 +0800 Subject: [PATCH 28/52] =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=96=87=E5=AD=97?= =?UTF-8?q?=E8=B6=85=E5=87=BA=E7=9C=81=E7=95=A5=E5=8F=B7=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/app.html | 2 +- .../javascripts/wechat/directives/ellipsis.js | 44 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/public/assets/wechat/app.html b/public/assets/wechat/app.html index 606164efe..00a55f553 100644 --- a/public/assets/wechat/app.html +++ b/public/assets/wechat/app.html @@ -36,7 +36,7 @@ - + diff --git a/public/javascripts/wechat/directives/ellipsis.js b/public/javascripts/wechat/directives/ellipsis.js index a5d5d9845..a5dcfa293 100644 --- a/public/javascripts/wechat/directives/ellipsis.js +++ b/public/javascripts/wechat/directives/ellipsis.js @@ -1,25 +1,25 @@ /** * Created by Tim on 7/22/16. */ -app.directive('ellipsisShow',["$timeout",function(timer){ - return{ - restrict: 'A', - scope: {}, - link: function(scope, element){ - timer(function() { - var textSplit = element.text().split(" "); - var newContent = []; - element.text(""); - for (var i = 0; i < textSplit.length; i++) { - newContent = newContent + " " + textSplit[i]; - element.text(newContent); - if(element[0].scrollHeight >= 100){ - newContent = newContent + " " + textSplit[i+1] + " " + textSplit[i+2] + " " + textSplit[i+3] + " " + textSplit[i+4] + "..."; - element.text(newContent); - break; - } - } - }); - } - } -}]); \ No newline at end of file +//app.directive('ellipsisShow',["$timeout",function(timer){ +// return{ +// restrict: 'A', +// scope: {}, +// link: function(scope, element){ +// timer(function() { +// var textSplit = element.text().split(" "); +// var newContent = []; +// element.text(""); +// for (var i = 0; i < textSplit.length; i++) { +// newContent = newContent + " " + textSplit[i]; +// element.text(newContent); +// if(element[0].scrollHeight >= 100){ +// newContent = newContent + " " + textSplit[i+1] + " " + textSplit[i+2] + " " + textSplit[i+3] + " " + textSplit[i+4] + "..."; +// element.text(newContent); +// break; +// } +// } +// }); +// } +// } +//}]); \ No newline at end of file From 4e5f3e56c70d2a397d4890d3aafe7b78bab85dc7 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 29 Jul 2016 16:24:42 +0800 Subject: [PATCH 29/52] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=E6=96=87=E5=AD=97=E5=B1=85=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/weui/weixin.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 58b4a244e..c67cd2a75 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -241,5 +241,5 @@ a.underline {text-decoration:underline;} /*20160729项目说明*/ -.project-intro {line-height:2;} +.project-intro {line-height:2; width:140px; margin-left:auto; margin-right:auto;} .project-intro li {list-style:disc; margin-left:20px;} \ No newline at end of file From a1553c7a8fb052658fbc4c8dcb9dfd68366b4947 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jul 2016 16:27:02 +0800 Subject: [PATCH 30/52] =?UTF-8?q?=E8=A7=92=E8=89=B2=E7=9A=84=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/members_controller.rb | 4 ++-- app/views/courses/_course_members.html.erb | 13 ------------- app/views/courses/_member.html.erb | 13 ------------- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 9c6f606f6..fe0da8d78 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -158,7 +158,7 @@ class MembersController < ApplicationController role_ids = attrs.delete(:role_ids) #role = Role.find(params[:membership][:role_ids]) # 这里的判断只能通过角色名,可以弄成常量 - if role_ids && !role_ids.include?("9") && role_ids.include?("10") + if role_ids && role_ids.include?("10") StudentsForCourse.create(:student_id => user_id, :course_id =>@course.id) end @@ -257,7 +257,7 @@ class MembersController < ApplicationController attrs = params[:membership].dup role_ids = attrs.delete(:role_ids) - if role_ids && !role_ids.include?("9") && role_ids.include?("10") + if role_ids && role_ids.include?("10") StudentsForCourse.create(:student_id => @member.user_id, :course_id =>@course.id) else joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id) diff --git a/app/views/courses/_course_members.html.erb b/app/views/courses/_course_members.html.erb index 563cbfff3..90db21489 100644 --- a/app/views/courses/_course_members.html.erb +++ b/app/views/courses/_course_members.html.erb @@ -52,7 +52,6 @@ \ No newline at end of file diff --git a/app/views/courses/_member.html.erb b/app/views/courses/_member.html.erb index 35cf0438c..9e6abcf4f 100644 --- a/app/views/courses/_member.html.erb +++ b/app/views/courses/_member.html.erb @@ -39,7 +39,6 @@ <% end%> From 824b430fbde392398fe5572ea25ea1a6eca88dd3 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 29 Jul 2016 17:38:21 +0800 Subject: [PATCH 31/52] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=B4=A8=E9=87=8F?= =?UTF-8?q?=E5=88=86=E6=94=AF=E5=BC=B9=E5=87=BA=E7=A9=BA=E7=99=BD=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/quality_analysis_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 80c5a2468..c9873ade4 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -37,7 +37,7 @@ class QualityAnalysisController < ApplicationController quality_an.delete unless quality_an.blank? end # Checks if the given job exists in Jenkins. - unless @client.job.exists?(job_name) + # unless @client.job.exists?(job_name) @g = Gitlab.client branch = params[:branch] language = swith_language_type(params[:language]) @@ -111,7 +111,7 @@ class QualityAnalysisController < ApplicationController end end end - end + # end rescue => e @message = e.message end From 48a72ff816e1278063293f4b3b4cede170359f76 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 29 Jul 2016 17:46:24 +0800 Subject: [PATCH 32/52] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=88=86=E6=9E=90?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E5=85=A5=E5=8F=A3=E6=94=BE=E7=BD=AE=E5=9C=A8?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_development_group.html.erb | 6 ------ app/views/repositories/show.html.erb | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 6961fcbac..2c7d36fb5 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -55,12 +55,6 @@ <%= link_to "+"+l(:project_gitlab_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %> <% end %>
    - - <% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %> - - <% end %> <% end %> diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 823d0c1ad..b80d9ee5b 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -7,6 +7,10 @@ <%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch ), :remote => true, :class => "btn_zipdown fr" %> <% end %> <% end %> + + <% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %> + <%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fr" %> + <% end %>
    <% if @entries.nil? %> From 335b82c046e8c2c55b1a033c8ed06ba180acc727 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jul 2016 19:19:58 +0800 Subject: [PATCH 33/52] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E7=9A=84=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 18 ++- app/controllers/users_controller.rb | 20 ++- app/helpers/courses_helper.rb | 2 +- app/services/courses_service.rb | 95 ++++++++++++ .../courses/_join_private_course.html.erb | 144 ++++++------------ app/views/courses/join.js.erb | 4 + .../courses/join_course_multi_role.js.erb | 52 +++++++ app/views/courses/join_private_courses.js.erb | 13 +- app/views/layouts/_course_base_info.html.erb | 6 +- .../_join_course_course_message.html.erb | 4 +- app/views/users/_user_message_course.html.erb | 4 +- config/routes.rb | 2 + db/schema.rb | 20 ++- public/stylesheets/css/common.css | 9 +- public/stylesheets/css/structure.css | 3 + public/stylesheets/sy_public.css | 4 + 16 files changed, 271 insertions(+), 129 deletions(-) create mode 100644 app/views/courses/join_course_multi_role.js.erb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 8fa46bda5..114d574d2 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -23,7 +23,7 @@ class CoursesController < ApplicationController before_filter :can_show_course, :except => [] before_filter :logged_user_by_apptoken,:only => [:show,:feedback] - before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses] + before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses, :join_course_multi_role] before_filter :authorize_course, :only => [:show, :settings, :update, :course] before_filter :authorize_course_global, :only => [:new,:create] before_filter :toggleCourse, :only => [:finishcourse, :restartcourse] @@ -81,6 +81,22 @@ class CoursesController < ApplicationController end + def join_course_multi_role + if User.current.logged? + cs = CoursesService.new + @user = User.current + join = cs.join_course_roles params,@user + @state = join[:state] + @course = join[:course] + else + @state = 5 #未登录 + end + @object_id = @course.id if @course + respond_to do |format| + format.js + end + end + def unjoin if User.current.logged? cs = CoursesService.new diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4efa05a1e..2f1d6a4db 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -355,15 +355,21 @@ class UsersController < ApplicationController case params[:agree] when 'Y' apply_user = User.find(@msg.course_message_id) - + ids = @msg.content.split(",") # [@msg.content] msg content保存的是申请的职位角色 + integer_ids = [] + ids.each do |role_id| + integer_ids << role_id.to_i + end if apply_user.member_of_course?(Course.find(@msg.course_id)) #将角色改为老师或者教辅 member = Course.find(@msg.course_id).members.where(:user_id=>apply_user.id).all[0] - member.role_ids = [@msg.content] # msg content保存的是申请的职位角色 - #删除为学生的记录 - joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@msg.course_id) - joined.each do |join| - join.delete + member.role_ids = integer_ids + #删除为学生的记录 + unless member.role_ids.include?(10) + joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@msg.course_id) + joined.each do |join| + join.delete + end end member.course_group_id = 0 @@ -372,7 +378,7 @@ class UsersController < ApplicationController @msg.update_attributes(:status=>1,:viewed=>1) else members = [] - members << Member.new(:role_ids => [@msg.content.to_i], :user_id => @msg.course_message_id) + members << Member.new(:role_ids => integer_ids, :user_id => @msg.course_message_id) Course.find(@msg.course_id).members << members CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1) @msg.update_attributes(:status=>1,:viewed=>1) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index ef304887f..cfc6fb1f6 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -794,7 +794,7 @@ module CoursesHelper if user.logged? joined = course.members.includes(:user).map{|member| member.user_id}.include? user.id text = joined ? l(:label_course_exit_student) : l(:label_course_join_student) - url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id) + url = joined ? join_path(:object_id => course.id) : join_private_courses_courses_path() method = joined ? 'delete' : 'post' if joined link = link_to(text, url, :remote => true, :method => method, :class => "sy_btn_grey fl", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index d864b6462..fd3aa6ebf 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -389,6 +389,101 @@ class CoursesService {:state => @state,:course => course} end + #多个角色加入课程 + def join_course_roles params,current_user + course = Course.find_by_invite_code(params[:invite_code]) if params[:invite_code] + + @state = 10 + if course + if course_endTime_timeout? course + @state = 2 + else + if current_user.member_of_course?(course) #如果已经是成员 + @state = 3 + # member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0] + # role_ids = params[:role] + # #roleName = member.roles[0].name if member + # #roleName = member.roles.map{|role| role.name}.join(",") if member + # if params[:invite_code].present? + # #如果加入角色为学生 并且当前是学生 + # if role_ids == "10" && roleName.include?("Student") && !roleName.include?("Teacher") && !roleName.include?("TeachingAsistant")&& !roleName.include?("Manager") + # @state = 3 + # #如果加入的角色为老师,并且当前已经是老师 + # elsif role_ids == "9" && roleName.include?("Teacher") && !roleName.include?("Student") + # @state = 8 + # #如果加入的角色教辅并且当前为教辅 + # elsif role_ids == "7" && roleName.include?("TeachingAsistant") && !roleName.include?("Student") + # @state = 9 + # elsif roleName.include?("Manager") + # @state = 10 + # #如果加入角色为教师或者教辅,并且当前是学生,或者是要成为教辅,当前不是教辅,或者要成为教师,当前不是教师。那么要发送请求 + # elsif (params[:role] != "10" && roleName == "Student") || (params[:role] == "7" && roleName != "TeachingAsistant" ) || (params[:role] == "9" && roleName != "Teacher" ) + # #如果已经发送过消息了,那么就要给个提示 + # if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0 ").count != 0 + # @state = 7 + # else + # Mailer.run.join_course_request(course, User.current, params[:role]) + # CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0) + # @state = 6 + # end + # #如果加入角色是学生,但是是当前课程的教师或者教辅 + # elsif params[:role] == "10" && roleName != "Student" + # member.role_ids = [params[:role]] + # member.save + # StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id) + # @state = 0 + # end + # else + # @state = 1 + # end + else + if params[:invite_code].present? + role_ids = params[:role] + role_str = role_ids.join(",") + if role_ids.include?("10") && !role_ids.include?("7") && !role_ids.include?("9") + members = [] + members << Member.new(:role_ids => [10], :user_id => current_user.id) + course.members << members + StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id) + @state = 0 + else + is_stu = false + if role_ids.include?("10") + members = [] + members << Member.new(:role_ids => [10], :user_id => current_user.id) + course.members << members + StudentsForCourse.create(:student_id => current_user.id, :course_id =>course.id) + is_stu = true + end + #如果已经发送过消息了,那么就要给个提示 + if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = '#{role_str}' and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0").count != 0 + if is_stu + @state = 12 + else + @state = 7 + end + else + Mailer.run.join_course_request(course, User.current, params[:role]) + CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> role_str,:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0) + if is_stu + @state = 13 + else + @state = 6 + end + end + end + else + @state = 1 + end + end + end + else + @state = 4 + end + {:state => @state,:course => course} + end + + #作业列表 #已提交的作业数量获取 bid.homeworks.count #学生提问数量获取 bid.commit.nil? ? 0 : bid.commit diff --git a/app/views/courses/_join_private_course.html.erb b/app/views/courses/_join_private_course.html.erb index ec5d18c7e..f95129903 100644 --- a/app/views/courses/_join_private_course.html.erb +++ b/app/views/courses/_join_private_course.html.erb @@ -1,100 +1,52 @@ - - - - - 快速进入班级通道 - - - +
    + +
  • + + 确  定 + 取  消 - -
    -
    -
    -

    快速加入班级通道

    -

    只要持有班级邀请码,就可以快速加入所在班级。班级页面搜索不到的私有班级只能从此通道进入哦!

    -
    -
    - <%= form_tag({:controller => 'courses', - :action => 'join'}, - :remote => true, - :method => :post, - :id => 'new-watcher-form') do %> -
      -
    • - - - 班级邀请码: - - -
    • -
    • 班级邀请码是所在班级页面中显示的邀请码
    • -
    • - - <% if User.current.logged? && User.current.extensions && User.current.extensions.identity == 0%> - - <%else%> - - <%end%> -
    • -
    • - - <%= l(:label_new_join) %> - - - <%= l(:button_cancel)%> - -
    • -
    - <% end%> -
    -
    +
    +
  • + + <% end %> +
    - - - + \ No newline at end of file diff --git a/app/views/courses/join.js.erb b/app/views/courses/join.js.erb index ac8b717d1..52c1347a5 100644 --- a/app/views/courses/join.js.erb +++ b/app/views/courses/join.js.erb @@ -36,6 +36,10 @@ window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/co alert("您已经是该班级的管理员了"); hidden_join_course_form(); window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 11%> +alert("该班级已被删除"); +hidden_join_course_form(); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" <% else %> alert("未知错误,请稍后再试"); <% end %> diff --git a/app/views/courses/join_course_multi_role.js.erb b/app/views/courses/join_course_multi_role.js.erb new file mode 100644 index 000000000..97d6b33ce --- /dev/null +++ b/app/views/courses/join_course_multi_role.js.erb @@ -0,0 +1,52 @@ +<% if @object_id && @state != 6 && @state !=4 %> +$("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(@course, @user)) %>"); +<% end %> +<% if @state %> +<% if @state == 0 %> +alert("加入成功"); +hideModal(); +$("#try_join_course_link").replaceWith(" 'index',:course=>@course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品"); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 1 %> +alert("密码错误"); +<% elsif @state == 2 %> +alert("班级已过期\n请联系班级管理员重启班级。(在配置班级处)"); +<% elsif @state == 3 %> +alert("您已经加入了班级"); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 4 %> +alert("您加入的班级不存在"); +<% elsif @state == 5 %> +alert("您还未登录"); +<% elsif @state == 6 %> +alert("申请成功,请等待审核"); +hidden_join_course_form(); +<% elsif @state == 7%> +alert("您已经发送过申请了,请耐心等待"); +hidden_join_course_form(); +<% elsif @state == 8%> +alert("您已经是该班级的教师了"); +hidden_join_course_form(); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 9%> +alert("您已经是该班级的教辅了"); +hidden_join_course_form(); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 10%> +alert("您已经是该班级的管理员了"); +hidden_join_course_form(); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 11%> +alert("该班级已被删除"); +hidden_join_course_form(); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 12 %> +alert("您已经发送过申请了,请耐心等待"); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% elsif @state == 13 %> +alert("申请成功,请等待审核"); +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +<% else %> +alert("未知错误,请稍后再试"); +<% end %> +<% end %> diff --git a/app/views/courses/join_private_courses.js.erb b/app/views/courses/join_private_courses.js.erb index 199cfb5ae..14402a9ff 100644 --- a/app/views/courses/join_private_courses.js.erb +++ b/app/views/courses/join_private_courses.js.erb @@ -1,11 +1,2 @@ -$('#topnav_course_menu').hide(); -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_private_course') %>'); -showModal('ajax-modal', '540px'); -$('#ajax-modal').css('height','390px'); -//$('#ajax-modal').siblings().remove(); -$('#ajax-modal').siblings().hide(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); -$('#ajax-modal').parent().addClass("alert_box"); +var htmlvalue = "<%= escape_javascript(render :partial => 'join_private_course') %>"; +pop_box_new(htmlvalue,460,40,50); diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb index a6d267d76..6eab17656 100644 --- a/app/views/layouts/_course_base_info.html.erb +++ b/app/views/layouts/_course_base_info.html.erb @@ -13,9 +13,8 @@
  • diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index fa2be7ae1..98ed3d1dc 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -586,9 +586,9 @@
  • <%= link_to ma.status == 1 ? - '您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'申请已通过' + '您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content.include?('9') ? '教师' : '教辅')+'申请已通过' : - '您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'的申请被拒绝', course_path(Course.find(ma.course_id)), + '您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content.include?('9') ? '教师' : '教辅')+'的申请被拒绝', course_path(Course.find(ma.course_id)), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> diff --git a/config/routes.rb b/config/routes.rb index 2704a25b4..3687460e3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1160,6 +1160,8 @@ RedmineApp::Application.routes.draw do end collection do match 'join_private_courses', :via => [:get, :post] + post "join_course_multi_role" + end match '/member', :to => 'courses#member', :as => 'member', :via => :get diff --git a/db/schema.rb b/db/schema.rb index b8352dde1..a46079722 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160727065357) do +ActiveRecord::Schema.define(:version => 20160728075947) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -52,9 +52,20 @@ ActiveRecord::Schema.define(:version => 20160727065357) do add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" + create_table "applied_messages", :force => true do |t| + t.integer "user_id" + t.integer "applied_id" + t.string "applied_type" + t.integer "viewed", :default => 0 + t.integer "status", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "applied_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.integer "role", :default => 0 end create_table "apply_add_schools", :force => true do |t| @@ -67,6 +78,7 @@ ActiveRecord::Schema.define(:version => 20160727065357) do t.integer "status", :default => 0 t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.integer "user_id" end create_table "apply_homeworks", :force => true do |t| @@ -1539,6 +1551,8 @@ ActiveRecord::Schema.define(:version => 20160727065357) do t.integer "boards_reply_count", :default => 0 t.integer "visits", :default => 0 t.integer "hot", :default => 0 + t.string "invite_code" + t.string "qrcode" end add_index "projects", ["lft"], :name => "index_projects_on_lft" diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index 888cb3ca3..2da6af729 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -545,6 +545,7 @@ a:hover.Blue-btn{ background:#3598db; color:#fff;} /*20160725 项目申请按钮*/ a.sy_btn_grey{ + display:inline-block; color: #333; background: #e1e1e1; text-align: center; @@ -559,13 +560,13 @@ a.sy_btn_grey{ } a:hover.sy_btn_grey{ background: #c3c3c3;} a.sy_btn_blue{ - display:block; - width:80px; - height: 30px; - text-align:center; + display:inline-block; color: #fff; background: #3b94d6; + text-align: center; font-size: 12px; + padding:0 15px; + height: 30px; line-height: 30px; -webkit-border-radius:3px; -moz-border-radius:3px; diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css index be8bbc65b..4e55af490 100644 --- a/public/stylesheets/css/structure.css +++ b/public/stylesheets/css/structure.css @@ -103,8 +103,11 @@ div#menu ul ul ul li a{ width:185px; overflow:hidden; white-space: nowrap; text- .homepageNewsPubTypeHomework {width:270px; font-size:12px; color:#888888; display: block; white-space:nowrap;} .homepageNewsContent {width:355px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } .homepageSystenMessageContent {width:281px; max-width:291px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden;text-overflow:ellipsis;max-height: 49px; } + .homepageHomeworkContentWarn {width:110px; max-width:365px; margin-right:10px; font-size:12px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } .homepageHomeworkContent {width:235px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } +.homepageHomeworkContentWarn2 {width:60px; max-width:365px; margin-right:10px; font-size:12px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } +.homepageHomeworkContent2 {width:285px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } .homepageNewsTime {width:75px; font-size:12px; color:#888888; display:block; text-align:right;} .loadMore {font-size:14px;width:748px; text-align:center; display:block; border:1px solid #dddddd; background-color:#ffffff; float:right;padding:5px 0; letter-spacing: 1px;} diff --git a/public/stylesheets/sy_public.css b/public/stylesheets/sy_public.css index 77c782698..08a47ab07 100644 --- a/public/stylesheets/sy_public.css +++ b/public/stylesheets/sy_public.css @@ -15,6 +15,7 @@ a.sy_cmore{ font-size:12px; color:#888; font-weight:normal;} a:hover.sy_cmore{color: #ee4a1f;} /* 按钮*/ a.btn_orange_big{ + display:inline-block; border: 1px solid #ee4a1f; color: #ee4a1f; text-align: center; @@ -32,6 +33,7 @@ a:hover.btn_orange_big{ color: #fff; } a.btn_green_big{ + display:inline-block; border: 1px solid #60b25e; color: #60b25e; text-align: center; @@ -49,6 +51,7 @@ a:hover.btn_green_big{ color: #fff; } a.sy_btn_green{ + display:inline-block; color: #fff; background: #60b25e; text-align: center; @@ -62,6 +65,7 @@ a.sy_btn_green{ border-radius:3px; } a:hover.sy_btn_green{ background: #51a74f;} + /*a.sy_btn_grey{*/ /*color: #333;*/ /*background: #e1e1e1;*/ From 5a8d2407e26a3f43542f207ee75c496a17bc9955 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jul 2016 19:28:50 +0800 Subject: [PATCH 34/52] =?UTF-8?q?=E6=94=BE=E5=BC=80=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E3=80=81=E6=96=B0=E5=BB=BA=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=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/views/layouts/new_base_user.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index f280f6506..562b35ecc 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -192,7 +192,7 @@ <%= link_to '课程',{:controller => "users", :action => "user_courselist", :id => @user.id}, :class => "homepageMenuText" %> <% if is_current_user%> - <% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%> + <%# if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
    • @@ -211,9 +211,9 @@
    - <% else%> - <%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%> - <% end%> + <%# else%> + <%#=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%> + <%# end%> <% end%>
  • <% end %> From 60417b2db732b3d3f50596a2b5160c4945e065df Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 29 Jul 2016 19:30:53 +0800 Subject: [PATCH 35/52] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E6=B6=88=E6=81=AF=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 --- .../users/_user_message_applide_action.html.erb | 12 ++++++------ app/views/users/_user_message_applied.html.erb | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/views/users/_user_message_applide_action.html.erb b/app/views/users/_user_message_applide_action.html.erb index 24f2471b5..850f6d456 100644 --- a/app/views/users/_user_message_applide_action.html.erb +++ b/app/views/users/_user_message_applide_action.html.erb @@ -1,12 +1,12 @@ <% if allow_to_show(ma) %> - :<%= link_to "同意", allow_to_join_project_project_memberships_path(:project_id => ma.applied.project, :applied_message_id => ma.id), :remote => true, :method => :post %> | - <%= link_to "拒绝", refused_allow_to_join_project_project_memberships_path(:project_id => ma.applied.project, :applied_message_id => ma.id), :remote => true, :method => :get %> + :<%= link_to "同意", allow_to_join_project_project_memberships_path(:project_id => ma.applied.project, :applied_message_id => ma.id), :remote => true, :method => :post, :class => "link-blue"%> | + <%= link_to "拒绝", refused_allow_to_join_project_project_memberships_path(:project_id => ma.applied.project, :applied_message_id => ma.id), :remote => true, :method => :get, :class => "link-blue" %> <% elsif ma.status == 4 %> - 被拒绝 + 被拒绝 <% elsif ma.status == 5 %> - 您已拒绝 + 您已拒绝 <% elsif ma.status == 6 %> - 已通过 + 已通过 <% elsif ma.status == 7 %> - 您已同意 + 您已同意 <% end %> \ No newline at end of file diff --git a/app/views/users/_user_message_applied.html.erb b/app/views/users/_user_message_applied.html.erb index a2eff7189..d15d8aac7 100644 --- a/app/views/users/_user_message_applied.html.erb +++ b/app/views/users/_user_message_applied.html.erb @@ -22,13 +22,15 @@
  • <%= render :partial => "users/user_message_applide_users", :locals =>{:ma => ma} %>
  • -
  • +
  • 以“<%= applied_project_message_type(ma.applied.role) %>”身份加入 <%= link_to ma.applied.project, project_path(ma.applied.project), :class => "link-blue", :target => '_blank' %> + +
  • +
  • <%= render :partial => "users/user_message_applide_action", :locals =>{:ma => ma} %> -
  • <%= time_tag(ma.created_at).html_safe %>
  • From 153efb7edabfd3afb228ba15524fef85c3ccdaf8 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 29 Jul 2016 19:42:21 +0800 Subject: [PATCH 36/52] =?UTF-8?q?=E5=B1=80=E9=83=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_join_exit_project.html.erb | 10 +++------- app/views/projects/_applied_status.html.erb | 9 +++++++++ 2 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 app/views/projects/_applied_status.html.erb diff --git a/app/views/layouts/_join_exit_project.html.erb b/app/views/layouts/_join_exit_project.html.erb index d39d3d67b..7d2f1b4d2 100644 --- a/app/views/layouts/_join_exit_project.html.erb +++ b/app/views/layouts/_join_exit_project.html.erb @@ -1,12 +1,8 @@
    - <% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %> - <%= watcher_link_for_project(@project, User.current) %> - - - <%= join_in_project_link(@project, User.current) %> - - <% end %> +
    + <%= render :partial => "projects/applied_status" %> +
    <% if User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) %> <%= link_to "#{l(:button_configure)}".html_safe, settings_project_path(@project), :class => "pr_join_a" %> diff --git a/app/views/projects/_applied_status.html.erb b/app/views/projects/_applied_status.html.erb new file mode 100644 index 000000000..d29819c03 --- /dev/null +++ b/app/views/projects/_applied_status.html.erb @@ -0,0 +1,9 @@ +<% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %> + <%= watcher_link_for_project(@project, User.current) %> + + <% if AppliedProject.where(:user_id => User.current, :project_id => @project_id).first.nil? %> + <%= join_in_project_link(@project, User.current) %> + <% else %> + 等待审批 + <% end %> +<% end %> \ No newline at end of file From b3d34d6e0fc0c3361136ec71beff366d3e914aea Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jul 2016 20:18:26 +0800 Subject: [PATCH 37/52] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E5=90=8D=E7=A7=B0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/courses_service.rb | 2 ++ app/views/admin/_courselist_detail_tr.html.erb | 2 +- app/views/admin/non_syllabus_courses.html.erb | 2 +- app/views/admin/syllabuses.html.erb | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index fd3aa6ebf..48a4a560c 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -397,6 +397,8 @@ class CoursesService if course if course_endTime_timeout? course @state = 2 + elsif course[:is_delete] == 1 + @state = 11 else if current_user.member_of_course?(course) #如果已经是成员 @state = 3 diff --git a/app/views/admin/_courselist_detail_tr.html.erb b/app/views/admin/_courselist_detail_tr.html.erb index 83b7904ce..6bec90845 100644 --- a/app/views/admin/_courselist_detail_tr.html.erb +++ b/app/views/admin/_courselist_detail_tr.html.erb @@ -7,7 +7,7 @@ - <%= link_to(course.teacher.show_name.truncate(6, omission: '...'), user_path(course.teacher)) %> + <%= link_to(course.teacher.show_name, user_path(course.teacher)) %> <%= course.class_period %> diff --git a/app/views/admin/non_syllabus_courses.html.erb b/app/views/admin/non_syllabus_courses.html.erb index 1be979eeb..c5a2c81ec 100644 --- a/app/views/admin/non_syllabus_courses.html.erb +++ b/app/views/admin/non_syllabus_courses.html.erb @@ -72,7 +72,7 @@ - <%= link_to(course.teacher.show_name.truncate(6, omission: '...'), user_path(course.teacher)) %> + <%= link_to(course.teacher.show_name, user_path(course.teacher)) %> <%= course.class_period %> diff --git a/app/views/admin/syllabuses.html.erb b/app/views/admin/syllabuses.html.erb index 194091abc..5098131da 100644 --- a/app/views/admin/syllabuses.html.erb +++ b/app/views/admin/syllabuses.html.erb @@ -52,7 +52,7 @@ - <%= link_to(syllabus.try(:user).try(:realname).truncate(6, omission: '...'), user_path(syllabus.user)) %> + <%= link_to syllabus.user.show_name, user_path(syllabus.user) %> <%= format_date(syllabus.created_at) %> @@ -70,7 +70,7 @@ <%= render :partial => 'admin/rename_course_name', :locals => {:course => course} %> - <%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %> + <%= link_to(course.teacher.show_name, user_path(course.teacher)) %> <%= format_date(course.created_at) %> From d0f83aab64c7802dc9f6ccfeaa1299e0b2b1c091 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jul 2016 20:24:04 +0800 Subject: [PATCH 38/52] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=A7=93=E5=92=8C?= =?UTF-8?q?=E5=90=8D=E4=B9=8B=E9=97=B4=E7=9A=84=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index afd45e08b..3d9e59f2e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -42,12 +42,12 @@ class User < Principal # Different ways of displaying/sorting users USER_FORMATS = { :firstname_lastname => { - :string => '#{firstname} #{lastname}', + :string => '#{firstname}#{lastname}', :order => %w(firstname lastname id), :setting_order => 1 }, :firstname_lastinitial => { - :string => '#{firstname} #{lastname.to_s.chars.first}.', + :string => '#{firstname}#{lastname.to_s.chars.first}.', :order => %w(firstname lastname id), :setting_order => 2 }, @@ -57,7 +57,7 @@ class User < Principal :setting_order => 3 }, :lastname_firstname => { - :string => '#{lastname} #{firstname}', + :string => '#{lastname}#{firstname}', :order => %w(lastname firstname id), :setting_order => 4 }, From 0bf9b5c6e6ce213cfb2a0049bff5aae11ff1173e Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 29 Jul 2016 20:31:24 +0800 Subject: [PATCH 39/52] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=BA=A2=E7=82=B9?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=20=20=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=A0=E5=85=A5=E9=A1=B9=E7=9B=AE=E5=85=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/applied_project_controller.rb | 14 +++++++---- app/models/user.rb | 3 ++- .../_applied_join_project.html.erb | 2 +- .../applied_join_project.js.erb | 2 +- app/views/layouts/new_base_user.html.erb | 23 +++++++++++++++++-- 5 files changed, 35 insertions(+), 9 deletions(-) diff --git a/app/controllers/applied_project_controller.rb b/app/controllers/applied_project_controller.rb index 221adc7bc..d779c7759 100644 --- a/app/controllers/applied_project_controller.rb +++ b/app/controllers/applied_project_controller.rb @@ -2,7 +2,9 @@ class AppliedProjectController < ApplicationController helper :watchers #申请加入项目 def applied_join_project - @project = Project.find_by_id(params[:object_id]) + if params[:object_id] + @project = Project.find_by_id(params[:object_id]) + end # @user_id = params[:user_id] # if params[:project_join] # if @project @@ -46,8 +48,12 @@ class AppliedProjectController < ApplicationController # role:成员角色 => 0(4:管理人员;5:开发人员;6:报告人员) # 申请成功则发送消息 def applied_project_info - @project = Project.find(params[:project_id]) - if params[:invite_code].to_s != @project.invite_code + if params[:project_id].nil? + @project = Project.where(:invite_code => params[:invite_code]).first + else + @project = Project.find(params[:project_id]) + end + if !@project || params[:invite_code].to_s != @project.invite_code @flag = 1 elsif User.current.member_of?(@project) @flag = 2 @@ -56,7 +62,7 @@ class AppliedProjectController < ApplicationController else @flag = 4 role = params[:member] == "member_manager" ? 3 : (params[:member] = "member_developer" ? 4 :5) - applied_project = AppliedProject.create(:user_id => User.current.id, :project_id => params[:project_id], :role => role) + applied_project = AppliedProject.create(:user_id => User.current.id, :project_id => @project.id, :role => role) # 申请成功则给项目管理员发送邮件及发送消息 Mailer.run.applied_project(applied_project) end diff --git a/app/models/user.rb b/app/models/user.rb index 996aa9be7..8de109169 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -369,7 +369,8 @@ class User < Principal system_messages_count = SystemMessage.where("created_at >?", onclick_time).count at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time).count - messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count + applied_count = AppliedMessage.where("user_id=? and viewed =? and created_at >?", user.id, 0, onclick_time).count + messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count + applied_count end # 查询指派给我的缺陷记录 diff --git a/app/views/applied_project/_applied_join_project.html.erb b/app/views/applied_project/_applied_join_project.html.erb index ad2d020c2..457cdf9cc 100644 --- a/app/views/applied_project/_applied_join_project.html.erb +++ b/app/views/applied_project/_applied_join_project.html.erb @@ -4,7 +4,7 @@
    - <%= form_tag( url_for(:controller => 'applied_project', :action => 'applied_project_info', :project_id => @project.id), :remote => true, :id => 'project_applied_form') do %> + <%= form_tag( url_for(:controller => 'applied_project', :action => 'applied_project_info', :project_id => (@project.nil? ? nil : @project.id)), :remote => true, :id => 'project_applied_form') do %>
    • diff --git a/app/views/applied_project/applied_join_project.js.erb b/app/views/applied_project/applied_join_project.js.erb index 6aa4481a4..5d9f7f87a 100644 --- a/app/views/applied_project/applied_join_project.js.erb +++ b/app/views/applied_project/applied_join_project.js.erb @@ -1,3 +1,3 @@ -var htmlvalue = "<%= escape_javascript(render :partial => 'applied_join_project', locals: {:project_id => @project.id}) %>"; +var htmlvalue = "<%= escape_javascript(render :partial => 'applied_join_project', locals: {:project_id => (@project.nil? ? nil : @project.id)}) %>"; pop_box_new(htmlvalue,460,40,50); diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index f280f6506..bcf00dd2c 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -245,8 +245,21 @@
    <%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :class => "homepageMenuText" %> - <% if is_current_user%> - <%=link_to "", new_project_path(:host=> Setting.host_name), :class => "homepageMenuSetting fr", :style => "margin-right:10px;", :title => "新建项目"%> + <% if is_current_user %> +
    +
      +
    • +
        +
      • + <%= link_to "新建项目", new_project_path(:host=> Setting.host_name), :class => "menuGrey"%> +
      • +
      • + <%= link_to "加入项目", applied_join_project_path,:remote => true,:class => "menuGrey",:method => "post"%> +
      • +
      +
    • +
    +
    <% end%>
    <%# if @user.projects.visible.count > 0 @@ -362,6 +375,12 @@ $("#courseMenu").mouseleave(function(){ $("#topnav_course_menu").hide(); }); + $("#projectMenu").mouseenter(function(){ + $("#topnav_project_menu").show(); + }); + $("#projectMenu").mouseleave(function(){ + $("#topnav_project_menu").hide(); + }); function leftCourseslistChange(){ $('#homepageLeftMenuCourses').slideToggle(); $('#hide_show_courseicon').toggleClass("homepageLeftMenuHideIcon"); From 02bee33ad27678aadda12d29438d9e127cefaf98 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jul 2016 20:33:35 +0800 Subject: [PATCH 40/52] =?UTF-8?q?=E8=BA=AB=E4=BB=BD=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=8A=A0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_course_base_info.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb index afd82646a..d2cc0840d 100644 --- a/app/views/layouts/_course_base_info.html.erb +++ b/app/views/layouts/_course_base_info.html.erb @@ -61,9 +61,9 @@ <% is_TE = get_user_member_roles_course @course, User.current, 9 %> <% is_ST = get_user_member_roles_course @course, User.current, 10 %> <% if !is_teacher && (is_TA || is_TE) %> - <%= link_to '教师身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => 10, :tar_role => (is_TA ? 7 : 9)), :class => "sy_btn_orange mr10 fl" %> + <%= link_to '教师身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => 10, :tar_role => (is_TA ? 7 : 9)), :class => "sy_btn_orange mr10 fl", :title => "由学生身份切换至教师身份" %> <% elsif is_teacher && is_ST %> - <%= link_to '学生身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => (is_TA ? 7 : 9), :tar_role => 10), :class => "sy_btn_orange mr10 fl" %> + <%= link_to '学生身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => (is_TA ? 7 : 9), :tar_role => 10), :class => "sy_btn_orange mr10 fl", :title => "由教师身份切换至学生身份" %> <% end %> <% unless (is_teacher || is_TA || is_TE) %>
    <%= join_in_course_header(@course, User.current) %>
    From 430a93e4b2f6c19224c2c2f23051bd540c36cd0b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 29 Jul 2016 20:48:36 +0800 Subject: [PATCH 41/52] =?UTF-8?q?=E5=8D=95=E4=BD=8D=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=8A=9F=E8=83=BD=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 2 +- app/controllers/school_controller.rb | 6 ++++++ app/views/admin/_all_schools.html.erb | 1 - app/views/admin/applied_schools.html.erb | 10 ++++----- app/views/admin/has_applied_schools.html.erb | 21 ++++++++----------- app/views/layouts/base_admin.html.erb | 7 +++++++ .../users/_user_message_applied.html.erb | 10 ++++++++- config/locales/zh.yml | 2 +- public/stylesheets/application.css | 3 +++ 9 files changed, 41 insertions(+), 21 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 1b95ef895..7602b10a5 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -160,7 +160,7 @@ class AdminController < ApplicationController @sort = "" if params[:sort] && (params[:order] == 'name') # courses = School.find_by_sql("SELECT c.*,count(c.id) FROM courses c,course_activities ca WHERE c.id = ca.course_id AND c.name like '%#{name}%' GROUP BY c.id ORDER BY count(c.id) #{params[:sort]}, c.id desc") - school = School.find_by_sql(" SELECT aas.name FROM apply_add_schools aas where aas.status = '0' GROUP BY CONVERT(name USING gbk) #{params[:sort]}, aas.id desc ") + school = School.find_by_sql(" SELECT aas.name FROM apply_add_schools aas where aas.status = '0' ORDER BY CONVERT(aas.name USING gbk) #{params[:sort]}, aas.id asc ") @order = params[:order] @sort = params[:sort] end diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index ec585e2b2..b927b1108 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -187,6 +187,12 @@ class SchoolController < ApplicationController user_extention= User.current.extensions user_extention.school_id = school.id user_extention.save! + + # status=4 向管理员发送信息 + users = User.where(:admin => 1) + users.each do |user| + AppliedMessage.create(:user_id => user.id, :status => 4, :viewed => true, :applied_id => school.id, :applied_type => "ApplyAddSchools", :name => school.name ) + end else data[:result] = 3 end diff --git a/app/views/admin/_all_schools.html.erb b/app/views/admin/_all_schools.html.erb index af59d7687..d4cf916f5 100644 --- a/app/views/admin/_all_schools.html.erb +++ b/app/views/admin/_all_schools.html.erb @@ -1,5 +1,4 @@ <%= stylesheet_link_tag 'css/common','css/popup' %> -
    更改为
    diff --git a/app/views/admin/applied_schools.html.erb b/app/views/admin/applied_schools.html.erb index 32e67914f..507cb7c49 100644 --- a/app/views/admin/applied_schools.html.erb +++ b/app/views/admin/applied_schools.html.erb @@ -53,7 +53,7 @@ <%= apply.id %> - + <%= apply.name %> @@ -65,7 +65,7 @@ <%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %> - + <%= apply.address %> @@ -76,9 +76,9 @@ <%= format_date(apply.created_at) %> - <%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }) %> - <%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure)) %> - <%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true %> + <%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }, :class => "application-default-link" ) %> + <%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %> + <%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true, :class => "application-default-link" %> diff --git a/app/views/admin/has_applied_schools.html.erb b/app/views/admin/has_applied_schools.html.erb index 11361dbac..555dce689 100644 --- a/app/views/admin/has_applied_schools.html.erb +++ b/app/views/admin/has_applied_schools.html.erb @@ -38,6 +38,9 @@ 原名 + + 用户 + 创建时间 @@ -53,7 +56,7 @@ <%= apply.id %> - + <% unless apply.school_id.nil? %> <% school_name = School.where("id=?", apply.school_id).first %> <%= school_name.name %> @@ -71,12 +74,16 @@ <%= school_province.province %> <% end %> - + <%= apply.address %> <%= apply.name %> + + <% count = UserExtensions.where("school_id = #{apply.school_id}").count %> + <%= count %> + <%= format_date(apply.created_at) %> @@ -84,16 +91,6 @@ <%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'applied' },:method => :delete, :confirm => l(:text_are_you_sure) ) %> - <% unless apply.remarks.blank? %> - - - - - - <%= apply.remarks %> - - - <% end %> <% end %> <% end %> diff --git a/app/views/layouts/base_admin.html.erb b/app/views/layouts/base_admin.html.erb index 81cc2df9d..7f62da514 100644 --- a/app/views/layouts/base_admin.html.erb +++ b/app/views/layouts/base_admin.html.erb @@ -62,3 +62,10 @@ <%= call_hook :view_layouts_base_body_bottom %> + + diff --git a/app/views/users/_user_message_applied.html.erb b/app/views/users/_user_message_applied.html.erb index 0a4924c27..d6815e988 100644 --- a/app/views/users/_user_message_applied.html.erb +++ b/app/views/users/_user_message_applied.html.erb @@ -27,7 +27,15 @@ <%= link_to ma.name + "的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", { :controller=> "my",:action => "account" } %>
  • <%= time_tag(ma.created_at).html_safe %>
  • - <% end %> + <% elsif ma.status == 4 %> + <%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + "> +
  • + + <%= User.where("id=?", ma.user_id).first.login %>提交了申请:添加新的单位“<%= ma.name %>” +
  • +
  • <%= time_tag(ma.created_at).html_safe %>
  • + <% end %> <% end %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index df9c26895..1340e7aa6 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -388,7 +388,7 @@ zh: label_organization_name: 组织名称 label_organization_list: 组织列表 label_school_plural: 学校列表 - label_applied_shcools: 单位名称列表 + label_applied_shcools: 单位审核 label_organization_new: 新建组织 label_edit_organization: 编辑组织 label_organization_edit: 修改组织 diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 112f8224b..9031ed9d8 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1281,6 +1281,9 @@ a, a:link, a:visited{ color: #169; text-decoration: none; } a:hover, a:active{ color: #c61a1a; text-decoration: underline;} a img{ border: 0; } +a.application-default-link {color: #169 !important; text-decoration: none;} +a.application-default-link:hover {color: #c61a1a !important; text-decoration: underline;} + a.issue.closed, a.issue.closed:link, a.issue.closed:visited { color: #999; text-decoration: line-through; } a.project.closed, a.project.closed:link, a.project.closed:visited { color: #999; } a.user.locked, a.user.locked:link, a.user.locked:visited {color: #999;} From 643b06484b34adeebe62fcaa4a7586e05b29db23 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 29 Jul 2016 20:50:55 +0800 Subject: [PATCH 42/52] =?UTF-8?q?=E6=B6=88=E6=81=AF=E8=A1=A8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/members_controller.rb | 8 ++++---- app/models/applied_message.rb | 2 +- app/models/applied_project.rb | 2 +- .../users/_user_message_applied.html.erb | 2 +- ...60729124038_add_role_to_applied_message.rb | 5 +++++ ...24833_add_project_id_to_applied_message.rb | 5 +++++ db/schema.rb | 20 +++++++++++-------- 7 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 db/migrate/20160729124038_add_role_to_applied_message.rb create mode 100644 db/migrate/20160729124833_add_project_id_to_applied_message.rb diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 6d3cf6aa5..31d32bb59 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -77,9 +77,9 @@ class MembersController < ApplicationController project.user_grades << user_grades unless user_grades.first.user_id.nil? @applied_message.update_attribute(:status, 2) # 添加成功后,申请人收到消息 - AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 6, :viewed => true, :applied_user_id => @applied_message.user_id) + AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 6, :viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role) # 添加成功后,批准人收到消息 - AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id) + AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role) rescue Exception => e puts e end @@ -96,9 +96,9 @@ class MembersController < ApplicationController @applied_message.update_attribute(:status, 3) applied_project = @applied_message.applied # 发送消息给被拒者,user_id对应的收到信息的用户 - AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4, :viewed => true, :applied_user_id => @applied_message.user_id) + AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4, :viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role) # 发送消息给拒绝者 - AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5, :viewed => true, :applied_user_id => @applied_message.applied_user_id) + AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role) # applied_project.delete end diff --git a/app/models/applied_message.rb b/app/models/applied_message.rb index 0175fcf47..ee22f21c8 100644 --- a/app/models/applied_message.rb +++ b/app/models/applied_message.rb @@ -1,6 +1,6 @@ class AppliedMessage < ActiveRecord::Base # status: 0表示未批准; status:1表示已批准; status: 2表示已拒绝 - attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id + attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id, :role, :project_id belongs_to :applied ,:polymorphic => true belongs_to :apply_add_schools belongs_to :user diff --git a/app/models/applied_project.rb b/app/models/applied_project.rb index fdc9a602e..b1945a937 100644 --- a/app/models/applied_project.rb +++ b/app/models/applied_project.rb @@ -10,7 +10,7 @@ class AppliedProject < ActiveRecord::Base # 仅仅给项目管理人员发送消息 def send_appliled_message self.project.managers.each do |member| - self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => true, :viewed => false, :applied_user_id => self.user_id) + self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => true, :viewed => false, :applied_user_id => self.user_id, :role => self.role, :project_id => self.project_id) end # end end diff --git a/app/views/users/_user_message_applied.html.erb b/app/views/users/_user_message_applied.html.erb index d15d8aac7..af62276e0 100644 --- a/app/views/users/_user_message_applied.html.erb +++ b/app/views/users/_user_message_applied.html.erb @@ -23,7 +23,7 @@ <%= render :partial => "users/user_message_applide_users", :locals =>{:ma => ma} %>
  • - 以“<%= applied_project_message_type(ma.applied.role) %>”身份加入 + 以“<%= applied_project_message_type(ma.role) %>”身份加入 <%= link_to ma.applied.project, project_path(ma.applied.project), :class => "link-blue", :target => '_blank' %>
  • diff --git a/db/migrate/20160729124038_add_role_to_applied_message.rb b/db/migrate/20160729124038_add_role_to_applied_message.rb new file mode 100644 index 000000000..c6a73c794 --- /dev/null +++ b/db/migrate/20160729124038_add_role_to_applied_message.rb @@ -0,0 +1,5 @@ +class AddRoleToAppliedMessage < ActiveRecord::Migration + def change + add_column :applied_messages, :role, :integer + end +end diff --git a/db/migrate/20160729124833_add_project_id_to_applied_message.rb b/db/migrate/20160729124833_add_project_id_to_applied_message.rb new file mode 100644 index 000000000..803c5d8aa --- /dev/null +++ b/db/migrate/20160729124833_add_project_id_to_applied_message.rb @@ -0,0 +1,5 @@ +class AddProjectIdToAppliedMessage < ActiveRecord::Migration + def change + add_column :applied_messages, :project_id, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 4747a74e3..f8a113834 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160728075947) do +ActiveRecord::Schema.define(:version => 20160729124833) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -78,16 +78,20 @@ ActiveRecord::Schema.define(:version => 20160728075947) do t.integer "user_id" t.integer "applied_id" t.string "applied_type" - t.integer "viewed", :default => 0 - t.integer "status", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "viewed", :default => 0 + t.integer "status", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "applied_user_id" + t.integer "role" + t.integer "project_id" end create_table "applied_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - t.integer "role", :default => 0 + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.integer "role", :default => 0 + t.integer "applied_user_id" end create_table "apply_add_schools", :force => true do |t| From 8d625eff5e6b11d9b57abbfd60da0408d2500ba3 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 29 Jul 2016 21:04:01 +0800 Subject: [PATCH 43/52] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E5=B0=B1=E7=94=A8=E6=88=B7=E5=9B=BE=E5=83=8F=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/members_controller.rb | 12 ++++++++---- .../users/_user_message_applide_action.html.erb | 4 ++-- app/views/users/_user_message_applied.html.erb | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 31d32bb59..4f34bb252 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -77,9 +77,11 @@ class MembersController < ApplicationController project.user_grades << user_grades unless user_grades.first.user_id.nil? @applied_message.update_attribute(:status, 2) # 添加成功后,申请人收到消息 - AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 6, :viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role) + AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id , + :status => 6, :viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id) # 添加成功后,批准人收到消息 - AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role) + AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id , + :status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id) rescue Exception => e puts e end @@ -96,9 +98,11 @@ class MembersController < ApplicationController @applied_message.update_attribute(:status, 3) applied_project = @applied_message.applied # 发送消息给被拒者,user_id对应的收到信息的用户 - AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4, :viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role) + AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4, + :viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id) # 发送消息给拒绝者 - AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role) + AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5, + :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id) # applied_project.delete end diff --git a/app/views/users/_user_message_applide_action.html.erb b/app/views/users/_user_message_applide_action.html.erb index 850f6d456..fc56b9f22 100644 --- a/app/views/users/_user_message_applide_action.html.erb +++ b/app/views/users/_user_message_applide_action.html.erb @@ -1,6 +1,6 @@ <% if allow_to_show(ma) %> - :<%= link_to "同意", allow_to_join_project_project_memberships_path(:project_id => ma.applied.project, :applied_message_id => ma.id), :remote => true, :method => :post, :class => "link-blue"%> | - <%= link_to "拒绝", refused_allow_to_join_project_project_memberships_path(:project_id => ma.applied.project, :applied_message_id => ma.id), :remote => true, :method => :get, :class => "link-blue" %> + :<%= link_to "同意", allow_to_join_project_project_memberships_path(:project_id => ma.project_id, :applied_message_id => ma.id), :remote => true, :method => :post, :class => "link-blue"%> | + <%= link_to "拒绝", refused_allow_to_join_project_project_memberships_path(:project_id => ma.project_id, :applied_message_id => ma.id), :remote => true, :method => :get, :class => "link-blue" %> <% elsif ma.status == 4 %> 被拒绝 <% elsif ma.status == 5 %> diff --git a/app/views/users/_user_message_applied.html.erb b/app/views/users/_user_message_applied.html.erb index af62276e0..825610057 100644 --- a/app/views/users/_user_message_applied.html.erb +++ b/app/views/users/_user_message_applied.html.erb @@ -17,14 +17,14 @@ <% elsif ma && ma.applied_type == "AppliedProject" %>
    • - <%=link_to image_tag(url_to_avatar(ma.applied.user), :width => "30", :height => "30"), user_path(ma.applied.user), :target => '_blank' %> + <%=link_to image_tag(url_to_avatar(applied_project_users(ma)), :width => "30", :height => "30"), user_path(applied_project_users(ma)), :target => '_blank' %>
    • <%= render :partial => "users/user_message_applide_users", :locals =>{:ma => ma} %>
    • 以“<%= applied_project_message_type(ma.role) %>”身份加入 - <%= link_to ma.applied.project, project_path(ma.applied.project), :class => "link-blue", :target => '_blank' %> + <%= link_to ma.applied.project, project_path(ma.project_id), :class => "link-blue", :target => '_blank' %>
    • From f857ceab3270bc7bc58382bc4a841a263137e428 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 29 Jul 2016 21:07:15 +0800 Subject: [PATCH 44/52] =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=B8=AD=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=B7=BB=E5=8A=A0title?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_applied.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/users/_user_message_applied.html.erb b/app/views/users/_user_message_applied.html.erb index 825610057..15f4046a5 100644 --- a/app/views/users/_user_message_applied.html.erb +++ b/app/views/users/_user_message_applied.html.erb @@ -24,7 +24,8 @@
    • 以“<%= applied_project_message_type(ma.role) %>”身份加入 - <%= link_to ma.applied.project, project_path(ma.project_id), :class => "link-blue", :target => '_blank' %> + <% project = Project.find(ma.project_id) %> + <%= link_to project.name, project_path(ma.project_id), :class => "link-blue", :target => '_blank', :title => "#{project.name}" %>
    • From 541408064630e048624a9ea82b6a915febc0431b Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 29 Jul 2016 21:21:59 +0800 Subject: [PATCH 45/52] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=92=8C=E6=8B=92=E7=BB=9D=E7=94=A8=E6=88=B7=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E5=86=8D=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/members_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 4f34bb252..46b5d812d 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -103,7 +103,7 @@ class MembersController < ApplicationController # 发送消息给拒绝者 AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id) - # applied_project.delete + applied_project.delete end def create @@ -370,6 +370,11 @@ class MembersController < ApplicationController grade.destroy end end + # 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除 + applied_projects = AppliedProject.where(:project_id => @project.id, :user_id => @member.user_id).first + unless applied_projects.nil? + applied_projects.delete + end #移出项目发送消息 ForgeMessage.create(:user_id => @member.user_id, :project_id => @project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => User.current.id) end From cf63d252e21fce2568a8e3f61299e5b712c7efdf Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 29 Jul 2016 21:37:35 +0800 Subject: [PATCH 46/52] =?UTF-8?q?=E5=B1=80=E9=83=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/applied_project/applied_project_info.js.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/applied_project/applied_project_info.js.erb b/app/views/applied_project/applied_project_info.js.erb index 7fff1b516..ab3cb396d 100644 --- a/app/views/applied_project/applied_project_info.js.erb +++ b/app/views/applied_project/applied_project_info.js.erb @@ -1,4 +1,5 @@ +<% if @project %> +$("#join_in_project_applied").html('<%= escape_javascript( render :partial => 'projects/applied_status') %>'); +<% end %> var htmlvalue = "<%= escape_javascript(render :partial => 'applied_project/applied_project_tip') %>"; pop_box_new(htmlvalue,380,40,50); - -//$("#join_in_project").attr('href','<%#= join_in_project_link(@project, User.current) %>'); From 807db1ac405c53577f1d9985bb640f71cfe790e2 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Jul 2016 21:41:19 +0800 Subject: [PATCH 47/52] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E9=93=BE=E6=8E=A5=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_join_course_course_message.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/users/_join_course_course_message.html.erb b/app/views/users/_join_course_course_message.html.erb index cecbe2755..c0d32eda1 100644 --- a/app/views/users/_join_course_course_message.html.erb +++ b/app/views/users/_join_course_course_message.html.erb @@ -23,9 +23,9 @@
    • <% if ma.status == 0 || ma.status.nil?%> - <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%> + <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true',:class=>'linkBlue'%> | - <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%> + <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true',:class=>'linkBlue'%> <% elsif ma.status == 1%> 您已经同意了该申请 <% elsif ma.status == 2%> From d6178ec7dd2a1be954ddf9b2380274d858cc4eb6 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 29 Jul 2016 21:45:52 +0800 Subject: [PATCH 48/52] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=8D=95=E4=BD=8D=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/school_controller.rb | 2 +- app/models/applied_message.rb | 3 ++- app/views/admin/applied_schools.html.erb | 2 +- app/views/admin/has_applied_schools.html.erb | 2 +- app/views/users/_user_message_applied.html.erb | 10 ++++++---- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index b927b1108..037fdd411 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -191,7 +191,7 @@ class SchoolController < ApplicationController # status=4 向管理员发送信息 users = User.where(:admin => 1) users.each do |user| - AppliedMessage.create(:user_id => user.id, :status => 4, :viewed => true, :applied_id => school.id, :applied_type => "ApplyAddSchools", :name => school.name ) + AppliedMessage.create(:user_id => user.id, :status => 4, :applied_user_id => User.current.id, :viewed => true, :applied_id => school.id, :applied_type => "ApplyAddSchools", :name => school.name ) end else data[:result] = 3 diff --git a/app/models/applied_message.rb b/app/models/applied_message.rb index c008a2284..2e8891fcd 100644 --- a/app/models/applied_message.rb +++ b/app/models/applied_message.rb @@ -1,6 +1,7 @@ class AppliedMessage < ActiveRecord::Base # status: 0表示未批准; status:1表示已批准; status: 2表示已拒绝 - attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id, :role, :project_id, :name belongs_to :applied ,:polymorphic => true + attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id, :role, :project_id, :name + belongs_to :applied ,:polymorphic => true belongs_to :apply_add_schools belongs_to :user has_many :message_alls, :class_name => 'MessageAll', :as =>:message, :dependent => :destroy diff --git a/app/views/admin/applied_schools.html.erb b/app/views/admin/applied_schools.html.erb index 507cb7c49..518624b5f 100644 --- a/app/views/admin/applied_schools.html.erb +++ b/app/views/admin/applied_schools.html.erb @@ -59,7 +59,7 @@ <% user = User.where("id=?", apply.user_id).first %> <% unless user.nil? %> - <%= user.login %> + <%=link_to user.show_name, user_path(user) %> <% end %> diff --git a/app/views/admin/has_applied_schools.html.erb b/app/views/admin/has_applied_schools.html.erb index 555dce689..286edbd19 100644 --- a/app/views/admin/has_applied_schools.html.erb +++ b/app/views/admin/has_applied_schools.html.erb @@ -65,7 +65,7 @@ <% user = User.where("id=?", apply.user_id).first %> <% unless user.nil? %> - <%= user.login %> + <%=link_to user.show_name, user_path(user) %> <% end %> diff --git a/app/views/users/_user_message_applied.html.erb b/app/views/users/_user_message_applied.html.erb index b2735f32a..d52e4c2c8 100644 --- a/app/views/users/_user_message_applied.html.erb +++ b/app/views/users/_user_message_applied.html.erb @@ -1,6 +1,7 @@ <% if ma.class == AppliedMessage %> <% if ma.applied_type == "ApplyAddSchools" %> + <% if ma.status == 1 || ma.status == 2 || ma.status == 3 || ma.status == 4 %> + <% end %> <% elsif ma && ma.applied_type == "AppliedProject" %>