网站页脚配置功能

This commit is contained in:
z9hang 2014-10-13 17:38:59 +08:00
parent 0d6116d216
commit af59cef90b
14 changed files with 164 additions and 13 deletions

View File

@ -252,4 +252,39 @@ class AdminController < ApplicationController
end
end
def web_footer_made
if request.get?
@organizer = WebFooterOranizer.all.first
@first_page = FirstPage.where("page_type = 'project'").first
#@notification = ContestNotification.all.first;
elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first
@first_page.web_title = params[:web_title]
@organizer = WebFooterOranizer.all.first
if @organizer.nil?
@organizer = WebFooterOranizer.new
end
@organizer.name = params[:organizer_name]
@organizer.description = params[:web_footer_oranizer][:description]
if @first_page.save && @organizer.save
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to admin_web_footer_made_path
}
format.api { render_api_ok }
end
else
respond_to do |format|
flash.now[:error] = "#{l :label_first_page_create_fail}: #{@first_page.errors.full_messages[0]}\n\t#{@organizer.errors.full_messages[0]}}"
format.html {
render :action => 'web_footer_made'
}
format.api { render_validation_errors(@first_page) }
format.api { render_validation_errors(@contest_page) }
end
end
end
end
end

View File

@ -42,6 +42,7 @@ class ApplicationController < ActionController::Base
end
before_filter :find_first_page
before_filter :find_web_footer
before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization
before_filter :user_agent
@ -758,4 +759,9 @@ class ApplicationController < ActionController::Base
@show_course = @first_page.show_course
@show_contest = @first_page.show_contest
end
def find_web_footer
@organize = WebFooterOranizer.all.first
@companys = WebFooterCompany.all
end
end

View File

@ -10,6 +10,7 @@
<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>

View File

@ -10,6 +10,7 @@
<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>
<h4><%=l(:label_course_first_page)%></h4>

View File

@ -10,6 +10,7 @@
<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>
<h4><%=l(:label_project_first_page)%></h4>

View File

@ -0,0 +1,35 @@
<h3><%=l(:label_first_page_made)%></h3>
<%= form_tag(:controller => 'admin', :action => 'web_footer_made') do%>
<p style="margin-left:60px;padding-right: 20px;">
<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>
<div style="float:right"><%= link_to l(:label_cooperation_compnay), web_footer_companies_path %></div>
<h4><%=l(:label_web_footer_page)%></h4>
<p style="margin-left:60px;padding-right: 20px;">
<label for='organizer_name'>&nbsp;&nbsp;&nbsp;<%= l(:label_organizer_name) %>:</label>
<%= text_field_tag 'organizer_name', params[:label_organizer_name], :value => @organizer.nil? ? "":@organizer.name,:size => 30,:style => "font-size:small;width:497px;margin-left:80px;" %>
</p>
<p style="margin-left:60px;padding-right: 20px;">
<label for='web_footer_oranizer_description' style="vertical-align: top">&nbsp;&nbsp;&nbsp;<%= l(:label_web_footer_description)%>:</label>
<!-- <#%= text_area_tag 'description',@first_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> -->
<%= text_area 'web_footer_oranizer', 'description', :value => @organizer.nil? ? "" : @organizer.description,:cols => 80, :rows => 15, :class => 'wiki-edit' %>
<%= wikitoolbar_for 'web_footer_oranizer_description' %>
</p>
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% end %>
<div>
</div>

View File

@ -7,20 +7,12 @@
<!--gcm-->
<p>
<span><%=l(:label_organizers)%></span>
<span class="footer_text_link"><%= link_to l(:label_organizers_information),"http://www.nudt.edu.cn/ArticleShow.asp?ID=47",:target=>"_blank"%></span>
<span class="footer_text_link"><%= link_to l(:label_organizers_information_institute), "http://www.nudt.edu.cn/ArticleShow.asp?ID=41", :target => "_blank" %></span>
<span id="copyright"><%=l(:label_copyright)%>©2007~2014</span>
<span id="contact_us" class="footer_text_link"><%= link_to l(:label_contact_us),"http://" + Setting.host_name + "/projects/2/member", :target=>"_blank" %></span>
<span id="record"class="footer_text_link"><%= link_to l(:label_record),"http://www.miibeian.gov.cn/", :target => "_blank" %></span>
<%= @organize.description.html_safe%>
</p>
<div id="logo_link">
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/nudt.png',:size=>'100x30',:alt=>"国防科学技术大学计算机学院"),"http://www.nudt.edu.cn/special.asp?classid=12", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/peking_eecs.png',:size=>'100x30',:alt=>"北京大学信息科学技术学院软件研究所"), "http://eecs.pku.edu.cn", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/buaa_scse.png',:size=>'100x30',:alt=>"北京航空航天大学计算机学院"), "http://scse.buaa.edu.cn/", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/iscas.png',:size=>'100x30',:alt=>"中国科学院软件研究所"), "http://www.iscas.ac.cn", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/inforbus.png',:size=>'100x30',:alt=>"山东中创软件商用中间件股份有限公司"), "http://www.inforbus.com", :target => "_blank" %></span>
<% @companys.each do |company| %>
<span class="footer_logo_link"><%= link_to image_tag(url_to_avatar(company),:size=>"100x30",:alt=>company.name),company.url, :target => "_blank" %></span>
<% end %>
</div>
<!--gcm-->

View File

@ -0,0 +1,18 @@
<h3><%= link_to l(:label_cooperation_compnay), web_footer_companies_path %> &#187; <%=l(:label_edit_company)%></h3>
<%= labelled_form_for @company do |f| %>
<%= error_messages_for 'tracker' %>
<div>
<div class="box tabular">
<p><%= f.text_field :name, :required => true %></p>
<p><%= f.text_field :url, :required => true %></p>
<p>
<label for='attachments_fields'>&nbsp;&nbsp;&nbsp;<%= l(:label_upload_logo) %>:</label>
</p>
<div style="margin-left: 75px;" id="avatar">
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@company} %>
</div>
</div>
<%= submit_tag l(:button_save) %>
</div>
<% end %>

View File

@ -0,0 +1,11 @@
<div class="contextual"><%= link_to l(:label_new_company), new_web_footer_company_path,:class => "icon icon-add" %></div>
<h3><%=l(:label_web_footer_cooperation_compnay)%></h3>
<div id="logo_link">
<% @companys.each do |company| %>
<span class="footer_logo_link"><%= link_to image_tag(url_to_avatar(company),:size=>"100x30",:alt=>company.name),company.url, :target => "_blank" %></span>
<%= link_to l(:button_edit),edit_web_footer_company_path(company) %>
<%= delete_link web_footer_company_path(company) %>
<br/>
<% end %>
</div>

View File

@ -0,0 +1,13 @@
<h3><%= link_to l(:label_cooperation_compnay), web_footer_companies_path %> &#187; <%=l(:label_new_company)%></h3>
<%= labelled_form_for @company do |f| %>
<%= error_messages_for 'tracker' %>
<div>
<div class="box tabular">
<p><%= f.text_field :name, :required => true %></p>
<p><%= f.text_field :url, :required => true %></p>
</div>
<%= submit_tag l(:button_create) %>
</div>
<% end %>

View File

@ -295,6 +295,7 @@ en:
field_hide_mail: Hide my email address
field_comments: Comment
field_url: URL
field_logo_size: Logo Size
field_start_page: Start page
field_subproject: Subproject
field_hours: Hours
@ -520,6 +521,17 @@ en:
label_project_new: New project
label_project_plural: Projects
label_project_deposit: Projects
label_first_page_made: Homepage customization
label_project_first_page: Project hosting platform page
label_course_first_page: Practice teaching platform of home page
label_contest_first_page: The competition of combat platform page
label_web_footer_page: Site footer configuration
label_organizer_name: Organizer name
label_web_footer_description: The footer content
label_cooperation_compnay: The cooperation unit
label_web_footer_cooperation_compnay: Site footer cooperation unit
label_new_company: Add the cooperation unit
label_upload_logo: Upload logo
label_x_projects:
zero: no projects
one: 1 project

View File

@ -315,6 +315,7 @@ zh:
field_hide_mail: 隐藏我的邮件地址
field_comments: 注释
field_url: 路径
field_logo_size: logo大小
field_start_page: 起始页
field_subproject: 子项目
field_hours: 小时
@ -525,6 +526,14 @@ zh:
label_project_first_page: 项目托管平台首页
label_course_first_page: 课程实践平台首页
label_contest_first_page: 竞赛实战平台首页
label_web_footer_page: 网站页脚配置
label_organizer_name: 主办单位名称
label_web_footer_description: 页脚内容
label_cooperation_compnay: 合作单位
label_web_footer_cooperation_compnay: 网站页脚合作单位
label_new_company: 添加合作单位
label_edit_company: 编辑合作单位
label_upload_logo: 上传logo
label_x_projects:
zero: 无项目
one: 1 个项目

View File

@ -573,6 +573,7 @@ RedmineApp::Application.routes.draw do
match 'permissions', :via => [:get, :post]
end
end
resources :web_footer_companies, :only => [:index, :new, :edit, :create,:update,:destroy]
resources :enumerations, :except => :show
match 'enumerations/:type', :to => 'enumerations#index', :via => :get
@ -588,6 +589,7 @@ RedmineApp::Application.routes.draw do
match 'admin/first_page_made', :via => [:get,:post]
match 'admin/course_page_made', :via => [:get,:post]
match 'admin/contest_page_made', :via => [:get,:post]
match 'admin/web_footer_made', :via => [:get,:post]
match 'admin/search', :via => [:get, :post]
match 'admin/plugins', :via => :get
match 'admin/info', :via => :get

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20141009055029) do
ActiveRecord::Schema.define(:version => 20141013023400) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -1209,6 +1209,21 @@ ActiveRecord::Schema.define(:version => 20141009055029) do
add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id"
add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type"
create_table "web_footer_companies", :force => true do |t|
t.string "name"
t.string "logo_size"
t.string "url"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "web_footer_oranizers", :force => true do |t|
t.string "name"
t.text "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "wiki_content_versions", :force => true do |t|
t.integer "wiki_content_id", :null => false
t.integer "page_id", :null => false