From 69affa8a2ecdc914e32a215f362e67f3f8bb0541 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Mon, 25 May 2015 15:19:42 +0800 Subject: [PATCH 01/29] ... --- app/views/boards/_form_project.html.erb | 6 +- app/views/boards/_project_new_topic.html.erb | 2 +- app/views/boards/_project_show.html.erb | 165 +++++++++++-------- 3 files changed, 98 insertions(+), 75 deletions(-) diff --git a/app/views/boards/_form_project.html.erb b/app/views/boards/_form_project.html.erb index 5cf20a993..58bb5501c 100644 --- a/app/views/boards/_form_project.html.erb +++ b/app/views/boards/_form_project.html.erb @@ -81,7 +81,11 @@ <% end %>
-

+ <% if replying%> +

+ <% else %> +

+ <%end %>
  • diff --git a/app/views/boards/_project_new_topic.html.erb b/app/views/boards/_project_new_topic.html.erb index 05304e978..d7c8972fc 100644 --- a/app/views/boards/_project_new_topic.html.erb +++ b/app/views/boards/_project_new_topic.html.erb @@ -1,4 +1,4 @@ -<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},:nhname=>'form', :html => {:multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %> +<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},:html => {:nhname=>'form', :multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %> <%= render :partial => 'form_project', :locals => {:f => f, :topic => @message} %>
  • diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index ae8dd5ed2..dc1cff634 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -31,72 +31,73 @@

    讨论区共有<%= @topic_count %>个帖子

    <% if @topics.any? %> <% @topics.each do |topic| %> -
    -
    - <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %> -
    - <% author = topic.author.to_s + ":" %> - <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> -

      <%= h(topic.subject) %>

    - <% if topic.editable_by?(User.current) %> - <%= l(:button_edit) %> - <% end %> - <%= link_to( - l(:button_delete), - {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :class => 'talk_edit fr', - :style => ' margin-right: 10px;' - ) if topic.destroyable_by?(User.current) %> - <% if topic.sticky? %> - <%= l(:label_board_sticky)%> - <% end %> -
    -
    -
    - <%= topic.content.html_safe %> -
    -
    - - <%= link_to_attachments_course topic, :author => false %> - <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %> -
    - <% if User.current.logged? %> - <%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => "about_newtalk#{topic.id}",:class => ' c_dblue fr' %> - <% end %> -
    -
    - -
    -
    - -
    - <% reply = Message.new(:subject => "RE: #{@message.subject}")%> - <% if !topic.locked? && authorize_for('messages', 'reply') %> - -
    - - <% end %> -
    - +
    + <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %> +
    + <% author = topic.author.to_s + ":" %> + <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> +

      <%= h(topic.subject) %>

    +
    + <% if topic.editable_by?(User.current) %> + <%= l(:button_edit) %> + <% end %> + <%= link_to( + l(:button_delete), + {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'}, + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'talk_edit fr', + :style => ' margin-right: 10px;' + ) if topic.destroyable_by?(User.current) %> + <% if topic.sticky? %> + <%= l(:label_board_sticky)%> + <% end %> +
    +
    +
    +
    + <%= topic.content.html_safe %> +
    +
    + + <%= link_to_attachments_course topic, :author => false %> + <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %> +
    + <% if User.current.logged? %> + <%= l(:button_reply) %> + <% end %> +
    + +
    +
    + <% reply = Message.new(:subject => "RE: #{@message.subject}")%> + <% if !topic.locked? && authorize_for('messages', 'reply') %> + +
    + + <% end %> +
    +
    +
    <% end %> <% end %> @@ -130,7 +131,8 @@ function nh_init_board(params){ params.showbtn.click(function(){//发帖/编辑/回复按钮的click if(params.textarea.data('init') == undefined){ - var editor = params.kindutil.create(params.textarea, {//初始化编辑器 + //初始化编辑器 + var editor = params.kindutil.create(params.textarea, { resizeType : 1, allowPreviewEmoticons : false, allowImageUpload : false, @@ -138,7 +140,8 @@ width:"565px", items : [] }); - params.submitbtn.click(function(){//提交按钮click + //表单提交 + params.form.submit(function(){ var is_checked = nh_check_field({ subject:params.inputsubject, subjectmsg:params.subjectmsg, @@ -148,14 +151,29 @@ if(is_checked){ alert('submit'); params.textarea.html(editor.html()); -// params.form.submit(); + return false; +// return true; } + return false; }); - params.cancelbtn.click(function(){//取消按钮click + //提交按钮click + params.submitbtn.click(function(){ + params.form.submit(); + }); + //取消按钮click + params.cancelbtn.click(function(){ params.about_talk.toggle();//显示/隐藏编辑区 - params.inputsubject.focus(); + if(params.about_talk.is(':hidden')){//隐藏时reset表单数据 + params.form[0].reset(); + editor.html(params.textarea.html()); + params.subjectmsg.hide(); + params.contentmsg.hide(); + }else{ + if(params.type=='reply'){editor.focus();}//有bug 页面不跟着跳 + else params.inputsubject.focus(); + } }); - params.textarea.data('init','1') + params.textarea.data('init','1');//标记为已经初始化 } params.cancelbtn.click();//显示/隐藏编辑区 }); @@ -178,10 +196,11 @@ form:$("form[nhname='form']",about_talk) }); }); - $("div[ecname='container_board_reply']").each(function(){ + $("div[mhname='container_board_reply']").each(function(){ var container = $(this); var about_talk = $("div[nhname='about_talk_reply']",container); nh_init_board({ + type:'reply', kindutil:K, showbtn:$("a[nhname='showbtn_reply']",container), about_talk:about_talk, From f52058aaf38fa3feb61c244bcaa6a45ee3306fa4 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 26 May 2015 09:37:29 +0800 Subject: [PATCH 02/29] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=96=B0=E7=95=8C=E9=9D=A2=EF=BC=88=E6=9C=AA=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 1 + app/views/layouts/base.html.erb | 4 ++-- app/views/layouts/base_welcome.html.erb | 23 ++++++++--------------- app/views/welcome/index.html.erb | 4 ++-- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 6e067fb83..787b1b050 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -16,6 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class WelcomeController < ApplicationController + layout "base_welcome" include ApplicationHelper include WelcomeHelper helper :project_score diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index 439c5f7b2..483cabac5 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -12,7 +12,7 @@ <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> <%= javascript_include_tag "jquery.leanModal.min" %> -<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> +<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> @@ -31,7 +31,7 @@
    <%=render :partial => 'layouts/base_footer'%> - + diff --git a/app/views/layouts/base_welcome.html.erb b/app/views/layouts/base_welcome.html.erb index d04f492ef..6d3b900c6 100644 --- a/app/views/layouts/base_welcome.html.erb +++ b/app/views/layouts/base_welcome.html.erb @@ -5,10 +5,9 @@ <%=h html_title %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> - <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> + <%= stylesheet_link_tag 'public', 'pleft', 'project', :media => 'all' %> + <%= javascript_include_tag "jquery.leanModal.min" %> - <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> <%= csrf_meta_tag %> <%= favicon %> @@ -18,32 +17,26 @@ <%= yield :header_tags -%> - -
    -
    -
    - <%=render :partial => 'layouts/base_header'%> + +
    + <%= render :partial => 'layouts/new_header' %> +
    <%= render_flash_messages %> <%= yield %> <%= call_hook :view_layouts_base_content %>
    - <%=render :partial => 'layouts/base_footer'%> + <%=render :partial => 'layouts/new_footer'%>
    - -
    -
    <%= call_hook :view_layouts_base_body_bottom %> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index dc8ef7f35..0cd9622a5 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -23,7 +23,7 @@ $(document).ready(function($) { $("#loggedas").find("a").attr("target", "_blank"); //$("#content .tabs_new~ .pagination").find("a").removeAttr("target"); - }); + });
    @@ -45,7 +45,7 @@ <% if @organization.nil? %> <% unless @first_page.nil? %> <%= l(:label_welcome_trustie_project)%><%= l(:label_welcome_trustie_project_description)%> From 4244c69b4670775aaafec09dbdebeb6679f11336 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Tue, 26 May 2015 14:18:42 +0800 Subject: [PATCH 03/29] ... --- app/views/boards/_form_project.html.erb | 6 +- app/views/boards/_project_show.html.erb | 178 ++++++++++++++++++++---- 2 files changed, 153 insertions(+), 31 deletions(-) diff --git a/app/views/boards/_form_project.html.erb b/app/views/boards/_form_project.html.erb index 58bb5501c..ca23193b4 100644 --- a/app/views/boards/_form_project.html.erb +++ b/app/views/boards/_form_project.html.erb @@ -15,7 +15,7 @@ <% replying ||= false %> <% extra_option = replying ? { readonly: true} : { maxlength: 200 } %> <% if replying %> -
  • +
  • <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}",:class=>"talk_input w585", :nhname=>'inputsubject' }.merge(extra_option) %> @@ -47,11 +47,11 @@
  • -
    +
    <% unless replying %> <% end %> - <%= text_area :quote,:quote,:style => 'display:none' %> + <%= text_area :quote,:quote,:style => 'display:none',:nhname=>"quote_input" %>
    <% if replying%> diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index dc1cff634..b0fd4049f 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -79,7 +79,7 @@
    - <% reply = Message.new(:subject => "RE: #{@message.subject}")%> + <% reply = Message.new(:subject => "RE: #{topic.subject}")%> <% if !topic.locked? && authorize_for('messages', 'reply') %>
    @@ -97,39 +97,107 @@ <% end %>
    + <% replies_all = topic.children.includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.id asc").all %> + <% unless replies_all.empty? %> +
    + +
    + <%if topic.replies_count>2 %> +
    + 展开回复(<%= topic.replies_count.to_s%>) +
    + <% end %> + <% end %> <% end %> + <% else %> +

    <%= l(:label_no_data) %>

    + <% end %> + + + +<%# other_formats_links do |f| %> + <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> +<%# end %> + <% html_title @board.name %> + <% content_for :header_tags do %> + <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %> <% end %> +
    @@ -59,7 +62,7 @@ <%= topic.content.html_safe %>
    -
    <%= l(:button_cancel)%> <%= l(:label_memo_create)%> @@ -161,6 +165,9 @@
    + \ No newline at end of file From dc557f7826eb05b5c94d06e1691ccb6e438b06e9 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Wed, 27 May 2015 09:04:39 +0800 Subject: [PATCH 07/29] ... --- app/views/boards/_project_show.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index fd685f168..738d9ac63 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -104,7 +104,7 @@ <% replies_all = topic.children.includes(:author, :attachments, {:board => :project}). reorder("#{Message.table_name}.id asc").all %> <% unless replies_all.empty? %> -
    +
      <% replies_all_i = 0 %> <% replies_all.each do |message| %> @@ -294,6 +294,7 @@ $(".talkmain_box").each(function(){ var target = $("li[nhname='reply_rec']",$(this)); var btn = $("a[nhname='reply_ex_btn']",$(this)); + var jumpobj = $("div[nhname='nh_reply_div']",$(this)); btn.click(function(){ if($(this).data('init')=='0'){ $(this).data('init',1); @@ -305,6 +306,8 @@ target.hide(); target.eq(0).show(); target.eq(1).show(); + $("#nhjump").attr('href','#'+jumpobj.attr('id')); + $("#nhjump")[0].click(); } }); }); From 94c7c68b7f639c1545ebc775419628207ba7bf67 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Wed, 27 May 2015 14:42:36 +0800 Subject: [PATCH 08/29] ... --- app/views/boards/_course_new.html.erb | 7 +- app/views/boards/_course_show.html.erb | 362 +++++++++++++----------- app/views/boards/_form_course.html.erb | 19 +- app/views/boards/_project_show.html.erb | 129 +-------- app/views/boards/show.html.erb | 203 ++++++++++--- 5 files changed, 380 insertions(+), 340 deletions(-) diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index 10f23d4f2..61c774a95 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -1,9 +1,10 @@ -<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message-form'} do |f| %> +<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'form_course', :locals => {:f => f, :topic => @message} %>
    • - <%= l(:button_cancel) %> - +
      +
      <%= l(:button_cancel) %> + <%= l(:button_submit)%>
      diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index d7eb7c215..fc3c38aad 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -1,26 +1,27 @@ - - - -
      -

      - <% if User.current.language == "zh"%> - <%= h @board.name %> - <% else %> - <%= l(:project_module_boards) %> - <% end %> - -

      - <%= l(:label_message_new) %> +
      +
      +

      + <% if User.current.language == "zh"%> + <%= h @board.name %> + <% else %> + <%= l(:project_module_boards) %> + <% end %> + +

      + <%= l(:label_message_new) %> +
      +
      +
      +
      +
        + <%= render :partial => 'course_new' %> +
      +
      +
      -
      -
      -
        - <%= render :partial => 'course_new' %> -
      -
      <% if !User.current.logged?%>
      @@ -32,7 +33,7 @@

      讨论区共有<%= @topic_count %>个帖子

      <% if @topics.any? %> <% @topics.each do |topic| %> -
      +
      <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
      <% author = topic.author.to_s + ":" %> @@ -40,7 +41,7 @@

        <%= h(topic.subject) %>

      <% if topic.course_editable_by?(User.current) %> - <%= l(:button_edit) %> <% end %> @@ -81,105 +82,118 @@ <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %>
      - <%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %> + <%= l(:button_reply) %>
      - -
      - -
      - <% reply = Message.new(:subject => "RE: #{@message.subject}")%> - <% if !topic.locked? && authorize_for('messages', 'reply') %> - -
      - +
      +
      + <% end %> + <% replies_all = topic.children. + includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.created_on DESC").offset(2). + all %> + <% replies_show = topic.children. + includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.created_on DESC").limit(2). + all %> + <% unless replies_show.empty? %> + <% reply_count = 0 %> +
      +
        + <% replies_show.each do |message| %> + +
      • + <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %> +
        + <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %> +
        +

        <%= textAreailizable message,:content,:attachments => message.attachments %>

        + +
        + <%= format_time(message.created_on) %> + <%= link_to( + + l(:button_delete), + {:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'}, + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :title => l(:button_delete), + :class => ' c_dblue fr' + ) if message.course_destroyable_by?(User.current) %> + <%= link_to( + l(:button_reply), + 'javascript:;', + :nhname =>'showbtn_child_reply', + :class => ' c_dblue fr', + :style => 'margin-right: 10px;', + :title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %> +
        +
        + +
      • + <% end %> +
      +
      + + <%if replies_all.first %> + + <% end %> + <% end %> +
      +
      +
      + <% end %> <% else %>

      <%= l(:label_no_data) %>

      @@ -197,58 +211,80 @@ <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@course}: #{@board}") %> <% end %>
      +
      \ No newline at end of file diff --git a/app/views/boards/_form_course.html.erb b/app/views/boards/_form_course.html.erb index cfef18f93..65e750b57 100644 --- a/app/views/boards/_form_course.html.erb +++ b/app/views/boards/_form_course.html.erb @@ -5,19 +5,19 @@
    • - <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585", :aa=>"subject" }.merge(extra_option) %> + <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585", :nhname=>'inputsubject' }.merge(extra_option) %> -

      +

    • <% else %>
    • - <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585", :aa=>"subject" }.merge(extra_option) %> + <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585", :nhname=>'inputsubject' }.merge(extra_option) %> -

      +

    • <% end %>
    • @@ -34,11 +34,11 @@
    • -
      +
      <% unless replying %> <% end %> - <%= text_area :quote,:quote,:style => 'display:none' %> + <%= text_area :quote,:quote,:style => 'display:none',:nhname=>"quote_input" %>
      <% if replying%> @@ -46,13 +46,14 @@ :width => '89%', :height => 300, :id => "message_content#{f.object.id}", - :aa => 'content', + :nhname => 'textarea', :onkeyup => "regexContent('#{f.object.id}');", :class => 'talk_text fl', :placeholder => "最多3000个汉字(或6000个英文字符)", :maxlength => 5000 %> <% else %> + <%= f.text_area :content, :width => '90%', :height => 300, @@ -61,14 +62,14 @@ :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :class => 'talk_text fl', - :aa => 'content', + :nhname => 'textarea', :placeholder => "最多3000个汉字(或6000个英文字符)", :maxlength => 5000 %> <% end %>
      -

      +

    • diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 738d9ac63..d6332a029 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -90,7 +90,7 @@ <%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %> <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %> -
      +
      <%= l(:button_cancel)%> <%= l(:button_submit)%> @@ -115,6 +115,7 @@ <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>

      <%= textAreailizable message,:content,:attachments => message.attachments %>

      +
      <%= format_time(message.created_on) %> <%= link_to( @@ -165,131 +166,7 @@
      - +<% if @project %> + <%= render :partial => 'project_show', locals: {project: @project} %> +<% elsif @course %> + <%= render :partial => 'course_show', locals: {course: @course} %> +<% end %> + + - -<% if @project %> - <%= render :partial => 'project_show', locals: {project: @project} %> -<% elsif @course %> - <%= render :partial => 'course_show', locals: {course: @course} %> -<% end %> + \ No newline at end of file From cd38e9aa7009f13a415ead66120039d82c7ac803 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Wed, 27 May 2015 15:50:31 +0800 Subject: [PATCH 09/29] ... --- app/views/boards/_course_show.html.erb | 63 ++++++------------------- app/views/boards/_project_show.html.erb | 2 +- app/views/boards/show.html.erb | 10 ++-- 3 files changed, 23 insertions(+), 52 deletions(-) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index fc3c38aad..ddf6a532d 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -8,12 +8,14 @@ <% end %> - <%= l(:label_message_new) %> + <% if User.current.logged? %> + <%= l(:label_message_new) %> + <% end %>
    -
    + <% end %> - <% replies_all = topic.children. - includes(:author, :attachments, {:board => :project}). - reorder("#{Message.table_name}.created_on DESC").offset(2). - all %> - <% replies_show = topic.children. - includes(:author, :attachments, {:board => :project}). - reorder("#{Message.table_name}.created_on DESC").limit(2). - all %> - <% unless replies_show.empty? %> - <% reply_count = 0 %> -
    + <% replies_all = topic.children.includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.created_on DESC").all %> + <% unless replies_all.empty? %> + <% replies_all_i = 0 %> +
      - <% replies_show.each do |message| %> - -
    • + <% replies_all.each do |message| %> + <% replies_all_i=replies_all_i+1 %> +
    • <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
      <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %> @@ -157,37 +153,8 @@ <% end %>
    - - <%if replies_all.first %> - + <%if topic.replies_count>2 %> + <% end %> <% end %>
    diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index d6332a029..d20119a6c 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -102,7 +102,7 @@
    <% replies_all = topic.children.includes(:author, :attachments, {:board => :project}). - reorder("#{Message.table_name}.id asc").all %> + reorder("#{Message.table_name}.id desc").all %> <% unless replies_all.empty? %>
      diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 3d20fd411..bb3faf28f 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -1,5 +1,8 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor-min" %> <% if @project %> <%= render :partial => 'project_show', locals: {project: @project} %> @@ -147,9 +148,9 @@ function nh_init_board(params){ textarea:params.textarea }); if(is_checked){ -// alert('submit'); -// return false; - return true; + //return true 居然不提交 fuck your sister + $(this)[0].submit(); +// return true; } return false; }); From cae882b3d62b3ae5d0500c9563cca5c19dc58141 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 28 May 2015 14:44:04 +0800 Subject: [PATCH 14/29] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=A1=A8=20=E7=9B=B8=E5=85=B3=E5=85=B3?= =?UTF-8?q?=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/invite_list.rb | 5 +++++ app/models/project.rb | 2 +- app/models/user.rb | 4 ++++ db/migrate/20150528024616_create_invite_lists.rb | 10 ++++++++++ spec/factories/invite_lists.rb | 7 +++++++ spec/models/invite_list_spec.rb | 5 +++++ 6 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 app/models/invite_list.rb create mode 100644 db/migrate/20150528024616_create_invite_lists.rb create mode 100644 spec/factories/invite_lists.rb create mode 100644 spec/models/invite_list_spec.rb diff --git a/app/models/invite_list.rb b/app/models/invite_list.rb new file mode 100644 index 000000000..605c35a07 --- /dev/null +++ b/app/models/invite_list.rb @@ -0,0 +1,5 @@ +class InviteList < ActiveRecord::Base + attr_accessible :project_id, :user_id + belongs_to :user + belongs_to :project +end diff --git a/app/models/project.rb b/app/models/project.rb index 47878dbec..249df8640 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -67,7 +67,7 @@ class Project < ActiveRecord::Base has_many :student, :through => :students_for_courses, :source => :user has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy has_many :applied_projects - + has_many :invite_lists # end #ADDED BY NIE diff --git a/app/models/user.rb b/app/models/user.rb index 7b232bf13..fa3134a58 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -125,6 +125,10 @@ class User < Principal has_many :documents # 项目中关联的文档再次与人关联 # end + # 邮件邀请状态 + has_many :invite_lists + # end + ######added by nie has_many :project_infos, :dependent => :destroy has_one :user_status, :dependent => :destroy diff --git a/db/migrate/20150528024616_create_invite_lists.rb b/db/migrate/20150528024616_create_invite_lists.rb new file mode 100644 index 000000000..222a3a3f8 --- /dev/null +++ b/db/migrate/20150528024616_create_invite_lists.rb @@ -0,0 +1,10 @@ +class CreateInviteLists < ActiveRecord::Migration + def change + create_table :invite_lists do |t| + t.integer :project_id + t.integer :user_id + + t.timestamps + end + end +end diff --git a/spec/factories/invite_lists.rb b/spec/factories/invite_lists.rb new file mode 100644 index 000000000..c9ce0e826 --- /dev/null +++ b/spec/factories/invite_lists.rb @@ -0,0 +1,7 @@ +FactoryGirl.define do + factory :invite_list do + project_id 1 +user_id 1 + end + +end diff --git a/spec/models/invite_list_spec.rb b/spec/models/invite_list_spec.rb new file mode 100644 index 000000000..8da327964 --- /dev/null +++ b/spec/models/invite_list_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe InviteList, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end From 709c026910a8274026b3b0ac007a8d20fd05cd5b Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Thu, 28 May 2015 15:48:52 +0800 Subject: [PATCH 15/29] ... --- app/views/boards/_course_show.html.erb | 4 ++-- app/views/boards/_project_show.html.erb | 2 +- app/views/boards/show.html.erb | 13 ++++++++----- public/images/public_icon.png | Bin 4987 -> 11734 bytes 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 889e82350..0b0e95b21 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -132,8 +132,8 @@
      <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
      -

      <%= textAreailizable message,:content,:attachments => message.attachments %>

      - +
      <%= textAreailizable message,:content,:attachments => message.attachments %>
      +
      <%= format_time(message.created_on) %> <%= link_to( diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 48b3d6ccf..a8dc4ad1a 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -120,7 +120,7 @@
      <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
      -

      <%= textAreailizable message,:content,:attachments => message.attachments %>

      +
      <%= textAreailizable message,:content,:attachments => message.attachments %>

      <%= format_time(message.created_on) %> diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 8bc4cc7af..69300ec4b 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -1,7 +1,10 @@
      diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 5333b91a7..d27895b03 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -19,7 +19,7 @@ a:hover.project_name{ color:#016f33;} a.project_txt02{ color:#0781b4; width:618px; display:block; float:left; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} a:hover.project_txt{ color:#066e9a;} .noline{ border-bottom:none;} -.news_description{max-height: 38px;overflow:hidden; } +.news_description{max-height: 360px;overflow:hidden; } .news_description_none{max-height: none;} a.news_foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:600px; height:20px; padding-top:3px; cursor:pointer;} a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;} From 0eace6e598f57a3b10aae17bf7889b9f088347e4 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 29 May 2015 18:42:22 +0800 Subject: [PATCH 28/29] =?UTF-8?q?cached=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_user_project_list.html.erb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/views/layouts/_user_project_list.html.erb b/app/views/layouts/_user_project_list.html.erb index f7cf841f8..e38f9c4bd 100644 --- a/app/views/layouts/_user_project_list.html.erb +++ b/app/views/layouts/_user_project_list.html.erb @@ -2,13 +2,11 @@
    • <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
        - <% cache User.current.projects.count do%> <% User.current.projects.each do |project| %>
      • <%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
      • <% end %> - <% end %>
    • -<% end %> \ No newline at end of file +<% end %> From f4c1cc839c65fe8f7b3943e887e69bf2e166b28b Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 29 May 2015 19:33:33 +0800 Subject: [PATCH 29/29] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/stores/index.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/stores/index.html.erb b/app/views/stores/index.html.erb index 89405b8ab..6fab364b5 100644 --- a/app/views/stores/index.html.erb +++ b/app/views/stores/index.html.erb @@ -3,10 +3,10 @@ <% end %>
      -<% @attach_array.each do |k|%> +<% @attach_array.each_with_index do |k, index|%>

      - <%= @str_arr.shift %> + <%= @str_arr[index] %>

      @@ -24,7 +24,7 @@
      - <% if @str_arr.shift == @str_arr[2]%> + <% if index == 2%> <% k.each do |c1|%>
      @@ -94,4 +94,4 @@ } }); -<% html_title(l(:label_stores_index)) -%> \ No newline at end of file +<% html_title(l(:label_stores_index)) -%>