Merge branch 'szzh' into develop
This commit is contained in:
commit
3ffbf4179e
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the WebFooterCompany controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -760,4 +761,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
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
class WebFooterCompaniesController < ApplicationController
|
||||
layout 'admin'
|
||||
menu_item :projects, :only => :projects
|
||||
menu_item :plugins, :only => :plugins
|
||||
menu_item :info, :only => :info
|
||||
before_filter :require_admin
|
||||
|
||||
def index
|
||||
@companys = WebFooterCompany.all
|
||||
end
|
||||
|
||||
def new
|
||||
@company = WebFooterCompany.new
|
||||
end
|
||||
|
||||
def create
|
||||
@company = WebFooterCompany.new(params[:web_footer_company])
|
||||
if @company.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to web_footer_companies_path
|
||||
else
|
||||
flash[:error] = "#{l :web_footer_company_create_fail}: #{@company.errors.full_messages[0]}"
|
||||
new
|
||||
render :action => 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@company = WebFooterCompany.find(params[:id])
|
||||
@company.destroy
|
||||
redirect_to web_footer_companies_path
|
||||
end
|
||||
|
||||
def edit
|
||||
@company = WebFooterCompany.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@company = WebFooterCompany.find(params[:id])
|
||||
if @company.update_attributes(params[:web_footer_company])
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to web_footer_companies_path
|
||||
else
|
||||
flash[:error] = "#{l :web_footer_company_update_fail}: #{@company.errors.full_messages[0]}"
|
||||
edit
|
||||
render :action => 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
module WebFooterCompaniesHelper
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class WebFooterCompany < ActiveRecord::Base
|
||||
attr_accessible :logo_size, :name, :url
|
||||
validates_presence_of :name,:url
|
||||
validates_length_of :name,:url, :maximum => 255
|
||||
validates_format_of :url,:with => /(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?/,:message => l(:is_not_url_error)
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class WebFooterOranizer < ActiveRecord::Base
|
||||
attr_accessible :description, :name
|
||||
end
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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'> <%= 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"> <%= 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>
|
|
@ -72,4 +72,4 @@
|
|||
<%= render :partial => 'show_all_attachment' %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_attachment_plural)) -%>
|
||||
<% html_title(l(:project_module_files)) -%>
|
|
@ -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 unless @organize.nil?%>
|
||||
</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-->
|
||||
|
||||
|
|
|
@ -38,3 +38,4 @@
|
|||
<%= l(:label_no_data) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% html_title(l(:label_member)) -%>
|
|
@ -111,3 +111,4 @@ function checkMaxLength() {
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% html_title(l(:label_project_tool_response)) -%>
|
|
@ -13,3 +13,5 @@
|
|||
<%#= submit_tag l(:button_create_and_continue), :name => 'continue' %>
|
||||
<%= javascript_tag "$('#project_name').focus();" %>
|
||||
<% end %>
|
||||
|
||||
<% html_title(l(:label_project_new)) -%>
|
|
@ -100,5 +100,5 @@
|
|||
<%= pagination_links_full @events_pages %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_overview)) -%>
|
||||
|
||||
|
|
|
@ -31,3 +31,4 @@
|
|||
</table></li></ul>
|
||||
<% end %>
|
||||
</div>
|
||||
<% html_title(l(:label_followers)) -%>
|
|
@ -0,0 +1,19 @@
|
|||
<h3><%= link_to l(:label_cooperation_compnay), web_footer_companies_path %> » <%=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><%= l(:label_url_prompt) %></p>
|
||||
<p>
|
||||
<label for='attachments_fields'> <%= 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 %>
|
|
@ -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) %>
|
||||
<hr/>
|
||||
<% end %>
|
||||
</div>
|
|
@ -0,0 +1,13 @@
|
|||
<h3><%= link_to l(:label_cooperation_compnay), web_footer_companies_path %> » <%=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>
|
||||
<p><%= l(:label_url_prompt) %></p>
|
||||
</div>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
</div>
|
||||
<% end %>
|
|
@ -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,22 @@ 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_url_prompt: Web site needs to http or https at the beginning, for example 'http://forge.trustie.net'
|
||||
web_footer_company_create_fail: The cooperation unit creation failed
|
||||
web_footer_company_update_fail: The cooperation unit update failed
|
||||
is_not_url_error: Is not a valid URL
|
||||
|
||||
label_x_projects:
|
||||
zero: no projects
|
||||
one: 1 project
|
||||
|
|
|
@ -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,18 @@ 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_url_prompt: 网址需以"http://"或"https://"开头,例:http://forge.trustie.net
|
||||
web_footer_company_create_fail: 合作单位创建失败
|
||||
web_footer_company_update_fail: 合作单位更新失败
|
||||
is_not_url_error: 不是正确的url
|
||||
label_x_projects:
|
||||
zero: 无项目
|
||||
one: 1 个项目
|
||||
|
|
|
@ -580,6 +580,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
|
||||
|
||||
|
@ -595,6 +596,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
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
class CreateWebFooterOranizers < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :web_footer_oranizers do |t|
|
||||
t.string :name
|
||||
t.text :description
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class CreateWebFooterCompanies < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :web_footer_companies do |t|
|
||||
t.string :name
|
||||
t.string :logo_size
|
||||
t.string :url
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
17
db/schema.rb
17
db/schema.rb
|
@ -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
|
||||
|
|
|
@ -108,3 +108,4 @@ function change_option(flag) {
|
|||
<%= stylesheet_link_tag "code_review.css", :plugin => "redmine_code_review", :media => "screen" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% html_title(l(:code_reviews)) -%>
|
|
@ -0,0 +1,11 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
logo_size: MyString
|
||||
url: MyString
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
logo_size: MyString
|
||||
url: MyString
|
|
@ -0,0 +1,9 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
description: MyText
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
description: MyText
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class WebFooterCompaniesControllerTest < ActionController::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
require 'test_helper'
|
||||
|
||||
class WebFooterCompaniesHelperTest < ActionView::TestCase
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class WebFooterCompanyTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class WebFooterOranizerTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
Reference in New Issue