diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index fd43977ee..23fe19333 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -600,7 +600,7 @@ private def has_login unless @attachment && @attachment.container_type == "PhoneAppVersion" - render_403 unless User.current.logged? + render_403 if !User.current.logged? && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download) end end end diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index c8dcf0b8e..5966b310f 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -25,7 +25,9 @@ class CommentsController < ApplicationController def create raise Unauthorized unless @news.commentable? - + if !@news.org_subfield_id.nil? + @org_subfield = OrgSubfield.find(@news.org_subfield_id) + end @comment = Comment.new #@project ? @comment.comments = params[:comment][:comments] : @comment.comments = params[:comment] if params[:user_activity_id] diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index d3ac71b99..0962deb10 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -46,15 +46,16 @@ class NewsController < ApplicationController @course = Course.find(params[:course_id]) end if @project + @page = params[:page] ? params[:page].to_i + 1 : 0 scope = @project ? @project.news.visible : News.visible @news_count = scope.count - @news_pages = Paginator.new @news_count, @limit, params['page'] - @offset ||= @news_pages.offset + #@news_pages = Paginator.new @news_count, @limit, params['page'] + #@offset ||= @news_pages.offset @newss = scope.all(:include => [:author, :project], :order => "#{News.table_name}.created_on DESC", - :offset => @offset, - :limit => @limit) + :offset => @page * 10, + :limit => 10) respond_to do |format| format.html { @@ -63,6 +64,7 @@ class NewsController < ApplicationController render :layout => false if request.xhr? } + format.js format.api format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") } end @@ -144,6 +146,10 @@ class NewsController < ApplicationController if @course render :layout => 'base_courses' end + elsif @news.org_subfield_id + @org_subfield = OrgSubfield.find(@news.org_subfield_id) + @organization = @org_subfield.organization + render :layout => 'base_org' end end @@ -151,6 +157,21 @@ class NewsController < ApplicationController #modify by nwb if @project @news = News.new(:project => @project, :author => User.current) + @news.safe_attributes = params[:news] + @news.save_attachments(params[:attachments]) + if @news.save + if params[:asset_id] + ids = params[:asset_id].split(',') + update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS + end + render_attachment_warning_if_needed(@news) + #flash[:notice] = l(:notice_successful_create) + redirect_to project_news_index_url(@project) + else + redirect_to project_news_index_url(@project) + #layout_file = 'base_courses' + #render :action => 'new', :layout => layout_file + end elsif @course @news = News.new(:course => @course, :author => User.current) #render :layout => 'base_courses' @@ -221,8 +242,14 @@ class NewsController < ApplicationController end def edit + if @news.org_subfield_id + @org_subfield = OrgSubfield.find(@news.org_subfield_id) + @organization = @org_subfield.organization + end if @course render :layout => "base_courses" + elsif @org_subfield + render :layout => 'base_org' end end @@ -240,12 +267,17 @@ class NewsController < ApplicationController end def destroy + if @news.org_subfield_id + @org_subfield = OrgSubfield.find(@news.org_subfield_id) + end @news.destroy # modify by nwb if @project redirect_to project_news_index_url(@project) elsif @course redirect_to course_news_index_url(@course) + elsif @org_subfield + redirect_to organization_path(@org_subfield.organization, :org_subfield_id => @org_subfield.id) end end diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 39ece6fbe..361303833 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -116,6 +116,7 @@ class OrganizationsController < ApplicationController @organization.description = params[:organization][:description] # @organization.domain = params[:organization][:domain] @organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0 + @organization.allow_guest_download = params[:organization][:allow_guest_download] == 'on' ? 1 : 0 #@organization.name = params[:organization][:name] @organization.save respond_to do |format| @@ -300,7 +301,11 @@ class OrganizationsController < ApplicationController def org_resources_subfield @org = Organization.find(params[:id]) - @subfield = @org.org_subfields.where('field_type = "Resource" ') + if params[:send_type].present? and params[:send_type] == 'news' + @subfield = @org.org_subfields.where("field_type = 'Post'") + else + @subfield = @org.org_subfields.where('field_type = "Resource" ') + end respond_to do | format| format.js end diff --git a/app/controllers/praise_tread_controller.rb b/app/controllers/praise_tread_controller.rb index 1a01a2f07..96eeab884 100644 --- a/app/controllers/praise_tread_controller.rb +++ b/app/controllers/praise_tread_controller.rb @@ -119,6 +119,8 @@ class PraiseTreadController < ApplicationController @obj = Journal.find_by_id(id) when 'BlogComment' @obj = BlogComment.find_by_id(id) + when 'OrgDocumentComment' + @obj = OrgDocumentComment.find_by_id(id) when 'User' @obj = User.find_by_id(id) when 'Issue' diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4f404eb93..d785a608a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -751,14 +751,34 @@ class UsersController < ApplicationController end end # end - jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @page = params[:page] ? params[:page].to_i + 1 : 0 + if params[:type].present? + case params[:type] + when "public" + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('created_on DESC') + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) + when "private" + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('created_on DESC') + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) + else + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) + end + else + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) + end + @type = params[:type] if User.current == @user jours.update_all(:is_readed => true, :status => false) jours.each do |journal| fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false) end end - @jour = paginateHelper jours,10 @state = false render :layout=>'new_base_user' end @@ -1758,6 +1778,48 @@ class UsersController < ApplicationController end end + def share_news_to_course + news = News.find(params[:send_id]) + course_ids = params[:course_ids] + course_ids.each do |course_id| + if Course.find(course_id).news.map(&:id).exclude?(news.id) + course_news = News.create(:course_id => course_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now,:project_id => -1) + news.attachments.each do |attach| + course_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + end + end + end + + def share_news_to_project + news = News.find(params[:send_id]) + project_ids = params[:project_ids] + project_ids.each do |project_id| + if Project.find(project_id).news.map(&:id).exclude?(news.id) + project_news = News.create(:project_id => project_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now) + news.attachments.each do |attach| + project_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + end + end + end + + def share_news_to_org + news = News.find(params[:send_id]) + field_id = params[:subfield] + org_news = News.create(:org_subfield_id => field_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now,:project_id => -1) + news.attachments.each do |attach| + org_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) + end + OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'News', :org_act_id => org_news.id, :user_id => User.current.id) + end + def change_org_subfield end @@ -2107,9 +2169,17 @@ class UsersController < ApplicationController @user = User.current if !params[:search].nil? #发送到有栏目类型为资源的组织中 search = "%#{params[:search].to_s.strip.downcase}%" - @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} + if params[:send_type].present? and params[:send_type] == 'news' + @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Post'").count > 0} + else + @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} + end else - @orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} + if params[:send_type].present? and params[:send_type] == 'news' + @orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Post'").count > 0} + else + @orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} + end end @search = params[:search] #这里仅仅是传递需要发送的资源id diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index ebd46caa7..8115f3f91 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -225,11 +225,11 @@ class WordsController < ApplicationController def leave_user_message if User.current.logged? @user = User.find(params[:id]) - if params[:new_form][:user_message].size>0 && User.current.logged? && @user + if params[:new_form][:content].size>0 && User.current.logged? && @user if params[:private] && params[:private] == '1' - @user.journals_for_messages << JournalsForMessage.new(:user_id => User.current.id, :notes => params[:new_form][:user_message], :reply_id => 0, :status => true, :is_readed => false, :private => 1) + @user.journals_for_messages << JournalsForMessage.new(:user_id => User.current.id, :notes => params[:new_form][:content], :reply_id => 0, :status => true, :is_readed => false, :private => 1) else - @user.add_jour(User.current, params[:new_form][:user_message]) + @user.add_jour(User.current, params[:new_form][:content]) end end redirect_to feedback_path(@user) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ce3b412a5..22c7df263 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2016,6 +2016,8 @@ module ApplicationHelper candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1) elsif attachment.container.is_a?(OrgSubfield) candown = true + elsif attachment.container.is_a?(OrgDocumentComment) + candown = true elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board && attachment.container.board.course course = attachment.container.board.course diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 318de2942..e7a17d4d1 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -379,6 +379,16 @@ class Mailer < ActionMailer::Base end + # issue截止时间提醒 + def issue_due_date(issue, recipients) + @author = issue.author.login + @issue_name = issue.subject + @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id) + @subject = "#{l(:mail_issue)}#{issue.subject} #{l(:mail_issue_due_date)} " + mail :to => recipients, + :subject => @subject + end + # Builds a Mail::Message object used to email recipients of the added issue. # # Example: diff --git a/app/models/news.rb b/app/models/news.rb index 7c44f7e8a..fee5d2801 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -22,6 +22,7 @@ class News < ActiveRecord::Base has_many_kindeditor_assets :assets, :dependent => :destroy #added by nwb belongs_to :course,:touch => true + belongs_to :org_subfield, :touch => true belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' has_many :comments, :as => :commented, :dependent => :destroy, :order => "created_on" # fq @@ -57,7 +58,7 @@ class News < ActiveRecord::Base after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail, :add_news_count after_update :update_activity - after_destroy :delete_kindeditor_assets, :decrease_news_count + after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities scope :visible, lambda {|*args| includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args)) @@ -187,4 +188,8 @@ class News < ActiveRecord::Base Mailer.run.news_added(self) if Setting.notified_events.include?('news_added') end + def delete_org_activities + OrgActivity.where("container_type='OrgSubfield' and org_act_type='News' and org_act_id=?", self.id).destroy_all + end + end \ No newline at end of file diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb index b109ba042..c62cbf4f8 100644 --- a/app/models/org_subfield.rb +++ b/app/models/org_subfield.rb @@ -6,6 +6,7 @@ class OrgSubfield < ActiveRecord::Base has_many :org_subfield_messages, :dependent => :destroy has_many :messages, :through => :org_subfield_messages has_many :boards, :dependent => :destroy + has_many :news, :dependent => :destroy acts_as_attachable after_create :create_board_sync # 创建资源栏目讨论区 diff --git a/app/views/attachments/_activity_attach.html.erb b/app/views/attachments/_activity_attach.html.erb index 9bd7d9d2f..32e796382 100644 --- a/app/views/attachments/_activity_attach.html.erb +++ b/app/views/attachments/_activity_attach.html.erb @@ -3,7 +3,7 @@
- <%= link_to_short_attachment attachment,:length=> 58, :class => 'mw400 hidden link_file_a fl newsBlue', :download => true -%> + <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw400', :download => true -%> ( diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index 02f1ad1ad..6f4397569 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -116,9 +116,18 @@ <% count=@article.children.count%> <% end %>
- <% unless count == 0 %> + <%# unless count == 0 %>
-
回复(<%=count %>)
+
回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if @article.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>@article, :user_activity_id=>@article.id,:type=>"activity"}%> + <% end %> + +
- <% if User.current.logged? %> -
- <%= link_to '文章', organization_org_document_comments_path(@organization) %>  - <% if User.current.logged? %> - ( - <%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %> - ) - <% end %> -  |  - <%= link_to '成员', members_organization_path(@organization.id) %>  - <% if User.current.logged? %> - (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>) - <% end %> -
- <% end %> +
+ <%= link_to '文章', organization_org_document_comments_path(@organization) %>  + <%# if User.current.logged? %> + ( + <%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %> + ) + <%# end %> + <% if User.current.logged? %> +  |  + <%= link_to '成员', members_organization_path(@organization.id) %>  + (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>) + <% end %> +
<%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %> diff --git a/app/views/mailer/issue_due_date.html.erb b/app/views/mailer/issue_due_date.html.erb new file mode 100644 index 000000000..a4fd81236 --- /dev/null +++ b/app/views/mailer/issue_due_date.html.erb @@ -0,0 +1,10 @@ +
+
    +
  • <%= l(:mail_issue_content)%> + +

    <%=link_to @author, user_url(@author) %> 发布的问题跟踪:<%=link_to @issue_name, @issue_url %> 截止时间快到了,请您关注!

    +
    +
  • +
+
+
\ 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 914b1a6a1..07aaef26d 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -41,6 +41,7 @@
    • +
    • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{@news.id}','#{User.current.id}','news')") %>
    • <%= link_to( l(:button_edit), @@ -59,6 +60,16 @@
+ <% elsif User.current.logged? %> + <%end%>
通知: <%= @news.title%> diff --git a/app/views/news/_edit_for_org_subfield.html.erb b/app/views/news/_edit_for_org_subfield.html.erb new file mode 100644 index 000000000..75f24e6b7 --- /dev/null +++ b/app/views/news/_edit_for_org_subfield.html.erb @@ -0,0 +1,49 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false) %> +<% end %> + +
+
+
+
+ +

+
+ +
+
+
\ No newline at end of file diff --git a/app/views/news/_organization_show.html.erb b/app/views/news/_organization_show.html.erb new file mode 100644 index 000000000..98d14c3ab --- /dev/null +++ b/app/views/news/_organization_show.html.erb @@ -0,0 +1,174 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> + + + + +
+
+
+ <%= link_to image_tag(url_to_avatar(@news.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@news.author) %> +
+
+ <% if User.current.logged? %> + + <%end%> + +
+ +
+ <% if @news.try(:author).try(:realname) == ' ' %> + <%= link_to @news.try(:author), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @news.try(:author).try(:realname), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> +
+
<%= format_time( @news.created_on)%>
+
+
+ <%= @news.description.html_safe%> +
+
+
+ <%= link_to_attachments_course @news, :author => false %> +
+
+
+
+
+
+ <% unless @comments.empty? %> +
+
回复(<%=@comments.count %>)
+
+
+
+ <% @comments.each_with_index do |reply,i| %> + +
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
+
+
+ <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% end %> +
+
+ <%= reply.comments.html_safe%> +
+
+ <%= format_time(reply.created_on) %> + +
+

+
+
+
+ <% end %> +
+ + <% end %> +
+ <% if @news.commentable? %> +
+ +
+
+ <%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %> +
+ <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%= f.kindeditor :comments, :editor_id => 'comment_editor', + :owner_id => @comment.nil? ? 0: @comment.id, + :owner_type => OwnerTypeHelper::COMMENT, + :width => '99%', + :height => 100, + :minHeight=>100, + :input_html => { :id => 'comment_content', + :class => 'talk_text fl', + :maxlength => 5000 }%> +
+

+

+ + <%= l(:label_cancel_with_space) %> + + + <%= l(:label_comment_with_space) %> + +

+ <% end %> +
+
+
+ <% end %> +
+
diff --git a/app/views/news/_project_news.html.erb b/app/views/news/_project_news.html.erb index efbb74e46..fa2a99cd7 100644 --- a/app/views/news/_project_news.html.erb +++ b/app/views/news/_project_news.html.erb @@ -1,77 +1,36 @@ - -<% - btn_tips = l(:label_news_new) - label_tips = l(:label_news) -%> -
-

<%= label_tips %>

-
-
-

<%= l(:label_total_news) %><%= @news_count %><%= l(:label_project_new_list) %>

- <% if @project && User.current.allowed_to?(:manage_news, @project) %> - <%= link_to(btn_tips, new_project_news_path(@project), - :class => 'problem_new_btn fl c_dorange') %> -
- - <% end %> -
-
-
- <% if @newss.empty? %> -

- <%= l(:label_no_data) %> -

- <% else %> - <% @newss.each do |news| %> -
- <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %> -
- <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %> - <%= l(:label_add_news) %>:<%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> - <%=link_to "#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w_news" %>
-
-

<%=textAreailizable news.description %>

- - <%= l(:label_create_time) %> :<%= format_time(news.created_on) %> -
-
-
+ +
+
+
+ 项目通知 +
+
+ <% if @project && User.current.allowed_to?(:manage_news, @project) %> + <%= labelled_form_for @news, :url =>{:controller=>'news',:action => 'new', :project_id => @project.id}, + :html => {:nhname=>'form',:multipart => true, :id => 'news-form'} do |f| %> + <%= render :partial => 'project_news_new', :locals => {:f => f, :news => @news, :edit_mode => false} %> <% end %> <% end %> + <%= render :partial=> 'project_news_detail',:locals =>{:all_news => @newss, :page => 0} %>
- -
    - <%= pagination_links_full @news_pages, @news_count, :per_page_links => false, :remote => false, :flag => true%> -
- - <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %> - <% end %> - - <% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> - <%= stylesheet_link_tag 'scm' %> - <% end %> - - <% html_title(l(:label_news_plural)) -%> - - diff --git a/app/views/news/_project_news_detail.html.erb b/app/views/news/_project_news_detail.html.erb new file mode 100644 index 000000000..fdb035bf5 --- /dev/null +++ b/app/views/news/_project_news_detail.html.erb @@ -0,0 +1,56 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false) %> + <%= javascript_include_tag "init_activity_KindEditor" %> +<% end %> + + +<% if all_news %> + <% all_news.each do |news| %> + + <% if news %> + <%= render :partial => 'users/project_news', :locals => {:activity => news, :user_activity_id => news.id} %> + <% end %> + <% end %> + + <% if all_news.count == 10 %> + <%= link_to "点击展开更多",news_index_path(:project_id => @project.id ,:page => page),:id => "show_more_project_news",:remote => "true",:class => "loadMore mt10 f_grey"%> + <% end %> +<% end%> + diff --git a/app/views/news/_project_news_new.html.erb b/app/views/news/_project_news_new.html.erb new file mode 100644 index 000000000..0e9b03c6f --- /dev/null +++ b/app/views/news/_project_news_new.html.erb @@ -0,0 +1,60 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false) %> +<% end %> + +
+
+
+
+ +

+
+ +
+
+
\ No newline at end of file diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb index 463b0f489..26ff807db 100644 --- a/app/views/news/_project_show.html.erb +++ b/app/views/news/_project_show.html.erb @@ -1,72 +1,184 @@ -
-

<%= l(:label_news) %>

-
+<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> + + + -<% if authorize_for('news', 'edit') %> - - diff --git a/app/views/organizations/_org_course_news.html.erb b/app/views/organizations/_org_course_news.html.erb index 7d6940f52..b6e2f74ef 100644 --- a/app/views/organizations/_org_course_news.html.erb +++ b/app/views/organizations/_org_course_news.html.erb @@ -27,11 +27,7 @@ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
-
-
- <%= activity.description.html_safe %> -
-
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
@@ -125,6 +121,3 @@
- diff --git a/app/views/organizations/_org_course_poll.html.erb b/app/views/organizations/_org_course_poll.html.erb index 925839f92..7e09e2215 100644 --- a/app/views/organizations/_org_course_poll.html.erb +++ b/app/views/organizations/_org_course_poll.html.erb @@ -34,11 +34,8 @@ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
-
-
- <%= activity.polls_description.html_safe %> -
-
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.polls_description} %> +
@@ -59,6 +56,3 @@ <% end %> - diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index 78964efbe..763a76d5e 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.html.erb @@ -38,13 +38,7 @@
-
-
- <% if activity.description? %> - <%= textAreailizable activity, :description, :attachments => activity.attachments %> - <% end %> -
-
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
@@ -145,6 +139,3 @@ - diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index f8f412732..96ed6adff 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -31,15 +31,12 @@ 更新时间:<%= format_time(OrgActivity.where("org_act_type='#{activity.class}' and org_act_id =#{activity.id}").first.updated_at) %>
-
-
- <% if activity.parent_id.nil? %> - <%= activity.content.to_s.html_safe%> - <% else %> - <%= activity.parent.content.to_s.html_safe%> - <% end %> -
-
+ <% if activity.parent_id.nil? %> + <% content = activity.content%> + <% else %> + <% content = activity.parent.content%> + <% end %> + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
@@ -136,6 +133,3 @@ - diff --git a/app/views/organizations/_org_subfield_news.html.erb b/app/views/organizations/_org_subfield_news.html.erb new file mode 100644 index 000000000..074d15a42 --- /dev/null +++ b/app/views/organizations/_org_subfield_news.html.erb @@ -0,0 +1,132 @@ +
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> +
+
+
+ <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= link_to activity.org_subfield.name.to_s+" | 帖子栏目通知", organization_path(activity.org_subfield.organization, :org_subfield_id => activity.org_subfield.id), :class => "newsBlue ml15" %> +
+ + +
+
+ 发布时间:<%= format_time(activity.created_on) %> +
+
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> +
+ + +
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %> +
+
+
    +
  • + <% if User.current.logged? %> +
      +
    • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}','#{User.current.id}','news')") %>
    • +
    + <% end %> +
  • +
+
+
+
+
+ <% count=activity.comments.count %> +
+
+
回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if activity.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + <% end %> + +
+
<%#= format_date(activity.updated_on) %>
+ <%if count>3 %> + + <% end %> +
+ + <% replies_all_i = 0 %> + <% if count > 0 %> +
+
    + <% activity.comments.reorder("created_on desc").each do |comment| %> + + <% replies_all_i = replies_all_i + 1 %> +
  • +
    + <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %> +
    +
    +
    + <% if comment.try(:author).try(:realname) == ' ' %> + <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(comment.created_on) %> + + <% if comment.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% end %> + +
    +
    + <%= comment.comments.html_safe %>
    +
    +
    +
  • + <% end %> +
+
+ <% end %> + +
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> + + +
+ +
+

+ <% end%> +
+
+
+
+
+
+
+ diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb index d15ceca38..baa687107 100644 --- a/app/views/organizations/_project_message.html.erb +++ b/app/views/organizations/_project_message.html.erb @@ -31,15 +31,12 @@ 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
-
-
- <% if activity.parent_id.nil? %> - <%= activity.content.to_s.html_safe%> - <% else %> - <%= activity.parent.content.to_s.html_safe%> - <% end %> -
-
+ <% if activity.parent_id.nil? %> + <% content = activity.content%> + <% else %> + <% content = activity.parent.content%> + <% end %> + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
@@ -137,6 +134,3 @@ - diff --git a/app/views/organizations/_show_home_page.html.erb b/app/views/organizations/_show_home_page.html.erb index 7178cfe1d..f6d5fc9ea 100644 --- a/app/views/organizations/_show_home_page.html.erb +++ b/app/views/organizations/_show_home_page.html.erb @@ -2,15 +2,13 @@
- <% if User.current.logged? %>
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
- <% end %> <% unless document.content.blank? %> -
+
<%= document.content.html_safe %>
<% end %> - <% if params[:show_homepage].nil? and User.current.logged? %> + <% if params[:show_homepage].nil? %>
发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %>
@@ -52,6 +50,9 @@
\ No newline at end of file +
\ No newline at end of file diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 6cac445ee..2c7d36fb5 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -47,6 +47,9 @@ <% else %> <%= link_to l(:project_module_repository),({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).identifier}), :class => "f14 c_blue02" %> <% end %> + <% unless @project.project_score.changeset_num == 0 %> + <%= link_to "(#{@project.project_score.changeset_num})", ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).identifier}), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %> + <% end %> <% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project)) && rep_is_gitlab?(@project) %> <%= link_to "+"+l(:project_gitlab_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %> diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb index ceee318a4..2614462d7 100644 --- a/app/views/projects/_project_news.html.erb +++ b/app/views/projects/_project_news.html.erb @@ -27,11 +27,7 @@ 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
-
-
- <%= activity.description.html_safe %> -
-
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
@@ -124,7 +120,4 @@
- - \ No newline at end of file + \ No newline at end of file diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index f73e039f9..651a284e4 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -93,11 +93,8 @@
匿评截止时间:<%= activity.homework_detail_manual.evaluation_end.to_s %> 23:59
<% end %> -
-
- <%= activity.description.html_safe %> -
-
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> +
@@ -350,5 +347,4 @@ $("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap'); $("#moreProject_<%=user_activity_id %>").show(); }); - $(description_show_hide(<%=user_activity_id %>)); diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 342d81579..abfbba993 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -35,14 +35,12 @@ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
-
-
<% if activity.parent_id.nil? %> - <%= activity.content.to_s.html_safe%> + <% content = activity.content%> <% else %> - <%= activity.parent.content.to_s.html_safe%> + <% content = activity.parent.content%> <% end %> -
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %> <% if activity.status == 1 %> <%= activity.created_on.year %> @@ -188,6 +186,4 @@ <% end %>
- + diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index 7d6940f52..67d09d365 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -27,11 +27,7 @@ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
-
-
- <%= activity.description.html_safe %> -
-
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
@@ -39,6 +35,17 @@
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+ +
@@ -125,6 +132,3 @@ - diff --git a/app/views/users/_course_poll.html.erb b/app/views/users/_course_poll.html.erb index c3eda8303..970fb516e 100644 --- a/app/views/users/_course_poll.html.erb +++ b/app/views/users/_course_poll.html.erb @@ -34,11 +34,7 @@ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
-
-
- <%= activity.polls_description.html_safe %> -
-
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.polls_description} %>
@@ -59,6 +55,3 @@ <% end %> - diff --git a/app/views/users/_intro_content.html.erb b/app/views/users/_intro_content.html.erb new file mode 100644 index 000000000..668a26cec --- /dev/null +++ b/app/views/users/_intro_content.html.erb @@ -0,0 +1,13 @@ +
+
+ <%= content.to_s.html_safe%> +
+
+ \ No newline at end of file diff --git a/app/views/users/_jour_form.html.erb b/app/views/users/_jour_form.html.erb new file mode 100644 index 000000000..13bf6d79a --- /dev/null +++ b/app/views/users/_jour_form.html.erb @@ -0,0 +1,19 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> + +<%= error_messages_for 'message' %> +
  • + <%= text_area :quote,:quote,:style => 'display:none' %> + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%= f.kindeditor :content, :editor_id => 'jour_content_editor', + :width => '99.7%', + :height => 40, + :minHeight=>40, + :input_html => { :id => 'jour_content', + :class => 'talk_text fl', + :maxlength => 5000 }%> +
    +

    +
  • +
    diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 4c89110ad..9f4e396de 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -50,13 +50,7 @@
    -
    -
    - <% if activity.description? %> - <%= textAreailizable activity, :description, :attachments => activity.attachments %> - <% end %> -
    -
    + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> <%# 局部刷新:修改xissue属性 %> <%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %>
    @@ -159,6 +153,3 @@ - diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index ab7502bd5..d4a7a9e60 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -36,15 +36,12 @@ 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
    -
    -
    - <% if activity.parent_id.nil? %> - <%= activity.content.to_s.html_safe%> - <% else %> - <%= activity.parent.content.to_s.html_safe%> - <% end %> -
    -
    + <% if activity.parent_id.nil? %> + <% content = activity.content%> + <% else %> + <% content = activity.parent.content%> + <% end %> + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
    @@ -170,6 +167,3 @@ - diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb index 3ea1479c5..eb4941668 100644 --- a/app/views/users/_project_news.html.erb +++ b/app/views/users/_project_news.html.erb @@ -1,29 +1,134 @@ -
    -
    +
    +
    - 用户头像
    + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> +
    - - -
    - -
    截止时间:2015-08-20
    +
    + <% if @ctivity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= link_to activity.project.name.to_s+" | 项目通知", project_news_index_path(activity.project), :class => "newsBlue ml15" %> +
    + + <% if activity.sticky == 1%> + 置顶 + <% end%> +
    +
    + 发布时间:<%= format_time(activity.created_on) %>
    -
    (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
    -
    -
    \ No newline at end of file + <% count=activity.comments.count %> +
    +
    +
    回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if activity.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + <% end %> + +
    +
    <%#= format_date(activity.updated_on) %>
    + <%if count>3 %> + + <% end %> +
    + + <% replies_all_i = 0 %> + <% if count > 0 %> +
    +
      + <% activity.comments.reorder("created_on desc").each do |comment| %> + + <% replies_all_i = replies_all_i + 1 %> +
    • +
      + <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %> +
      +
      +
      + <% if comment.try(:author).try(:realname) == ' ' %> + <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(comment.created_on) %> + + <% if comment.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% end %> + +
      +
      + <%= comment.comments.html_safe %>
      +
      +
      +
    • + <% end %> +
    +
    + <% end %> + +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    +
    + <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> + + +
    + +
    +

    + <% end%> +
    +
    +
    +
    +
    +
    +
    + diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index 5a712b857..792db7546 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -1,7 +1,7 @@
    发送到
    - @@ -13,7 +13,7 @@ <%= hidden_field_tag(:send_ids, send_ids) %> <% end %>
    diff --git a/app/views/users/_resource_share_for_project_popup.html.erb b/app/views/users/_resource_share_for_project_popup.html.erb index f15c29e90..33fa03061 100644 --- a/app/views/users/_resource_share_for_project_popup.html.erb +++ b/app/views/users/_resource_share_for_project_popup.html.erb @@ -2,7 +2,7 @@
    发送到
    - @@ -18,7 +18,7 @@ <%= hidden_field_tag(:send_ids, send_ids) %> <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb index af7bd5bd3..74265cabb 100644 --- a/app/views/users/_resource_share_popup.html.erb +++ b/app/views/users/_resource_share_popup.html.erb @@ -4,7 +4,7 @@
    发送到
    - @@ -20,7 +20,7 @@ <%= hidden_field_tag(:send_ids, send_ids) %> <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> diff --git a/app/views/users/_share_news_to_course.html.erb b/app/views/users/_share_news_to_course.html.erb new file mode 100644 index 000000000..144792201 --- /dev/null +++ b/app/views/users/_share_news_to_course.html.erb @@ -0,0 +1,56 @@ + + +
    +
    +
    发送到
    +
    + +
    +
    +
    + +
    + <%= form_tag search_user_course_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + + <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> + <% end %> +
    + <%= form_tag share_news_to_course_user_path(user),:remote=>true,:id=>'course_list_form' %> +
    + + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + <% if !courses.empty? %> + <% courses.each do |course| %> +
      +
    • + +
    • +
    • <%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%>
    • +
    + <% end %> +
    +
    +
    +
    + + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
    + +
    +
    + <% end %> +
    + diff --git a/app/views/users/_share_news_to_org.html.erb b/app/views/users/_share_news_to_org.html.erb new file mode 100644 index 000000000..794c6db89 --- /dev/null +++ b/app/views/users/_share_news_to_org.html.erb @@ -0,0 +1,59 @@ +
    +
    发送到
    +
    + +
    + <%= form_tag search_user_org_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_org_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + <% end %> +
    +
    +<%= form_tag share_news_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + +
      + <% unless @orgs.empty? %> + <% @orgs.each do |org|%> +
    • + +
    • + <%end%> + <%end%> +
    +
    +
    +
      + + + <%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%> + + + + + +
    +
    +
    +
    目标地址:
    +
    + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %> +
    +
    + 取消 +
    +
    +<%end %> \ No newline at end of file diff --git a/app/views/users/_share_news_to_project.html.erb b/app/views/users/_share_news_to_project.html.erb new file mode 100644 index 000000000..37bac105a --- /dev/null +++ b/app/views/users/_share_news_to_project.html.erb @@ -0,0 +1,54 @@ +
    +
    +
    发送到
    +
    + +
    +
    +
    + +
    + <%= form_tag search_user_project_user_path(user),:method => 'get', + :remote=>true,:id=>'search_user_project_form',:class=>'resourcesSearchBox' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> + + + + <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> + <% end %> +
    + <%= form_tag share_news_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %> +
    + + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %> +
    + <% if !projects.empty? %> + <% projects.each do |project| %> +
      +
    • + +
    • +
    • <%= project.name%>
    • +
    + <% end %> +
    +
    +
    +
    + + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
    + +
    +
    + <% end %> +
    + diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index 1a4b90768..581bfb53c 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -33,11 +33,7 @@ 更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %>
    -
    -
    - <%= activity.content.html_safe %> -
    -
    + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.content} %>
    @@ -148,5 +144,4 @@ $("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap'); $("#moreProject_<%=user_activity_id %>").show(); }); - $(description_show_hide(<%=user_activity_id %>)); diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index d1b3f62fc..b3e14d174 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -95,11 +95,7 @@
    <% end %>
    -
    -
    - <%= homework_common.description.html_safe %> -
    -
    + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>homework_common.id, :content=>homework_common.description} %>
    @@ -352,5 +348,4 @@ $("#relatePWrap_<%=homework_common.id %>").toggleClass('relatePWrap'); $("#moreProject_<%=homework_common.id %>").show(); }); - $(homework_description_show_hide(<%=homework_common.id %>)); \ No newline at end of file diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 01afbfebe..5c9386f94 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -25,6 +25,7 @@ <% end %>
    +

    @@ -32,7 +33,7 @@
    - <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true) unless edit_mode%> + <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业(将于2016年春上线)") unless edit_mode%> <% if edit_mode %> <% end %> diff --git a/app/views/users/_user_jours_list.html.erb b/app/views/users/_user_jours_list.html.erb new file mode 100644 index 000000000..cc5a589b5 --- /dev/null +++ b/app/views/users/_user_jours_list.html.erb @@ -0,0 +1,32 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> + <%#= javascript_include_tag "init_KindEditor","user" %> +<% end %> + +<%if jours %> + <% jours.each do |jour|%> + <% unless jour.private == 1 && (!User.current || (User.current && jour.jour_id != User.current.id && jour.user_id != User.current.id)) %> + + <%= render :partial => 'user_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id} %> + <%#= render :partial => 'user_jours_new', :locals => {:jour => jour} %> + <% end %> + <%end%> +<% end%> +<% if (jours.count + page * 10) < count %> + <%= link_to "点击展开更多",feedback_path(@user.id, :type => type, :page => page),:id => "show_more_jours",:remote => "true",:class => "loadMore mt10 f_grey"%> +<% end %> \ No newline at end of file diff --git a/app/views/users/_user_programing_attr.html.erb b/app/views/users/_user_programing_attr.html.erb index e0bee689a..3f2e53fe8 100644 --- a/app/views/users/_user_programing_attr.html.erb +++ b/app/views/users/_user_programing_attr.html.erb @@ -1,44 +1,46 @@ - -

    编程作业的测试集设置

    -
    -
    -
    - -
    - <% if edit_mode && homework.is_program_homework? %> - <% homework.homework_tests.each_with_index do |test, index| %> -
    - - - - <% if index != 0 %> - - <% end %> -
    -
    - <% end %> - <% else %> -
    - - - -
    -
    - <% end %> - -
    - 温馨提示:您可以在发布作业后,在作业“模拟答题”中进行标准代码的检测。 - 确  定 -
    -
    - -
    - - \ No newline at end of file diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb index d0ac40ed0..138eab6f9 100644 --- a/app/views/users/search_user_course.js.erb +++ b/app/views/users/search_user_course.js.erb @@ -9,7 +9,11 @@ //$("#upload_box").css('left','').css('top',''); //$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); //$("#upload_box").css('display','block'); -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% if params[:send_type].present? && params[:send_type] == 'news' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_course' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% else %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% end %> showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb index db099fe72..fb6efec9a 100644 --- a/app/views/users/search_user_org.js.erb +++ b/app/views/users/search_user_org.js.erb @@ -1,4 +1,8 @@ -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% if params[:send_type].present? && params[:send_type] == 'news' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% else %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +<% end %> showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb index 5218c22ab..926b7aa58 100644 --- a/app/views/users/search_user_project.js.erb +++ b/app/views/users/search_user_project.js.erb @@ -1,4 +1,8 @@ -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% if params[:send_type].present? && params[:send_type] == 'news' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% else %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% end %> showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before(""); diff --git a/app/views/users/share_news_to_course.js.erb b/app/views/users/share_news_to_course.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_news_to_course.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/app/views/users/share_news_to_org.js.erb b/app/views/users/share_news_to_org.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_news_to_org.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/app/views/users/share_news_to_project.js.erb b/app/views/users/share_news_to_project.js.erb new file mode 100644 index 000000000..5a5046dfa --- /dev/null +++ b/app/views/users/share_news_to_project.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("发送成功!"); \ No newline at end of file diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index 1035f5656..24f625e03 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -1,68 +1,40 @@ -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> - <%= javascript_include_tag "init_KindEditor","user" %> -<% end %> - - -
    +
    -
    留言
    -
    - +
    留言
    +
      +
    • +
        +
      • <%= link_to "全部", {:controller => "users", :action => "user_newfeedback", :type => nil}, :class =>"resourcesTypeAll resourcesGrey"%>
      • +
      • <%= link_to "留言", {:controller => "users", :action => "user_newfeedback", :type => "public"}, :class => "mesIcon resourcesGrey"%>
      • +
      • <%= link_to "私信", {:controller => "users", :action => "user_newfeedback", :type => "private"}, :class => "personalIcon resourcesGrey"%>
      • +
      +
    • +
    +
    -
    -
    - <%= form_for('new_form',:url => leave_user_message_path(@user.id), :html =>{:id => "user_feedback_new"}, :method => "post") do |f|%> - -

    - -
    - - 留言 - 私信
    - <% end%> -
    -
    - -
    - <%if @jour%> - <% @jour.each do |jour|%> - <% unless jour.private == 1 && (!User.current || (User.current && jour.jour_id != User.current.id && jour.user_id != User.current.id)) %> - <%= render :partial => 'user_jours_new', :locals => {:jour => jour} %> - <% end %> - <%end%> - <% end%> - -
      - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> -
    -
    +
    +
    <%= link_to image_tag(url_to_avatar(User.current),:class=>"fl mr10", :width => "50", :height => "50"), :alt => "用户头像" %> +
    + <%= form_for('new_form',:url => leave_user_message_path(@user.id), :html =>{:id => "user_feedback_new"}, :method => "post") do |f|%> + <%=render :partial => "jour_form", :locals => {:f => f} %> + + 留言 + 私信 + <% end %> +
    + <%=render :partial => "users/user_jours_list", :locals => {:jours =>@jour, :page => 0, :type => @type, :count => @jour_count} %>
    - \ No newline at end of file diff --git a/app/views/users/user_newfeedback.js.erb b/app/views/users/user_newfeedback.js.erb new file mode 100644 index 000000000..cfac4cef2 --- /dev/null +++ b/app/views/users/user_newfeedback.js.erb @@ -0,0 +1 @@ +$("#show_more_jours").replaceWith("<%= escape_javascript( render :partial => 'users/user_jours_list',:locals => {:jours => @jour, :page => @page,:type => @type, :count => @jour_count} )%>"); diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 2f94e4401..e395604f4 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -141,7 +141,7 @@
  • 预览
  • 重命名
  • -
  • 发送
  • +
  • 发送
  • 删除
  • @@ -330,7 +330,7 @@ - function show_send(){ + function show_send_(){ $("#contextMenu").hide(); document.oncontextmenu = function() {return true;} line.children().css("background-color",'white'); @@ -338,12 +338,14 @@ if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 $.ajax({ type: 'get', - url: '<%= search_user_project_user_path(@user)%>' + '?send_id=' + id + url: '<%= search_user_project_user_path(@user)%>' + '?send_id=' + id, + data:{send_type:'file'} }); }else{ $.ajax({ type: 'get', - url: '<%= search_user_course_user_path(@user)%>' + '?send_id=' + id + url: '<%= search_user_course_user_path(@user)%>' + '?send_id=' + id, + data:{send_type:'file'} }); } } @@ -476,91 +478,5 @@ } } - //id 发送的id - //发送的id数组 - function chooseSendType(res_id,res_ids){ - - sendType = $(".resourcesSendType").val(); - if (sendType === lastSendType) { - return; - } else if (lastSendType != null) { //不是第一次点击的时候 - if(res_ids == "") {//如果是单个发送 - if (sendType === '1') { - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(@user)%>' + '?send_id=' + id - }); - } else if(sendType === '2') { - $.ajax({ - type: 'get', - url: '<%= search_user_project_user_path(@user)%>' + '?send_id=' + id - }); - }else if(sendType ==='3') - { - $.ajax({ - type: 'get', - url: '<%= search_user_org_user_path(@user)%>' + '?send_id=' + res_id - }); - } - }else{//如果是多个发送 - if (sendType === '1'){ - $.ajax({ - type: 'get', - url: '<%= search_user_course_user_path(@user)%>' + '?'+ $("#resources_list_form").serialize() - }); - }else if(sendType === '2'){ - $.ajax({ - type: 'get', - url: '<%= search_user_project_user_path(@user)%>' + '?' + $("#resources_list_form").serialize() - }); - }else if(sendType === '3'){ - $.ajax({ - type: 'get', - url: '<%= search_user_org_user_path(User.current)%>' + '?'+$("#resources_list_form").serialize() - }); - } - } - } - - lastSendType = sendType; - } - - function observeSearchfieldOnInput(fieldId, url,send_id,send_ids) { - $('#'+fieldId).each(function() { - var $this = $(this); - $this.addClass('autocomplete'); - $this.attr('data-value-was', $this.val()); - var check = function() { - var val = $this.val(); - if ($this.attr('data-value-was') != val){ - $this.attr('data-value-was', val); - $.ajax({ - url: url, - type: 'get', - data: {search: $this.val(),send_id:send_id,send_ids:send_ids}, - success: function(data){ }, - beforeSend: function(){ $this.addClass('ajax-loading'); }, - complete: function(){ $this.removeClass('ajax-loading'); } - }); - } - }; - var reset = function() { - if (timer) { - clearInterval(timer); - timer = setInterval(check, 300); - } - }; - var timer = setInterval(check, 300); - $this.bind('keyup click mousemove', reset); - }); - } - - function subfield_click(){ - var sendText = $("input[name='org_id']:checked").next().text(); - var orgDirection = "目标地址:" - var sendColumn = $("input[name='subfield']:checked").next().text(); - $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); - } - diff --git a/app/views/users/user_system_messages.html.erb b/app/views/users/user_system_messages.html.erb index 66d7037e9..86ae56cc8 100644 --- a/app/views/users/user_system_messages.html.erb +++ b/app/views/users/user_system_messages.html.erb @@ -12,7 +12,7 @@ <%= system_message.subject.nil? ? "系统消息" : system_message.subject %>
    -
    +

    <%= system_message.content.nil? ? system_message.description.html_safe : system_message.content.html_safe %>

    diff --git a/config/locales/mailers/zh.yml b/config/locales/mailers/zh.yml index 7b56011b1..00a1bfafd 100644 --- a/config/locales/mailers/zh.yml +++ b/config/locales/mailers/zh.yml @@ -28,4 +28,6 @@ zh: mail_homework: "作业:" mail_anonymous_comment_close: "作业匿评已经关闭,请您关注!" mail_anonymous_comment_open: "作业匿评已经开启,请您关注!" - mail_anonymous_comment_failed: "作业匿评开启失败,请您关注!" \ No newline at end of file + mail_anonymous_comment_failed: "作业匿评开启失败,请您关注!" + mail_issue_due_date: "问题跟踪截止时间快到了,请您关注!" + mail_issue: "问题跟踪:" \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index f55c69403..148b6dea2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -464,6 +464,8 @@ RedmineApp::Application.routes.draw do get 'projects/:id/issues/report', :to => 'reports#issue_report', :as => 'project_issues_report' get 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :as => 'project_issues_report_details' post '/users/:id/user_activities', :to => 'users#show', :as => "user_activities" + match 'projects/:project_id/news/index', :to => 'news#index', :via => [:get, :post], :as => 'new_course_news' + match 'projects/:project_id/news/new', :to => 'news#new', :via => [:get, :post] post '/courses/:id/course_activity', :to => 'courses#show', :as => 'course_activity' get '/boards/:id/boards_topic', :to =>'boards#show', :as => 'boards_topic' @@ -533,6 +535,9 @@ RedmineApp::Application.routes.draw do post "add_exist_file_to_course" post "add_exist_file_to_project" post 'add_exist_file_to_org' + post 'share_news_to_course' + post 'share_news_to_project' + post 'share_news_to_org' get 'resource_preview' get 'rename_resource' get 'search_user_project' diff --git a/db/migrate/20160120032758_add_org_subfield_id_to_news.rb b/db/migrate/20160120032758_add_org_subfield_id_to_news.rb new file mode 100644 index 000000000..bd4ca9772 --- /dev/null +++ b/db/migrate/20160120032758_add_org_subfield_id_to_news.rb @@ -0,0 +1,5 @@ +class AddOrgSubfieldIdToNews < ActiveRecord::Migration + def change + add_column :news, :org_subfield_id, :integer + end +end diff --git a/db/migrate/20160121070232_add_allow_guest_download_to_organizations.rb b/db/migrate/20160121070232_add_allow_guest_download_to_organizations.rb new file mode 100644 index 000000000..edf5c47b0 --- /dev/null +++ b/db/migrate/20160121070232_add_allow_guest_download_to_organizations.rb @@ -0,0 +1,5 @@ +class AddAllowGuestDownloadToOrganizations < ActiveRecord::Migration + def change + add_column :organizations, :allow_guest_download, :boolean, :default => true + end +end diff --git a/db/schema.rb b/db/schema.rb index 197fbbb02..be1fdb1a4 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 => 20160118083751) do +ActiveRecord::Schema.define(:version => 20160121070232) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1092,6 +1092,7 @@ ActiveRecord::Schema.define(:version => 20160118083751) do t.integer "comments_count", :default => 0, :null => false t.integer "course_id" t.integer "sticky", :default => 0 + t.integer "org_subfield_id" end add_index "news", ["author_id"], :name => "index_news_on_author_id" @@ -1266,6 +1267,7 @@ ActiveRecord::Schema.define(:version => 20160118083751) do t.boolean "is_public" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.boolean "allow_guest_download", :default => true end create_table "phone_app_versions", :force => true do |t| @@ -1712,6 +1714,10 @@ ActiveRecord::Schema.define(:version => 20160118083751) do t.string "extra" end + create_table "temp", :id => false, :force => true do |t| + t.integer "id", :default => 0, :null => false + end + create_table "time_entries", :force => true do |t| t.integer "project_id", :null => false t.integer "user_id", :null => false diff --git a/lib/tasks/issue_due_date.rake b/lib/tasks/issue_due_date.rake index f40fa290f..8d101ff94 100644 --- a/lib/tasks/issue_due_date.rake +++ b/lib/tasks/issue_due_date.rake @@ -12,8 +12,8 @@ namespace :issue_due_date do recipients << assigner recipients.each do |r| issue.forge_messages << ForgeMessage.new(:user_id => r.id, :project_id => issue.project_id, :viewed => false, :status => 1) - # 发送邮件通知 - # Mailer.homework_endtime__added(homework_common, s.student_id).deliver + # issue截止时间邮件提醒 + Mailer.issue_due_date(issue, recipients).deliver end end end diff --git a/lib/trustie/gitlab/sync.rb b/lib/trustie/gitlab/sync.rb index 1f6f7c146..d41b813e7 100644 --- a/lib/trustie/gitlab/sync.rb +++ b/lib/trustie/gitlab/sync.rb @@ -53,6 +53,19 @@ module Trustie ) project.gpid = gproject.id project.save! + + # 创建的时候一并同步成员及角色 + project.members.each do |m| + begin + gid = m.user.gid + unless gid + gid = sync_user(m.user).id + end + self.g.add_team_member(gproject.id, gid, UserLevel::DEVELOPER) + rescue => e + puts e + end + end end def sync_project(project, opt={}) diff --git a/public/images/mes_icon.png b/public/images/mes_icon.png new file mode 100644 index 000000000..4a37cca0c Binary files /dev/null and b/public/images/mes_icon.png differ diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 193b358dc..f982d92f6 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -23,23 +23,6 @@ function description_show_hide(id){ }); } -function homework_description_show_hide(id){ - showNormalImage('homework_description_'+id); - if($("#intro_content_"+id).height() > 810) { - $("#intro_content_show_"+id).show(); - } - $("#intro_content_show_"+id).click(function(){ - $("#homework_description_"+id).toggleClass("maxh360"); - $("#intro_content_show_"+id).hide(); - $("#intro_content_hide_"+id).show(); - }); - $("#intro_content_hide_"+id).click(function(){ - $("#homework_description_"+id).toggleClass("maxh360"); - $("#intro_content_hide_"+id).hide(); - $("#intro_content_show_"+id).show(); - }); -} - function cleanArray (actual){ var newArray = new Array(); for (var i = 0; i< actual.length; i++){ @@ -1035,3 +1018,120 @@ function showNormalImage(id) { } } + +//文件、帖子、通知分享 +function org_id_click(){ + var sendText = $("input[name='org_id']:checked").next().text(); + var orgDirection = "目标地址:"; + $(".orgDirection").text(orgDirection + sendText); +} +function subfield_click(){ + var sendText = $("input[name='org_id']:checked").next().text(); + var orgDirection = "目标地址:"; + var sendColumn = $("input[name='subfield']:checked").next().text(); + $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); +} + +function observeSearchfieldOnInput(fieldId, url,send_id,send_ids, send_type) { + $('#'+fieldId).each(function() { + var $this = $(this); + $this.addClass('autocomplete'); + $this.attr('data-value-was', $this.val()); + var check = function() { + var val = $this.val(); + if ($this.attr('data-value-was') != val){ + $this.attr('data-value-was', val); + $.ajax({ + url: url, + type: 'get', + data: {search: $this.val(),send_id:send_id,send_ids:send_ids, send_type:send_type}, + success: function(data){ }, + beforeSend: function(){ $this.addClass('ajax-loading'); }, + complete: function(){ $this.removeClass('ajax-loading'); } + }); + } + }; + var reset = function() { + if (timer) { + clearInterval(timer); + timer = setInterval(check, 300); + } + }; + var timer = setInterval(check, 300); + $this.bind('keyup click mousemove', reset); + }); +} +function check_des(event){ + if($(".sectionContent").find('input[type="radio"]:checked').length <= 0){ + event.preventDefault(); + $(".orgDirection").text('目标地址组织不能为空'); + return false; + }else if($(".columnContent").find('input[type="radio"]:checked').length <= 0){ + event.preventDefault(); + $(".orgDirection").text('目标地址栏目不能为空'); + return false; + }else{ + return true; + } +} + +var sendType = '1'; +var lastSendType ;//初始为发送到我的课程 +function show_send(id, user_id, send_type){ + if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_project', + data:{send_id:id, send_type:send_type} + }); + }else if(lastSendType == '1'){ + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_course', + data:{send_id:id, send_type:send_type} + }); + }else if( lastSendType == '3'){//组织 + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_org', + data:{send_id:id, send_type:send_type} + }); + }else{ + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_course', + data:{send_id:id, send_type:send_type} + }); + } +} + +//id 发送的id +//发送的id数组 +function chooseSendType(res_id,res_ids, user_id, send_type){ + + sendType = $(".resourcesSendType").val(); + if (sendType === lastSendType) { + return; + } else if(lastSendType != null) { //不是第一次点击的时候 + if (sendType == '1') { + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_course', + data:{send_id:res_id, send_type:send_type} + }); + } else if(sendType == '2') { + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_project', + data:{send_id:res_id, send_type:send_type} + }); + }else if(sendType == '3'){ + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_org', + data:{send_id:res_id, send_type:send_type} + }); + } + } + lastSendType = sendType; +} diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index be212fb29..45721fd1b 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -114,7 +114,9 @@ $(function(){ dialogClass: 'BluePopupBox', minWidth: 753 }); - $('#BluePopupBox').parent().css("border","3px solid #269ac9"); + $('#BluePopupBox').parent().resizable("disable"); + $('#BluePopupBox').parent().removeClass("ui-state-disabled"); + $('#BluePopupBox').parent().css("border","3px solid #269ac9").css("padding","10px"); $('a.ProBtn').live('click', function(){ $("#BluePopupBox").dialog("open"); @@ -205,7 +207,9 @@ $(function(){ dialogClass: 'BluePopupBox', minWidth: 290 }); - $('#GroupPopupBox').parent().css("border","3px solid #269ac9"); + $('#GroupPopupBox').parent().resizable("disable"); + $('#GroupPopupBox').parent().removeClass("ui-state-disabled"); + $('#GroupPopupBox').parent().css("border","3px solid #269ac9").css("padding","10px"); $('a.groupBtn').live('click', function(){ $("#GroupPopupBox").dialog("open"); diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index 567d2322f..f273f0b77 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -55,6 +55,43 @@ function show_more_project(url){ ); } +//个人留言 +function jour_submit(){ + if(jourReplyVerify()){ + $("#private_flag").val("0"); + jour_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值 + $("#user_feedback_new").submit(); + } +} + +function private_jour_submit(){ + if(jourReplyVerify()){ + $("#private_flag").val("1"); + jour_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值 + $("#user_feedback_new").submit(); + } +} + +function jourReplyVerify() { + var content = jour_content_editor.html();//$.trim($("#message_content").val()); + if (jour_content_editor.isEmpty()) { + $("#jour_content_span").text("回复不能为空"); + $("#jour_content_span").css('color', '#ff0000'); + $("#submit_feedback_user").one('click',function() { + jour_submit(); + }); + $("#private_submit_feedback_user").one('click',function() { + private_jour_submit(); + }); + return false; + } + else { + $("#jour_content_span").text("填写正确"); + $("#jour_content_span").css('color', '#008000'); + return true; + } +} + //老师提交 新建/修改 作业 function submit_homework(id){ if(!regex_homework_name()){ diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 0f4ef57fe..c08c81054 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -241,7 +241,7 @@ function regexTitle() { function regexDescription() { project_news_description_editor.sync(); - var name = $("#news_description").val(); + var name = project_news_description_editor.html(); if (name.length == 0) { $("#description_notice_span").text("描述不能为空"); $("#description_notice_span").css('color', '#ff0000'); @@ -272,9 +272,26 @@ function submitFocus(obj) { $(obj).focus(); } + function submitComment() { - $("#add_comment_form").submit(); + if (newsReplyVerify()) { + comment_editor.sync(); + $("#add_comment_form").submit(); + } +} + +function newsReplyVerify() { + var content = comment_editor.html(); + if(comment_editor.isEmpty()) { + $("#add_reply_news").text("评论不能为空"); + $("#add_reply_news").css('color', '#ff0000'); + return false; + } else { + $("#add_reply_news").text("填写正确"); + $("#add_reply_news").css('color', '#008000'); + return true; + } } //当项目描述长度小于112px时,不显示更多按钮 diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 88949f24d..c913d9b0c 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1099,7 +1099,7 @@ a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; c .postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} .postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} -.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important;} +.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;} .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} .postDetailReply { margin-top:28px; color:#888888; float:right;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index fb5e64523..b1f950960 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1,3 +1,4 @@ + /* CSS Document */ /* 2015-06-26 */ body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;} @@ -98,6 +99,7 @@ a.linkGrey6:hover {color:#ffffff !important;} .mr40{ margin-right:40px !important;} .mr65 {margin-right: 65px;} .mw20{ margin: 0 20px;} +.mw400 {max-width: 400px !important;} .mt-20 {margin-top:-20px;} .mt-4 {margin-top: -4px;} .mt0 {margin-top: 0px !important;} @@ -555,7 +557,7 @@ a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no- /*.navHomepageProfile ul li ul {display:none;} .navHomepageProfile ul li:hover ul {display:block;}*/ .homepageLeft {width:240px; float:left; margin-right:10px; margin-bottom:10px;} -.homepageRight {width:750px; float:left; margin-top:10px; margin-bottom:10px;} +.homepageRight {width:750px; float:left; margin-top:10px; margin-bottom:10px; margin-top:10px;} .homepagePortraitContainer {width:208px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px; padding:15px;} .homepagePortraitImage {width:78px; height:78px; position:relative; border:1px solid #cbcbcb; padding: 2px;} .homepagePortraitImage:hover {border:1px solid #269ac9;} @@ -839,7 +841,7 @@ a.sortArrowActiveU {background:url(images/post_image_list.png) -17px -20px no-re .postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} .postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} -.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important;} +.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;} .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} .postDetailReply { margin-top:28px; color:#888888; float:right;display: inline} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index cf23eb963..f1b0c5846 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -1109,7 +1109,7 @@ a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;} .postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} .postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} -.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important;} +.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;} .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} .postDetailReply { margin-top:28px; color:#888888; float:right;} @@ -1167,4 +1167,4 @@ div.disable_link {background-color: #c1c1c1 !important;} /*问题跟踪局部修改属性*/ .proInfoBox2{ border:1px solid #dddddd; height:45px; padding:10px 0; background-color:#f1f1f1;} -.proInfoBox2 ul li{ height:24px; position:relative;} \ No newline at end of file +.proInfoBox2 ul li{ height:24px; position:relative;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index baa3f6fcf..6827ee83f 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -172,7 +172,7 @@ h4{ font-size:14px; color:#3b3b3b;} .h70{ height:70px;} .h150{ height:150px;} .p10 {padding-left:10px; padding-right:10px;} -.mw400 {max-width: 400px;} +.mw400 {max-width: 400px !important;} .mh18 {max-height: 18px;} /* Font & background Color */ @@ -309,7 +309,7 @@ a:hover.bgreen_n_btn{background:#08a384;} .blue_btn_cir{ background:#3498db; 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;} .orange_btn_cir{ background:#e67e22; 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;} .bgreen_btn_cir{ background:#1abc9c; 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;} -.grey_border{border:1px solid #dddddd !important; } +.grey_border{border:1px solid #dddddd !important;} /* commonpic */ .pic_date{ display:block; background:url(../images/new_project/public_icon.png) -31px 0 no-repeat; width:16px; height:15px; float:left;} .pic_add{ display:block; background:url(../images/new_project/public_icon.png) -31px -273px no-repeat; width:16px; height:15px; float:left;} diff --git a/public/stylesheets/share.css b/public/stylesheets/share.css index 43e0bc8f6..02d91304f 100644 --- a/public/stylesheets/share.css +++ b/public/stylesheets/share.css @@ -35,7 +35,7 @@ ul.subNavArrow:hover li ul {display:block;} a.mesIcon {background:url(../images/mes_icon.png) -5px -73px no-repeat; padding-left:23px;} a.personalIcon {background:url(../images/mes_icon.png) -6px -16px no-repeat; padding-left:23px;} .mesType {background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 15px; left:-50px; font-size:12px; color:#888888; display:none; line-height:2; z-index:999; white-space:nowrap;} -a.greyBtn2 {float:right; text-align:center; font-size:12px; color:#ffffff; background-color:#cecece; padding:3px 10px;} +a.greyBtn2 {float:right; text-align:center; font-size:12px; color:#ffffff; background-color:#aaaaaa; padding:3px 10px;} .PMTag {padding:0px 5px; background-color:#555555; border-radius:3px; color:#ffffff;} .upload_con h2{ display:block; background:#eaeaea; font-size:14px; color:#343333; height:31px; width: auto; margin-top:25px; padding-left:20px; padding-top:5px;} .upload_box{ width:430px; margin:15px auto;}