添加企业首页配置功能
This commit is contained in:
parent
79d1a069c2
commit
836be8c75e
|
@ -91,10 +91,6 @@ GEM
|
|||
descendants_tracker (0.0.4)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
diff-lcs (1.2.5)
|
||||
dnsruby (1.57.0)
|
||||
email_verifier (0.0.7)
|
||||
dnsruby (>= 1.5)
|
||||
rails (>= 3.0.0)
|
||||
equalizer (0.0.9)
|
||||
erubis (2.7.0)
|
||||
execjs (2.2.1)
|
||||
|
@ -170,7 +166,6 @@ GEM
|
|||
mysql2 (0.3.11-x86-mingw32)
|
||||
nenv (0.2.0)
|
||||
net-ldap (0.3.1)
|
||||
newrelic_rpm (3.9.9.275)
|
||||
nokogiri (1.6.3)
|
||||
mini_portile (= 0.6.0)
|
||||
nokogiri (1.6.3-x86-mingw32)
|
||||
|
@ -320,7 +315,6 @@ DEPENDENCIES
|
|||
capybara (~> 2.4.1)
|
||||
coderay (~> 1.0.6)
|
||||
coffee-rails (~> 3.2.1)
|
||||
email_verifier
|
||||
factory_girl (~> 4.4.0)
|
||||
faker
|
||||
fastercsv (~> 1.5.0)
|
||||
|
@ -336,7 +330,6 @@ DEPENDENCIES
|
|||
mocha (~> 1.1.0)
|
||||
mysql2 (= 0.3.11)
|
||||
net-ldap (~> 0.3.1)
|
||||
newrelic_rpm
|
||||
nokogiri (~> 1.6.3)
|
||||
paperclip (~> 3.5.4)
|
||||
rack-mini-profiler!
|
||||
|
|
|
@ -39,7 +39,7 @@ module Mobile
|
|||
mount Apis::Homeworks
|
||||
|
||||
#add_swagger_documentation ({api_version: 'v1', base_path: 'http://u06.shellinfo.cn/trustie/api'})
|
||||
#add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development?
|
||||
add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development?
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -283,4 +283,43 @@ class AdminController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#企业主页定制
|
||||
def enterprise_page_made
|
||||
@enterprise_page = FirstPage.find_by_page_type('enterprise')
|
||||
if @enterprise_page.nil?
|
||||
@enterprise_page = FirstPage.new
|
||||
@enterprise_page.page_type = 'enterprise'
|
||||
end
|
||||
if request.get?
|
||||
@first_page = FirstPage.find_by_page_type('project')
|
||||
elsif request.post?
|
||||
@first_page = FirstPage.find_by_page_type('project')
|
||||
@first_page.web_title = params[:web_title]
|
||||
@enterprise_page.web_title = params[:web_title]
|
||||
@enterprise_page.title = params[:course_title]
|
||||
@enterprise_page.image_width = params[:image_width]
|
||||
@enterprise_page.image_height = params[:image_height]
|
||||
@enterprise_page.description = params[:course_description]
|
||||
if @first_page.save && @enterprise_page.save
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to enterprise_page_made_url
|
||||
}
|
||||
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#{@enterprise_page.errors.full_messages[0]}"
|
||||
#flash.now[:error] = "#{l :label_first_page_create_fail}: #{@course_page.errors.full_messages[0]}"
|
||||
format.html {
|
||||
render :action => 'enterprise_page_made'
|
||||
}
|
||||
format.api { render_validation_errors(@first_page) }
|
||||
format.api { render_validation_errors(@enterprise_page) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -30,6 +30,11 @@ class WelcomeController < ApplicationController
|
|||
@organization = @cur_projects.enterprise_name
|
||||
@organization_projects = Project.find_by_sql(["select * from projects where enterprise_name =? ", @organization])
|
||||
@e_count = @organization_projects.count
|
||||
@enterprise_page = FirstPage.find_by_page_type('enterprise')
|
||||
if @enterprise_page.nil?
|
||||
@enterprise_page = FirstPage.new
|
||||
@enterprise_page.page_type = 'enterprise'
|
||||
end
|
||||
if @e_count < 9
|
||||
part_count = 9 - @e_count
|
||||
# @part_projects = find_all_hot_project part_count, order
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
<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>
|
||||
<li><%= link_to l(:label_enterprise_page_made), {:action => 'enterprise_page_made'}, class: "#{current_page?(enterprise_page_made_path)? 'selected' : nil }" %></li>
|
||||
</ul>
|
||||
</div>
|
|
@ -0,0 +1,39 @@
|
|||
<h3><%=l(:label_first_page_made)%></h3>
|
||||
|
||||
<%= form_tag(:controller => 'admin', :action => 'enterprise_page_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>
|
||||
<%= render 'tab_partial' %>
|
||||
<h4><%=l(:label_enterprise_page_made)%></h4>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='attachments_fields'> <%= l(:label_site_image) %>:</label>
|
||||
</p>
|
||||
<div style="margin-left: 82px;" id="avatar">
|
||||
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@enterprise_page} %>
|
||||
</div>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='image_width' style="vertical-align: top"> <%= l(:label_image_width)%>:</label>
|
||||
<%= text_field_tag 'image_width', params[:label_image_width],:value => @enterprise_page.image_width,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='image_height' style="vertical-align: top"> <%= l(:label_imgae_height)%>:</label>
|
||||
<%= text_field_tag 'image_height', params[:label_imgae_height], :value => @enterprise_page.image_height,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='course_title'> <%= l(:label_site_title) %>:</label>
|
||||
<%= text_field_tag 'course_title', params[:label_site_title], :value => @enterprise_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='course_description' style="vertical-align: top"> <%= l(:label_site_description)%>:</label>
|
||||
<%= text_area_tag 'course_description',@enterprise_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
|
||||
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
|
||||
<% end %>
|
||||
<div>
|
||||
|
||||
|
||||
|
||||
</div>
|
|
@ -38,7 +38,7 @@
|
|||
<%= image_tag '/images/transparent.png', width:@first_page.image_width,height: @first_page.image_height %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= image_tag '/images/avatars/Project/0', width:@first_page.image_width,height: @first_page.image_height %>
|
||||
<%= image_tag(url_to_avatar(@enterprise_page), width:@first_page.image_width,height: @first_page.image_height) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="welcome_left" id="welcome_left" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
|
||||
|
@ -52,7 +52,7 @@
|
|||
</span>
|
||||
<br/>
|
||||
<span class="font_welcome_trustie">
|
||||
<%= @first_page.title %>
|
||||
<%= @enterprise_page.title %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -2088,4 +2088,5 @@ en:
|
|||
label_anonymous_comments: Anonymous comments
|
||||
label_anonymous: Anonymous
|
||||
label_submit_comments: Submit_comments
|
||||
label_course_empty_select: You have not selected course!
|
||||
label_course_empty_select: You have not selected course!
|
||||
label_enterprise_page_made: enterprise_page
|
|
@ -536,6 +536,7 @@ zh:
|
|||
label_project_first_page: 项目托管平台首页
|
||||
label_course_first_page: 课程实践平台首页
|
||||
label_contest_first_page: 竞赛实战平台首页
|
||||
label_enterprise_page_made: 在线协同开发社区首页
|
||||
label_web_footer_page: 网站页脚配置
|
||||
label_organizer_name: 主办单位名称
|
||||
label_web_footer_description: 页脚内容
|
||||
|
|
|
@ -640,6 +640,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'admin/course_page_made', as: :course_page_made
|
||||
match 'admin/contest_page_made', as: :contest_page_made
|
||||
match 'admin/web_footer_made', as: :web_footer_made
|
||||
match 'admin/enterprise_page_made', as: :enterprise_page_made
|
||||
match 'admin/search', :via => [:get, :post]
|
||||
match 'admin/plugins', :via => :get
|
||||
match 'admin/info', :via => :get
|
||||
|
|
Loading…
Reference in New Issue