diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index f579090e6..58d754af4 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -811,7 +811,7 @@ class StudentWorkController < ApplicationController @new_score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" @new_score.user_id = User.current.id @new_score.student_work_id = @work.id - if @is_teacher && @work.work_status == 0 + if @is_teacher && !@new_score.score.nil? && @work.work_status == 0 @work.update_attributes(:work_status => 1, :commit_time => Time.now) end if User.current.admin? diff --git a/app/models/data_exception.rb b/app/models/data_exception.rb new file mode 100644 index 000000000..70e03b524 --- /dev/null +++ b/app/models/data_exception.rb @@ -0,0 +1,3 @@ +class DataException < ActiveRecord::Base + attr_accessible :container_id, :container_type, :message +end diff --git a/app/models/poll.rb b/app/models/poll.rb index b0499b572..d2f5b40fe 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -44,7 +44,9 @@ class Poll < ActiveRecord::Base def act_as_course_activity if self.polls_type == "Course" if self.polls_status == 2 #问卷是发布状态 - self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.polls_group_id) + if CourseActivity.where(:course_id => self.polls_group_id, :user_id => self.user_id, :course_act_id => self.id, :course_act_type => 'Poll').count == 0 + self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.polls_group_id) + end elsif self.polls_status == 1 #问卷是新建状态 self.course_acts.destroy_all end diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index 8195e5ee3..5fb8cdf4d 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -92,7 +92,7 @@
<%= format_time( @article.created_on)%>
-
+
<%= @article.content.to_s.html_safe %>
diff --git a/app/views/issues/_detail.html.erb b/app/views/issues/_detail.html.erb index 5f31f6281..aa5e13d49 100644 --- a/app/views/issues/_detail.html.erb +++ b/app/views/issues/_detail.html.erb @@ -28,7 +28,7 @@ <%= render :partial => 'action_menu' %>
<% if @issue.description? || @issue.attachments.any? -%> -
+
<% if @issue.description? %> <%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %> <%= textAreailizable @issue, :description, :attachments => @issue.attachments %> diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index de3f1d41f..b350c05c8 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -59,7 +59,7 @@ <% if params[:action] == "new" %> 取消 <% else %> - 取消 + <%= link_to "取消", issue_path(@issue), :class => "sy_btn_grey mr5 fr" %> <% end %> diff --git a/app/views/issues/_issue_commit_ids.html.erb b/app/views/issues/_issue_commit_ids.html.erb index 745b8ebf9..5cd2b7e12 100644 --- a/app/views/issues/_issue_commit_ids.html.erb +++ b/app/views/issues/_issue_commit_ids.html.erb @@ -1,6 +1,6 @@ -<% if @issue_commit_ids %> +<% unless @issue_commit_ids.blank? %> <% @issue_commit_ids.each do |commit_id| %> -
+
<%= link_to commit_id[0,8], {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit_id}, :target => "_blank", :class => "commit_id_value" %> <% if @issue %> <% if User.current.admin? || is_project_manager?(User.current.id, @project.id) || User.current.id == @issue.author_id %> @@ -13,6 +13,4 @@ <% end %>
<% end %> -<% else %> -
暂无
<% end %> \ No newline at end of file diff --git a/app/views/issues/_issue_commit_ids_show.html.erb b/app/views/issues/_issue_commit_ids_show.html.erb new file mode 100644 index 000000000..4633c87ec --- /dev/null +++ b/app/views/issues/_issue_commit_ids_show.html.erb @@ -0,0 +1,20 @@ +<% if !@issue_commit_ids.blank? %> + 关联Commit + <% @issue_commit_ids.each do |commit_id| %> +
+ <%= link_to commit_id[0,8], {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit_id}, :target => "_blank", :class => "commit_id_value" %> + <% if @issue %> + <% if User.current.admin? || is_project_manager?(User.current.id, @project.id) || User.current.id == @issue.author_id %> + <%= link_to "×", issue_commit_delete_issues_path(:commit_id => commit_id, :project_id => @project.id, :issue_commit_ids => @issue_commit_ids, :issue_id => @issue.try(:id)), :remote => true, :style => "color:#fff;" %> + <% end %> + <% else %> + <% if User.current.member_of?(@project) %> + <%= link_to "×", issue_commit_delete_issues_path(:commit_id => commit_id, :project_id => @project.id, :issue_commit_ids => @issue_commit_ids, :issue_id => @issue.try(:id)), :remote => true, :style => "color:#fff;" %> + <% end %> + <% end %> +
+ <% end %> +<% else %> + 关联Commit + +<% end %> \ No newline at end of file diff --git a/app/views/issues/_project_issue.html.erb b/app/views/issues/_project_issue.html.erb index aa6d9d3fe..97f9945a5 100644 --- a/app/views/issues/_project_issue.html.erb +++ b/app/views/issues/_project_issue.html.erb @@ -73,7 +73,7 @@ <%= activity.journals.count %> <% end %>
- <%= link_to "", issue_path(activity.id, :edit => 'true'), :class => 'sy_icons_edit fl mt15', :style => "margin-top:25px;", :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %> + <%= link_to "", edit_issue_path(activity.id), :class => 'sy_icons_edit fl mt15', :style => "margin-top:25px;", :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %> <% if !defined?(project_id) && !defined?(user_id) %> <%= link_to "", issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'sy_icons_del fl mt15', :style => "margin-top:25px;" if User.current.allowed_to?(:delete_issues, activity.project) %> <% elsif defined?(project_id) %> diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index eb25deda0..fbb3ac538 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -37,7 +37,7 @@
-
    +
    • 当前状态 <%= @issue.status.name %> @@ -74,10 +74,8 @@ <%= @issue.done_ratio %>%
    • <% end %> -
    • 关联Commit -
      - <%= render :partial => "issues/issue_commit_ids" %> -
      +
    • + <%= render :partial => "issues/issue_commit_ids_show" %>
    diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 922afe740..1066c494d 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -45,7 +45,7 @@ <%= link_to @memo.author.show_name, user_path(@memo.author), :class => "linkBlue2", :target=> "_blank"%>
<%= format_date( @memo.created_at)%>
-
+
<%= @memo.content.html_safe%>
diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 6c00b54b4..414bdbfb4 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -73,7 +73,7 @@
<%= format_time( @topic.created_on)%>
-
+
<%= @topic.content.html_safe%>
diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb index 19e8b30d5..da745e466 100644 --- a/app/views/messages/_org_subfield_show.html.erb +++ b/app/views/messages/_org_subfield_show.html.erb @@ -104,7 +104,7 @@
<%= format_time(@topic.created_on) %>
-
+
<%= @topic.content.html_safe %>
diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index 3cf97c076..7316d82e8 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -136,7 +136,7 @@
<%= format_time( @topic.created_on)%>
-
+
<%= @topic.content.html_safe%>
diff --git a/app/views/my/clear_user_avatar_temp.js.erb b/app/views/my/clear_user_avatar_temp.js.erb index 3278adcb5..96e6dc5e0 100644 --- a/app/views/my/clear_user_avatar_temp.js.erb +++ b/app/views/my/clear_user_avatar_temp.js.erb @@ -1,8 +1,8 @@ - $("img[nhname='avatar_image']").attr('src',$("#nh_source_tx").attr('src')); - $('#ajax-modal').html($("#nh_tx_dialog_html").html()); - showModal('ajax-modal','460px'); - $('#ajax-modal').siblings().hide(); - $('#ajax-modal').parent().removeClass("alert_praise").removeClass("copyCoursePopup"); - $('#ajax-modal').parent().css("top","30%").css("left","40%"); - $('#ajax-modal').parent().addClass("alert_box"); - $('#ajax-modal').parent().css("border", "3px solid #269ac9").css("border-radius", "0").css(" -webkit-border-radius", "0").css(" -moz-border-radius", "0"); \ No newline at end of file +$("img[nhname='avatar_image']").attr('src',$("#nh_source_tx").attr('src')); +$('#ajax-modal').html($("#nh_tx_dialog_html").html()); +showModal('ajax-modal','460px'); +$('#ajax-modal').siblings().hide(); +$('#ajax-modal').parent().removeClass("alert_praise").removeClass("copyCoursePopup"); +$('#ajax-modal').parent().css("top","30%").css("left","40%"); +$('#ajax-modal').parent().addClass("alert_box"); +$('#ajax-modal').parent().css("border", "3px solid #269ac9").css("border-radius", "0").css(" -webkit-border-radius", "0").css(" -moz-border-radius", "0"); \ No newline at end of file diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 7fb6bad7f..73c78f98c 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -70,7 +70,7 @@
<%= format_time( @news.created_on)%>
-
+
<%= @news.description.html_safe%>
diff --git a/app/views/news/_organization_show.html.erb b/app/views/news/_organization_show.html.erb index c86d71d63..7fcc0f413 100644 --- a/app/views/news/_organization_show.html.erb +++ b/app/views/news/_organization_show.html.erb @@ -60,7 +60,7 @@
<%= format_time( @news.created_on)%>
-
+
<%= @news.description.html_safe%>
diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb index 29fe6a207..aafba092e 100644 --- a/app/views/news/_project_show.html.erb +++ b/app/views/news/_project_show.html.erb @@ -74,7 +74,7 @@
<%= format_time( @news.created_on)%>
-
+
<%= @news.description.html_safe%>
diff --git a/app/views/projects/_act_issues.html.erb b/app/views/projects/_act_issues.html.erb index 022144364..173466117 100644 --- a/app/views/projects/_act_issues.html.erb +++ b/app/views/projects/_act_issues.html.erb @@ -17,7 +17,7 @@
    • - <%= link_to l(:button_edit), issue_path(activity.id, :edit => 'true'), :class => 'postOptionLink', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %> + <%= link_to l(:button_edit), edit_issue_path(activity.id), :class => 'postOptionLink', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
    • <% if !defined?(project_id) && !defined?(user_id) %> diff --git a/app/views/projects/_project_attachment.html.erb b/app/views/projects/_project_attachment.html.erb index 580e5bee2..7f5a6a2cf 100644 --- a/app/views/projects/_project_attachment.html.erb +++ b/app/views/projects/_project_attachment.html.erb @@ -9,10 +9,10 @@
      <%= link_to activity.try(:author).show_name, user_path(activity.author_id), :class => "newsBlue mr15" %> TO - <%= link_to activity.project.name.to_s+" | 项目资源", project_files_path(activity.project), :class => "newsBlue ml15" %> + <%= link_to activity.project.name.to_s+" | 项目资源", project_files_path(activity.course), :class => "newsBlue ml15" %>
      - <%= link_to activity.filename, project_files_path(activity.project), :class => "postGrey" %> + <%= link_to activity.filename, project_files_path(activity.course), :class => "postGrey" %>
      diff --git a/app/views/pull_requests/_show_container.html.erb b/app/views/pull_requests/_show_container.html.erb index 24216ac77..974e64387 100644 --- a/app/views/pull_requests/_show_container.html.erb +++ b/app/views/pull_requests/_show_container.html.erb @@ -6,10 +6,15 @@
      项目分支 <%= @request.source_branch %> 和 <%= @request.target_branch %> 似乎没有差异,请将新改动提交至源分支或者切换到其它目标分支
      +<% elsif !@request.merge_when_build_succeeds %> +
      + Pull Request中存在冲突,请先解决冲突或者手动进行合并。 +
      <% else %> <% if is_project_manager?(User.current.id, @project.id) %>
      - 在管理员接受后,将由系统自动合并。<%= link_to "接受", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "linkBlue2", :remote => true %> + 在管理员接受后,将由系统自动合并。 + <%= link_to "接受", accept_pull_request_project_pull_request_path(@request.id, :project_id => @project.id), :class => "linkBlue2", :remote => true %>
      <% end %> <% end %> diff --git a/app/views/student_work/_upload_attachment.html.erb b/app/views/student_work/_upload_attachment.html.erb index 904c3ad54..6f90a0705 100644 --- a/app/views/student_work/_upload_attachment.html.erb +++ b/app/views/student_work/_upload_attachment.html.erb @@ -48,6 +48,7 @@

      +
      注意:暂不支持IE浏览器的上传,请更换浏览器
      取消 确定 @@ -55,4 +56,14 @@ <% end %>
      -
      \ No newline at end of file +
      + \ No newline at end of file diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index 0c65e871f..e9f3a03de 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -5,6 +5,16 @@ <% end %> - -
      -
      消息动态
      -
        -
      • -
          -
        • -
            - <% if hidden_unproject_infos %> -
          • <%= link_to "全部动态", {:controller => "users", :action => "course_community", :type => "all"}, :class => "homepagePostTypeAll postTypeGrey" %>
          • -
          • <%= link_to @user == User.current ? "我的动态" : "他的动态", {:controller => "users", :action => "course_community", :type => "current_user"}, :class => "homepagePostTypeMine postTypeGrey" %>
          • -
          • <%= link_to "作业动态", {:controller => "users", :action => "course_community", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey" %>
          • -
          • <%= link_to "通知动态", {:controller => "users", :action => "course_community", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey" %>
          • -
          • <%= link_to "论坛动态", {:controller => "users", :action => "course_community", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey" %>
          • -
          • <%= link_to "问卷动态", {:controller => "users", :action => "course_community", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey" %>
          • -
          • <%= link_to "班级留言", {:controller => "users", :action => "course_community", :type => "course_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %>
          • -
          • <%= link_to "个人留言", {:controller => "users", :action => "course_community", :type => "user_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %>
          • - <% end %> -
          -
        • -
        -
      • -
      -
      - - -<%# if @user.blog.homepage_id and BlogComment.where("id=?", @user.blog.homepage_id).count > 0 %> - <%# homepage = BlogComment.find(@user.blog.homepage_id) %> - <%#= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %> -<%# end %> - <% if @user_activities_count > 0 %> - <%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities, :page => 0, :type => @type, - :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => params[:action] } %> - <% else %> -
      - <%= render :partial => 'users/no_data' %> -
      - <% end %> + + +
      +
      消息动态
      +
        +
      • +
          +
        • +
            + <% if hidden_unproject_infos %> +
          • <%= link_to "全部动态", {:controller => "users", :action => "course_community", :type => "all"}, :class => "homepagePostTypeAll postTypeGrey" %>
          • +
          • <%= link_to @user == User.current ? "我的动态" : "他的动态", {:controller => "users", :action => "course_community", :type => "current_user"}, :class => "homepagePostTypeMine postTypeGrey" %>
          • +
          • <%= link_to "作业动态", {:controller => "users", :action => "course_community", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey" %>
          • +
          • <%= link_to "通知动态", {:controller => "users", :action => "course_community", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey" %>
          • +
          • <%= link_to "论坛动态", {:controller => "users", :action => "course_community", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey" %>
          • +
          • <%= link_to "问卷动态", {:controller => "users", :action => "course_community", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey" %>
          • +
          • <%= link_to "班级留言", {:controller => "users", :action => "course_community", :type => "course_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %>
          • +
          • <%= link_to "个人留言", {:controller => "users", :action => "course_community", :type => "user_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %>
          • + <% end %> +
          +
        • +
        +
      • +
      +
      + + +<%# if @user.blog.homepage_id and BlogComment.where("id=?", @user.blog.homepage_id).count > 0 %> + <%# homepage = BlogComment.find(@user.blog.homepage_id) %> + <%#= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %> +<%# end %> + <% if @user_activities_count > 0 %> + <%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities, :page => 0, :type => @type, + :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => params[:action] } %> + <% else %> +
      + <%= render :partial => 'users/no_data' %> +
      + <% end %> diff --git a/app/views/users/course_community.js.erb b/app/views/users/course_community.js.erb index ed8b26937..be78ac849 100644 --- a/app/views/users/course_community.js.erb +++ b/app/views/users/course_community.js.erb @@ -1,6 +1,6 @@ -$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities', - :locals => {:user_activities => @user_activities, - :page => @page, - :type => @type, - :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), +$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities', + :locals => {:user_activities => @user_activities, + :page => @page, + :type => @type, + :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => "course_community"} )%>"); \ No newline at end of file diff --git a/app/views/users/project_community.html.erb b/app/views/users/project_community.html.erb index 1d5a49569..ce0129dae 100644 --- a/app/views/users/project_community.html.erb +++ b/app/views/users/project_community.html.erb @@ -1,37 +1,37 @@ - - -
      -
      消息动态
      -
        -
      • -
          -
        • -
            - <% if hidden_unproject_infos %> -
          • <%= link_to "全部动态", {:controller => "users", :action => "project_community", :type => "all"}, :class => "homepagePostTypeAll postTypeGrey" %>
          • -
          • <%= link_to @user == User.current ? "我的动态" : "他的动态", {:controller => "users", :action => "project_community", :type => "current_user"}, - :class => "homepagePostTypeMine postTypeGrey" %>
          • -
          • <%= link_to "问题动态", {:controller => "users", :action => "project_community", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
          • -
          • <%= link_to "论坛动态", {:controller => "users", :action => "project_community", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
          • -
          • <%= link_to "个人留言", {:controller => "users", :action => "project_community", :type => "user_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %>
          • - <% end %> -
          -
        • -
        -
      • -
      -
      - - -<%# if @user.blog.homepage_id and BlogComment.where("id=?", @user.blog.homepage_id).count > 0 %> -<%# homepage = BlogComment.find(@user.blog.homepage_id) %> -<%#= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %> -<%# end %> -<% if @user_activities_count > 0 %> - <%= render :partial => 'users/user_activities', :locals => { :user_activities => @user_activities, :page => 0, :type => @type, - :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => params[:action] } %> -<% else %> -
      - <%= render :partial => 'users/no_data' %> -
      -<% end %> + + +
      +
      消息动态
      +
        +
      • +
          +
        • +
            + <% if hidden_unproject_infos %> +
          • <%= link_to "全部动态", {:controller => "users", :action => "project_community", :type => "all"}, :class => "homepagePostTypeAll postTypeGrey" %>
          • +
          • <%= link_to @user == User.current ? "我的动态" : "他的动态", {:controller => "users", :action => "project_community", :type => "current_user"}, + :class => "homepagePostTypeMine postTypeGrey" %>
          • +
          • <%= link_to "问题动态", {:controller => "users", :action => "project_community", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
          • +
          • <%= link_to "论坛动态", {:controller => "users", :action => "project_community", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
          • +
          • <%= link_to "个人留言", {:controller => "users", :action => "project_community", :type => "user_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %>
          • + <% end %> +
          +
        • +
        +
      • +
      +
      + + +<%# if @user.blog.homepage_id and BlogComment.where("id=?", @user.blog.homepage_id).count > 0 %> +<%# homepage = BlogComment.find(@user.blog.homepage_id) %> +<%#= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %> +<%# end %> +<% if @user_activities_count > 0 %> + <%= render :partial => 'users/user_activities', :locals => { :user_activities => @user_activities, :page => 0, :type => @type, + :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => params[:action] } %> +<% else %> +
      + <%= render :partial => 'users/no_data' %> +
      +<% end %> diff --git a/app/views/users/project_community.js.erb b/app/views/users/project_community.js.erb index e3fda3f6e..aeebef08e 100644 --- a/app/views/users/project_community.js.erb +++ b/app/views/users/project_community.js.erb @@ -1,6 +1,6 @@ -$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities', - :locals => {:user_activities => @user_activities, - :page => @page, - :type => @type, - :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), +$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities', + :locals => {:user_activities => @user_activities, + :page => @page, + :type => @type, + :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => "project_community"} )%>"); \ No newline at end of file diff --git a/app/views/users/project_community.js.erb.BASE.erb b/app/views/users/project_community.js.erb.BASE.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/users/project_community.js.erb.LOCAL.erb b/app/views/users/project_community.js.erb.LOCAL.erb new file mode 100644 index 000000000..aeebef08e --- /dev/null +++ b/app/views/users/project_community.js.erb.LOCAL.erb @@ -0,0 +1,6 @@ +$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities', + :locals => {:user_activities => @user_activities, + :page => @page, + :type => @type, + :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), + :action => "project_community"} )%>"); \ No newline at end of file diff --git a/app/views/users/project_community.js.erb.REMOTE.erb b/app/views/users/project_community.js.erb.REMOTE.erb new file mode 100644 index 000000000..aeebef08e --- /dev/null +++ b/app/views/users/project_community.js.erb.REMOTE.erb @@ -0,0 +1,6 @@ +$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities', + :locals => {:user_activities => @user_activities, + :page => @page, + :type => @type, + :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), + :action => "project_community"} )%>"); \ No newline at end of file diff --git a/db/migrate/20161213074134_create_data_exceptions.rb b/db/migrate/20161213074134_create_data_exceptions.rb new file mode 100644 index 000000000..a9f79402c --- /dev/null +++ b/db/migrate/20161213074134_create_data_exceptions.rb @@ -0,0 +1,11 @@ +class CreateDataExceptions < ActiveRecord::Migration + def change + create_table :data_exceptions do |t| + t.string :message + t.integer :container_id + t.string :container_type + + t.timestamps + end + end +end diff --git a/db/migrate/20161216031906_delete_course_activities.rb b/db/migrate/20161216031906_delete_course_activities.rb new file mode 100644 index 000000000..dbbe193ce --- /dev/null +++ b/db/migrate/20161216031906_delete_course_activities.rb @@ -0,0 +1,14 @@ +class DeleteCourseActivities < ActiveRecord::Migration + def up + course_acts = CourseActivity.where(:course_id => 844, :user_id => 10096, :course_act_id => 436, :course_act_type => 'Poll') + + if course_acts.count > 1 + course_acts.limit(course_acts.count - 1).each do |act| + act.delete + end + end + end + + def down + end +end diff --git a/lib/tasks/gitlab_sync.rake b/lib/tasks/gitlab_sync.rake new file mode 100644 index 000000000..c4d84eef8 --- /dev/null +++ b/lib/tasks/gitlab_sync.rake @@ -0,0 +1,50 @@ +namespace :gitlab do + desc "make sure trustie'data consistent with gitlab's data" + task :sync_data => :environment do + s = Trustie::Gitlab::Sync.new + g = Gitlab.client + projects = Project.where("gpid is not null and status=?", 1) + projects.each do |project| + # sync members and roles + begin + if project.members.count != g.team_members(project.gpid).count + project.members.each do |m| + begin + gid = m.user.gid + if gid.nil? + gid = s.sync_user(m.user).id + end + access_level = m.roles[0].position == 3 ? 40 : (m.roles[0].position == 4 ? 30 : 20) + # sync project's members + g.add_team_member(project.gpid, gid, access_level) + # sync members' roles + g.edit_team_member(project.gpid, gid, access_level) + rescue Exception => e + DataException.create(:message => e.message, :container_id => project.id, :container_type => "Project") + puts e + end + end + end + rescue Exception => e + puts e + end + end + + users = User.where("gid is not null and status =?", 1) + users.each do |user| + begin + # sync username + g.edit_user(user.gid, :username => user.login) if user.login != g.user(user.gid).try(:username) + + # sync email + g.edit_user(user.gid, :email => user.mail) if user.mail != g.user(user.gid).try(:email) + + # sync password + options = {:encrypted_password=> user.hashed_password, :password_salt=> user.salt} + g.put("/users/ext/#{user.gid}", :body => options) + rescue Exception => e + puts e + end + end + end +end diff --git a/public/assets/kindeditor/plugins/code/previewcode.css b/public/assets/kindeditor/plugins/code/previewcode.css index 0db8eb45b..9e3fddab2 100644 --- a/public/assets/kindeditor/plugins/code/previewcode.css +++ b/public/assets/kindeditor/plugins/code/previewcode.css @@ -1,6 +1,4 @@ .ke-content { - font-size: 14px; - /*font: 14px/1.5 "sans serif",tahoma,verdana,helvetica;*/ font-family: "微软雅黑","宋体"; } .ke-content pre { diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 6e796a36d..94cdb67fe 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -2201,3 +2201,12 @@ function archive_course(id, type, source){ } } +//判断是不是IE浏览器 +function is_IE(){ + if(navigator.userAgent.toLowerCase().indexOf('msie') > -1){ + return true; + }else{ + return false; + } +} + diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index 9c44ea40d..39f6ebe94 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -834,6 +834,10 @@ a:hover.sy_btn_pink{ background: #e64c4c;} } .ke-block ol li{list-style-type: decimal;margin-left: 40px;} .ke-block ul li{list-style-type: disc;margin-left: 40px;} +.ke-block{font-size: 14px;} +.ke-block h1{font-size: 2em;} +.ke-block h2{font-size: 1.5em;} +.ke-block h3{font-size: 1.17em;} a.export_icon{background: url(/images/item.png) -58px -30px no-repeat; width: 45px; float: left; line-height: 41px; font-size: 14px; margin-top: -5px;} a.export_icon:hover {background: url(/images/item.png) -58px -60px no-repeat;} diff --git a/spec/models/data_exception_spec.rb b/spec/models/data_exception_spec.rb new file mode 100644 index 000000000..566563cbb --- /dev/null +++ b/spec/models/data_exception_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe DataException, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end