From 75fb5a2cd3c98ebd7ed25cac262d384d95868e0c Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 11 Oct 2014 15:48:51 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_history.html.erb | 77 +++++++++++++++------------ app/views/words/_new_respond.html.erb | 18 ++++--- 2 files changed, 52 insertions(+), 43 deletions(-) diff --git a/app/views/bids/_history.html.erb b/app/views/bids/_history.html.erb index 00a497e78..b67421823 100644 --- a/app/views/bids/_history.html.erb +++ b/app/views/bids/_history.html.erb @@ -19,41 +19,48 @@ <% if journals.size >0 %> -
+ <% end %> diff --git a/app/views/words/_new_respond.html.erb b/app/views/words/_new_respond.html.erb index d3f4145a8..64b83d777 100644 --- a/app/views/words/_new_respond.html.erb +++ b/app/views/words/_new_respond.html.erb @@ -1,13 +1,15 @@ <%= form_tag({:controller => 'words', :action => 'create_reply'}, :remote => true) do %> -<%= text_area_tag 'user_notes', "", :class => 'noline', - :style => "resize: none;", :rows => 4, - :placeholder => l(:label_projects_feedback_respond_content), - :maxlength => 250 %> + <%= text_area_tag 'user_notes', "", :class => 'noline', + :style => "resize: none;", :rows => 4, + :placeholder => l(:label_projects_feedback_respond_content), + :maxlength => 250 %> -<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> -<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> -<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> -<%= submit_tag l(:button_projects_feedback_respond), :name => nil , :class => "enterprise", :style => "float: right; margin-top: 1px; margin-right: 4px;"%> + <%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> + <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> + <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> + <%= submit_tag l(:button_projects_feedback_respond), :name => nil , + :class => "enterprise", + :style => "float: right; margin-top: 1px; margin-right: 4px;"%> <% end %> \ No newline at end of file From f372b7126ab9eac1162065e854b1c6f63d92add0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 11 Oct 2014 16:00:37 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E8=80=81=E5=B8=88=E6=89=93=E5=8C=85?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=A2=9E=E5=8A=A0=E5=BC=82=E5=B8=B8=E6=8D=95?= =?UTF-8?q?=E8=8E=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/zipdown_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index a7d804321..df834f13c 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -31,7 +31,8 @@ class ZipdownController < ApplicationController end send_file zipfile, :filename => obj.name+".zip", :type => detect_content_type(zipfile) if zipfile - #rescue NameError, ActiveRecord::RecordNotFound => e + rescue Exception => e + render file: 'public/no_file_found.html' , :layout => 'course_base' #logger.error "[ZipDown] ===> #{e}" #@error = e end From 85d28ba2fa7078f6e354429c665b48a936c2ceaf Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 11 Oct 2014 16:10:19 +0800 Subject: [PATCH 03/14] =?UTF-8?q?#1170=20=E4=BF=AE=E5=A4=8D=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E4=B8=BB=E8=AE=B2=E6=95=99=E5=B8=88=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_homework.html.erb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index bff70ba3d..87893e5c4 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -66,19 +66,19 @@- - - <%= link_to course.name.to_s, homework_course_path(course) if course %> - - + + + <%= link_to course.name.to_s, homework_course_path(course) if course %> + + |
- - - <%=link_to(@bid.name, respond_path(@bid)) %> - + + + <%=link_to(@bid.name, respond_path(@bid)) %> + |
<%= f.text_area :description, :rows => 8, :value => @bid.description, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>
- -<%= f.text_field :deadline, :value => nil,:required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%> +
<%= f.text_field :deadline, :value => nil,:required => true, :size => 60, :style => "width:150px;" , :readonly => true %><%= calendar_for('bid_deadline')%>
<%= f.select :is_evaluation, is_evaluation_option %> diff --git a/app/views/bids/_form.html.erb b/app/views/bids/_form.html.erb index c5c284d85..98277d315 100644 --- a/app/views/bids/_form.html.erb +++ b/app/views/bids/_form.html.erb @@ -30,6 +30,6 @@
-<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%> +
<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}", :readonly => true %><%= calendar_for('bid_deadline')%>
diff --git a/app/views/bids/_form_contest.html.erb b/app/views/bids/_form_contest.html.erb index 448af2e8e..e2dba9271 100644 --- a/app/views/bids/_form_contest.html.erb +++ b/app/views/bids/_form_contest.html.erb @@ -33,4 +33,4 @@ -<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%>
+<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :readonly => true, :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%>
diff --git a/app/views/bids/_homework_form.html.erb b/app/views/bids/_homework_form.html.erb index 226eae650..2508ff925 100644 --- a/app/views/bids/_homework_form.html.erb +++ b/app/views/bids/_homework_form.html.erb @@ -29,7 +29,7 @@
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>
-<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;", :onchange => "regexDeadLine();") %> +
<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;", :readonly => true, :onchange => "regexDeadLine();") %> <%= calendar_for('bid_deadline')%> diff --git a/app/views/bids/_new_bid.html.erb b/app/views/bids/_new_bid.html.erb index afce79577..db1387a00 100644 --- a/app/views/bids/_new_bid.html.erb +++ b/app/views/bids/_new_bid.html.erb @@ -69,7 +69,7 @@ border-top: 1px solid #acaeb1; border-bottom: 1px solid #acaeb1; margin-top: 30p
<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();") %> +
<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();", :readonly => true) %> <%= calendar_for('bid_deadline')%> diff --git a/app/views/issues/bulk_edit.html.erb b/app/views/issues/bulk_edit.html.erb index 281c7a309..2924ad927 100644 --- a/app/views/issues/bulk_edit.html.erb +++ b/app/views/issues/bulk_edit.html.erb @@ -107,14 +107,14 @@ <% if @safe_attributes.include?('start_date') %>
- <%= text_field_tag 'issue[start_date]', '', :size => 10 %><%= calendar_for('issue_start_date') %> + <%= text_field_tag 'issue[start_date]', '', :size => 10, :readonly => true %><%= calendar_for('issue_start_date') %>
<% end %> <% if @safe_attributes.include?('due_date') %>- <%= text_field_tag 'issue[due_date]', '', :size => 10 %><%= calendar_for('issue_due_date') %> + <%= text_field_tag 'issue[due_date]', '', :size => 10, :readonly => true %><%= calendar_for('issue_due_date') %>
<% end %> diff --git a/app/views/projects/_new_homework.html.erb b/app/views/projects/_new_homework.html.erb index 1da188f3b..64a76aa0f 100644 --- a/app/views/projects/_new_homework.html.erb +++ b/app/views/projects/_new_homework.html.erb @@ -68,7 +68,7 @@ border-top: 1px solid #acaeb1; border-bottom: 1px solid #acaeb1; margin-top: 30p<%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %>
+<%= f.text_field :spent_on, :size => 10, :required => true, :readonly => true %><%= calendar_for('time_entry_spent_on') %>
<%= f.text_field :hours, :size => 6, :required => true %>
<%= f.text_field :comments, :size => 100, :maxlength => 255 %>
<%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %>
diff --git a/app/views/timelog/bulk_edit.html.erb b/app/views/timelog/bulk_edit.html.erb index caabc18a2..a7ccc36fc 100644 --- a/app/views/timelog/bulk_edit.html.erb +++ b/app/views/timelog/bulk_edit.html.erb @@ -18,7 +18,7 @@- <%= text_field :time_entry, :spent_on, :size => 10 %><%= calendar_for('time_entry_spent_on') %> + <%= text_field :time_entry, :spent_on, :size => 10, :readonly => true %><%= calendar_for('time_entry_spent_on') %>
diff --git a/app/views/versions/_form.html.erb b/app/views/versions/_form.html.erb index d852b3dab..d0729c720 100644 --- a/app/views/versions/_form.html.erb +++ b/app/views/versions/_form.html.erb @@ -2,15 +2,40 @@ <%= error_messages_for 'version' %>
<%= f.text_field :name, :size => 60, :required => true %>
-<%= f.text_field :description, :size => 60, :style => "margin-left:10px;" %>
-<%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %>
-<%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %>
-<%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %>
-<%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %>
++ <%= f.text_field :name, :size => 60, :required => true %> +
++ <%= f.text_field :description, :size => 60, :style => "margin-left:10px;" %> +
++ + <%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %> + +
++ + <%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %> + +
++ + <%= f.text_field :effective_date, :size => 10, :readonly => true %> + <%= calendar_for('version_effective_date') %> + +
++ + <%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %> + +
<% @version.custom_field_values.each do |value| %> -<%= custom_field_tag_with_label :version, value %>
++ + <%= custom_field_tag_with_label :version, value %> + +
<% end %><%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> - <%= preview_link(preview_board_message_path(@board), 'message-form' ,target='preview',{:class => 'whiteButton m3p10'} )%> | + <%#= preview_link(preview_board_message_path(@board), 'message-form' ,target='preview',{:class => 'whiteButton m3p10'} )%> <%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;' ,:class => 'whiteButton m3p10' %>
<% end %> diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 199155838..d615c877c 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -18,8 +18,8 @@ <%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'messages/form', :locals => {:f => f} %><%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> - <%= preview_link(preview_board_message_path(@board), 'message-form', target='preview', {:class => 'whiteButton m3p10'}) %> - | + <%#= preview_link(preview_board_message_path(@board), 'message-form', target='preview', {:class => 'whiteButton m3p10'}) %> + <%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;', :class => 'whiteButton m3p10' %>
<% end %> diff --git a/app/views/common/_preview.html.erb b/app/views/common/_preview.html.erb index 90d83ce8c..cf26d78ab 100644 --- a/app/views/common/_preview.html.erb +++ b/app/views/common/_preview.html.erb @@ -1,3 +1,3 @@ diff --git a/app/views/contestnotifications/edit.html.erb b/app/views/contestnotifications/edit.html.erb index 27e38f999..22f484724 100644 --- a/app/views/contestnotifications/edit.html.erb +++ b/app/views/contestnotifications/edit.html.erb @@ -7,7 +7,7 @@ :method => :put } do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> -<%= preview_link preview_contestnotifications_path(id: @contestnotification), +<%#= preview_link preview_contestnotifications_path(id: @contestnotification), 'contestnotifications-form' %> <% end %> diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index ea94244d5..f66def486 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -74,9 +74,9 @@ <%= labelled_form_for @news, :url => course_news_index_path(@course), :html => {:id => 'news-form', :multipart => true} do |f| %> <%= render :partial => 'news/course_form', :locals => {:f => f, :is_new => true} %> - <%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'whiteButton m3p10' %>| - <%= preview_link preview_news_path(:course_id => @course), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> - | + <%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'whiteButton m3p10' %> + <%#= preview_link preview_news_path, 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> + <%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'whiteButton m3p10' %> <% end if @course %> diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 6e03e8e34..6f13c28c7 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -70,7 +70,7 @@ <%= render :partial => 'course_form', :locals => { :f => f, :is_new => false } %> <%#= submit_tag l(:button_save) %> <%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'whiteButton m3p10' %> - <%= preview_link preview_news_path(:course_id => @course, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %> | + <%#= preview_link preview_news_path(:course_id => @course, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %> <%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'whiteButton m3p10' %> <% end %> diff --git a/app/views/news/_project_news.html.erb b/app/views/news/_project_news.html.erb index 75f33d1d3..79217f1fe 100644 --- a/app/views/news/_project_news.html.erb +++ b/app/views/news/_project_news.html.erb @@ -84,8 +84,8 @@ <%#= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %> <%= link_to l(:button_create), "#", :onclick => 'submitNews();',:onmouseover => 'submitFocus(this);', :class => 'whiteButton m3p10' %> | - <%= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {: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' %> <% end if @project %> diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb index 665094cc8..7b4c209b0 100644 --- a/app/views/news/_project_show.html.erb +++ b/app/views/news/_project_show.html.erb @@ -70,7 +70,7 @@ <%= render :partial => 'form', :locals => { :f => f } %> <%#= submit_tag l(:button_save) %> <%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'whiteButton m3p10' %> - <%= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form',target='preview',{: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 %> diff --git a/app/views/news/edit.html.erb b/app/views/news/edit.html.erb index e5e5221b9..3225f8031 100644 --- a/app/views/news/edit.html.erb +++ b/app/views/news/edit.html.erb @@ -3,7 +3,7 @@ <%= labelled_form_for @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' %> +<%#= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form' %> <% end %> diff --git a/app/views/news/new.html.erb b/app/views/news/new.html.erb index 836d3b6ed..03c1d3ee7 100644 --- a/app/views/news/new.html.erb +++ b/app/views/news/new.html.erb @@ -4,14 +4,14 @@ :html => {:id => 'news-form', :multipart => true} do |f| %> <%= render :partial => 'news/form', :locals => {:f => f} %> <%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> - <%= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> + <%#= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> <% end %> <% elsif @course %> <%= labelled_form_for @news, :url => course_news_index_path(@course), :html => {:id => 'news-form', :multipart => true} do |f| %> <%= render :partial => 'news/form', :locals => {:f => f} %> <%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> - <%= preview_link preview_news_path(:course_id => @course), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> + <%#= preview_link preview_news_path(:course_id => @course), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> <% end %> <% end %> diff --git a/app/views/wiki/edit.html.erb b/app/views/wiki/edit.html.erb index 3a1abdd83..ba82865ad 100644 --- a/app/views/wiki/edit.html.erb +++ b/app/views/wiki/edit.html.erb @@ -44,7 +44,7 @@<%= submit_tag l(:button_save) %> - <%= preview_link({:controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, 'wiki_form') %>
+ <%#= preview_link({:controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, 'wiki_form') %> <%= wikitoolbar_for 'content_text' %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index f4f858a9f..339d3a853 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -100,7 +100,6 @@ RedmineApp::Application.routes.draw do #resources :contestnotifications, :only => [:index, :show, :edit, :update, :destroy] # match '/contestnotifications/:id/notificationcomments', :to => 'notificationcomments#create', :via => :post # match '/contestnotifications/:id/notificationcomments/:notificationcomment_id', :to => 'notificationcomments#destroy', :via => :delete - match '/contestnotifications/preview', :to => 'previews#contestnotification', :as => 'preview_contestnotifications', :via => [:get, :post, :put] ## new added by linchun #新竞赛相关 resources :contests, only: [:index] do resources :contestnotifications do @@ -136,6 +135,19 @@ RedmineApp::Application.routes.draw do end end + match '/news/preview', :to => 'previews#news', :as => 'preview_news', :via => [:get, :post, :put] + match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put] + match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put] + match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put] + match '/contestnotifications/preview', :to => 'previews#contestnotification', :as => 'preview_contestnotifications', :via => [:get, :post, :put] + + #resource :previews, only: [] do + # collection do + # match 'news', :via => [:get, :post, :put] + # match 'issue', :via => [:get, :post, :put] + # end + #end + resources :stores do collection do match 'search', :via => [:get, :post] @@ -188,11 +200,6 @@ RedmineApp::Application.routes.draw do match 'account/activate', :via => :get match 'account/valid_ajax', :via => :get - match '/news/preview', :to => 'previews#news', :as => 'preview_news', :via => [:get, :post, :put] - match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put] - match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put] - match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put] - match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] From 13ee0dc9b2ef3632aecfb80e1897f1862909b6aa Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 13 Oct 2014 10:31:40 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9403=E3=80=81403?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 6 ++- app/views/common/403.html | 41 ++++++++++++++++ app/views/common/404.html | 41 ++++++++++++++++ public/404.html | 58 +++++++++++++++-------- 4 files changed, 124 insertions(+), 22 deletions(-) create mode 100644 app/views/common/403.html create mode 100644 app/views/common/404.html diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0d9fe62a8..50196f21e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -495,12 +495,14 @@ class ApplicationController < ActionController::Base def render_403(options={}) @project = nil - render_error({:message => :notice_not_authorized, :status => 403}.merge(options)) + #render_error({:message => :notice_not_authorized, :status => 403}.merge(options)) + render :template => 'common/403' return false end def render_404(options={}) - render_error({:message => :notice_file_not_found, :status => 404}.merge(options)) + #render_error({:message => :notice_file_not_found, :status => 404}.merge(options)) + render :template => 'common/404' return false end diff --git a/app/views/common/403.html b/app/views/common/403.html new file mode 100644 index 000000000..8462570e4 --- /dev/null +++ b/app/views/common/403.html @@ -0,0 +1,41 @@ + + + + +The page you were trying to access doesn't exist or has been removed.
- + + From 3dd14b6112d86d3d45ec5b4e11af35ceb21ef1bb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 13 Oct 2014 11:09:33 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8=E5=88=B0=E5=A4=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/index.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/courses/index.html.erb b/app/views/courses/index.html.erb index 24eefd4cb..907be64a4 100644 --- a/app/views/courses/index.html.erb +++ b/app/views/courses/index.html.erb @@ -56,9 +56,9 @@ <% end %> -<% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> -<% end %> +<%# other_formats_links do |f| %> + <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> +<%# end %> <% content_for :sidebar do %> <%= form_tag({}, :method => :get) do %> From 864d969c155393c7a5410e18fde98531911e9f99 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 13 Oct 2014 14:52:07 +0800 Subject: [PATCH 08/14] =?UTF-8?q?#1173=20=E9=87=8D=E5=90=AF=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E3=80=81=E5=85=B3=E9=97=AD=E8=AF=BE=E7=A8=8B=E3=80=81?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E7=A8=8B=E3=80=81=E9=80=80=E5=87=BA?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=AD=89=E6=8C=89=E9=92=AE=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 1 - app/views/courses/finishcourse.js.erb | 14 +++--- app/views/layouts/_base_header.html.erb | 43 +++++-------------- app/views/layouts/_user_courses_list.html.erb | 14 ++++++ app/views/layouts/_user_project_list.html.erb | 12 ++++++ 5 files changed, 43 insertions(+), 41 deletions(-) create mode 100644 app/views/layouts/_user_courses_list.html.erb create mode 100644 app/views/layouts/_user_project_list.html.erb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 945b8c514..a9a02045f 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -544,7 +544,6 @@ class CoursesController < ApplicationController def finishcourse yesterday = Date.today.prev_day.to_time - @course_prefs.endup_time = yesterday @save_flag = @course_prefs.save get_courses diff --git a/app/views/courses/finishcourse.js.erb b/app/views/courses/finishcourse.js.erb index 75c2b774d..46bc57e32 100644 --- a/app/views/courses/finishcourse.js.erb +++ b/app/views/courses/finishcourse.js.erb @@ -1,12 +1,12 @@ <% if @save_flag %> -<% if Rails.env.development? %> -console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@course.extra).try(:endup_time)%>'); -<% end %> -$('#content-title-top-div').html("<%= j(render partial: 'users/my_course_ex', :locals => {:memberships => @memberships,:user=>@user, -:memberships_doing=>@memberships_doing,:memberships_done=>@memberships_done} )%>") -$('#finish_course_<%=@course.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:course => @course} )%>") + <% if Rails.env.development? %> + console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@course.extra).try(:endup_time)%>'); + <% end %> + $('#content-title-top-div').html("<%= j(render partial: 'users/my_course_ex', :locals => {:memberships => @memberships,:user=>@user, + :memberships_doing=>@memberships_doing,:memberships_done=>@memberships_done} )%>"); + $('#finish_course_<%=@course.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:course => @course} )%>"); <% else %> -alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。'); + alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。'); <% end %> diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index b0daf8c88..c3b06759c 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -42,48 +42,25 @@ @@ -98,7 +75,7 @@ \ No newline at end of file diff --git a/app/views/messages/_form.html.erb b/app/views/messages/_form.html.erb index 4eab5658c..d906efea9 100644 --- a/app/views/messages/_form.html.erb +++ b/app/views/messages/_form.html.erb @@ -5,12 +5,22 @@
+
+
+
<%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :maxlength => 254 %>
- <%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :readonly => true %>
+
+
+
+ <%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :readonly => true %>
@@ -31,7 +41,7 @@
<%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %> - <%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content' %> + <%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content', :onblur => "regexContent();" %>
From 7529a944cfb150351c23966d14deb626489951e2 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 14 Oct 2014 10:32:59 +0800 Subject: [PATCH 11/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=98=BE=E7=A4=BA=E8=AF=BE=E7=A8=8B=EF=BC=9A?= =?UTF-8?q?=201.3-8=E6=9C=88=E4=BB=BD=E4=B8=BA=E6=98=BE=E7=A4=BA=E6=98=A5?= =?UTF-8?q?=E5=AD=A3=E8=AF=BE=E7=A8=8B=EF=BC=8C9-2=E6=9C=88=E4=BB=BD?= =?UTF-8?q?=E4=B8=BA=E6=98=BE=E7=A4=BA=E7=A7=8B=E5=AD=A3=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=201.=E5=BD=93=E5=89=8D=E7=94=A8=E6=88=B7=E6=9C=AA=E7=99=BB?= =?UTF-8?q?=E5=BD=95=EF=BC=9A=E6=98=BE=E7=A4=BA=E7=B3=BB=E7=BB=9F=E4=B8=AD?= =?UTF-8?q?=E5=9C=A8=E5=BD=93=E5=89=8D=E5=B9=B4=E5=BA=A6=E3=80=81=E5=AD=A3?= =?UTF-8?q?=E5=BA=A6=E4=B8=AD=E4=BA=BA=E6=95=B0=E6=9C=80=E5=A4=9A=E7=9A=84?= =?UTF-8?q?10=E4=B8=AA=E5=85=AC=E5=BC=80=E8=AF=BE=E7=A8=8B=202.=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E7=94=A8=E6=88=B7=E4=BB=A5=E7=99=BB=E5=BD=95=EF=BC=8C?= =?UTF-8?q?=E6=88=96=E8=80=85=E9=80=89=E6=8B=A9=E6=8C=87=E5=AE=9A=E5=AD=A6?= =?UTF-8?q?=E6=A0=A1=EF=BC=9A=E6=98=BE=E7=A4=BA=E8=AF=A5=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=89=80=E5=9C=A8=E5=AD=A6=E6=A0=A1/=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E5=AD=A6=E6=A0=A1=E5=9C=A8=E5=BD=93=E5=89=8D=E5=B9=B4=E5=BA=A6?= =?UTF-8?q?=E3=80=81=E5=AD=A3=E5=BA=A6=E4=B8=AD=E4=BA=BA=E6=95=B0=E6=9C=80?= =?UTF-8?q?=E5=A4=9A=E7=9A=8410=E9=97=A8=E8=AF=A5=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8F=AF=E8=A7=81=E7=9A=84=E8=AF=BE=E7=A8=8B(=E5=8C=85?= =?UTF-8?q?=E6=8B=AC=E8=AF=A5=E7=94=A8=E6=88=B7=E5=8F=AF=E8=A7=81=E7=9A=84?= =?UTF-8?q?=E7=A7=81=E6=9C=89=E8=AF=BE=E7=A8=8B)=EF=BC=8C=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E8=AF=A5=E5=AD=A6=E6=A0=A1=E8=AF=BE=E7=A8=8B=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E4=B8=8D=E8=B6=B3=EF=BC=8C=E5=90=91=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=8E=A8=E8=8D=90=E5=85=B6=E4=BB=96=E8=AF=BE=E7=A8=8B=E8=A1=A5?= =?UTF-8?q?=E5=85=85=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 11 +++--- app/helpers/welcome_helper.rb | 44 +++++++++++++++--------- app/views/welcome/course.html.erb | 48 +++++++++++++++------------ 3 files changed, 62 insertions(+), 41 deletions(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index dee79bc31..6cc565863 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -62,11 +62,12 @@ class WelcomeController < ApplicationController def course @course_page = FirstPage.where("page_type = 'course'").first - if params[:school_id] - @school_id = params[:school_id] - elsif User.current.logged? && User.current.user_extensions.try(:school) - @school_id = User.current.user_extensions.school.try(:id) - end + #if params[:school_id] + # @school_id = params[:school_id] + #elsif User.current.logged? && User.current.user_extensions.try(:school) + # @school_id = User.current.user_extensions.school.try(:id) + #end + @school_id = params[:school_id] || User.current.user_extensions.school.try(:id) @logoLink ||= logolink() end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 1139deb35..2399179b8 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -136,31 +136,33 @@ module WelcomeHelper #获取课程列表 # add by nwb - def find_miracle_course(sum=10, max_rate=7, school_id) + def find_miracle_course(sum=10, max_rate=7, school_id, time,term) if User.current.user_extensions.nil? && User.current.user_extensions.school.nil? and school_id.nil? Course.active.visible. joins(:memberships). + where("courses.time = #{time} and courses.term = #{term}"). group('members.course_id'). reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum else if school_id.nil? Course.active.visible. joins(:memberships). - where("#{Course.table_name}.school_id = ?", User.current.user_extensions.school.id). + where("#{Course.table_name}.school_id = ? and courses.time = ? and courses.term = ?", User.current.user_extensions.school.id, time, term). group('members.course_id'). - reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum + reorder("COUNT(members.course_id) DESC").take sum else if school_id == "0" Course.active.visible. joins(:memberships). + where("courses.time = #{time} and courses.term = #{term}"). group('members.course_id'). - reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum + reorder("COUNT(members.course_id) DESC").take sum else Course.active.visible. joins(:memberships). - where("#{Course.table_name}.school_id = ?", school_id). + where("#{Course.table_name}.school_id = ? and courses.time = ? and courses.term = ?", school_id, time, term). group('members.course_id'). - reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum + reorder("COUNT(members.course_id) DESC").take sum end end end @@ -229,16 +231,28 @@ module WelcomeHelper end # modif by nwb - def find_all_new_hot_course limit = 9 ,school_id = 0 + def find_all_new_hot_course limit = 9 ,school_id = nil, year_now, course_term #sort_project_by_hot_rails 1, 'course_ac_para DESC', limit - time_now = Time.new.strftime("%Y") - if school_id - courses = Course.includes(:school, :members).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <> - ?", school_id).order("course_ac_para DESC").limit(limit).all - else - courses = Course.includes(:school, :members).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id is not NULL - ").order("course_ac_para DESC").limit(limit).all - end + #time_now = Time.new.strftime("%Y") + #if school_id + #courses = Course.includes(:school, :members).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <> + # ?", school_id).order("course_ac_para DESC").limit(limit).all + #else + # courses = Course.includes(:school, :members).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id is not NULL + # ").order("course_ac_para DESC").limit(limit).all + # end + school_id.nil? ? + courses = Course.includes(:school, :members).visible. + joins(:memberships). + where("courses.time = ? and courses.term = ? and courses.school_id is not NULL", year_now, course_term). + group('members.course_id'). + reorder("COUNT(members.course_id) DESC").limit(limit).all + : + courses = Course.includes(:school, :members).visible. + joins(:course_status). + where("courses.time = ? and courses.term = ? and courses.school_id <> ?",year_now, course_term, school_id). + group('members.course_id'). + reorder("COUNT(members.course_id) DESC").limit(limit).all courses end diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index d28c89aa8..ea8963f7e 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -78,29 +78,28 @@