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)) %> +
@@ -107,7 +107,7 @@ 主讲老师 : - <%= link_to(@user.lastname+@user.firstname, user_path(@user)) %> + <%= link_to(course.teacher.lastname+course.teacher.firstname, user_path(course.teacher)) %> From 395ae35a0e4d152947de8d4bcca15a40b8c955d3 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 11 Oct 2014 16:27:39 +0800 Subject: [PATCH 04/14] =?UTF-8?q?#1148=20=E8=B0=83=E6=95=B4=E6=89=80?= =?UTF-8?q?=E6=9C=89=E6=97=A5=E6=9C=9F=E4=B8=BA=E9=80=89=E6=8B=A9=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E6=89=8B=E5=8A=A8=E8=BE=93=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_fork_form.html.erb | 8 ++--- app/views/bids/_form.html.erb | 2 +- app/views/bids/_form_contest.html.erb | 2 +- app/views/bids/_homework_form.html.erb | 2 +- app/views/bids/_new_bid.html.erb | 2 +- app/views/contests/_form_contest.html.erb | 1 + app/views/courses/_homework_form.html.erb | 2 +- app/views/issues/bulk_edit.html.erb | 4 +-- app/views/projects/_new_homework.html.erb | 2 +- app/views/timelog/_form.html.erb | 2 +- app/views/timelog/bulk_edit.html.erb | 2 +- app/views/versions/_form.html.erb | 39 +++++++++++++++++++---- 12 files changed, 47 insertions(+), 21 deletions(-) diff --git a/app/views/bids/_fork_form.html.erb b/app/views/bids/_fork_form.html.erb index 3fcf0f02e..7a7010794 100644 --- a/app/views/bids/_fork_form.html.erb +++ b/app/views/bids/_fork_form.html.erb @@ -10,13 +10,13 @@

<%= 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 <%= text_field_tag 'bid_deadline', "#{l(:label_deadline)}", :class => 'noline', :required => true, - :onfocus => "clearInfo('bid_deadline', '#{l(:label_deadline)}')", :onblur => "showInfo('bid_deadline', '#{l(:label_deadline)}')"%> + :onfocus => "clearInfo('bid_deadline', '#{l(:label_deadline)}')", :readonly => true, :onblur => "showInfo('bid_deadline', '#{l(:label_deadline)}')"%> <%= calendar_for('bid_deadline')%> diff --git a/app/views/contests/_form_contest.html.erb b/app/views/contests/_form_contest.html.erb index 513419668..ffd273db9 100644 --- a/app/views/contests/_form_contest.html.erb +++ b/app/views/contests/_form_contest.html.erb @@ -68,6 +68,7 @@ :required => true, :size => 60, :style => "width:150px;", + :readonly => true, :placeholder => "#{l(:label_deadline)}" %> <%= calendar_for('contest_deadline')%> diff --git a/app/views/courses/_homework_form.html.erb b/app/views/courses/_homework_form.html.erb index 4b63b8852..b397b8d8f 100644 --- a/app/views/courses/_homework_form.html.erb +++ b/app/views/courses/_homework_form.html.erb @@ -34,7 +34,7 @@ <%#= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>

--> <% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %> -

<%= 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
- <%= text_field_tag 'bid_deadline', "#{l(:label_deadline)}", :class => 'noline', :required => true, + <%= text_field_tag 'bid_deadline', "#{l(:label_deadline)}", :class => 'noline', :readonly => true, :required => true, :onfocus => "clearInfo('bid_deadline', '#{l(:label_deadline)}')", :onblur => "showInfo('bid_deadline', '#{l(:label_deadline)}')"%> <%= calendar_for('bid_deadline')%> diff --git a/app/views/timelog/_form.html.erb b/app/views/timelog/_form.html.erb index 3256feaac..a3c0fa81b 100644 --- a/app/views/timelog/_form.html.erb +++ b/app/views/timelog/_form.html.erb @@ -13,7 +13,7 @@ <%= f.text_field :issue_id, :size => 6 %> <%= h("#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}") if @time_entry.issue %>

-

<%= 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 %>
From 7a710a4a8f094577379656c47b2174334aaf5825 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 13 Oct 2014 09:40:49 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=8E=89=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=97=A0=E7=94=A8=E9=A2=84=E8=A7=88=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_course_show.html.erb | 2 +- app/views/boards/_project_show.html.erb | 4 ++-- app/views/common/_preview.html.erb | 2 +- app/views/contestnotifications/edit.html.erb | 2 +- app/views/news/_course_news.html.erb | 6 +++--- app/views/news/_course_show.html.erb | 2 +- app/views/news/_project_news.html.erb | 4 ++-- app/views/news/_project_show.html.erb | 2 +- app/views/news/edit.html.erb | 2 +- app/views/news/new.html.erb | 4 ++-- app/views/wiki/edit.html.erb | 2 +- config/routes.rb | 19 +++++++++++++------ 12 files changed, 29 insertions(+), 22 deletions(-) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 35e066d45..26576195d 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -17,7 +17,7 @@ <%= 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/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 @@
<%= l(:label_preview) %> -<%= textilizable @text, :attachments => @attachments, :object => @previewed %> + <%= textilizable @text, :attachments => @attachments, :object => @previewed %>
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 @@ + + + + +没有访问权限 + + + + + +
+
403
+
+

ERROR FORBIDDEN
+ 没有访问权限!建议您

+ +
+ +
+ + diff --git a/app/views/common/404.html b/app/views/common/404.html new file mode 100644 index 000000000..5a3eaec9f --- /dev/null +++ b/app/views/common/404.html @@ -0,0 +1,41 @@ + + + + +页面不见了 + + + + + +
+
404
+
+

ERROR PAGE
+ 页面不见了!建议您

+ +
+ +
+ + diff --git a/public/404.html b/public/404.html index 8f2a53fe2..5b3280ccb 100644 --- a/public/404.html +++ b/public/404.html @@ -1,23 +1,41 @@ - - -Trustie 404 error - + + + + + 页面不见了 + + + -

Page not found

-

The page you were trying to access doesn't exist or has been removed.

-

Back

+ +
+
404
+
+

ERROR PAGE
+ 页面不见了!建议您

+ +
+ +
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 @@
<% unless replying %> -


+

+ +
<%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :maxlength => 254 %>

<% else %> -


- <%= 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 %>

<% end %>

@@ -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 @@

<%= l(:lable_hot_course)%>

- <% if @school_id %> - <% school_course = find_miracle_course(10,7, @school_id) %> - <% else %> - <%school_course=[]%> - <% end %> - <% if (school_course.count == 0) %> - <%= render :partial => 'more_course', :locals => {:school_id => nil}%> + <% month_now = Time.now.strftime("%m").to_i %> + <% year_now = Time.new.strftime("%Y") %> + + <% (month_now >= 3 && month_now < 9) ? course_term = "春季学期" : course_term = "秋季学期" %> + <% @school_id.nil? ? cur_school_course = [] : cur_school_course = find_miracle_course(10,7,@school_id, year_now, course_term) %> + + <% if cur_school_course.count == 0 %> + <%= render :partial => 'more_course', :locals => {:school_id => nil}%>
    - <% if User.current.logged? %>
  • <%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_no_course)} %>
  • - <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9, @school_id)} %> - <% else %> - <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(10, @school_id)} %> <% end %> + <% User.current.logged? ? course_count = 9 : course_count = 10 %> + <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(course_count, @school_id, year_now, course_term)} %>
<% else %> - <% if school_course.count < 9 %> + <% if cur_school_course.count < 9 %> <%= render :partial => 'more_course', :locals => {:school_id => nil}%> @@ -111,12 +110,12 @@ <% end %>
    - <%= render :partial => 'course_list', :locals => {:course_list => school_course} %> - <% if school_course.count < 9 %> + <%= render :partial => 'course_list', :locals => {:course_list => cur_school_course} %> + <% if cur_school_course.count < 9 %>
  • <%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_less_course)} %>
  • - <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9 - school_course.count, @school_id)} %> + <%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9-cur_school_course.count, @school_id, year_now, course_term)} %> <% end %>
@@ -136,19 +135,26 @@ <% find_new_forum_topics(10).each do |topic| %>
  • -       - <%= 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;" %> + +       + <%= link_to '['+topic.forum.name + ']', forum_path(topic.forum), :class => 'memo_Bar_title' %> + <%= link_to topic.subject, topic.event_url, :class => "gray", :style => "font-size: 10pt !important;" %>
    <%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %> - - <%= l(:label_question_sponsor)%>: <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> + + <%= l(:label_question_sponsor)%>: + <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> - - <%= l(:label_final_reply)%>:<% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %><%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%><% end %> + + <%= l(:label_final_reply)%>: + <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %> + <%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%> + <% end %> <%= l(:label_reply)%>(<%= link_to topic.try(:replies_count), topic.event_url %>) From 64ee96b5262786ee80a32214bb21e5d9b8457ca1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 14 Oct 2014 15:37:06 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=95=99=E8=A8=80=E5=9B=9E=E5=A4=8D=E6=8A=A5?= =?UTF-8?q?500=E7=9A=84BUG=20=E4=BA=A7=E7=94=9F=E5=8E=9F=E5=9B=A0=EF=BC=9A?= =?UTF-8?q?=E6=88=AA=E5=8F=96=E8=B7=AF=E7=94=B1=E6=AD=A3=E5=88=99=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8F=E6=9C=89=E8=AF=AF=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E6=96=B9=E6=A1=88=EF=BC=9A=E4=BF=AE=E6=AD=A3=E6=AD=A3=E5=88=99?= =?UTF-8?q?=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/words_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index f2502e03e..1a7feae2c 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -236,7 +236,7 @@ class WordsController < ApplicationController #modify by nwb #添加对课程留言的支持 referer = request.headers["Referer"] - obj_id = referer.match(%r(/([0-9]{1,})(/|$)))[1] + obj_id = referer.match(%r(/([0-9]{1,})(/|\?|$)))[1] if referer.match(/project/) obj = Project.find_by_id(obj_id) elsif referer.match(/course/) From 8f402fe0b72b243a1ea92322cebaccfdeb9f4a7f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 14 Oct 2014 17:09:52 +0800 Subject: [PATCH 13/14] =?UTF-8?q?#562=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E5=9B=9E=E5=A4=8D=E5=A2=9E=E5=8A=A0js=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=20=E5=8F=82=E8=B5=9B=E4=BD=9C=E5=93=81js=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=A2=9E=E5=8A=A0=E5=B7=A6=E5=8F=B3=E4=B8=A4=E7=AB=AF?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC=E5=8E=BB=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contests/_new_softapplication.html.erb | 8 ++--- app/views/messages/_course_show.html.erb | 31 +++++++++++++++---- app/views/messages/_form.html.erb | 1 + 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/app/views/contests/_new_softapplication.html.erb b/app/views/contests/_new_softapplication.html.erb index 3e4c0c9e0..fb16e9351 100644 --- a/app/views/contests/_new_softapplication.html.erb +++ b/app/views/contests/_new_softapplication.html.erb @@ -4,7 +4,7 @@ //验证作品名称 function regexName() { - var name = $("#softapplication_name").val(); + var name = $.trim($("#softapplication_name").val()); if(name.length == 0) { $("#spane_name_notice").text("<%= l(:label_no_softapplication_name) %>"); @@ -31,7 +31,7 @@ //验证作品简介 function regexDescription() { - var name = $("#softapplication_description").val(); + var name = $.trim($("#softapplication_description").val()); if(name.length ==0) { $("#span_sofapplication_description").text("<%= l(:label_no_softapplication_description) %>"); @@ -56,7 +56,7 @@ //验证运行平台 function regexWorkdescription() { - var workDescription = $("#softapplication_android_min_version_available").val(); + var workDescription = $.trim($("#softapplication_android_min_version_available").val()); if(workDescription.length ==0) { $("#spane_workdescription_notice").text("<%= l(:label_no_softapplication_platform) %>"); @@ -80,7 +80,7 @@ //验证开发人员 function regexDevelopers() { - var workDescription = $("#softapplication_application_developers").val(); + var workDescription = $.trim($("#softapplication_application_developers").val()); if(workDescription.length ==0) { $("#span_softapplication_application_developers").text("<%= l(:label_no_softapplication_developers) %>"); diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 41f2e4736..51764341d 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -177,7 +177,8 @@ <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'form', :locals => {:f => f, :replying => true} %> - <%= submit_tag l(:button_submit) %> + <%#= submit_tag l(:button_submit) %> + <%#= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form') %> <% end %>
    @@ -190,9 +191,27 @@ jQuery(document).ready(function($) { transpotUrl('#content'); }); -// function regexContent() -// { -// var content = trim($("#message_content").val()); -// alert(content); -// } + function submit_message_replay() + { + if(regexContent()) + { + $("#message-form").submit(); + } + } + function regexContent() + { + var content = $.trim($("#message_content").val()); + if(content.length ==0) + { + $("#message_content_span").text("<%= l(:label_reply_empty) %>"); + $("#message_content_span").css('color','#ff0000'); + return false; + } + else + { + $("#message_content_span").text("<%= l(:label_field_correct) %>"); + $("#message_content_span").css('color','#008000'); + return true; + } + } \ No newline at end of file diff --git a/app/views/messages/_form.html.erb b/app/views/messages/_form.html.erb index d906efea9..2cfeea80e 100644 --- a/app/views/messages/_form.html.erb +++ b/app/views/messages/_form.html.erb @@ -42,6 +42,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', :onblur => "regexContent();" %> +

    From 2780cd6317691aaed7686e9dcead90768caab843 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 14 Oct 2014 17:16:38 +0800 Subject: [PATCH 14/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2=E7=BB=93=E6=9E=9C=E5=8F=B3?= =?UTF-8?q?=E4=B8=8B=E8=A7=92=E6=98=BE=E7=A4=BA=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/search.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/courses/search.html.erb b/app/views/courses/search.html.erb index 25b45e0db..e25cd5349 100644 --- a/app/views/courses/search.html.erb +++ b/app/views/courses/search.html.erb @@ -45,13 +45,13 @@ <% if User.current.logged? %>

    - <%= l(:label_my_projects) %> + <%= l(:label_my_course) %>

    <% 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 %>