From 1a1d5b4c49bc25b19499cc2a72f965c25c1d3b10 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 28 Mar 2016 19:20:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=EF=BC=9A=E5=8F=91=E9=80=81?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=9C=A8=E4=B8=AD=E6=96=87=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8C=E4=BC=9A=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E8=BE=93=E5=85=A5=E6=A1=86=E5=86=85=E5=AE=B9=E5=A2=9E?= =?UTF-8?q?=E5=A4=9A=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_course_file_form.html.erb | 26 ++++++++++++ app/views/users/_course_message_form.html.erb | 26 ++++++++++++ app/views/users/_course_news_form.html.erb | 26 ++++++++++++ app/views/users/_org_file_form.html.erb | 32 ++++++++++++++ app/views/users/_org_message_form.html.erb | 31 ++++++++++++++ app/views/users/_org_news_form.html.erb | 32 ++++++++++++++ app/views/users/_project_file_form.html.erb | 25 +++++++++++ .../users/_project_message_form.html.erb | 25 +++++++++++ app/views/users/_project_news_form.html.erb | 25 +++++++++++ .../users/_resource_share_for_orgs.html.erb | 42 ++----------------- ..._resource_share_for_project_popup.html.erb | 27 +----------- .../users/_resource_share_popup.html.erb | 29 ++----------- .../users/_share_message_to_course.html.erb | 31 ++------------ .../users/_share_message_to_org.html.erb | 42 ++----------------- .../users/_share_message_to_project.html.erb | 30 ++----------- .../users/_share_news_to_course.html.erb | 31 ++------------ app/views/users/_share_news_to_org.html.erb | 42 ++----------------- .../users/_share_news_to_project.html.erb | 31 ++------------ app/views/users/search_user_course.js.erb | 38 ++++++++++------- app/views/users/search_user_org.js.erb | 12 +++++- app/views/users/search_user_project.js.erb | 10 +++++ public/javascripts/application.js | 6 +-- 22 files changed, 326 insertions(+), 293 deletions(-) create mode 100644 app/views/users/_course_file_form.html.erb create mode 100644 app/views/users/_course_message_form.html.erb create mode 100644 app/views/users/_course_news_form.html.erb create mode 100644 app/views/users/_org_file_form.html.erb create mode 100644 app/views/users/_org_message_form.html.erb create mode 100644 app/views/users/_org_news_form.html.erb create mode 100644 app/views/users/_project_file_form.html.erb create mode 100644 app/views/users/_project_message_form.html.erb create mode 100644 app/views/users/_project_news_form.html.erb diff --git a/app/views/users/_course_file_form.html.erb b/app/views/users/_course_file_form.html.erb new file mode 100644 index 000000000..2743ed159 --- /dev/null +++ b/app/views/users/_course_file_form.html.erb @@ -0,0 +1,26 @@ +<%= form_tag add_exist_file_to_course_user_path(user),:remote=>true,:id=>'course_list_form' do %> +
+ <%= 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 %> + <% end %> +
+
+
+
+ + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
+ +
+
+<% end %> \ No newline at end of file diff --git a/app/views/users/_course_message_form.html.erb b/app/views/users/_course_message_form.html.erb new file mode 100644 index 000000000..94e0f65ec --- /dev/null +++ b/app/views/users/_course_message_form.html.erb @@ -0,0 +1,26 @@ +<%= form_tag share_message_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 %> + <% end %> +
+
+
+
+ + <%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();' %> +
+ +
+
\ No newline at end of file diff --git a/app/views/users/_course_news_form.html.erb b/app/views/users/_course_news_form.html.erb new file mode 100644 index 000000000..a244b8678 --- /dev/null +++ b/app/views/users/_course_news_form.html.erb @@ -0,0 +1,26 @@ +<%= 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 %> + <% end %> +
+
+
+
+ + <%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();' %> +
+ +
+
\ No newline at end of file diff --git a/app/views/users/_org_file_form.html.erb b/app/views/users/_org_file_form.html.erb new file mode 100644 index 000000000..8d8332297 --- /dev/null +++ b/app/views/users/_org_file_form.html.erb @@ -0,0 +1,32 @@ +<%= form_tag add_exist_file_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) %> +
+ + +
+
+ +
+
+
目标地址:
+
+ <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %> +
+
+ 取消 +
+
+<%end %> \ No newline at end of file diff --git a/app/views/users/_org_message_form.html.erb b/app/views/users/_org_message_form.html.erb new file mode 100644 index 000000000..82fbed8e4 --- /dev/null +++ b/app/views/users/_org_message_form.html.erb @@ -0,0 +1,31 @@ +<%= form_tag share_message_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) %> +
+ +
+
+ +
+
+
目标地址:
+
+ <%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();', :onclick => "check_des(event);" %> +
+
+ 取消 +
+
+<% end %> \ No newline at end of file diff --git a/app/views/users/_org_news_form.html.erb b/app/views/users/_org_news_form.html.erb new file mode 100644 index 000000000..2c2fbf230 --- /dev/null +++ b/app/views/users/_org_news_form.html.erb @@ -0,0 +1,32 @@ +<%= 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) %> +
+ + +
+
+ +
+
+
目标地址:
+
+ <%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();', :onclick => "check_des(event);" %> +
+
+ 取消 +
+
+<% end %> \ No newline at end of file diff --git a/app/views/users/_project_file_form.html.erb b/app/views/users/_project_file_form.html.erb new file mode 100644 index 000000000..d56402407 --- /dev/null +++ b/app/views/users/_project_file_form.html.erb @@ -0,0 +1,25 @@ +<%= form_tag add_exist_file_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 %> + <% end %> +
+
+
+
+ + <%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();' %> +
+ +
+
diff --git a/app/views/users/_project_message_form.html.erb b/app/views/users/_project_message_form.html.erb new file mode 100644 index 000000000..1084142f9 --- /dev/null +++ b/app/views/users/_project_message_form.html.erb @@ -0,0 +1,25 @@ +<%= form_tag share_message_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 %> \ No newline at end of file diff --git a/app/views/users/_project_news_form.html.erb b/app/views/users/_project_news_form.html.erb new file mode 100644 index 000000000..2293f942a --- /dev/null +++ b/app/views/users/_project_news_form.html.erb @@ -0,0 +1,25 @@ +<%= 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 %> + <% end %> +
+
+
+
+ + <%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();' %> +
+ +
+
\ No newline at end of file diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index 792db7546..2438727a3 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -18,42 +18,6 @@ <% end %>
-<%= form_tag add_exist_file_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) %> -
- - -
-
- -
-
-
目标地址:
-
- <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %> -
-
- 取消 -
-
- <%end %> \ No newline at end of file +
+ <%= render :partial => 'users/org_file_form', :locals => {:user => user, :orgs => @orgs, :send_id => send_id, :send_ids => send_ids} %> +
\ No newline at end of file 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 33fa03061..219db4ffc 100644 --- a/app/views/users/_resource_share_for_project_popup.html.erb +++ b/app/views/users/_resource_share_for_project_popup.html.erb @@ -24,31 +24,8 @@ <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> <% end %> - <%= form_tag add_exist_file_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 %> -
+
+ <%= render :partial => 'users/project_file_form', :locals => {:user => user, :projects => projects, :send_id => send_id, :send_ids => send_ids} %>
-
-
- - <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> -
- -
-
- <% end %>
diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb index 74265cabb..13494758c 100644 --- a/app/views/users/_resource_share_popup.html.erb +++ b/app/views/users/_resource_share_popup.html.erb @@ -26,31 +26,8 @@ <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> <% end %> - <%= form_tag add_exist_file_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 %> +
+ <%= render :partial => "users/course_file_form", :locals => {:user => user, :send_id => send_id, :send_ids => send_ids, :courses => courses} %> +
diff --git a/app/views/users/_share_message_to_course.html.erb b/app/views/users/_share_message_to_course.html.erb index eda4a9b97..66d44739c 100644 --- a/app/views/users/_share_message_to_course.html.erb +++ b/app/views/users/_share_message_to_course.html.erb @@ -26,31 +26,8 @@ <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> <% end %> - <%= form_tag share_message_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 %> - +
+ <%= render :partial => 'users/course_message_form', :locals => {:user => user, :courses => courses, :send_id => send_id, :send_ids => send_ids} %> +
+ diff --git a/app/views/users/_share_message_to_org.html.erb b/app/views/users/_share_message_to_org.html.erb index da3c7a072..8cb2fae57 100644 --- a/app/views/users/_share_message_to_org.html.erb +++ b/app/views/users/_share_message_to_org.html.erb @@ -18,42 +18,6 @@ <% end %>
-<%= form_tag share_message_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) %> -
- - -
-
- -
-
-
目标地址:
-
- <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %> -
-
- 取消 -
-
-<%end %> \ No newline at end of file +
+ <%= render :partial => 'users/org_message_form',:locals => {:user => user, :orgs => @orgs, :send_id => send_id, :send_ids => send_ids} %> +
\ No newline at end of file diff --git a/app/views/users/_share_message_to_project.html.erb b/app/views/users/_share_message_to_project.html.erb index 4b79a779c..3a89c0b9f 100644 --- a/app/views/users/_share_message_to_project.html.erb +++ b/app/views/users/_share_message_to_project.html.erb @@ -24,30 +24,8 @@ <%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %> <% end %> - <%= form_tag share_message_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 %> - +
+ <%= render :partial => 'users/project_message_form', :locals => {:projects => projects, :user => user, :send_id => send_id, :send_ids => send_ids} %> +
+ diff --git a/app/views/users/_share_news_to_course.html.erb b/app/views/users/_share_news_to_course.html.erb index 144792201..a1a0d6e39 100644 --- a/app/views/users/_share_news_to_course.html.erb +++ b/app/views/users/_share_news_to_course.html.erb @@ -26,31 +26,8 @@ <%= 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 %> - +
+ <%= render :partial => 'users/course_news_form',:locals => {:user => user, :courses => courses, :send_id => send_id, :send_ids => send_ids} %> +
+ diff --git a/app/views/users/_share_news_to_org.html.erb b/app/views/users/_share_news_to_org.html.erb index 794c6db89..095e09027 100644 --- a/app/views/users/_share_news_to_org.html.erb +++ b/app/views/users/_share_news_to_org.html.erb @@ -18,42 +18,6 @@ <% 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) %> -
- - -
-
- -
-
-
目标地址:
-
- <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %> -
-
- 取消 -
-
-<%end %> \ No newline at end of file +
+ <%= render :partial => 'users/org_news_form', :locals => {:orgs => @orgs, :user => user,:send_id => send_id, :send_ids => send_ids} %> +
\ 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 index 37bac105a..0fb38f8df 100644 --- a/app/views/users/_share_news_to_project.html.erb +++ b/app/views/users/_share_news_to_project.html.erb @@ -24,31 +24,8 @@ <%= 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 %> - +
+ <%= render :partial => 'users/project_news_form', :locals => {:user => user, :projects => projects, :send_id => send_id, :send_ids => send_ids} %> +
+ diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb index f4509987f..c191d8c4c 100644 --- a/app/views/users/search_user_course.js.erb +++ b/app/views/users/search_user_course.js.erb @@ -9,18 +9,28 @@ //$("#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'); -<% 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}) %>'); -<% elsif params[:send_type] == 'file' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); -<% elsif params[:send_type] == 'message' %> -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_course' ,:locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); +<% if params[:is_observe].nil? %> + <% 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}) %>'); + <% elsif params[:send_type] == 'file' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' , :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); + <% elsif params[:send_type] == 'message' %> + $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_course' ,: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(""); + $('#ajax-modal').parent().css("top","50%").css("left","50%"); + $('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup"); + $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); + var val = $("#search_course_input").val(); + $("#search_course_input").val("").focus().val(val); +<% else %> + <% if params[:send_type] == 'news' %> + $("#course_news_form").html("<%= escape_javascript(render :partial => 'users/course_news_form', :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>") + <% elsif params[:send_type] == 'file' %> + $("#course_file_form").html("<%= escape_javascript(render :partial => 'users/course_file_form', :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); + <% elsif params[:send_type] == 'message' %> + $("#course_message_form").html("<%= escape_javascript(render :partial => 'users/course_message_form', :locals => {:courses => @course, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); + <% end %> <% end %> -showModal('ajax-modal', '452px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","50%").css("left","50%"); -$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup"); -$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); -var val = $("#search_course_input").val(); -$("#search_course_input").val("").focus().val(val); diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb index ee12e9439..044f93be5 100644 --- a/app/views/users/search_user_org.js.erb +++ b/app/views/users/search_user_org.js.erb @@ -1,3 +1,4 @@ +<% if params[:is_observe].nil? %> <% 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})%>'); <% elsif params[:send_type] == 'file' %> @@ -12,4 +13,13 @@ $('#ajax-modal').parent().css("top","50%").css("left","50%"); $('#ajax-modal').parent().addClass("popbox").addClass("shareDP"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); var val = $("#search_org_input").val(); -$("#search_org_input").val("").focus().val(val); \ No newline at end of file +$("#search_org_input").val("").focus().val(val); +<% else %> + <% if params[:send_type] == 'news' %> + $("#org_news_form").html("<%= escape_javascript(render :partial => 'users/org_news_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>"); + <% elsif params[:send_type] == 'file' %> + $("#org_file_form").html("<%= escape_javascript(render :partial => 'users/org_file_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>"); + <% elsif params[:send_type] == 'message' %> + $("#org_message_form").html("<%= escape_javascript(render :partial => 'users/org_message_form', :locals => {:orgs => @orgs,:user=> @user,:send_id => @send_id, :send_ids => @send_ids}) %>"); + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb index d58c56ca9..b431af716 100644 --- a/app/views/users/search_user_project.js.erb +++ b/app/views/users/search_user_project.js.erb @@ -1,3 +1,4 @@ +<% if params[:is_observe].nil? %> <% 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}) %>'); <% elsif params[:send_type] == 'file' %> @@ -14,3 +15,12 @@ $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); //$("#search_project_input").focus(); var val = $("#search_project_input").val(); $("#search_project_input").val("").focus().val(val); +<% else %> +<% if params[:send_type] == 'news' %> +$("#project_news_form").html("<%= escape_javascript(render :partial => 'users/project_news_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); +<% elsif params[:send_type] == 'file' %> +$("#project_file_form").html("<%= escape_javascript(render :partial => 'users/project_file_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); +<% elsif params[:send_type] == 'message' %> +$("#project_message_form").html("<%= escape_javascript(render :partial => 'users/project_message_form', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>"); +<% end %> +<% end %> diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 3378a515c..0045b0ce3 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1055,7 +1055,7 @@ function observeSearchfieldOnInput(fieldId, url,send_id,send_ids, send_type) { $.ajax({ url: url, type: 'get', - data: {search: $this.val(),send_id:send_id,send_ids:send_ids, send_type:send_type}, + data: {search: $this.val(),send_id:send_id,send_ids:send_ids, send_type:send_type, is_observe:true}, success: function(data){ }, beforeSend: function(){ $this.addClass('ajax-loading'); }, complete: function(){ $this.removeClass('ajax-loading'); } @@ -1065,10 +1065,10 @@ function observeSearchfieldOnInput(fieldId, url,send_id,send_ids, send_type) { var reset = function() { if (timer) { clearInterval(timer); - timer = setInterval(check, 300); + timer = setInterval(check, 500); } }; - var timer = setInterval(check, 300); + var timer = setInterval(check, 500); $this.bind('keyup click mousemove', reset); }); }