| @@ -0,0 +1,2 @@ | |||||
| // Place all the behaviors and hooks related to the matching controller here. | |||||
| // All this logic will automatically be available in application.js. | |||||
| @@ -0,0 +1,2 @@ | |||||
| // Place all the behaviors and hooks related to the matching controller here. | |||||
| // All this logic will automatically be available in application.js. | |||||
| @@ -0,0 +1,3 @@ | |||||
| // Place all the styles related to the admins/faqs controller here. | |||||
| // They will automatically be included in application.css. | |||||
| // You can use Sass (SCSS) here: http://sass-lang.com/ | |||||
| @@ -0,0 +1,3 @@ | |||||
| // Place all the styles related to the helps/faqs controller here. | |||||
| // They will automatically be included in application.css. | |||||
| // You can use Sass (SCSS) here: http://sass-lang.com/ | |||||
| @@ -0,0 +1,58 @@ | |||||
| class Admins::FaqsController < Admins::BaseController | |||||
| before_action :find_faq, only: [:edit,:update, :destroy] | |||||
| def index | |||||
| sort_by = params[:sort_by] ||= 'updated_at' | |||||
| sort_direction = params[:sort_direction] ||= 'desc' | |||||
| keyword = params[:keyword].to_s.strip | |||||
| collection = Faq.search_question(keyword).order("#{sort_by} #{sort_direction}") | |||||
| @faqs = paginate collection | |||||
| end | |||||
| def new | |||||
| @faq = Faq.new | |||||
| end | |||||
| def edit | |||||
| end | |||||
| def update | |||||
| begin | |||||
| @faq.update!(faq_params) | |||||
| flash[:success] = '修改成功' | |||||
| rescue Exception | |||||
| flash[:danger] = @faq.errors.full_messages.to_sentence | |||||
| end | |||||
| redirect_to admins_faqs_path | |||||
| end | |||||
| def destroy | |||||
| @faq.destroy | |||||
| redirect_to admins_faqs_path | |||||
| flash[:success] = "删除成功" | |||||
| end | |||||
| def create | |||||
| @faq = Faq.new(faq_params) | |||||
| begin | |||||
| @faq.save! | |||||
| flash[:success] = '创建成功' | |||||
| rescue Exception | |||||
| flash[:danger] = @faq.errors.full_messages.to_sentence | |||||
| end | |||||
| redirect_to admins_faqs_path | |||||
| end | |||||
| private | |||||
| def find_faq | |||||
| @faq = Faq.find params[:id] | |||||
| end | |||||
| def faq_params | |||||
| params.require(:faq).permit(:question, :url) | |||||
| end | |||||
| end | |||||
| @@ -2,7 +2,7 @@ module Acceleratorable | |||||
| extend ActiveSupport::Concern | extend ActiveSupport::Concern | ||||
| def enable_accelerator?(clone_addr) | def enable_accelerator?(clone_addr) | ||||
| clone_addr.include?(github_domain) || clone_addr.include?(gitlab_domain) | |||||
| is_foreign_url?(clone_addr) && config_accelerator? | |||||
| end | end | ||||
| def accelerator_url(repo_name) | def accelerator_url(repo_name) | ||||
| @@ -25,4 +25,12 @@ module Acceleratorable | |||||
| Gitea.gitea_config[:accelerator]["access_key_id"] | Gitea.gitea_config[:accelerator]["access_key_id"] | ||||
| end | end | ||||
| def config_accelerator? | |||||
| Gitea.gitea_config[:accelerator].present? | |||||
| end | |||||
| def is_foreign_url?(clone_addr) | |||||
| clone_addr.include?(github_domain) || clone_addr.include?(gitlab_domain) | |||||
| end | |||||
| end | end | ||||
| @@ -0,0 +1,8 @@ | |||||
| class Helps::FaqsController < ApplicationController | |||||
| skip_before_action :check_sign, :user_setup | |||||
| def index | |||||
| faqs = Faq.select_without_id.order(updated_at: :desc) | |||||
| render json: faqs.as_json(:except => [:id]) | |||||
| end | |||||
| end | |||||
| @@ -1,5 +1,5 @@ | |||||
| class Organizations::OrganizationsController < Organizations::BaseController | class Organizations::OrganizationsController < Organizations::BaseController | ||||
| before_action :require_login, except: [:index, :show] | |||||
| before_action :require_login, except: [:index, :show, :recommend] | |||||
| before_action :convert_image!, only: [:create, :update] | before_action :convert_image!, only: [:create, :update] | ||||
| before_action :load_organization, only: [:show, :update, :destroy] | before_action :load_organization, only: [:show, :update, :destroy] | ||||
| before_action :check_user_can_edit_org, only: [:update, :destroy] | before_action :check_user_can_edit_org, only: [:update, :destroy] | ||||
| @@ -62,6 +62,13 @@ class Organizations::OrganizationsController < Organizations::BaseController | |||||
| tip_exception(e.message) | tip_exception(e.message) | ||||
| end | end | ||||
| def recommend | |||||
| recommend = %W(xuos Huawei_Technology openatom_foundation pkecosystem TensorLayer) | |||||
| @organizations = Organization.with_visibility(%w(common)) | |||||
| .where(login: recommend).select(:id, :login, :firstname, :lastname, :nickname) | |||||
| end | |||||
| private | private | ||||
| def convert_image! | def convert_image! | ||||
| return unless params[:image].present? | return unless params[:image].present? | ||||
| @@ -106,19 +106,29 @@ class ProjectsController < ApplicationController | |||||
| def update | def update | ||||
| ActiveRecord::Base.transaction do | ActiveRecord::Base.transaction do | ||||
| Projects::UpdateForm.new(project_params).validate! | |||||
| private = params[:private] || false | |||||
| new_project_params = project_params.except(:private).merge(is_public: !private) | |||||
| @project.update_attributes!(new_project_params) | |||||
| gitea_params = { | |||||
| private: private, | |||||
| default_branch: @project.default_branch, | |||||
| website: @project.website | |||||
| } | |||||
| if [true, false].include? private | |||||
| Gitea::Repository::UpdateService.call(@owner, @project.identifier, gitea_params) | |||||
| @project.repository.update_column(:hidden, private) | |||||
| # TODO: | |||||
| # 临时特殊处理修改website、lesson_url操作方法 | |||||
| if project_params.has_key?("website") | |||||
| @project.update(project_params) | |||||
| else | |||||
| validate_params = project_params.slice(:name, :description, | |||||
| :project_category_id, :project_language_id, :private) | |||||
| Projects::UpdateForm.new(validate_params).validate! | |||||
| private = params[:private] || false | |||||
| new_project_params = project_params.except(:private).merge(is_public: !private) | |||||
| @project.update_attributes!(new_project_params) | |||||
| gitea_params = { | |||||
| private: private, | |||||
| default_branch: @project.default_branch, | |||||
| website: @project.website | |||||
| } | |||||
| if [true, false].include? private | |||||
| Gitea::Repository::UpdateService.call(@owner, @project.identifier, gitea_params) | |||||
| @project.repository.update_column(:hidden, private) | |||||
| end | |||||
| end | end | ||||
| end | end | ||||
| rescue Exception => e | rescue Exception => e | ||||
| @@ -167,7 +177,7 @@ class ProjectsController < ApplicationController | |||||
| end | end | ||||
| def recommend | def recommend | ||||
| @projects = Project.recommend.includes(:repository, :project_category, :owner).order(id: :desc).limit(5) | |||||
| @projects = Project.recommend.includes(:repository, :project_category, :owner).order(id: :desc) | |||||
| end | end | ||||
| def about | def about | ||||
| @@ -136,7 +136,8 @@ class PullRequestsController < ApplicationController | |||||
| def show | def show | ||||
| @issue_user = @issue.user | @issue_user = @issue.user | ||||
| @issue_assign_to = @issue.get_assign_user | @issue_assign_to = @issue.get_assign_user | ||||
| @gitea_pull = Gitea::PullRequest::GetService.call(@owner.login, | |||||
| @repository.identifier, @pull_request.gpid, current_user&.gitea_token) | |||||
| end | end | ||||
| def pr_merge | def pr_merge | ||||
| @@ -53,6 +53,18 @@ class RepositoriesController < ApplicationController | |||||
| @entries = Gitea::Repository::Entries::ListService.new(@owner, @project.identifier, ref: @ref).call | @entries = Gitea::Repository::Entries::ListService.new(@owner, @project.identifier, ref: @ref).call | ||||
| @entries = @entries.present? ? @entries.sort_by{ |hash| hash['type'] } : [] | @entries = @entries.present? ? @entries.sort_by{ |hash| hash['type'] } : [] | ||||
| @path = Gitea.gitea_config[:domain]+"/#{@project.owner.login}/#{@project.identifier}/raw/branch/#{@ref}/" | @path = Gitea.gitea_config[:domain]+"/#{@project.owner.login}/#{@project.identifier}/raw/branch/#{@ref}/" | ||||
| # TODO | |||||
| # 临时处理readme文件问题 | |||||
| admin = current_user.blank? ? User.where(admin: true).last : current_user | |||||
| result = Gitea::Repository::Readme::GetService.call(@owner.login, @project.identifier, @ref, admin&.gitea_token) | |||||
| @readme = | |||||
| if result[:status] == :success | |||||
| result[:body] | |||||
| else | |||||
| {} | |||||
| end | |||||
| end | end | ||||
| end | end | ||||
| @@ -0,0 +1,2 @@ | |||||
| module Admins::FaqsHelper | |||||
| end | |||||
| @@ -0,0 +1,2 @@ | |||||
| module Helps::FaqsHelper | |||||
| end | |||||
| @@ -47,6 +47,7 @@ | |||||
| # watchers_count :integer default("0") | # watchers_count :integer default("0") | ||||
| # devops_step :integer default("0") | # devops_step :integer default("0") | ||||
| # gitea_token :string(255) | # gitea_token :string(255) | ||||
| # platform :string(255) | |||||
| # | # | ||||
| # Indexes | # Indexes | ||||
| # | # | ||||
| @@ -0,0 +1,20 @@ | |||||
| # == Schema Information | |||||
| # | |||||
| # Table name: faqs | |||||
| # | |||||
| # id :integer not null, primary key | |||||
| # question :string(255) | |||||
| # url :string(255) | |||||
| # created_at :datetime not null | |||||
| # updated_at :datetime not null | |||||
| # | |||||
| class Faq < ApplicationRecord | |||||
| validates :question, presence: true,length: { maximum: 100, too_long: "最多%{count}个字符" } | |||||
| validates :url, format: { with: CustomRegexp::URL, multiline: true, message: "格式不正确" } | |||||
| scope :select_without_id, -> { select(:question, :url) } | |||||
| scope :search_question, ->(keyword) { where("question LIKE ?", "%#{keyword}%") unless keyword.blank?} | |||||
| end | |||||
| @@ -47,6 +47,7 @@ | |||||
| # watchers_count :integer default("0") | # watchers_count :integer default("0") | ||||
| # devops_step :integer default("0") | # devops_step :integer default("0") | ||||
| # gitea_token :string(255) | # gitea_token :string(255) | ||||
| # platform :string(255) | |||||
| # | # | ||||
| # Indexes | # Indexes | ||||
| # | # | ||||
| @@ -47,6 +47,7 @@ | |||||
| # watchers_count :integer default("0") | # watchers_count :integer default("0") | ||||
| # devops_step :integer default("0") | # devops_step :integer default("0") | ||||
| # gitea_token :string(255) | # gitea_token :string(255) | ||||
| # platform :string(255) | |||||
| # | # | ||||
| # Indexes | # Indexes | ||||
| # | # | ||||
| @@ -167,7 +168,8 @@ class User < Owner | |||||
| # Groups and active users | # Groups and active users | ||||
| scope :active, lambda { where(status: STATUS_ACTIVE) } | scope :active, lambda { where(status: STATUS_ACTIVE) } | ||||
| scope :like, lambda { |keywords| | scope :like, lambda { |keywords| | ||||
| where("LOWER(concat(lastname, firstname, login, mail)) LIKE ?", "%#{keywords.split(" ").join('|')}%") unless keywords.blank? | |||||
| sql = "CONCAT(lastname, firstname) LIKE :keyword OR login LIKE :keyword OR mail LIKE :keyword OR nickname LIKE :keyword" | |||||
| where(sql, :search => "%#{keywords.split(" ").join('|')}%") unless keywords.blank? | |||||
| } | } | ||||
| scope :simple_select, -> {select(:id, :login, :lastname,:firstname, :nickname, :gitea_uid, :type)} | scope :simple_select, -> {select(:id, :login, :lastname,:firstname, :nickname, :gitea_uid, :type)} | ||||
| @@ -1,15 +1,14 @@ | |||||
| # Get a pull request | # Get a pull request | ||||
| class Gitea::PullRequest::GetService < Gitea::ClientService | class Gitea::PullRequest::GetService < Gitea::ClientService | ||||
| attr_reader :user, :repo, :pull_request_id | |||||
| attr_reader :owner, :repo, :number, :token | |||||
| # user: 用户 | |||||
| # repo: 仓库名称/标识 | |||||
| # pull_request_id: pull request主键id | |||||
| def initialize(user, repo, pull_request_id) | |||||
| super({token: user.gitea_token}) | |||||
| @user = user | |||||
| #eq: | |||||
| # Gitea::PullRequest::GetService.call(user.login, repository.identifier, pull.gpid, user.gitea_token) | |||||
| def initialize(owner, repo, number, token=nil) | |||||
| @owner = owner | |||||
| @repo = repo | @repo = repo | ||||
| @pull_request_id = pull_request_id | |||||
| @number = number | |||||
| @token = token | |||||
| end | end | ||||
| def call | def call | ||||
| @@ -19,11 +18,11 @@ class Gitea::PullRequest::GetService < Gitea::ClientService | |||||
| private | private | ||||
| def params | def params | ||||
| Hash.new.merge(token: user.gitea_token) | |||||
| Hash.new.merge(token: token) | |||||
| end | end | ||||
| def url | def url | ||||
| "/repos/#{user.login}/#{repo}/pulls/#{pull_request_id}".freeze | |||||
| "/repos/#{owner}/#{repo}/pulls/#{number}".freeze | |||||
| end | end | ||||
| def render_result(response) | def render_result(response) | ||||
| @@ -31,7 +30,7 @@ class Gitea::PullRequest::GetService < Gitea::ClientService | |||||
| when 200 | when 200 | ||||
| JSON.parse(response.body) | JSON.parse(response.body) | ||||
| else | else | ||||
| nil | |||||
| {} | |||||
| end | end | ||||
| end | end | ||||
| end | end | ||||
| @@ -28,7 +28,7 @@ class Issues::ListQueryService < ApplicationService | |||||
| end | end | ||||
| if search_name.present? | if search_name.present? | ||||
| issues = issues.where("subject like ?", "%#{search_name}%") | |||||
| issues = issues.where("subject LIKE ? OR description LIKE ? ", "%#{search_name}%", "%#{search_name}%") | |||||
| end | end | ||||
| if start_time&.present? || end_time&.present? | if start_time&.present? || end_time&.present? | ||||
| @@ -21,9 +21,7 @@ class Repositories::MigrateService < ApplicationService | |||||
| private | private | ||||
| def repository_params | def repository_params | ||||
| params.merge(project_id: project.id, | |||||
| identifier: params[:identifier], | |||||
| source_clone_url: params[:source_clone_url]) | |||||
| params.merge(project_id: project.id) | |||||
| end | end | ||||
| def gitea_repository_params | def gitea_repository_params | ||||
| @@ -0,0 +1,24 @@ | |||||
| <div class="modal fade faq-change-modal" tabindex="-1" role="dialog" aria-hidden="true"> | |||||
| <div class="modal-dialog modal-dialog-centered" role="document"> | |||||
| <div class="modal-content"> | |||||
| <div class="modal-header"> | |||||
| <h5 class="modal-title"><%= type == "create" ? "新增" : "编辑" %></h5> | |||||
| <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | |||||
| <span aria-hidden="true">×</span> | |||||
| </button> | |||||
| </div> | |||||
| <%= form_for @faq, url: {controller: "faqs", action: "#{type}"} do |p| %> | |||||
| <div class="modal-body"> | |||||
| <%= p.text_field :question,class: "form-control input-lg",placeholder: "问题",required: true, maxlength: 100%> | |||||
| </div> | |||||
| <div class="modal-body"> | |||||
| <%= p.text_field :url,class: "form-control input-lg",placeholder: "链接",required: true, maxlength: 100%> | |||||
| </div> | |||||
| <div class="modal-footer"> | |||||
| <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button> | |||||
| <%= p.submit "确认", class: "btn btn-primary submit-btn" %> | |||||
| </div> | |||||
| <% end %> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| @@ -0,0 +1,33 @@ | |||||
| <table class="table table-hover text-center subject-list-table"> | |||||
| <thead class="thead-light"> | |||||
| <tr> | |||||
| <th width="5%">序号</th> | |||||
| <th width="20%">标题</th> | |||||
| <th width="30%">url</th> | |||||
| <th width="10%"><%= sort_tag('创建于', name: 'created_at', path: admins_faqs_path) %></th> | |||||
| <th width="10%"><%= sort_tag('更新于', name: 'updated_at', path: admins_faqs_path) %></th> | |||||
| <th width="25%">操作</th> | |||||
| </tr> | |||||
| </thead> | |||||
| <tbody> | |||||
| <% if faqs.present? %> | |||||
| <% faqs.each_with_index do |faq, index| %> | |||||
| <tr class="user-item-<%= faq.id %>"> | |||||
| <td><%= list_index_no((params[:page] || 1).to_i, index) %></td> | |||||
| <td><%= faq.question%></td> | |||||
| <td><%= link_to faq.url, target: '_blank' %></td> | |||||
| <td><%= display_text(faq.created_at&.strftime('%Y-%m-%d %H:%M')) %></td> | |||||
| <td><%= display_text(faq.updated_at&.strftime('%Y-%m-%d %H:%M')) %></td> | |||||
| <td class="action-container"> | |||||
| <%= link_to "编辑", edit_admins_faq_path(faq), remote: true, class: "action" %> | |||||
| <%= link_to "删除", admins_faqs_path(faq.id), method: :delete, data:{confirm: "确认删除的吗?"}, class: "delete-project-action" %> | |||||
| </td> | |||||
| </tr> | |||||
| <% end %> | |||||
| <% else %> | |||||
| <%= render 'admins/shared/no_data_for_table' %> | |||||
| <% end %> | |||||
| </tbody> | |||||
| </table> | |||||
| <%= render partial: 'admins/shared/paginate', locals: { objects: faqs } %> | |||||
| @@ -0,0 +1,2 @@ | |||||
| $("#faq-modals").html("<%= j render(partial: 'admins/faqs/form_modal', locals: {type: 'update'}) %>") | |||||
| $(".faq-change-modal").modal('show'); | |||||
| @@ -0,0 +1,17 @@ | |||||
| <% define_admin_breadcrumbs do %> | |||||
| <% add_admin_breadcrumb('FAQ', admins_faqs_path) %> | |||||
| <% end %> | |||||
| <div class="box search-form-container faq-list-form"> | |||||
| <%= form_tag(admins_faqs_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %> | |||||
| <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '输入标题搜素') %> | |||||
| <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> | |||||
| <% end %> | |||||
| <%= link_to "新增", new_admins_faq_path, remote: true, class: "btn btn-primary pull-right", "data-disabled-with":"...新增" %> | |||||
| </div> | |||||
| <div class="box admin-list-container faqs-list-container"> | |||||
| <%= render partial: 'admins/faqs/list', locals: { faqs: @faqs } %> | |||||
| </div> | |||||
| <div id="faq-modals"> | |||||
| </div> | |||||
| @@ -0,0 +1 @@ | |||||
| $('.faqs-list-container').html("<%= j( render partial: 'admins/faqs/list', locals: { faqs: @faqs } ) %>"); | |||||
| @@ -0,0 +1,2 @@ | |||||
| $("#faq-modals").html("<%= j render(partial: 'admins/faqs/form_modal', locals: {type: 'create'}) %>") | |||||
| $(".faq-change-modal").modal('show'); | |||||
| @@ -10,7 +10,6 @@ | |||||
| </td> | </td> | ||||
| <td> | <td> | ||||
| <% if school && school.identifier.present? %> | <% if school && school.identifier.present? %> | ||||
| <%= link_to school.identifier.to_s, statistics_college_path(school.identifier), target: '_blank' %> | |||||
| <% else %> | <% else %> | ||||
| -- | -- | ||||
| <% end %> | <% end %> | ||||
| @@ -38,6 +38,7 @@ | |||||
| <li><%= sidebar_item(admins_cooperatives_path, '合作伙伴', icon: 'handshake-o', controller: 'admins-cooperatives') %></li> | <li><%= sidebar_item(admins_cooperatives_path, '合作伙伴', icon: 'handshake-o', controller: 'admins-cooperatives') %></li> | ||||
| <li><%= sidebar_item(edit_admins_agreement_path, '服务协议', icon: 'file-text-o', controller: 'admins-agreements') %></li> | <li><%= sidebar_item(edit_admins_agreement_path, '服务协议', icon: 'file-text-o', controller: 'admins-agreements') %></li> | ||||
| <li><%= sidebar_item(edit_admins_help_center_path, '帮助中心', icon: 'question-circle-o', controller: 'admins-help_centers') %></li> | <li><%= sidebar_item(edit_admins_help_center_path, '帮助中心', icon: 'question-circle-o', controller: 'admins-help_centers') %></li> | ||||
| <li><%= sidebar_item(admins_faqs_path, 'FAQ', icon: 'question-circle', controller: 'admins-faqs') %></li> | |||||
| <% end %> | <% end %> | ||||
| </li> --> | </li> --> | ||||
| <li> | <li> | ||||
| @@ -0,0 +1,6 @@ | |||||
| json.organizations @organizations do |organization| | |||||
| json.id organization.id | |||||
| json.name organization.login | |||||
| json.nickname organization.nickname.blank? ? organization.name : organization.nickname | |||||
| json.avatar_url url_to_avatar(organization) | |||||
| end | |||||
| @@ -12,6 +12,8 @@ json.pull_request do | |||||
| json.pull_request_staus @pull_request.status == 1 ? "merged" : (@pull_request.status == 2 ? "closed" : "open") | json.pull_request_staus @pull_request.status == 1 ? "merged" : (@pull_request.status == 2 ? "closed" : "open") | ||||
| json.fork_project_user @pull_request&.fork_project&.owner.try(:login) | json.fork_project_user @pull_request&.fork_project&.owner.try(:login) | ||||
| json.create_user @pull_request&.user&.login | json.create_user @pull_request&.user&.login | ||||
| json.mergeable @gitea_pull["mergeable"] | |||||
| json.state @gitea_pull["state"] | |||||
| end | end | ||||
| json.issue do | json.issue do | ||||
| @@ -21,7 +21,7 @@ json.versions_count @project.versions_count #里程碑数量 | |||||
| json.version_releases_count @project.releases_size(@user.try(:id), "all") | json.version_releases_count @project.releases_size(@user.try(:id), "all") | ||||
| json.version_releasesed_count @project.releases_size(@user.try(:id), "released") #已发行的版本 | json.version_releasesed_count @project.releases_size(@user.try(:id), "released") #已发行的版本 | ||||
| json.permission render_permission(@user, @project) | json.permission render_permission(@user, @project) | ||||
| json.mirror_url @project&.repository.source_clone_url | |||||
| json.mirror_url @project&.repository.remote_mirror_url | |||||
| json.mirror @project&.repository.mirror_url.present? | json.mirror @project&.repository.mirror_url.present? | ||||
| json.type @project.numerical_for_project_type | json.type @project.numerical_for_project_type | ||||
| json.open_devops @project.open_devops? | json.open_devops @project.open_devops? | ||||
| @@ -59,4 +59,6 @@ if @project.forge? | |||||
| end | end | ||||
| end | end | ||||
| end | end | ||||
| json.readme @readme.merge(content: readme_render_decode64_content(@readme["content"], nil)) | |||||
| end | end | ||||
| @@ -130,6 +130,7 @@ Rails.application.routes.draw do | |||||
| get :search | get :search | ||||
| end | end | ||||
| end | end | ||||
| get :recommend, on: :collection | |||||
| end | end | ||||
| end | end | ||||
| @@ -603,6 +604,10 @@ Rails.application.routes.draw do | |||||
| end | end | ||||
| end | end | ||||
| # Project Area END | # Project Area END | ||||
| scope module: :helps do | |||||
| resources :faqs, only: [:index] | |||||
| end | |||||
| end | end | ||||
| namespace :admins do | namespace :admins do | ||||
| @@ -779,6 +784,7 @@ Rails.application.routes.draw do | |||||
| post :drag, on: :collection | post :drag, on: :collection | ||||
| post :replace_image_url, on: :member | post :replace_image_url, on: :member | ||||
| end | end | ||||
| resources :faqs | |||||
| resources :laboratories, only: [:index, :create, :destroy, :update] do | resources :laboratories, only: [:index, :create, :destroy, :update] do | ||||
| member do | member do | ||||
| get :shixuns_for_select | get :shixuns_for_select | ||||
| @@ -0,0 +1,10 @@ | |||||
| class CreateFaqs < ActiveRecord::Migration[5.2] | |||||
| def change | |||||
| create_table :faqs do |t| | |||||
| t.string :question | |||||
| t.string :url | |||||
| t.timestamps | |||||
| end | |||||
| end | |||||
| end | |||||