1、代码优化。2、项目新建项目后个人主页中项目tab页点击报错问题

This commit is contained in:
z9hang 2014-10-21 10:40:03 +08:00
parent aef3847290
commit f15c870053
12 changed files with 26 additions and 87 deletions

View File

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

View File

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

View File

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

View File

@ -0,0 +1,8 @@
<div class="tabs">
<ul>
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'}, class: "#{current_page?(first_page_made_path)? 'selected' : nil }" %></li>
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'}, class: "#{current_page?(course_page_made_path)? 'selected' : nil }" %></li>
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'}, class: "#{current_page?(contest_page_made_path)? 'selected' : nil }" %></li>
<li><%= link_to l(:label_web_footer_page), {:action => 'web_footer_made'}, class: "#{current_page?(web_footer_made_path)? 'selected' : nil }" %></li>
</ul>
</div>

View File

@ -5,14 +5,7 @@
<label for='web_title'><%= l(:label_web_title) %>:</label>
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<div class="tabs">
<ul>
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %></li>
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %></li>
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} , :class => 'selected'%></li>
<li><%= link_to l(:label_web_footer_page),{:action => 'web_footer_made'} %></li>
</ul>
</div>
<%= render 'tab_partial' %>
<h4><%=l(:label_contest_first_page)%></h4>
<p style="margin-left:60px;padding-right: 20px;">
@ -38,26 +31,7 @@
<label for='contest_description' style="vertical-align: top">&nbsp;&nbsp;&nbsp;<%= l(:label_site_description)%>:</label>
<%= text_area_tag 'contest_description',@contest_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<p style="margin-left:60px;padding-right: 20px;">
<label>&nbsp;&nbsp;&nbsp;<%= link_to l(:label_notification), '#',
:onclick => '$("#notification").slideToggle(400); ' %></label>
</p>
<div style="margin-left:60px;padding-right: 20px;" id="notification">
<label for='contest_notification_title'>&nbsp;&nbsp;&nbsp;<%= l(:label_contest_notification_title) %>:</label>
<p style="margin-left:70px;padding-right: 20px;">
<%= 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;" %>
</p>
<label for='contest_notification' style="vertical-align: top">&nbsp;&nbsp;&nbsp;<%= l(:label_contest_notification_content)%>:</label>
<%= text_area 'contest_notification', 'content', :value => @notification.content,:cols => 80, :rows => 15, :class => 'wiki-edit' %>
<%= wikitoolbar_for 'contest_notification_content' %>
<!-- <script src="/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
<p><#%= text_area 'contest_notification', 'content', :value => @notification.content,:required => true, :size => 80,:class => 'wiki-edit', id: 'editor01' %></p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script> -->
</div>
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% end %>
<div>

View File

@ -5,14 +5,7 @@
<label for='web_title'><%= l(:label_web_title) %>:</label>
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<div class="tabs">
<ul>
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %></li>
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'}, :class => 'selected' %></li>
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} %></li>
<li><%= link_to l(:label_web_footer_page),{:action => 'web_footer_made'} %></li>
</ul>
</div>
<%= render 'tab_partial' %>
<h4><%=l(:label_course_first_page)%></h4>
<p style="margin-left:60px;padding-right: 20px;">
<label for='attachments_fields'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_image) %>:</label>

View File

@ -5,14 +5,7 @@
<label for='web_title'><%= l(:label_web_title) %>:</label>
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<div class="tabs">
<ul>
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'}, :class => 'selected' %></li>
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %></li>
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} %></li>
<li><%= link_to l(:label_web_footer_page),{:action => 'web_footer_made'} %></li>
</ul>
</div>
<%= render 'tab_partial' %>
<h4><%=l(:label_project_first_page)%></h4>
<p style="margin-left:60px;padding-right: 20px;">
<label for='attachments_fields'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_image) %>:</label>

View File

@ -5,14 +5,7 @@
<label for='web_title'><%= l(:label_web_title) %>:</label>
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<div class="tabs">
<ul>
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %></li>
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %></li>
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'}%></li>
<li><%= link_to l(:label_web_footer_page),{:action => 'web_footer_made'} , :class => 'selected' %></li>
</ul>
</div>
<%= render 'tab_partial' %>
<div style="float:right"><%= link_to l(:label_cooperation_compnay), web_footer_companies_path %></div>
<h4><%=l(:label_web_footer_page)%></h4>

View File

@ -67,7 +67,6 @@
<td>
<table>
<tr>
<!-- modified by zjc 课程名称添加超链接 -->
<td class="info-course"><%= link_to @course.name,course_path(@course) %></td>
</tr>
<tr>
@ -80,9 +79,6 @@
<% else %>
<%= join_in_course(@course, User.current) %>
<% end %>
<%# unless User.current.member_of_course?(@course) %>
<!-- <%#= image_tag "/images/fav.png" %> -->
<%# end %>
<% end %>
</div>
</td>
@ -118,12 +114,10 @@
<td class="font_index"><%= link_to files_count, course_files_path(@course) %></td>
<tr class="font_aram">
<td align="center" width="80px" id="teacherCount">
<!-- %= l(:label_x_base_courses_member, :count => @course.members.count) % -->
<%= l(:label_x_base_courses_teacher, :count => teacherCount(@course)) %>
</td>
<td align="center" width="80px" id="studentCount">
<%= l(:label_x_base_courses_student, :count => studentCount(@course)) %>
<!-- %= l(:label_x_course_data, :count => files_count) % -->
</td>
<td align="center" width="80px">
<%= l(:label_x_course_data, :count => files_count) %>
@ -168,7 +162,6 @@
<% unless @course.teacher.user_extensions.nil? || @course.teacher.user_extensions.school.nil? %>
<tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_teacher_work_unit) %> :</td>
<!-- modified by zjc 教师单位添加超链接 -->
<td class="font_lighter_sidebar"><a href="http://course.trustie.net/?school_id=<%= @course.teacher.user_extensions.school.id%>"><%= @course.teacher.user_extensions.school %></a></td>
</tr>
<% else %>

View File

@ -4,25 +4,15 @@
<div class="box ph10_5">
<!--[form:message]-->
<% unless replying %>
<p>
<label for="message_subject">
<%= l(:field_subject) %>
<span class="required"> *&nbsp;&nbsp;</span>
</label>
<br/>
<%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :maxlength => 254 %><!--by young-->
</p>
<% else %>
<p>
<label for="message_subject">
<%= l(:field_subject) %>
<span class="required"> *&nbsp;&nbsp;</span>
</label>
<br/>
<%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :readonly => true %>
</p>
<% end %>
<% extra_option = replying ? { readonly: true} : { maxlength: 254 } %>
<p>
<label for="message_subject">
<%= l(:field_subject) %>
<span class="required"> *&nbsp;&nbsp;</span>
</label>
<br/>
<%= f.text_field :subject, { size: 60, style: "width: 99%;", id: "message_subject" }.merge(extra_option) %>
</p>
<p>
<% unless replying %>
<% if @message.safe_attribute? 'sticky' %>

View File

@ -141,7 +141,7 @@
<span class="font_lighter"> <%= format_time(comment.created_on) %></span>
</td>
<td width="200" align="right" class="a">
<%= 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) %>

View File

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