Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_home
杨树林 5 years ago
commit 36d578c641

@ -19,6 +19,13 @@ class Admins::LaboratoryShixunsController < Admins::BaseController
render_ok
end
def destroy
return render_js_error('不能删除自建实训', type: :notify) if current_laboratory_shixun.ownership?
current_laboratory_shixun.destroy!
render_delete_success
end
def homepage
current_laboratory_shixun.update!(homepage: true)
render_ok

@ -21,6 +21,15 @@ class Admins::LaboratorySubjectsController < Admins::BaseController
render_ok
end
def destroy
return render_js_error('不能删除自建课程', type: :notify) if current_laboratory_subject.ownership?
current_laboratory_subject.destroy!
render_delete_success
end
def homepage
current_laboratory_subject.update!(homepage: true)
render_ok

@ -16,7 +16,7 @@ class Cooperative::BaseController < ApplicationController
private
def current_laboratory
@_current_laboratory ||= Laboratory.find_by_subdomain(request.subdomain)
@_current_laboratory ||= Laboratory.find_by_subdomain('hut' || request.subdomain)
end
def current_setting_or_default(name)

@ -15,6 +15,13 @@ class Cooperative::LaboratoryShixunsController < Cooperative::BaseController
end
def destroy
return render_js_error('不能删除自建实训', type: :notify) if current_laboratory_shixun.ownership?
current_laboratory_shixun.destroy!
render_delete_success
end
def homepage
current_laboratory_shixun.update!(homepage: true)
render_ok

@ -18,6 +18,13 @@ class Cooperative::LaboratorySubjectsController < Cooperative::BaseController
current_laboratory_subject.subject.update!(update_params)
end
def destroy
return render_js_error('不能删除自建实践课程', type: :notify) if current_laboratory_subject.ownership?
current_laboratory_subject.destroy!
render_delete_success
end
def homepage
current_laboratory_subject.update!(homepage: true)
render_ok

@ -25,4 +25,8 @@
<%= link_to('去修改', admins_shixun_settings_path(id: laboratory_shixun.shixun_id)) %>
<%= javascript_void_link('首页展示', class: 'action homepage-show-action', data: { id: laboratory_shixun.id }, style: laboratory_shixun.homepage? ? 'display:none' : '') %>
<%= javascript_void_link('取消首页展示', class: 'action homepage-hide-action', data: { id: laboratory_shixun.id }, style: laboratory_shixun.homepage? ? '' : 'display:none') %>
<% unless laboratory_shixun.ownership? %>
<%= delete_link '删除', admins_laboratory_laboratory_shixun_path(current_laboratory, laboratory_shixun, element: ".laboratory-shixun-item-#{laboratory_shixun.id}") %>
<% end %>
</td>

@ -36,6 +36,10 @@
<%= link_to('去修改', admins_subjects_path(id: laboratory_subject.subject_id)) %>
<%= javascript_void_link('首页展示', class: 'action homepage-show-action', data: { id: laboratory_subject.id }, style: laboratory_subject.homepage? ? 'display:none' : '') %>
<%= javascript_void_link('取消首页展示', class: 'action homepage-hide-action', data: { id: laboratory_subject.id }, style: laboratory_subject.homepage? ? '' : 'display:none') %>
<% unless laboratory_subject.ownership? %>
<%= delete_link '删除', admins_laboratory_laboratory_subject_path(current_laboratory, laboratory_subject, element: ".laboratory-subject-item-#{laboratory_subject.id}") %>
<% end %>
</td>
</tr>
<% end %>

@ -29,4 +29,8 @@
<% end %>
<%= javascript_void_link('首页展示', class: 'action homepage-show-action', data: { id: laboratory_shixun.id }, style: laboratory_shixun.homepage? ? 'display:none' : '') %>
<%= javascript_void_link('取消首页展示', class: 'action homepage-hide-action', data: { id: laboratory_shixun.id }, style: laboratory_shixun.homepage? ? '' : 'display:none') %>
<% unless laboratory_shixun.ownership? %>
<%= delete_link '删除', cooperative_laboratory_shixun_path(laboratory_shixun, element: ".laboratory-shixun-item-#{laboratory_shixun.id}") %>
<% end %>
</td>

@ -25,4 +25,8 @@
<%= javascript_void_link('首页展示', class: 'action homepage-show-action', data: { id: laboratory_subject.id }, style: laboratory_subject.homepage? ? 'display:none' : '') %>
<%= javascript_void_link('取消首页展示', class: 'action homepage-hide-action', data: { id: laboratory_subject.id }, style: laboratory_subject.homepage? ? '' : 'display:none') %>
<% unless laboratory_subject.ownership? %>
<%= delete_link '删除', cooperative_laboratory_subject_path(laboratory_subject, element: ".laboratory-subject-item-#{laboratory_subject.id}") %>
<% end %>
</td>

@ -3,11 +3,11 @@ json.images_url @images_url
json.reps @rep_list
json.shixuns do
json.partial! 'shixuns/shixun', locals: {shixuns: @shixuns.present? ? @shixuns : @main_shixuns}
json.partial! 'shixuns/shixun', locals: {shixuns: @shixuns}
end
json.subjects do
json.partial! 'subjects/subject', locals: {subjects: @subjects.present? ? @subjects : @main_subjects}
json.partial! 'subjects/subject', locals: {subjects: @subjects}
end
if current_laboratory.main_site?

@ -13,6 +13,7 @@ json.phone @user.phone
json.email @user.mail
json.profile_completed @user.profile_completed?
json.professional_certification @user.professional_certification
json.main_site current_laboratory.main_site?
if @course
json.course_identity @course_identity
json.course_name @course.name

@ -1049,13 +1049,13 @@ Rails.application.routes.draw do
post :drag, on: :collection
end
resources :laboratory_shixuns, only: [:index, :create] do
resources :laboratory_shixuns, only: [:index, :create, :destroy] do
member do
post :homepage
post :cancel_homepage
end
end
resources :laboratory_subjects, only: [:index, :create] do
resources :laboratory_subjects, only: [:index, :create, :destroy] do
member do
post :homepage
post :cancel_homepage
@ -1132,13 +1132,13 @@ Rails.application.routes.draw do
resources :carousels, only: [:index, :create, :update, :destroy] do
post :drag, on: :collection
end
resources :laboratory_shixuns, only: [:index, :edit, :update] do
resources :laboratory_shixuns, only: [:index, :edit, :update, :destroy] do
member do
post :homepage
post :cancel_homepage
end
end
resources :laboratory_subjects, only: [:index, :edit, :update] do
resources :laboratory_subjects, only: [:index, :edit, :update, :destroy] do
member do
post :homepage
post :cancel_homepage

Loading…
Cancel
Save