From b9ff46f8d01a033adcd39367f78a6a1e7abc6440 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 24 Sep 2015 09:40:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=96=E5=AD=90=E7=9A=84=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E4=B8=8E=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/memos_controller.rb | 5 + app/views/forums/index.html.erb | 2 +- app/views/memos/_attachments_links.html.erb | 6 +- app/views/memos/edit.html.erb | 100 +++++++++----------- app/views/memos/show.html.erb | 4 +- public/javascripts/new_user.js | 21 +++- public/stylesheets/header.css | 2 +- public/stylesheets/public_new.css | 2 +- 8 files changed, 79 insertions(+), 63 deletions(-) diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index f7de712ca..f3c383573 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -143,7 +143,12 @@ class MemosController < ApplicationController end def edit + @my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count + @my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count @replying = false + respond_to do |format| + format.html {render :layout=>'base_forums'} + end end def update diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index 93dcbc3fa..8f5cb15cc 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -61,7 +61,7 @@ n += 1;//英文,不多说了 } } - if(n >= 160) + if(n >= 160 && event.keyCode != 8) event.returnValue = false; } }); diff --git a/app/views/memos/_attachments_links.html.erb b/app/views/memos/_attachments_links.html.erb index 7da30aad0..15473e6e7 100644 --- a/app/views/memos/_attachments_links.html.erb +++ b/app/views/memos/_attachments_links.html.erb @@ -35,13 +35,13 @@
<% end %> - <% if attachment.is_text? %> - <%= link_to image_tag('magnifier.png'), + <%# if attachment.is_text? %> + <%#= link_to image_tag('magnifier.png'), :controller => 'attachments', :action => 'show', :id => attachment, :filename => attachment.filename%> - <% end %> + <%# end %> diff --git a/app/views/memos/edit.html.erb b/app/views/memos/edit.html.erb index 487d923b5..0efa57ccc 100644 --- a/app/views/memos/edit.html.erb +++ b/app/views/memos/edit.html.erb @@ -1,55 +1,47 @@ - -<% @replying = !@memo.parent.nil? %> -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> -

<%=l(:label_memo_edit)%>

-<%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo)) do |f| %> - <% if @memo.errors.any? %> -
-

- <%= pluralize(@memo.errors.count, "error") %> - prohibited this memo from being saved: -

- -
- <% end %> -
-

- <% if @memo.parent.nil? && @memo.children.first.nil? %> - <%#= f.text_field :subject, :required => true, :size => 96 ,:readonly => false, :maxlength => 50%> - <% else %> - <%#= f.text_field :subject, :required => true, :size => 96 ,:readonly => true, :style => "border: 1px solid gray", :maxlength => 50%> - <% end %> -

- <% if User.current.admin?%> -

- <% unless @replying %> - <% if @memo.safe_attribute? 'sticky' %> - <%= f.check_box :sticky %> - <%= label_tag 'memo_sticky', l(:label_board_sticky) %> - <% end %> - <% if @memo.safe_attribute? 'lock' %> - <%= f.check_box :lock %> <%= label_tag 'memo_locked', l(:label_board_locked) %> - <% end %> - <% end %> -

- <% end %> -

- <%= f.kindeditor :content, :required => true, :size => 80,:owner_id => @memo.id,:owner_type => 1 %> -

- -

- <%= l(:label_attachment_plural) %> -
- <%= render :partial => 'attachments/form', :locals => {:container => @memo} %> -

-
-
- <%= f.submit :value => l(:button_change) %>  <%= link_to l(:button_back), back_url ,:class => "button-canel",:style => "color: #ffffff;"%> +<%= javascript_include_tag 'new_user'%> + +
+
编辑帖子
+
+
+ <%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo),:html=>{:id=>'edit_memo'}) do |f| %> + +
+ +
-<% end %> +
+ + +
+
+ + <%= render :partial => 'forums/file_form', :locals => {:container => @memo} %> + + +
+
+ <% end %> +
\ No newline at end of file diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 18244d765..57b6875e5 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -24,8 +24,8 @@ diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index eb50c2762..b894edf02 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -249,4 +249,23 @@ var autoTextarea = function (elem, extra, maxHeight) { addEvent('input', change); addEvent('focus', change); change(); -}; \ No newline at end of file +}; + +function limitStrsize(id,length){ + document.getElementById(id).onkeydown = function() + { + var n = 0; + var str = this.value; + for (i = 0; i < str.length; i++) { + var leg = str.charCodeAt(i);//ASCII码 + if (leg > 255) {//大于255的都是中文 + n += 2;//如果是中文就是2个字节 + } else { + n += 1;//英文,不多说了 + } + } + + if(n >= length && event.keyCode !== 8) + event.returnValue = false; + } +} \ No newline at end of file diff --git a/public/stylesheets/header.css b/public/stylesheets/header.css index 2d6f5e0b8..ffea2f5b7 100644 --- a/public/stylesheets/header.css +++ b/public/stylesheets/header.css @@ -55,7 +55,7 @@ a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;} .homepageLeftLabelContainer {width:238px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px;} .homepageLabelText {color:#484848; font-size:16px; margin-left:10px; margin-bottom:12px; display:block;} .homepageRightBanner {width:720px; height:34px; margin:0px auto; border-bottom:1px solid #e9e9e9;} -.NewsBannerName {font-size:16px; color:#4b4b4b; display:block; background:url(../images/homepage_icon.png) -18px -230px no-repeat; width:150px; float:left; padding-left:15px; margin-top:4px;} +.NewsBannerName {font-size:16px; color:#4b4b4b; display:block; width:150px; float:left; margin-top:4px;} .newsType {width:60px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:5px 10px; left:-40px; font-size:12px; color:#888888; display:none; line-height:2; z-index:9999;} .newsReadSetting {width:700px; background-color:#f6f6f6; border-bottom:1px solid #eeeeee; margin:10px auto; height:39px; line-height:39px; vertical-align:middle; font-size:14px; color:#7a7a7a; padding-left:10px;} .homepageNewsList {width:710px; height:49px; line-height:49px; vertical-align:middle; border-bottom:1px dashed #eaeaea; margin-left:10px;} diff --git a/public/stylesheets/public_new.css b/public/stylesheets/public_new.css index 7cd0a461c..7dc695428 100644 --- a/public/stylesheets/public_new.css +++ b/public/stylesheets/public_new.css @@ -534,7 +534,7 @@ a.sendButtonBlue:hover {color:#ffffff;} outline:none; } .homepageRightBanner {width:720px; height:34px; margin:0px auto; border-bottom:1px solid #e9e9e9;} -.NewsBannerName {font-size:16px; color:#4b4b4b; display:block; background:url(images/homepage_icon.png) -18px -230px no-repeat; width:150px; float:left; padding-left:15px; margin-top:4px;} +.NewsBannerName {font-size:16px; color:#4b4b4b; display:block; width:150px; float:left; margin-top:4px;} a.resourcesTypeAll {background:url(images/homepage_icon.png) -180px -89px no-repeat; padding-left:23px;} a.resourcesTypeAtt {background:url(images/homepage_icon.png) -180px -49px no-repeat; padding-left:23px;} .resourcesType {width:75px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 20px; left:-90px; font-size:12px; color:#888888; display:none; line-height:2;}