Merge branch 'develop' into standalone_develop
This commit is contained in:
commit
a494a905fa
|
@ -1,6 +1,6 @@
|
||||||
class Admins::ProjectIgnoresController < Admins::BaseController
|
class Admins::ProjectIgnoresController < Admins::BaseController
|
||||||
before_action :set_ignore, only: [:edit,:update, :destroy,:show]
|
before_action :set_ignore, only: [:edit,:update, :destroy,:show]
|
||||||
before_action :validate_params, only: [:create, :update]
|
# before_action :validate_params, only: [:create, :update]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
sort_by = Ignore.column_names.include?(params[:sort_by]) ? params[:sort_by] : 'created_at'
|
sort_by = Ignore.column_names.include?(params[:sort_by]) ? params[:sort_by] : 'created_at'
|
||||||
|
@ -31,12 +31,12 @@ class Admins::ProjectIgnoresController < Admins::BaseController
|
||||||
# }
|
# }
|
||||||
@project_ignore = Ignore.new(ignore_params)
|
@project_ignore = Ignore.new(ignore_params)
|
||||||
|
|
||||||
if @project_ignore.save!
|
if @project_ignore.save
|
||||||
redirect_to admins_project_ignores_path
|
redirect_to admins_project_ignores_path
|
||||||
flash[:success] = "创建成功"
|
flash[:success] = "创建成功"
|
||||||
else
|
else
|
||||||
render :new
|
redirect_to admins_project_ignores_path
|
||||||
flash[:danger] = "创建失败"
|
flash[:danger] = @project_ignore.errors.full_messages.join(",")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ class Admins::ProjectIgnoresController < Admins::BaseController
|
||||||
redirect_to admins_project_ignores_path
|
redirect_to admins_project_ignores_path
|
||||||
flash[:success] = "更新成功"
|
flash[:success] = "更新成功"
|
||||||
else
|
else
|
||||||
render :edit
|
redirect_to admins_project_ignores_path
|
||||||
flash[:danger] = "更新失败"
|
flash[:danger] = @project_ignore.errors.full_messages.join(",")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -98,23 +98,23 @@ class Admins::ProjectIgnoresController < Admins::BaseController
|
||||||
params.require(:ignore).permit(:name,:content)
|
params.require(:ignore).permit(:name,:content)
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_params
|
# def validate_params
|
||||||
name = params[:ignore][:name]
|
# name = params[:ignore][:name]
|
||||||
if name.blank?
|
# if name.blank?
|
||||||
flash[:danger] = "名称不允许为空"
|
# flash[:danger] = "名称不允许为空"
|
||||||
redirect_to admins_project_ignores_path
|
# redirect_to admins_project_ignores_path
|
||||||
elsif check_ignore_present?(name) && @project_ignore.blank?
|
# elsif check_ignore_present?(name) && @project_ignore.blank?
|
||||||
flash[:danger] = "创建失败:名称已存在"
|
# flash[:danger] = "创建失败:名称已存在"
|
||||||
redirect_to admins_project_ignores_path
|
# redirect_to admins_project_ignores_path
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
|
|
||||||
def check_ignore_present?(name)
|
# def check_ignore_present?(name)
|
||||||
return true if name.blank?
|
# return true if name.blank?
|
||||||
name_downcase = name.downcase
|
# name_downcase = name.downcase
|
||||||
name_upcase = name.upcase
|
# name_upcase = name.upcase
|
||||||
name_first_big = name.capitalize
|
# name_first_big = name.capitalize
|
||||||
Ignore.exists?(name: name_downcase) || Ignore.exists?(name: name_upcase) || Ignore.exists?(name: name_first_big)
|
# Ignore.exists?(name: name_downcase) || Ignore.exists?(name: name_upcase) || Ignore.exists?(name: name_first_big)
|
||||||
end
|
# end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,17 +27,18 @@ class Admins::ProjectLanguagesController < Admins::BaseController
|
||||||
flash[:success] = '创建成功'
|
flash[:success] = '创建成功'
|
||||||
else
|
else
|
||||||
redirect_to admins_project_languages_path
|
redirect_to admins_project_languages_path
|
||||||
flash[:danger] = '创建失败'
|
flash[:danger] = @project_language.errors.full_messages.join(",")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @project_language.update_attribute(:name, @name)
|
@project_language.attributes = {name: @name}
|
||||||
|
if @project_language.save
|
||||||
redirect_to admins_project_languages_path
|
redirect_to admins_project_languages_path
|
||||||
flash[:success] = '更新成功'
|
flash[:success] = '更新成功'
|
||||||
else
|
else
|
||||||
redirect_to admins_project_languages_path
|
redirect_to admins_project_languages_path
|
||||||
flash[:success] = '更新失败'
|
flash[:danger] = @project_language.errors.full_messages.join(",")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class Admins::ProjectLicensesController < Admins::BaseController
|
class Admins::ProjectLicensesController < Admins::BaseController
|
||||||
before_action :set_license, only: [:edit,:update, :destroy,:show]
|
before_action :set_license, only: [:edit,:update, :destroy,:show]
|
||||||
before_action :validate_params, only: [:create, :update]
|
# before_action :validate_params, only: [:create, :update]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
sort_by = License.column_names.include?(params[:sort_by]) ? params[:sort_by] : 'created_at'
|
sort_by = License.column_names.include?(params[:sort_by]) ? params[:sort_by] : 'created_at'
|
||||||
|
@ -30,13 +30,12 @@ class Admins::ProjectLicensesController < Admins::BaseController
|
||||||
# position: max_position
|
# position: max_position
|
||||||
# }
|
# }
|
||||||
@project_license = License.new(license_params)
|
@project_license = License.new(license_params)
|
||||||
|
if @project_license.save
|
||||||
if @project_license.save!
|
|
||||||
redirect_to admins_project_licenses_path
|
redirect_to admins_project_licenses_path
|
||||||
flash[:success] = "创建成功"
|
flash[:success] = "创建成功"
|
||||||
else
|
else
|
||||||
render :new
|
redirect_to admins_project_licenses_path
|
||||||
flash[:danger] = "创建失败"
|
flash[:danger] = @project_license.errors.full_messages.join(",")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,12 +53,13 @@ class Admins::ProjectLicensesController < Admins::BaseController
|
||||||
# permissions: permissions.to_s,
|
# permissions: permissions.to_s,
|
||||||
# limitations: limitations.to_s
|
# limitations: limitations.to_s
|
||||||
# }
|
# }
|
||||||
if @project_license.update_attributes(license_params)
|
@project_license.attributes = license_params
|
||||||
|
if @project_license.save
|
||||||
redirect_to admins_project_licenses_path
|
redirect_to admins_project_licenses_path
|
||||||
flash[:success] = "更新成功"
|
flash[:success] = "更新成功"
|
||||||
else
|
else
|
||||||
render :edit
|
render admins_project_licenses_path
|
||||||
flash[:danger] = "更新失败"
|
flash[:danger] = @project_license.errors.full_messages.join(",")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -98,23 +98,23 @@ class Admins::ProjectLicensesController < Admins::BaseController
|
||||||
params.require(:license).permit(:name,:content)
|
params.require(:license).permit(:name,:content)
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_params
|
# def validate_params
|
||||||
name = params[:license][:name]
|
# name = params[:license][:name]
|
||||||
if name.blank?
|
# if name.blank?
|
||||||
flash[:danger] = "名称不允许为空"
|
# flash[:danger] = "名称不允许为空"
|
||||||
redirect_to admins_project_licenses_path
|
# redirect_to admins_project_licenses_path
|
||||||
elsif check_license_present?(name) && @project_license.blank?
|
# elsif check_license_present?(name) && @project_license.blank?
|
||||||
flash[:danger] = "创建失败:名称已存在"
|
# flash[:danger] = "创建失败:名称已存在"
|
||||||
redirect_to admins_project_licenses_path
|
# redirect_to admins_project_licenses_path
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
|
|
||||||
def check_license_present?(name)
|
# def check_license_present?(name)
|
||||||
return true if name.blank?
|
# return true if name.blank?
|
||||||
name_downcase = name.downcase
|
# name_downcase = name.downcase
|
||||||
name_upcase = name.upcase
|
# name_upcase = name.upcase
|
||||||
name_first_big = name.capitalize
|
# name_first_big = name.capitalize
|
||||||
License.exists?(name: name_downcase) || License.exists?(name: name_upcase) || License.exists?(name: name_first_big)
|
# License.exists?(name: name_downcase) || License.exists?(name: name_upcase) || License.exists?(name: name_first_big)
|
||||||
end
|
# end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -65,13 +65,13 @@ class MembersController < ApplicationController
|
||||||
|
|
||||||
def check_member_exists!
|
def check_member_exists!
|
||||||
@current_user_header_team = Team.joins(:team_users, :team_projects).where(team_projects: {project_id: @project.id}, team_users: {user_id: current_user.id}).order(authorize: :desc).take
|
@current_user_header_team = Team.joins(:team_users, :team_projects).where(team_projects: {project_id: @project.id}, team_users: {user_id: current_user.id}).order(authorize: :desc).take
|
||||||
return render_error("user_id为#{params[:user_id]}的用户已经是项目成员") if member_exists? || (params[:user_id].to_i == current_user.id && @current_user_header_team.present?)
|
return render_error("#{@user&.nickname}已经是项目成员") if member_exists? || (params[:user_id].to_i == current_user.id && @current_user_header_team.present?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_member_not_exists!
|
def check_member_not_exists!
|
||||||
@current_user_header_team = Team.joins(:team_users, :team_projects).where(team_projects: {project_id: @project.id}, team_users: {user_id: current_user.id}).order(authorize: :desc).take
|
@current_user_header_team = Team.joins(:team_users, :team_projects).where(team_projects: {project_id: @project.id}, team_users: {user_id: current_user.id}).order(authorize: :desc).take
|
||||||
return render_error("用户为组织成员,请到组织下操作!") if (params[:user_id].to_i == current_user.id && @current_user_header_team.present?) && !member_exists?
|
return render_error("用户为组织成员,请到组织下操作!") if (params[:user_id].to_i == current_user.id && @current_user_header_team.present?) && !member_exists?
|
||||||
return render_error("user_id为#{params[:user_id]}的用户还不是项目成员") unless member_exists?
|
return render_error("#{@user&.nickname}还不是项目成员") unless member_exists?
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_user_profile_completed
|
def check_user_profile_completed
|
||||||
|
|
|
@ -11,4 +11,7 @@
|
||||||
|
|
||||||
class Ignore < ApplicationRecord
|
class Ignore < ApplicationRecord
|
||||||
include Projectable
|
include Projectable
|
||||||
|
|
||||||
|
validates :name, :content, presence: true
|
||||||
|
validates :name, uniqueness: { case_sensitive: false }
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,4 +11,8 @@
|
||||||
|
|
||||||
class License < ApplicationRecord
|
class License < ApplicationRecord
|
||||||
include Projectable
|
include Projectable
|
||||||
|
|
||||||
|
validates :name, :content, presence: true
|
||||||
|
validates :name, uniqueness: { case_sensitive: false }
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,4 +12,6 @@
|
||||||
|
|
||||||
class ProjectLanguage < ApplicationRecord
|
class ProjectLanguage < ApplicationRecord
|
||||||
include Projectable
|
include Projectable
|
||||||
|
|
||||||
|
validates :name, uniqueness: true
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
</label>
|
</label>
|
||||||
<%= p.number_field :pinned_index,class: "form-control input-lg",placeholder: "精选等级",required: true%>
|
<%= p.number_field :pinned_index,class: "form-control input-lg",placeholder: "精选等级",required: true%>
|
||||||
</div>
|
</div>
|
||||||
|
<%if false%>
|
||||||
<div class="logo-item">
|
<div class="logo-item">
|
||||||
<% logo_img = @project_category.logo_url %>
|
<% logo_img = @project_category.logo_url %>
|
||||||
<div class="logo-item-left mr-3 <%= logo_img ? 'has-img' : '' %>">
|
<div class="logo-item-left mr-3 <%= logo_img ? 'has-img' : '' %>">
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
<div>尺寸:高度38px以内,宽等比例缩放</div>
|
<div>尺寸:高度38px以内,宽等比例缩放</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||||
|
|
|
@ -223,6 +223,12 @@ zh-CN:
|
||||||
platform: '直播平台'
|
platform: '直播平台'
|
||||||
live_time: '开播时间'
|
live_time: '开播时间'
|
||||||
duration: '直播时长'
|
duration: '直播时长'
|
||||||
|
license:
|
||||||
|
name: '许可证名称'
|
||||||
|
content: '许可证内容'
|
||||||
|
ignore:
|
||||||
|
name: 'git忽略文件名称'
|
||||||
|
content: 'git忽略文件内容'
|
||||||
close_pr: 合并请求
|
close_pr: 合并请求
|
||||||
roles:
|
roles:
|
||||||
Developer: 开发者
|
Developer: 开发者
|
||||||
|
|
Loading…
Reference in New Issue