diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index 5c9c48904..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
diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb
index f1d96d22c..47c08d2fb 100644
--- a/app/views/files/_course_list.html.erb
+++ b/app/views/files/_course_list.html.erb
@@ -43,7 +43,7 @@
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
- <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
<% if @course.is_public? %>
-
@@ -61,7 +61,7 @@
<% end %>
<%else%>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
<% end %>
<% end %>
diff --git a/app/views/files/_file_tools.html.erb b/app/views/files/_file_tools.html.erb
index df4d9d738..91b475600 100644
--- a/app/views/files/_file_tools.html.erb
+++ b/app/views/files/_file_tools.html.erb
@@ -2,7 +2,7 @@
<% if (is_project_manager?(User.current, @project) || file.author_id == User.current.id) && project_contains_attachment?(@project,file) %>
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @project.id && file.container_type == "Project" %>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
- <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
<% if @project.is_public? %>
-
@@ -25,7 +25,7 @@
<% end %>
<%else%>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
<% end %>
<% end %>
diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb
index 424319889..7a5d95125 100644
--- a/app/views/files/_org_subfield_list.html.erb
+++ b/app/views/files/_org_subfield_list.html.erb
@@ -38,7 +38,7 @@
<% if User.current.logged? %>
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
- <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
-
@@ -52,7 +52,7 @@
<%else%>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
<% end %>
<% end %>
diff --git a/app/views/files/_tool_settings.html.erb b/app/views/files/_tool_settings.html.erb
index 72ec6d89f..41d74b7df 100644
--- a/app/views/files/_tool_settings.html.erb
+++ b/app/views/files/_tool_settings.html.erb
@@ -4,7 +4,7 @@
<% if (is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file) %>
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project" %>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
- <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
<% if project.is_public? %>
-
@@ -20,7 +20,7 @@
<% end %>
<% else %>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
<% end %>
<% end %>
diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb
index b702d5872..8cb547b13 100644
--- a/app/views/files/index.html.erb
+++ b/app/views/files/index.html.erb
@@ -245,105 +245,7 @@
});
}
- 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 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;
- }
- }
- <% if User.current.logged? %>
- var sendType = '1';
- var lastSendType ;//初始为发送到我的课程
- function show_send(id){
- if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
- $.ajax({
- type: 'get',
- url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + id
- });
- }else if(lastSendType == '1'){
- $.ajax({
- type: 'get',
- url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
- });
- }else if( lastSendType == '3'){//组织
- $.ajax({
- type: 'get',
- url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + id
- });
- }else{
- $.ajax({
- type: 'get',
- url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
- });
- }
- }
-
- //id 发送的id
- //发送的id数组
- function chooseSendType(res_id,res_ids){
-
- sendType = $(".resourcesSendType").val();
- if (sendType === lastSendType) {
- return;
- } else if(lastSendType != null) { //不是第一次点击的时候
- if (sendType == '1') {
- $.ajax({
- type: 'get',
- url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + res_id
- });
- } else if(sendType == '2') {
- $.ajax({
- type: 'get',
- url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + res_id
- });
- }else if(sendType == '3'){
- $.ajax({
- type: 'get',
- url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + res_id
- });
- }
- }
-
- lastSendType = sendType;
- }
- <% end %>
<% if @course %>
var tagNameHtml; //当前双击的链接的父节点的html
var tagName; //标签的值
diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb
index bd3c99672..c4dd11ea0 100644
--- a/app/views/news/index.html.erb
+++ b/app/views/news/index.html.erb
@@ -4,118 +4,5 @@
<%= render :partial => 'course_news', locals: {course: @course} %>
<% end %>
-
diff --git a/app/views/news/index.js.erb b/app/views/news/index.js.erb
index 302c0cf9d..d2cac877c 100644
--- a/app/views/news/index.js.erb
+++ b/app/views/news/index.js.erb
@@ -1,5 +1,5 @@
<% if @project %>
- $("#news_list").html("<%= escape_javascript(render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count})%>");
+ $("#show_more_project_news").replaceWith("<%= escape_javascript(render :partial => 'project_news_detail', :locals=>{ :all_news=>@newss,:page => @page})%>");
<% else %>
$("#show_more_course_news").replaceWith("<%= escape_javascript( render :partial => 'course_news_detail', :locals =>{:newss => @newss, :page => @page} )%>");
<% end %>
\ No newline at end of file
diff --git a/app/views/org_subfields/_show_post_type.html.erb b/app/views/org_subfields/_show_post_type.html.erb
index 6faabd3e9..bc95c0774 100644
--- a/app/views/org_subfields/_show_post_type.html.erb
+++ b/app/views/org_subfields/_show_post_type.html.erb
@@ -29,121 +29,6 @@
:org_act_count=> @org_activities.count} %>
<% end %>
-
-
diff --git a/app/views/org_subfields/show.html.erb b/app/views/org_subfields/show.html.erb
index 374088acf..82203b4de 100644
--- a/app/views/org_subfields/show.html.erb
+++ b/app/views/org_subfields/show.html.erb
@@ -238,105 +238,7 @@
});
}
- 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 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;
- }
- }
-
- <% if User.current.logged? %>
- var sendType = '1';
- var lastSendType ;//初始为发送到我的课程
- function show_send(id){
- if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
- $.ajax({
- type: 'get',
- url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + id
- });
- }else if(lastSendType == '1'){
- $.ajax({
- type: 'get',
- url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
- });
- }else if( lastSendType == '3'){//组织
- $.ajax({
- type: 'get',
- url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + id
- });
- }else{
- $.ajax({
- type: 'get',
- url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
- });
- }
- }
-
- //id 发送的id
- //发送的id数组
- function chooseSendType(res_id,res_ids){
-
- sendType = $(".resourcesSendType").val();
- if (sendType === lastSendType) {
- return;
- } else if(lastSendType != null) { //不是第一次点击的时候
- if (sendType == '1') {
- $.ajax({
- type: 'get',
- url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + res_id
- });
- } else if(sendType == '2') {
- $.ajax({
- type: 'get',
- url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + res_id
- });
- }else if(sendType == '3'){
- $.ajax({
- type: 'get',
- url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + res_id
- });
- }
- }
- lastSendType = sendType;
- }
- <% end %>
<% if @course %>
var tagNameHtml; //当前双击的链接的父节点的html
var tagName; //标签的值
diff --git a/app/views/organizations/_org_subfield_news.html.erb b/app/views/organizations/_org_subfield_news.html.erb
index 3cb530860..074d15a42 100644
--- a/app/views/organizations/_org_subfield_news.html.erb
+++ b/app/views/organizations/_org_subfield_news.html.erb
@@ -35,7 +35,7 @@
-
<% if User.current.logged? %>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}')") %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}','#{User.current.id}','news')") %>
<% end %>
diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb
index fdb8f2476..ea61e2895 100644
--- a/app/views/users/_course_news.html.erb
+++ b/app/views/users/_course_news.html.erb
@@ -40,7 +40,7 @@
-
<% if User.current.logged? %>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}')") %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
<% end %>
diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb
index 57597d6e4..eb4941668 100644
--- a/app/views/users/_project_news.html.erb
+++ b/app/views/users/_project_news.html.erb
@@ -37,7 +37,7 @@
-
<% if User.current.logged? %>
- - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}')") %>
+ - <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}','#{User.current.id}','news')") %>
<% 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 @@
发送到
-