实训项目上传banner问题

mast_item_banktwo
daiao 5 years ago
parent 31165027ed
commit 4205e7d4cf

@ -16,7 +16,7 @@ class Admins::LaboratorySettingsController < Admins::BaseController
def form_params
params.permit(:identifier, :name,
:nav_logo, :login_logo, :tab_logo, :oj_banner,
:nav_logo, :login_logo, :tab_logo, :oj_banner, :shixun_banner,
:subject_banner, :course_banner, :competition_banner, :moop_cases_banner,
:footer, navbar: %i[name link hidden])
end

@ -30,6 +30,10 @@ class LaboratorySetting < ApplicationRecord
image_url('_subject_banner')
end
def shixun_banner_url
image_url('_shixun_banner')
end
def course_banner_url
image_url('_course_banner')
end
@ -62,7 +66,7 @@ class LaboratorySetting < ApplicationRecord
name: nil,
navbar: [
{ 'name' => '实践课程', 'link' => '/paths', 'hidden' => false },
{ 'name' => '翻转课堂', 'link' => '/courses', 'hidden' => false },
{ 'name' => '教学课堂', 'link' => '/courses', 'hidden' => false },
{ 'name' => '实训项目', 'link' => '/shixuns', 'hidden' => false },
{ 'name' => '在线竞赛', 'link' => '/competitions', 'hidden' => false },
{ 'name' => '教学案例', 'link' => '/moop_cases', 'hidden' => false },

@ -40,6 +40,7 @@ class Admins::SaveLaboratorySettingService < ApplicationService
save_image_file(params[:login_logo], 'login')
save_image_file(params[:tab_logo], 'tab')
save_image_file(params[:subject_banner], '_subject_banner')
save_image_file(params[:shixun_banner], '_shixun_banner')
save_image_file(params[:course_banner], '_course_banner')
save_image_file(params[:competition_banner], '_competition_banner')
save_image_file(params[:moop_cases_banner], '_moop_cases_banner')

@ -100,9 +100,19 @@
</div>
</div>
<div class="col-12 col-md-4 banner-item">
<%- shixun_banner = setting.shixun_banner_url -%>
<div class="banner-item-top">实训项目</div>
<div class="banner-item-bottom <%= shixun_banner ? 'has-img' : '' %>">
<img class="banner-item-img shixun-banner-img" src="<%= shixun_banner %>" style="<%= subject_banner.present? ? '' : 'display: none' %>"/>
<%= file_field_tag(:shixun_banner, accept: 'image/*', style: 'display: none', value: params[:shixun_banner]) %>
<label for="shixun_banner" class="banner-item-upload" data-toggle="tooltip" data-title="选择图片"></label>
</div>
</div>
<div class="col-12 col-md-4 banner-item">
<%- course_banner = setting.course_banner_url -%>
<div class="banner-item-top">翻转课堂</div>
<div class="banner-item-top">教学课堂</div>
<div class="banner-item-bottom <%= course_banner ? 'has-img' : '' %>">
<img class="banner-item-img course-banner-img" src="<%= course_banner %>" style="<%= course_banner.present? ? '' : 'display: none' %>"/>
<%= file_field_tag(:course_banner, accept: 'image/*', style: 'display: none', value: params[:course_banner]) %>

@ -10,7 +10,7 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item"><a class="nav-link" href="/paths">实践课程</a></li>
<li class="nav-item"><a class="nav-link" href="/courses">翻转课堂</a></li>
<li class="nav-item"><a class="nav-link" href="/courses">教学课堂</a></li>
<li class="nav-item"><a class="nav-link" href="/shixuns">实训项目</a></li>
<li class="nav-item"><a class="nav-link" href="/competitions">在线竞赛</a></li>
<li class="nav-item"><a class="nav-link" href="/moop_cases">教学案例</a></li>

@ -101,7 +101,7 @@
<div class="col-12 col-md-4 banner-item">
<%- course_banner = setting.course_banner_url -%>
<div class="banner-item-top">翻转课堂</div>
<div class="banner-item-top">教学课堂</div>
<div class="banner-item-bottom <%= course_banner ? 'has-img' : '' %>">
<img class="banner-item-img course-banner-img" src="<%= course_banner %>" style="<%= course_banner.present? ? '' : 'display: none' %>"/>
<%= file_field_tag(:course_banner, accept: 'image/*', style: 'display: none', value: params[:course_banner]) %>

Loading…
Cancel
Save