From dcde828e64457822f598483d37d6a3b371e84689 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 Aug 2014 09:40:57 +0800
Subject: [PATCH 1/3] =?UTF-8?q?1.=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5--?=
=?UTF-8?q?=E5=85=B3=E6=B3=A8=E3=80=81=E7=B2=89=E4=B8=9D=EF=BC=8C=E5=8D=B3?=
=?UTF-8?q?=E4=BD=BF=E5=85=B3=E6=B3=A8=E8=80=85=E3=80=81=E7=B2=89=E4=B8=9D?=
=?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=8F=82=E5=8A=A0=E9=A1=B9=E7=9B=AE=E3=80=81?=
=?UTF-8?q?=E8=AF=BE=E7=A8=8B=EF=BC=8C=E6=98=BE=E7=A4=BA=E4=B8=BA=E2=80=9C?=
=?UTF-8?q?=E5=8F=82=E4=B8=8E=E4=BA=860=E4=B8=AA=E9=A1=B9=E7=9B=AE/?=
=?UTF-8?q?=E8=AF=BE=E7=A8=8B=E2=80=9D=20#1211=202=20=E4=BF=AE=E5=A4=8D?=
=?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5=E5=85=B3=E6=B3=A8=E3=80=81?=
=?UTF-8?q?=E7=B2=89=E4=B8=9D=E5=8F=82=E4=B8=8E=E8=AF=BE=E7=A8=8B=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/users/user_fanslist.html.erb | 27 +++++++++----------------
app/views/users/user_watchlist.html.erb | 25 ++++++++++++-----------
2 files changed, 22 insertions(+), 30 deletions(-)
diff --git a/app/views/users/user_fanslist.html.erb b/app/views/users/user_fanslist.html.erb
index 984cdf352..f16e6d397 100644
--- a/app/views/users/user_fanslist.html.erb
+++ b/app/views/users/user_fanslist.html.erb
@@ -20,27 +20,18 @@
- <% unless user.memberships.empty? %>
- <% cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" %>
- <% memberships = user.memberships.all(:conditions => cond) %>
- <%= l(:label_x_contribute_to, :count => memberships.count) %>
- <% for member in memberships %>
- <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
- <% end %>
- <% else %>
- <%= l(:label_x_contribute_to, :count => 0) %>
+ <% cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" %>
+ <% memberships = user.memberships.all(:conditions => cond) %>
+ <%= l(:label_x_contribute_to, :count => memberships.count) %>
+ <% for member in memberships %>
+ <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
<% end %>
- <% unless user.memberships.empty? %>
- <% cond = Project.visible_condition(User.current) + " AND projects.project_type = 1" %>
- <% memberships = user.memberships.all(:conditions => cond) %>
- <%= l(:label_x_course_contribute_to, :count => memberships.count) %>
- <% for member in memberships %>
- <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
- <% end %>
- <% else %>
- <%= l(:label_x_course_contribute_to, :count => 0) %>
+ <% user_courses = user_courses_list(user) %>
+ <%= l(:label_x_course_contribute_to, :count => user_courses.count) %>
+ <% for course in user_courses %>
+ <%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.course_domain} %><%= (user_courses.last == course) ? '' : ',' %>
<% end %>
|
diff --git a/app/views/users/user_watchlist.html.erb b/app/views/users/user_watchlist.html.erb
index bc4a655d8..e58e35d27 100644
--- a/app/views/users/user_watchlist.html.erb
+++ b/app/views/users/user_watchlist.html.erb
@@ -7,31 +7,32 @@
<%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.name}" %> |
- <%= content_tag "div", link_to(user.name,user_path(user)), :class => "project_avatar_name" %>
+ <%= content_tag "div", link_to(user.name,user_path(user)), :class => "project_avatar_name" %>
|
|
- <% unless user.memberships.empty? %>
+ <%# unless user.memberships.empty? %>
<% cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" %>
<% memberships = user.memberships.all(:conditions => cond) %>
<%= l(:label_x_contribute_to, :count => memberships.count) %>
<% for member in memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
<% end %>
- <% end %>
+ <%# end %>
- <% unless user.memberships.empty? %>
- <% cond = Project.visible_condition(User.current) + " AND projects.project_type = 1" %>
- <% memberships = user.memberships.all(:conditions => cond) %>
- <%= l(:label_x_course_contribute_to, :count => memberships.count) %>
- <% for member in memberships %>
- <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
- <% end %>
- <% end %>
+ <%# unless user.memberships.empty? %>
+ <% user_courses = user_courses_list(user) %>
+ <%= l(:label_x_course_contribute_to, :count => user_courses.count) %>
+ <% for course in user_courses %>
+ <%# if course.name != nil %>
+ <%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.course_domain} %><%= (user_courses.last == course) ? '' : ',' %>
+ <%# end %>
+ <% end %>
+ <%# end %>
- |
+
From b50dac6a3621c5aec10c33e66c487f24da29a85c Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 Aug 2014 10:17:31 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E8=B5=84=E6=BA=90=E6=8E=92=E5=BA=8F=E6=97=A0=E6=95=88=E7=9A=84?=
=?UTF-8?q?BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/files_controller.rb | 39 ++++++++++++++++++++++++++---
1 file changed, 36 insertions(+), 3 deletions(-)
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 031f78277..ef6e20644 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -45,11 +45,45 @@ class FilesController < ApplicationController
'filename' => "#{Attachment.table_name}.filename",
'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads"
+ sort = ""
if params[:project_id]
@isproject = true
- @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
- @containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
+
+ if params[:sort]
+ params[:sort].split(",").each do |sort_type|
+ order_by = sort_type.split(":")
+
+ case order_by[0]
+ when "filename"
+ attribute = "filename"
+ when "size"
+ attribute = "filesize"
+ when "attach_type"
+ attribute = "attachtype"
+ when "content_type"
+ attribute = "created_on"
+ when "field_file_dense"
+ attribute = "is_public"
+ when "downloads"
+ attribute = "downloads"
+ when "created_on"
+ attribute = "created_on"
+ end
+
+ if order_by.count == 1
+ sort += "#{Attachment.table_name}.#{attribute} desc "
+ elsif order_by.count == 2
+ sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
+ end
+ if sort_type != params[:sort].split(",").last
+ sort += ","
+ end
+ end
+ end
+
+ @containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)]
+ @containers += @project.versions.includes(:attachments).reorder(sort).all.sort
show_attachments @containers
@@ -57,7 +91,6 @@ class FilesController < ApplicationController
elsif params[:course_id]
@isproject = false
- sort = ""
if params[:sort]
params[:sort].split(",").each do |sort_type|
order_by = sort_type.split(":")
From d8e04ae9741d92895cf5d57673c5cf1763607fd4 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 29 Aug 2014 11:40:00 +0800
Subject: [PATCH 3/3] =?UTF-8?q?1.=E9=A1=B9=E7=9B=AE=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?=E3=80=81=E4=BF=AE=E6=94=B9=E6=96=B0=E9=97=BB=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?js=E9=AA=8C=E8=AF=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/news/_form.html.erb | 6 ++-
app/views/news/_project_news.html.erb | 57 +++++++++++++++++++++++++-
app/views/news/_project_show.html.erb | 59 +++++++++++++++++++++++++--
3 files changed, 116 insertions(+), 6 deletions(-)
diff --git a/app/views/news/_form.html.erb b/app/views/news/_form.html.erb
index f92559903..35d8da952 100644
--- a/app/views/news/_form.html.erb
+++ b/app/views/news/_form.html.erb
@@ -3,9 +3,11 @@
<%= @project ? l(:label_news_new) : l(:bale_news_notice) %>
- <%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %>
+ <%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;", :onblur => "regexTitle();" %>
+ (60个字符以内)
- <%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %>
+ <%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;", :onblur => "regexDescription();" %>
+
<%= render :partial => 'attachments/form', :locals => {:container => @news} %>
diff --git a/app/views/news/_project_news.html.erb b/app/views/news/_project_news.html.erb
index cdef33e34..e9a912c5c 100644
--- a/app/views/news/_project_news.html.erb
+++ b/app/views/news/_project_news.html.erb
@@ -1,3 +1,56 @@
+
+
<%
if @project.project_type == Project::ProjectType_course
btn_tips = l(:label_news_notice)
@@ -22,7 +75,9 @@
<%= labelled_form_for @news, :url => project_news_index_path(@project),
:html => {:id => 'news-form', :multipart => true} do |f| %>
<%= render :partial => 'news/form', :locals => {:f => f} %>
- <%= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %> |
+ <%#= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %>
+ <%= link_to l(:button_create), "#", :onclick => 'submitNews();', :class => 'whiteButton m3p10' %>
+ |
<%= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
|
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'whiteButton m3p10' %>
diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb
index c8a8c5767..ecae672b6 100644
--- a/app/views/news/_project_show.html.erb
+++ b/app/views/news/_project_show.html.erb
@@ -1,3 +1,55 @@
+
<%= watcher_link(@news, User.current) %>
<%= link_to(l(:button_edit),
@@ -15,9 +67,10 @@
<%= labelled_form_for :news, @news, :url => news_path(@news),
:html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
- <%= submit_tag l(:button_save) %>
- <%= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form',target='preview',{:class => ''} %> |
- <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;' %>
+ <%#= submit_tag l(:button_save) %>
+ <%= link_to l(:button_save), "#", :onclick => 'submitNews();',:class => 'whiteButton m3p10' %>
+ <%= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %> |
+ <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'whiteButton m3p10' %>
<% end %>
|