ADD trustie home edit
This commit is contained in:
parent
33cc2f2b15
commit
36a11d9690
|
@ -527,6 +527,27 @@ class AdminController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def home
|
||||||
|
if request.get?
|
||||||
|
@home = Home.first
|
||||||
|
elsif request.post?
|
||||||
|
@home = Home.first || Home.new
|
||||||
|
@home.name = params[:home][:name]
|
||||||
|
@home.content = params[:home][:content]
|
||||||
|
if @home.save
|
||||||
|
respond_to do |format|
|
||||||
|
flash[:notice] = l(:notice_successful_update)
|
||||||
|
format.html { redirect_to admin_home_path }
|
||||||
|
end
|
||||||
|
else
|
||||||
|
respond_to do |format|
|
||||||
|
flash.now[:error] = "#{l :label_first_page_create_fail}: #{@home.errors.full_messages[0]}"
|
||||||
|
format.html { render :action => 'home' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def course_page_made
|
def course_page_made
|
||||||
if request.get?
|
if request.get?
|
||||||
@course_page = FirstPage.find_by_page_type('course')
|
@course_page = FirstPage.find_by_page_type('course')
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
module HomesHelper
|
module HomesHelper
|
||||||
|
|
||||||
def home_cover_tag(home)
|
def home_cover_tag(home)
|
||||||
file_path = home&.cover&.file.nil? ? "/images/introduce/activeBanner.jpg": local_path(home.cover.file)
|
file_path =
|
||||||
|
if File.exists?(Rails.root.join('/public/images', url_to_avatar(home)))
|
||||||
|
url_to_avatar(home)
|
||||||
|
else
|
||||||
|
"/images/introduce/activeBanner.jpg"
|
||||||
|
end
|
||||||
image_tag(file_path, class: 'mb30', width: '592px')
|
image_tag(file_path, class: 'mb30', width: '592px')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<h3>trustie首页</h3>
|
||||||
|
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><%= link_to "首页定制", admin_home_path, class: "#{current_page?(admin_home_path)? 'selected' : nil }" %></li>
|
||||||
|
<li><%= link_to "动态新闻", admin_dynamic_news_path, class: "#{current_page?(admin_dynamic_news_path)? 'selected' : nil }" %></li>
|
||||||
|
<li><%= link_to "开源生态", web_footer_companies_path, class: "#{current_page?(web_footer_companies_path)? 'selected' : nil }" %></li>
|
||||||
|
</div>
|
||||||
|
<%= form_tag(:controller => 'admin', :action => 'home') do %>
|
||||||
|
<h4>首页定制</h4>
|
||||||
|
<p style="margin-left:60px;padding-right: 20px;">
|
||||||
|
<label for='attachments_fields'> 封面:</label>
|
||||||
|
</p>
|
||||||
|
<div style="margin-left: 82px;" id="avatar">
|
||||||
|
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source: @home} %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p style="margin-left:60px;padding-right: 20px;">
|
||||||
|
<label for='image_height' style="vertical-align: top"> 标题:</label>
|
||||||
|
<%= text_field_tag 'home[name]', params[:name], :value => @home&.name, :style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p style="margin-left:60px;padding-right: 20px;">
|
||||||
|
<label for='content' style="vertical-align: top"> 介绍:</label>
|
||||||
|
<!-- <#%= text_area_tag 'content',@first_page.content,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> -->
|
||||||
|
<%= text_area 'home', 'content', :value => @home.content,:cols => 80, :rows => 15, :class => 'wiki-edit' %>
|
||||||
|
<%= wikitoolbar_for 'home_content' %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
|
||||||
|
<% end %>
|
|
@ -2204,6 +2204,7 @@ zh:
|
||||||
# 动态消息
|
# 动态消息
|
||||||
label_dynamic_new: 新建动态新闻
|
label_dynamic_new: 新建动态新闻
|
||||||
label_dynamic_new_plural: 首页动态新闻列表
|
label_dynamic_new_plural: 首页动态新闻列表
|
||||||
|
label_trustie_home: trustie首页
|
||||||
label_dynamic_new_title: 标题
|
label_dynamic_new_title: 标题
|
||||||
label_dynamic_new_synopsis: 简介
|
label_dynamic_new_synopsis: 简介
|
||||||
label_new_dynamic_new: '动态新闻'
|
label_new_dynamic_new: '动态新闻'
|
||||||
|
|
|
@ -1380,6 +1380,7 @@ RedmineApp::Application.routes.draw do
|
||||||
post 'admin/select_course_syllabus'
|
post 'admin/select_course_syllabus'
|
||||||
post 'admin/create_syllabus'
|
post 'admin/create_syllabus'
|
||||||
match 'admin/dynamic_news', :via => [:get, :post]
|
match 'admin/dynamic_news', :via => [:get, :post]
|
||||||
|
match 'admin/home', :via => [:get, :post]
|
||||||
|
|
||||||
resources :auth_sources do
|
resources :auth_sources do
|
||||||
member do
|
member do
|
||||||
|
|
|
@ -376,6 +376,7 @@ Redmine::MenuManager.map :homework_menu do |menu|
|
||||||
end
|
end
|
||||||
########end
|
########end
|
||||||
Redmine::MenuManager.map :admin_menu do |menu|
|
Redmine::MenuManager.map :admin_menu do |menu|
|
||||||
|
menu.push :home, {:controller => 'admin',:action => 'home'}, :caption => :label_trustie_home
|
||||||
menu.push :organization, {:controller => 'admin', :action => 'organization'}, :caption => :label_organization_list
|
menu.push :organization, {:controller => 'admin', :action => 'organization'}, :caption => :label_organization_list
|
||||||
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
|
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
|
||||||
menu.push :syllabuses, {:controller => 'admin', :action => 'syllabuses'}, :caption => :label_course_all
|
menu.push :syllabuses, {:controller => 'admin', :action => 'syllabuses'}, :caption => :label_course_all
|
||||||
|
@ -387,7 +388,6 @@ Redmine::MenuManager.map :admin_menu do |menu|
|
||||||
menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural
|
menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural
|
||||||
menu.push :applied_schools, {:controller => 'admin', :action => 'applied_schools'}, :caption => :label_applied_shcools
|
menu.push :applied_schools, {:controller => 'admin', :action => 'applied_schools'}, :caption => :label_applied_shcools
|
||||||
menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made
|
menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made
|
||||||
menu.push :dynamic_news, {:controller => 'admin',:action => 'dynamic_news'},:caption => :label_dynamic_new_plural
|
|
||||||
menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version
|
menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version
|
||||||
menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural
|
menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural
|
||||||
menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions
|
menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions
|
||||||
|
|
Loading…
Reference in New Issue