From f9166a71a75a5e73a14c69451ea058877594b34f Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 20 May 2014 09:12:15 +0800 Subject: [PATCH 1/2] issues#555 --- app/views/layouts/base_courses.html.erb | 4 +- app/views/news/index.html.erb | 180 +++++++++++++----------- 2 files changed, 97 insertions(+), 87 deletions(-) diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index bbdfbfe66..785479bd5 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -140,7 +140,7 @@
- +
@@ -266,5 +266,7 @@ <%= call_hook :view_layouts_base_body_bottom %> + + \ No newline at end of file diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb index 499c58b3c..4dfa21d52 100644 --- a/app/views/news/index.html.erb +++ b/app/views/news/index.html.erb @@ -1,100 +1,108 @@ - <% - if @project.project_type == 1 - btn_tips = l(:label_news_notice) - label_tips = l(:label_course_news) - else - btn_tips = l(:label_news_new) - label_tips = l(:label_news) - end + if @project.project_type == Project::ProjectType_course + btn_tips = l(:label_news_notice) + label_tips = l(:label_course_news) + else + btn_tips = l(:label_news_new) + label_tips = l(:label_news) + end %> -<% if @project && User.current.allowed_to?(:manage_news, @project) %> -
- <%= link_to(btn_tips, - new_project_news_path(@project), - :class => 'icon icon-add', - :onclick => 'showAndScrollTo("add-news", "news_title"); return false;') %> -
- + + <%= label_tips %> + +<%= link_to(btn_tips, + new_project_news_path(@project), + :class => 'icon icon-add', + :onclick => 'showAndScrollTo("add-news", "news_title"); return false;') %> + +<% if @project && User.current.allowed_to?(:manage_news, @project) %> + <% end %> - -

<%=label_tips%>

- <% if @newss.empty? %> -

- <%= l(:label_no_data) %> -

- <% else %> - <% @newss.each do |news| %> - -
- - - - -
<%= link_to image_tag(url_to_avatar(news.author), :class => "avatar"), user_path(news.author) %> - - <% if @project.project_type == 1 %> - - - - <% else %> - - - - <% end %> - - - - - - - -
<%= link_to_user(news.author)if news.respond_to?(:author) %><%= l(:label_project_notice)%><%= link_to h(news.title), news_path(news) %> - <%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @project) %>
<%= link_to_user(news.author)if news.respond_to?(:author) %><%= l(:label_project_newshare)%> <%= link_to h(news.title), news_path(news) %> - <%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @project) %>
<%= textilizable(news, :description) %>
<%= l :label_update_time %>: <%= format_time(news.created_on) %><%= link_to l(:label_project_newother),news_path(news)%><%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count >= 0 %>
- <% end %> - <% end %> + <% if @newss.empty? %> +

+ <%= l(:label_no_data) %> +

+ <% else %> + <% @newss.each do |news| %> + + + + + + +
<%= link_to image_tag(url_to_avatar(news.author), :class => "avatar"), user_path(news.author) %> + + <% if @project.project_type == 1 %> + + + + <% else %> + + + + <% end %> + + + + + + + +
+ <%= link_to_user(news.author) if news.respond_to?(:author) %><%= l(:label_project_notice) %><%= link_to h(news.title), news_path(news) %> + <%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @project) %> +
+ <%= link_to_user(news.author) if news.respond_to?(:author) %><%= l(:label_project_newshare) %> <%= link_to h(news.title), news_path(news) %> + <%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @project) %> +
+ <%= textilizable(news, :description) %>
<%= l :label_update_time %> + : <%= format_time(news.created_on) %><%= link_to l(:label_project_newother), news_path(news) %><%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count >= 0 %>
+
+ <% end %> + <% end %>
- + - <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %> - <% end %> + <% other_formats_links do |f| %> + <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %> + <% end %> - <% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> - <%= stylesheet_link_tag 'scm' %> - <% end %> + <% content_for :header_tags do %> + <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> + <%= stylesheet_link_tag 'scm' %> + <% end %> - <% html_title(l(:label_news_plural)) -%> + <% html_title(l(:label_news_plural)) -%>
+ From 112b8de92163a4ec1dcb4fe6ffc5da7148035ac3 Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 20 May 2014 09:50:28 +0800 Subject: [PATCH 2/2] issues#575 --- app/views/memos/show.html.erb | 7 +++++++ app/views/messages/show.html.erb | 6 ++++++ app/views/welcome/contest.html.erb | 28 +++++++--------------------- public/javascripts/application.js | 8 ++++++++ 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 642d71649..fcd10a011 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -140,3 +140,10 @@
<% end %> + + + \ No newline at end of file diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb index 116c25931..4f22fd140 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -185,3 +185,9 @@ <% end %> <% html_title @topic.subject %> + + \ No newline at end of file diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index 0dc89b96c..e757356b0 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -120,21 +120,7 @@ <%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_contest) %> , <%= l(:label_welcome_trustie_contest_description) %> - - +
<%= form_tag({controller: 'contests', action: 'index'}, method: :get) do %> @@ -160,7 +146,7 @@ <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
  • -
    +
    <%= image_tag('/images/contest1.png')%>
    @@ -192,7 +178,7 @@
    -

    +

    问题和反馈动态 <%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> <%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> @@ -207,11 +193,11 @@ <%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %>
    - <%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前 + <%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前 由 <%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);" %> 发表 - 回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>) + 回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>)

  • <% end %> @@ -228,7 +214,7 @@ <% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %>
  • -
    +
    <%= image_tag('/images/app1.png')%>
    @@ -237,7 +223,7 @@
    - ><%=softapplication.description.truncate(50, omission: '...')%> + ><%=softapplication.description.to_s.truncate(50, omission: '...')%>

    diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 8e4db7fe6..81160fa93 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -609,6 +609,14 @@ function toggleAndSettingWordsVal(parent_widget, text_widget, value){ text_widget.val(value) parent_widget.slideToggle(400) } +function transpotUrl (scope) { + $(scope).each(function(){ + var tmpContent = $(this).html(); + tmpContent = tmpContent.replace(/(^|[^\"\'])(http|ftp|mms|rstp|news|https)(\:\/\/[^<\s\+,,]+)/gi,"$1$2$3<\/a>"); + // tmpContent = tmpContent.replace(/(^|[^\/])(www\.[^<\s\+,,]+)/gi,"$1$2"); + $(this).html(tmpContent); + }); +} $(document).ready(setupAjaxIndicator); $(document).ready(hideOnLoad);