From f15c870053363c922f0dcc267bc99b774d3ab385 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Tue, 21 Oct 2014 10:40:03 +0800
Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?=
=?UTF-8?q?=E3=80=822=E3=80=81=E9=A1=B9=E7=9B=AE=E6=96=B0=E5=BB=BA?=
=?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=90=8E=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?=
=?UTF-8?q?=E4=B8=AD=E9=A1=B9=E7=9B=AEtab=E9=A1=B5=E7=82=B9=E5=87=BB?=
=?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/admin_controller.rb | 6 +---
app/controllers/users_controller.rb | 2 +-
.../web_footer_companies_controller.rb | 2 --
app/views/admin/_tab_partial.html.erb | 8 ++++++
app/views/admin/contest_page_made.html.erb | 28 +------------------
app/views/admin/course_page_made.html.erb | 9 +-----
app/views/admin/first_page_made.html.erb | 9 +-----
app/views/admin/web_footer_made.html.erb | 9 +-----
app/views/layouts/base_courses.html.erb | 7 -----
app/views/messages/_form.html.erb | 28 ++++++-------------
app/views/news/_project_show.html.erb | 2 +-
config/routes.rb | 3 +-
12 files changed, 26 insertions(+), 87 deletions(-)
create mode 100644 app/views/admin/_tab_partial.html.erb
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index f3b8b421a..fb6c2e8fe 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -217,21 +217,17 @@ class AdminController < ApplicationController
if request.get?
@contest_page = FirstPage.find_by_page_type('contest')
@first_page = FirstPage.find_by_page_type('project')
- @notification = ContestNotification.first;
elsif request.post?
@first_page = FirstPage.find_by_page_type('project')
@contest_page = FirstPage.find_by_page_type('contest')
- @notification = ContestNotification.first;
@first_page.web_title = params[:web_title]
@contest_page.web_title = params[:web_title]
@contest_page.title = params[:contest_title]
@contest_page.image_width = params[:image_width]
@contest_page.image_height = params[:image_height]
@contest_page.description = params[:contest_description]
- @notification.title = params[:contest_notification_title]
- @notification.content = params[:contest_notification][:content]
- if @first_page.save && @contest_page.save && @notification.save
+ if @first_page.save && @contest_page.save
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 21adfa19e..7e6e3d04a 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -33,7 +33,7 @@ class UsersController < ApplicationController
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info,
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
- :activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities]
+ :activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index]
#edit has been deleted by huang, 2013-9-23
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
:user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
diff --git a/app/controllers/web_footer_companies_controller.rb b/app/controllers/web_footer_companies_controller.rb
index 4c5748e40..b61a58189 100644
--- a/app/controllers/web_footer_companies_controller.rb
+++ b/app/controllers/web_footer_companies_controller.rb
@@ -20,7 +20,6 @@ class WebFooterCompaniesController < ApplicationController
redirect_to web_footer_companies_url
else
flash[:error] = "#{l :web_footer_company_create_fail}: #{@company.errors.full_messages[0]}"
- new
render :action => 'new'
end
end
@@ -42,7 +41,6 @@ class WebFooterCompaniesController < ApplicationController
redirect_to web_footer_companies_url
else
flash[:error] = "#{l :web_footer_company_update_fail}: #{@company.errors.full_messages[0]}"
- edit
render :action => 'edit'
end
end
diff --git a/app/views/admin/_tab_partial.html.erb b/app/views/admin/_tab_partial.html.erb
new file mode 100644
index 000000000..86191fdb5
--- /dev/null
+++ b/app/views/admin/_tab_partial.html.erb
@@ -0,0 +1,8 @@
+
+
+ - <%= link_to l(:label_project_first_page), {:action => 'first_page_made'}, class: "#{current_page?(first_page_made_path)? 'selected' : nil }" %>
+ - <%= link_to l(:label_course_first_page), {:action => 'course_page_made'}, class: "#{current_page?(course_page_made_path)? 'selected' : nil }" %>
+ - <%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'}, class: "#{current_page?(contest_page_made_path)? 'selected' : nil }" %>
+ - <%= link_to l(:label_web_footer_page), {:action => 'web_footer_made'}, class: "#{current_page?(web_footer_made_path)? 'selected' : nil }" %>
+
+
\ No newline at end of file
diff --git a/app/views/admin/contest_page_made.html.erb b/app/views/admin/contest_page_made.html.erb
index dab3b6885..a25f149ed 100644
--- a/app/views/admin/contest_page_made.html.erb
+++ b/app/views/admin/contest_page_made.html.erb
@@ -5,14 +5,7 @@
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
-
-
- - <%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %>
- - <%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %>
- - <%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} , :class => 'selected'%>
- - <%= link_to l(:label_web_footer_page),{:action => 'web_footer_made'} %>
-
-
+ <%= render 'tab_partial' %>
<%=l(:label_contest_first_page)%>
@@ -38,26 +31,7 @@
<%= text_area_tag 'contest_description',@contest_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
-
-
-
-
-
-
-
- <%= text_field_tag 'contest_notification_title', params[:label_contest_notification_title], :value => @notification.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
-
-
- <%= text_area 'contest_notification', 'content', :value => @notification.content,:cols => 80, :rows => 15, :class => 'wiki-edit' %>
- <%= wikitoolbar_for 'contest_notification_content' %>
-
-
-
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% end %>
diff --git a/app/views/admin/course_page_made.html.erb b/app/views/admin/course_page_made.html.erb
index aa99dc7cd..8b91e2600 100644
--- a/app/views/admin/course_page_made.html.erb
+++ b/app/views/admin/course_page_made.html.erb
@@ -5,14 +5,7 @@
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
-
-
- - <%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %>
- - <%= link_to l(:label_course_first_page), {:action => 'course_page_made'}, :class => 'selected' %>
- - <%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} %>
- - <%= link_to l(:label_web_footer_page),{:action => 'web_footer_made'} %>
-
-
+ <%= render 'tab_partial' %>
<%=l(:label_course_first_page)%>
diff --git a/app/views/admin/first_page_made.html.erb b/app/views/admin/first_page_made.html.erb
index e4403457c..d8fbc0533 100644
--- a/app/views/admin/first_page_made.html.erb
+++ b/app/views/admin/first_page_made.html.erb
@@ -5,14 +5,7 @@
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
-
-
- - <%= link_to l(:label_project_first_page), {:action => 'first_page_made'}, :class => 'selected' %>
- - <%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %>
- - <%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} %>
- - <%= link_to l(:label_web_footer_page),{:action => 'web_footer_made'} %>
-
-
+ <%= render 'tab_partial' %>
<%=l(:label_project_first_page)%>
diff --git a/app/views/admin/web_footer_made.html.erb b/app/views/admin/web_footer_made.html.erb
index 52f7cd5eb..65e77631c 100644
--- a/app/views/admin/web_footer_made.html.erb
+++ b/app/views/admin/web_footer_made.html.erb
@@ -5,14 +5,7 @@
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
-
-
- - <%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %>
- - <%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %>
- - <%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'}%>
- - <%= link_to l(:label_web_footer_page),{:action => 'web_footer_made'} , :class => 'selected' %>
-
-
+ <%= render 'tab_partial' %>
<%= link_to l(:label_cooperation_compnay), web_footer_companies_path %>
<%=l(:label_web_footer_page)%>
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index bfb8d11d5..edc90f8cc 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -67,7 +67,6 @@
-
<%= link_to @course.name,course_path(@course) %> |
@@ -80,9 +79,6 @@
<% else %>
<%= join_in_course(@course, User.current) %>
<% end %>
- <%# unless User.current.member_of_course?(@course) %>
-
- <%# end %>
<% end %>
@@ -118,12 +114,10 @@
<%= link_to files_count, course_files_path(@course) %> |
-
<%= l(:label_x_base_courses_teacher, :count => teacherCount(@course)) %>
|
<%= l(:label_x_base_courses_student, :count => studentCount(@course)) %>
-
|
<%= l(:label_x_course_data, :count => files_count) %>
@@ -168,7 +162,6 @@
<% unless @course.teacher.user_extensions.nil? || @course.teacher.user_extensions.school.nil? %>
|
<%= l(:label_teacher_work_unit) %> : |
-
<% else %>
diff --git a/app/views/messages/_form.html.erb b/app/views/messages/_form.html.erb
index 2cfeea80e..eb0a7f53e 100644
--- a/app/views/messages/_form.html.erb
+++ b/app/views/messages/_form.html.erb
@@ -4,25 +4,15 @@
- <% 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 %>
-
- <% end %>
+ <% extra_option = replying ? { readonly: true} : { maxlength: 254 } %>
+
+
+
+ <%= f.text_field :subject, { size: 60, style: "width: 99%;", id: "message_subject" }.merge(extra_option) %>
+
<% unless replying %>
<% if @message.safe_attribute? 'sticky' %>
diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb
index 7b4c209b0..70fca5e48 100644
--- a/app/views/news/_project_show.html.erb
+++ b/app/views/news/_project_show.html.erb
@@ -141,7 +141,7 @@
<%= format_time(comment.created_on) %>
- <%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
+ <%= link_to_if_authorized image_tag('delete.png'), delete_news_comments_path(id: @news, comment: comment),
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:title => l(:button_delete) %>
diff --git a/config/routes.rb b/config/routes.rb
index 91f96bfb2..a20ab8ef6 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -460,7 +460,8 @@ RedmineApp::Application.routes.draw do
resources :news, :only => [:index, :show, :edit, :update, :destroy]
match '/news/:id/comments', :to => 'comments#create', :via => :post
- match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete
+ #match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete
+ delete '/news/:id/comments/:comment_id', :to => 'comments#destroy', as: :delete_news_comments
resources :versions, :only => [:show, :edit, :update, :destroy] do
post 'status_by', :on => :member
| |