From 30cb622abd8a7ba026a04ed5de0d69638a845c15 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 25 Mar 2015 20:36:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/news/_course_show.html.erb | 73 ++++++++++++++++++++++------ config/locales/commons/zh.yml | 2 + public/stylesheets/courses.css | 4 +- 3 files changed, 62 insertions(+), 17 deletions(-) diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 00cbc17de..eaec389fe 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -49,8 +49,65 @@ $("#news-form").submit(); } } + function submitComment() + { + + } +
+

课程通知

+
+ +
+ <%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %> +
+

<%=h @news.title %>

+ <%= watcher_link(@news, User.current) %> + <%= link_to(l(:button_edit), + edit_news_path(@news), + :class => 'talk_edit fr', + :accesskey => accesskey(:edit), + :onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @course) %> + <%= delete_link(news_path(@news),:class => 'talk_edit fr') if User.current.allowed_to?(:manage_news, @course) %> +
+
<%= textilizable(@news, :description) %>
<%= l(:label_create_time) %> : <%= format_time(@news.created_on) %>
+ <%= link_to_attachments @news %> + +
+
+ <% if @news.commentable? %> +
+

添加评论

+ <%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %> +
+ <%= text_area 'comment', 'comments', :placeholder=>"最多250个字"%> +
+

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

+ <% end %> +
+ <% end %> +
+
+
+
+ gugu012014-10-24 +
+

我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,前十四位的验证就相当于转换类型再查表一样,所以它的验证号码速度比一般的方式快。如果还不明白就说明你写框架写多了,或者

+
+
删除 +
+
+
+
+
+ +
<%= watcher_link(@news, User.current) %> <%= link_to(l(:button_edit), @@ -84,21 +141,7 @@
<%= link_to_attachments @news %>
- - <% if @news.commentable? %> -

- <%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %> -

- <%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %> -
- <%= text_area 'comment', 'comments', :cols => 80, :rows => 15, :class => 'wiki-edit' %> - <%= wikitoolbar_for 'comment_comments' %> -
-

- <%= submit_tag l(:button_add) %> -

- <% end %> - <% end %> + <% html_title @news.title -%> diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml index a0eb6e74a..d21d90174 100644 --- a/config/locales/commons/zh.yml +++ b/config/locales/commons/zh.yml @@ -205,6 +205,8 @@ zh: button_save: 保存 button_back: 返回 button_cancel: 取消 + label_cancel_with_space: 取 消 + label_comment_with_space: 评 论 label_submit: 提交 button_project_tags_add: 增加 label_more: "更多>>" diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 4674c47aa..cafe30625 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -176,7 +176,7 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;} .msg_box{ width:670px; height:173px; border-bottom:1px dashed #CCC; padding-top:10px;} .msg_box h4{ } .msg_box textarea{width:658px;height:90px;padding:5px;overflow:hidden;background-color: #ffffff; border:1px solid #CCC; margin:5px 0px; color:#666; font-size:12px; } -.msg_box a{ float:right; display:block; width:50px; height:22px; background:#15bccf; padding-top:3px; color:#fff; margin-left:10px; text-align:center; margin-top:5px; } +/*.msg_box a{ float:right; display:block; width:50px; height:22px; background:#15bccf; padding-top:3px; color:#fff; margin-left:10px; text-align:center; margin-top:5px; }*/ .msg_box a:hover{ background-color:#03a1b3; text-decoration:none;} @@ -338,7 +338,7 @@ a:hover.st_add{ color:#ff8e15;} a.link_file{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; color:#64bdd9; } a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;} -.r_txt_tit{width:510px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;} +.r_txt_tit{width:500px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;} From 132287d6e1fa8d41c6a938c3d71550e1ee3220e3 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 26 Mar 2015 11:02:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_form.html.erb | 17 ++++ app/views/news/_course_form.html.erb | 13 ++- app/views/news/_course_show.html.erb | 128 +++++++++------------------ public/stylesheets/courses.css | 2 +- 4 files changed, 68 insertions(+), 92 deletions(-) diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 8b22ea417..5fe95f919 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -1,5 +1,22 @@ <% if defined?(container) && container && container.saved_attachments %> + <% container.attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + <%= l(:field_is_public)%>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> + <%= if attachment.id.nil? + #待补充代码 + else + link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') + end + %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + + <% end %> <% container.saved_attachments.each_with_index do |attachment, i| %> <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> diff --git a/app/views/news/_course_form.html.erb b/app/views/news/_course_form.html.erb index 3c77e8768..4b2792627 100644 --- a/app/views/news/_course_form.html.erb +++ b/app/views/news/_course_form.html.erb @@ -57,12 +57,12 @@
  • - +
  • - +
  • @@ -71,8 +71,13 @@ <%= render :partial => 'attachments/form', :locals => {:container => @news} %>
  • - <%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %> - <%= link_to l(:button_cancel), course_news_index_path(@course), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %> + <% if is_new %> + <%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %> + <%= link_to l(:button_cancel), course_news_index_path(@course), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %> + <% else %> + <%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %> + <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'blue_btn grey_btn fl c_white' %> + <% end %>
  • \ 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 eaec389fe..167ea8308 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -51,13 +51,26 @@ } function submitComment() { - + $("#add_comment_form").submit(); + } + function clearMessage() + { + $("#comment_comments").val(""); }

    课程通知

    +<% if authorize_for_course('news', 'edit') %> + +<% end %>
    <%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %> @@ -76,108 +89,49 @@
    +
    + <% if @news.commentable? %>
    -

    添加评论

    +

    <%= l(:label_comment_add) %>

    <%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %>
    <%= text_area 'comment', 'comments', :placeholder=>"最多250个字"%>

    - <%= submit_tag l(:button_add) %> - <%= l(:label_cancel_with_space) %> - <%= l(:label_comment_with_space) %> + <%= l(:label_cancel_with_space) %> + <%= l(:label_comment_with_space) %>

    <% end %>
    <% end %> -
    -
    -
    -
    - gugu012014-10-24 + <% comments = @comments.reverse %> + <% comments.each do |comment| %> + <% next if comment.new_record? %> +
    +
    <%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author)%>
    +
    +
    + <%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %><%= format_time(comment.created_on) %> +
    + <%= textilizable(comment.comments) %> +
    +
    <%= link_to_if_authorized_course image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment}, + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %> +
    + +
    -

    我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,前十四位的验证就相当于转换类型再查表一样,所以它的验证号码速度比一般的方式快。如果还不明白就说明你写框架写多了,或者

    -
    删除 -
    -
    -
    -
    -
    - - -
    - <%= watcher_link(@news, User.current) %> - <%= link_to(l(:button_edit), - edit_news_path(@news), - :class => 'icon icon-edit', - :accesskey => accesskey(:edit), - :onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @course) %> - <%= delete_link news_path(@news) if User.current.allowed_to?(:manage_news, @course) %> -
    - -

    <%=h @news.title %>

    - -<% if authorize_for_course('news', 'edit') %> - -<% end %> - -
    + <% end if @comments.any? %> -
    - <%= textilizable(@news, :description) %> -
    - <%= link_to_attachments @news %> -
    - <% html_title @news.title -%> + + <% content_for :header_tags do %> + <%= stylesheet_link_tag 'scm' %> + <% end %> - <% content_for :header_tags do %> - <%= stylesheet_link_tag 'scm' %> - <% end %> - -
    -
    -

    <%= l(:label_comment_plural) %>

    - <% comments = @comments.reverse %> - <% comments.each do |comment| %> - <% next if comment.new_record? %> - - - - - -
    <%= image_tag(url_to_avatar(comment.author), :class => "avatar")%> - - - - - - - - - - - -
    <%= link_to_user(comment.author) if comment.respond_to?(:author) %> <%= l(:label_project_newadd) %><%= l(:label_comment_plural) %>
    - - <%= textilizable(comment.comments) %> - -
    <%= format_time(comment.created_on) %><%= link_to_if_authorized_course image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment}, - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %>
    - <% end if @comments.any? %> -
    +<% html_title @news.title -%> \ No newline at end of file diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index cafe30625..23703cbcf 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -216,7 +216,7 @@ a:hover.ping_sub{ background:#14a8b9;} .ping_dispic a{ display:block; height:46px; width:46px; border:1px solid #CCC; padding:1px; float:left;} .ping_dispic a:hover{border:1px solid #15bccf;} .ping_discon{ float:left; width:610px; margin-left:10px; } -.ping_distop span{ float:left;} +/*.ping_distop span{ float:left;}*/ .ping_distop p{ color:#5f5f5f;} .ping_disfoot a{ float:right; color: #6883b6; margin-left:5px; margin-bottom:5px;} .ping_distop span a{ float:right; width:20px; height:20px; background:url(images/star.png) -24px 0 no-repeat; margin-right:3px;}