Fix bug.
Add feature that batch delete and change status. Add adjust display fields in backend table.
This commit is contained in:
parent
50f9c1b5f4
commit
9814b7c79c
|
@ -1,15 +1,20 @@
|
|||
|
||||
.form-horizontal {
|
||||
.ask-question .control-group.col-sm-6:nth-child(2n+1) {
|
||||
clear: left;
|
||||
}
|
||||
.ask-question .controls label.radio-inline{
|
||||
float: left;
|
||||
}
|
||||
.ask-question-form {
|
||||
background-color: #fdfdfd;
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
.form-horizontal .control-group {
|
||||
.ask-question-form .control-group {
|
||||
margin-bottom: 1em;
|
||||
padding-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.form-horizontal .control-label {
|
||||
.ask-question-form .control-label {
|
||||
font-size: 1em;
|
||||
float: left;
|
||||
width: 10em;
|
||||
|
@ -20,13 +25,13 @@
|
|||
display: block;
|
||||
}
|
||||
|
||||
.form-horizontal .control-group .controls {
|
||||
.ask-question-form .control-group .controls {
|
||||
margin-left: 13.5em;
|
||||
}
|
||||
|
||||
.form-horizontal input[type="text"],
|
||||
.form-horizontal textarea,
|
||||
.form-horizontal select {
|
||||
.ask-question-form input[type="text"],
|
||||
.ask-question-form textarea,
|
||||
.ask-question-form select {
|
||||
height: 2.1em;
|
||||
line-height: 2.1em;
|
||||
width: 220px;
|
||||
|
@ -35,17 +40,17 @@
|
|||
border-radius: 0.3em;
|
||||
}
|
||||
|
||||
.form-horizontal textarea {
|
||||
.ask-question-form textarea {
|
||||
width: 97%;
|
||||
height: 180px;
|
||||
}
|
||||
|
||||
/*button*/
|
||||
.form-horizontal .form-actions {
|
||||
.ask-question-form .form-actions {
|
||||
border-top: 1px solid #d7dadb;
|
||||
/*padding: 1em 0 0 20em;*/
|
||||
}
|
||||
.form-horizontal .form-actions input, .form-horizontal .form-actions a{
|
||||
.ask-question-form .form-actions input, .ask-question-form .form-actions a{
|
||||
float: right;
|
||||
}
|
||||
/*驗證碼*/
|
||||
|
|
|
@ -5,6 +5,7 @@ class Admin::AsksController < OrbitAdminController
|
|||
before_action ->(module_app = @app_title) { set_variables module_app }
|
||||
before_action :set_askquestion, only: [:edit, :destroy, :update, :print]
|
||||
layout :compute_layout
|
||||
helper_method :ask_thead
|
||||
def compute_layout
|
||||
if action_name=='print'
|
||||
false
|
||||
|
@ -18,8 +19,7 @@ class Admin::AsksController < OrbitAdminController
|
|||
end
|
||||
def print_setting
|
||||
@set = nil
|
||||
@cats_relations = get_categories_info_for_ask
|
||||
@category_id = (params[:category] || @cats_relations[0][0] rescue nil)
|
||||
prepare_category_select
|
||||
if @category_id.blank?
|
||||
@set = AskPrintSetting.first
|
||||
else
|
||||
|
@ -38,7 +38,7 @@ class Admin::AsksController < OrbitAdminController
|
|||
set = AskPrintSetting.first
|
||||
end
|
||||
set.update_attributes(print_format: params[:ask_print_setting][:print_format],save_name: params[:ask_print_setting][:save_name])
|
||||
redirect_to "/#{locale}/admin/asks"
|
||||
redirect_to admin_asks_path(:locale=>locale)
|
||||
end
|
||||
def category_print_setting_save
|
||||
locale = I18n.locale
|
||||
|
@ -47,11 +47,9 @@ class Admin::AsksController < OrbitAdminController
|
|||
set.update_attributes(print_format: params['print_format'],save_name: params['save_name'],category_id: params['category_id'])
|
||||
redirect_to "/#{locale}/admin/asks/category_setting"
|
||||
end
|
||||
def filter_fields(categories, tags)
|
||||
def filter_fields(categories, tags=[])
|
||||
{
|
||||
:situation=>[{:title=>"ask.is_waiting",:id=>"is_waiting"},{:title=>"ask.is_processed",:id=>"is_processed"},{:title=>"ask.is_referral",:id=>"is_referral"},{:title=>"ask.is_published",:id=>"is_published"}],
|
||||
:category=>categories.map{|c| {:title=>(c.title.blank? ? " " : c.title), :id=>c.id}},
|
||||
:identity=>tags.map{|tag| {:title=>(tag.name.blank? ? " " : tag.name), :id=>tag.id}}
|
||||
:situation=> AskTicketStatus.all.map{|s| {:title=> s.title, :id=>s.key}}
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -79,6 +77,7 @@ class Admin::AsksController < OrbitAdminController
|
|||
end
|
||||
end
|
||||
def category_setting_save
|
||||
# render :html => params and return
|
||||
locale = I18n.locale
|
||||
ask_setting = AskCategorySetting.where(category_id: params['category_id']).first
|
||||
ask_setting = AskCategorySetting.create(category_id: params['category_id']) if ask_setting.nil?
|
||||
|
@ -90,6 +89,17 @@ class Admin::AsksController < OrbitAdminController
|
|||
@ask_setting = AskSetting.first
|
||||
@url = setting_save_admin_asks_path
|
||||
end
|
||||
def backend_table_setting
|
||||
category_id = params[:category_id].present? ? params[:category_id] : nil
|
||||
@ask_list_setting = AskListSetting.where(:category_id=>category_id).first || AskListSetting.create(:category_id=>category_id)
|
||||
@url = ask_list_setting_save_admin_asks_path
|
||||
end
|
||||
def ask_list_setting_save
|
||||
@ask_list_setting = AskListSetting.find(params[:id])
|
||||
ask_list_setting_params = params.require('ask_list_setting').permit!
|
||||
@ask_list_setting.update_attributes(ask_list_setting_params)
|
||||
redirect_to admin_asks_path(:locale=>locale)
|
||||
end
|
||||
def get_new_setting_index
|
||||
ask_setting_index = AskSettingIndex.first
|
||||
ask_setting_index = AskSettingIndex.create() if ask_setting_index.nil?
|
||||
|
@ -137,11 +147,32 @@ class Admin::AsksController < OrbitAdminController
|
|||
def index
|
||||
AskPrintSetting.create() if AskPrintSetting.first.nil?
|
||||
@ask_setting = AskSetting.first
|
||||
@tags = @module_app.tags
|
||||
prepare_category_select
|
||||
category_id = @category_id.present? ? @category_id : nil
|
||||
@ask_list_setting = AskListSetting.where(:category_id=>category_id).first || AskListSetting.create(:category_id=>category_id)
|
||||
# @tags = @module_app.tags
|
||||
@categories = @module_app.categories.enabled.sort_by{|category| (((@module_app.asc rescue true) ? category.sort_number.to_i : -category.sort_number.to_i) rescue category.id)}
|
||||
@filter_fields = filter_fields(@categories, @tags)
|
||||
@filter_fields = filter_fields(@categories)
|
||||
# 列表欄位
|
||||
@table_fields = ['ask.serial_number', :situation, :category, 'title' , 'ask.name', 'ask.phone', 'ask.appointment','ask.created_at','ask.ip']
|
||||
@table_fields_default_fields = @ask_list_setting.default_fields.select{|f| @ask_setting.default_setting[f].nil? || @ask_setting.default_setting[f] }
|
||||
@table_fields = @table_fields_default_fields.map{|v| ['title'].include?(v) ? v : "ask.#{v}"}
|
||||
if @category_id.present?
|
||||
ask_setting = AskCategorySetting.where(:category_id=>@category_id).first
|
||||
tmp = ask_setting.custom_fields
|
||||
list_setting_custom_fields = @ask_list_setting.custom_fields_list
|
||||
else
|
||||
tmp = []
|
||||
default_setting = AskSetting.first
|
||||
if default_setting
|
||||
tmp += default_setting.custom_fields.map{|k,v| ["default@#{k}", v]}
|
||||
end
|
||||
AskCategorySetting.all.each do |ask_setting|
|
||||
tmp += ask_setting.custom_fields.map{|k,v| ["custom@#{ask_setting.id}@#{k}", v]}
|
||||
end
|
||||
tmp = tmp.to_h
|
||||
list_setting_custom_fields = (tmp.keys & @ask_list_setting.custom_fields)
|
||||
end
|
||||
@table_ext_fields = list_setting_custom_fields.map{|k| [k,tmp[k]]}.select{|k,v| v}
|
||||
# 列表排序
|
||||
# debugger
|
||||
if filter2("situation").blank? and filter2("identity").blank?
|
||||
|
@ -161,7 +192,7 @@ class Admin::AsksController < OrbitAdminController
|
|||
.any_in(:identity => filter2("identity"))
|
||||
.any_in(:situation => filter2("situation"))
|
||||
end
|
||||
|
||||
@askquestions = @askquestions.where(:category_id=>category_id)
|
||||
# 分頁
|
||||
@askquestions = search_data(@askquestions,[:title]).page(params[:page]).per(10)
|
||||
if request.xhr?
|
||||
|
@ -307,10 +338,20 @@ class Admin::AsksController < OrbitAdminController
|
|||
@url = admin_ask_path(@ask_question)
|
||||
end
|
||||
|
||||
def batch_modify_status
|
||||
AskQuestion.where(:id.in=>params[:ids]).update_all(:situation=>params[:status_key])
|
||||
render :body => nil, :status => 204
|
||||
end
|
||||
|
||||
def delete
|
||||
AskQuestion.where(:id.in=>params[:ids]).destroy
|
||||
render :body => nil, :status => 204
|
||||
end
|
||||
|
||||
def destroy
|
||||
locale = I18n.locale
|
||||
@ask_question.destroy
|
||||
redirect_to "/#{locale}/admin/asks"
|
||||
redirect_to admin_asks_path(:locale=>locale)
|
||||
end
|
||||
|
||||
def update
|
||||
|
@ -351,7 +392,7 @@ class Admin::AsksController < OrbitAdminController
|
|||
build_email(@ask_question)
|
||||
end
|
||||
|
||||
redirect_to "/#{locale}/admin/asks", notice: t('ask.reply_success')
|
||||
redirect_to admin_asks_path(:locale=>locale), notice: t('ask.reply_success')
|
||||
end
|
||||
|
||||
def build_email(email_er)
|
||||
|
@ -426,9 +467,12 @@ class Admin::AsksController < OrbitAdminController
|
|||
@ask_question = AskQuestion.find(params[:id])
|
||||
end
|
||||
def order_fields
|
||||
prepare_category_select
|
||||
@disp_fields_infos = AskSetting.get_disp_fields_infos(false,@category_id)
|
||||
end
|
||||
def prepare_category_select
|
||||
@cats_relations = get_categories_info_for_ask
|
||||
@category_id = (params[:category] || @cats_relations[0][0] rescue nil)
|
||||
@disp_fields_infos = AskSetting.get_disp_fields_infos(false,@category_id)
|
||||
end
|
||||
def update_order_fields
|
||||
ask_setting = AskCategorySetting.where(:category_id=>params[:category]).first
|
||||
|
@ -439,6 +483,10 @@ class Admin::AsksController < OrbitAdminController
|
|||
default_setting = AskSetting.first
|
||||
ask_setting = AskCategorySetting.create(category_id: params[:category])
|
||||
p1 = default_setting.get_attrs
|
||||
p1['need_check_customs'] = []
|
||||
p1['agree_customs'] = p1['custom_fields'].keys rescue []
|
||||
p1['reject_customs'] = []
|
||||
p1['custom_fields'] = p1['custom_fields'].map{|k,v| ["default@#{k}", v]}.to_h rescue {}
|
||||
ask_setting.update_attributes(p1)
|
||||
ask_setting.update(:use_default => true)
|
||||
ask_setting_index = AskCategorySettingIndex.where(category_id: params[:category]).first
|
||||
|
@ -555,4 +603,16 @@ class Admin::AsksController < OrbitAdminController
|
|||
end
|
||||
param_clone.merge({"custom_fields"=> custom_fields})
|
||||
end
|
||||
def ask_thead(field, trans,center=false)
|
||||
sort = field.to_s.include?('.') ? field.to_s.split('.')[1] : field.to_s
|
||||
active = params[:sort].eql? sort
|
||||
order = active ? (["asc", "desc"]-[params[:order]]).first : "asc"
|
||||
arrow = (order.eql? "desc") ? "<b class='icons-arrow-up-3'></b>" : "<b class='icons-arrow-down-4'></b>"
|
||||
klass = field.eql?(:title) ? "span5" : "span2"
|
||||
|
||||
th_data = "<a href='?sort=#{sort}&order=#{order}'>#{trans} #{active ? arrow : ""}</a>"
|
||||
|
||||
"<th class='#{klass} #{active ? "active" : ""}' style='#{center ? "text-align:center" : ""}'>#{th_data}</th>".html_safe
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -337,6 +337,7 @@ class AsksController < ApplicationController
|
|||
tmp_type = (ask_setting.class == AskSetting) ? 0 : 1
|
||||
tmp_ask_cat_id = (tmp_type == 1) ? ask_setting.id.to_s : ""
|
||||
set_input_name_for_ask("ask_question")
|
||||
has_ask_category_id = false
|
||||
disp_fields_infos.each do |field, info|
|
||||
if field.start_with?("default@")
|
||||
k = field[8..-1]
|
||||
|
@ -360,14 +361,15 @@ class AsksController < ApplicationController
|
|||
end
|
||||
else
|
||||
if field == 'ask_category_id'
|
||||
has_ask_category_id = true
|
||||
if show_categories || ask_setting.default_setting[field]
|
||||
if categories.count > 1
|
||||
defalt_fields = defalt_fields + [{'style_html'=>'','label'=>ask_label(@default_ask_setting.field_name("ask_category_id"),'true'),'content'=>select_tag('ask_question[category_id]', options_for_select(categories.collect{|t| [ t.title, t.id ]}))}]
|
||||
defalt_fields << {'style_html'=>'','label'=>ask_label(@default_ask_setting.field_name("ask_category_id"),'true'),'content'=>select_tag('ask_question[category_id]', options_for_select(categories.collect{|t| [ t.title, t.id ]}))}
|
||||
else
|
||||
defalt_fields = defalt_fields + [{'style_html'=>'','label'=>ask_label(@default_ask_setting.field_name("ask_category_id"),'true'),'content'=>"<span>#{(categories[0].title rescue '')}</span>"+hidden_field_tag('ask_question[category_id]', (categories[0].id.to_s rescue ''))}]
|
||||
defalt_fields << {'style_html'=>'','label'=>ask_label(@default_ask_setting.field_name("ask_category_id"),'true'),'content'=>"<span>#{(categories[0].title rescue '')}</span>"+hidden_field_tag('ask_question[category_id]', (categories[0].id.to_s rescue ''))}
|
||||
end
|
||||
else
|
||||
defalt_fields = defalt_fields + [{'style_html'=>'display: none;','label'=>'','content'=>hidden_field_tag('ask_question[category_id]', (categories[0].id.to_s rescue ''))}]
|
||||
defalt_fields << {'style_html'=>'display: none;','label'=>'','content'=>hidden_field_tag('ask_question[category_id]', (categories[0].id.to_s rescue ''))}
|
||||
end
|
||||
else
|
||||
if ask_setting.default_setting[field] || field == "usage_rule"
|
||||
|
@ -413,6 +415,9 @@ class AsksController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
unless has_ask_category_id
|
||||
defalt_fields << {'style_html'=>'display: none;','label'=>'','content'=>hidden_field_tag('ask_question[category_id]', (tmp_type == 1 ? ask_setting.category_id : (categories[0].id.to_s rescue '')))}
|
||||
end
|
||||
defalt_fields
|
||||
end
|
||||
def cal_html(fields,token_tag,form_id,referer_url,is_hidden=true,ask_setting=None)
|
||||
|
@ -495,6 +500,7 @@ class AsksController < ApplicationController
|
|||
default_idx = ask_settings[1..-1].to_a.map{|a| a.category_id.to_s}.index(categories[0].id.to_s)
|
||||
default_idx = default_idx.nil? ? 0 : default_idx + 1
|
||||
end
|
||||
@default_ask_setting ||= AskSetting.first
|
||||
switch_form = script_text + ask_settings.collect.with_index do |ask_setting,i|
|
||||
fields = cal_form_from_setting(ask_setting,categories,true)
|
||||
is_hidden = (i != default_idx)
|
||||
|
|
|
@ -30,7 +30,7 @@ module Admin::AsksHelper
|
|||
cats = cats.sort_by{|category| (-category.sort_number.to_i rescue category.id)}
|
||||
end
|
||||
cats_relations = cats.map{|c| [c.id.to_s, c.title]}
|
||||
if include_all
|
||||
if include_all && cats_relations.count != 1
|
||||
cats_relations.insert(0, ["",t(:all)])
|
||||
end
|
||||
cats_relations
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
class AskListSetting
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
DefaultFields = ['serial_number','situation','ask_category_id','title','name','sex','mail','phone','appointment','created_at','ip']
|
||||
DefaultEnabled = ['serial_number','situation','ask_category_id','title','name','phone','appointment','created_at','ip']
|
||||
field :default_fields, type: Array, default: []
|
||||
field :custom_fields, type: Array, default: []
|
||||
field :category_id
|
||||
def default_fields
|
||||
tmp = super()
|
||||
return tmp if tmp.length>0
|
||||
self.class::DefaultEnabled
|
||||
end
|
||||
def custom_fields_list
|
||||
locale = I18n.locale
|
||||
default_setting = AskSetting.first
|
||||
if self.category_id.blank?
|
||||
fields = default_setting ? {I18n.t(:default) => default_setting.custom_fields.map{|k,v| ["default@#{k}",v['field'][locale]]}.to_h} : {}
|
||||
cat_ids_map = Category.where(:id.in=> AskCategorySetting.all.pluck(:category_id),:disabled.ne=>true).map{|c| [c.id.to_s, c.title]}.to_h
|
||||
fields = fields.merge(AskCategorySetting.where(:category_id.in => cat_ids_map.keys()).map{|c| [cat_ids_map[c.category_id] , c.custom_fields.select{|k,v| !(k.start_with?('default@'))}.map{|k,v| ["custom@#{c.id}@#{k}",v['field'][locale]]}]}.to_h)
|
||||
else
|
||||
fields = AskCategorySetting.where(:category_id=>self.category_id).to_a.map{|c| [(Category.find(c.category_id).title rescue ''), c.custom_fields.map{|k,v| [k,v['field'][locale]]}]}.to_h
|
||||
end
|
||||
fields
|
||||
end
|
||||
end
|
|
@ -244,8 +244,15 @@
|
|||
<%= f.text_area "usage_rule",class: 'ckeditor' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% ask_setting.custom_fields.each do |k,v| %>
|
||||
<%= custom_field_block_for_ask(k,v).html_safe %>
|
||||
<% if @default_custom_fields %>
|
||||
<% ask_setting.custom_fields.each do |k,v| %>
|
||||
<%= custom_field_block_for_ask("default@#{k}",v, false, (hidden_field_tag("#{f.object_name}[agree_customs][]", k))).html_safe %>
|
||||
<% end %>
|
||||
<%= f.hidden_field :use_default, :value => false %>
|
||||
<% else %>
|
||||
<% ask_setting.custom_fields.each do |k,v| %>
|
||||
<%= custom_field_block_for_ask(k,v).html_safe %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<tr class="add_field">
|
||||
<td colspan="2" style="text-align: center;">
|
||||
|
|
|
@ -3,11 +3,16 @@
|
|||
<%= render :partial => 'show_default_ask_setting' %>
|
||||
</div>
|
||||
<div class="default_ask_setting hide">
|
||||
<%= form_for @default_ask_setting, method: 'post',url: @url,html: { class: 'form-horizontal main-forms previewable' } do |f| %>
|
||||
<%= form_for @default_ask_setting, method: 'post',url: @url,html: { class: 'form-horizontal main-forms previewable fix_diabled_form' } do |f| %>
|
||||
<% f.object_name = 'ask_category_setting' %>
|
||||
<%= hidden_field_tag "not_clone_attrs", true , :class=> 'not_clone_attrs' %>
|
||||
<%= hidden_field_tag "category_id", @first_category_id , :class=> 'hidden_category_id' %>
|
||||
<%= render partial: 'ask_setting',locals:{ask_setting: @default_ask_setting,f: f,submit_text: t('submit'), :@has_email_regex => false, :@has_switch_button => true} %>
|
||||
<%= render partial: 'ask_setting',locals:{ask_setting: @default_ask_setting,f: f,submit_text: t('submit'), :@has_email_regex => false, :@has_switch_button => true, :@default_custom_fields => true } %>
|
||||
<% end %>
|
||||
<script>
|
||||
$('.fix_diabled_form').on('submit', function(){
|
||||
$(this).find('input[disabled]').removeAttr('disabled');
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
|
@ -1,11 +1,180 @@
|
|||
<script>
|
||||
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
|
||||
if( Array.prototype.delete == undefined ){
|
||||
Array.prototype.delete = function(v){
|
||||
var idx = this.indexOf(v);
|
||||
if(idx != -1){
|
||||
return this.splice(idx, 1)[0];
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
function reload_tbody(url){
|
||||
console.log("done");
|
||||
if(url == undefined){
|
||||
url = window.location.href;
|
||||
}
|
||||
$.get(url).done(function(data){
|
||||
$('#index_table tbody').replaceWith($(data).find('tbody'));
|
||||
if(window.scroll_top){
|
||||
$(window).scrollTop(window.scroll_top);
|
||||
}
|
||||
window.batch_select_asks = [];
|
||||
$(".delete_asks_btn, .batch_modify_status_btn").addClass('hide');
|
||||
});
|
||||
}
|
||||
$(document).on("click", ".batch_select", function(){
|
||||
var that = $(this);
|
||||
var id = that.data("id");
|
||||
if(window.batch_select_asks == undefined){
|
||||
window.batch_select_asks = [];
|
||||
}
|
||||
if(that.prop("checked")){
|
||||
window.batch_select_asks.push(id);
|
||||
}else{
|
||||
window.batch_select_asks.delete(id);
|
||||
}
|
||||
if(window.batch_select_asks.length == 0){
|
||||
$(".delete_asks_btn, .batch_modify_status_btn").addClass('hide');
|
||||
}else{
|
||||
$(".delete_asks_btn, .batch_modify_status_btn").removeClass('hide');
|
||||
}
|
||||
})
|
||||
function batch_delete_asks(){
|
||||
if(!window.batch_select_asks || window.batch_select_asks.length == 0){
|
||||
return null;
|
||||
}
|
||||
var data = new FormData();
|
||||
var csrf_token = document
|
||||
.querySelector("meta[name='csrf-token']")
|
||||
.getAttribute("content");
|
||||
var csrf_param = document
|
||||
.querySelector("meta[name='csrf-param']")
|
||||
.getAttribute("content");
|
||||
if (csrf_token && csrf_param) {
|
||||
data.append(csrf_param, csrf_token);
|
||||
}
|
||||
window.batch_select_asks.forEach(function(val){
|
||||
data.append('ids[]', val);
|
||||
});
|
||||
$.ajax({
|
||||
url: "<%=delete_admin_asks_path%>",
|
||||
method: 'DELETE',
|
||||
data: data,
|
||||
headers: {
|
||||
// 'Content-Type': 'multipart/form-data',
|
||||
// 使用 multipart/form-data 在此不需要設定 Content-Type。
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Authorization': `Bearer ${ csrf_token }`,
|
||||
},
|
||||
contentType: false, //required
|
||||
processData: false, // required
|
||||
statusCode: {
|
||||
204: reload_tbody,
|
||||
403: function() {
|
||||
alert( "Delete failed!" );
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
function batch_edit_status_asks(){
|
||||
if($('#dialog-batch-modify-status').length == 0){
|
||||
var li_statuses = "";
|
||||
<% AskTicketStatus.all.each do |s| %>
|
||||
li_statuses += "<li style=\"list-style: none;\"><label><input type=\"radio\" name=\"status_key\" value=\"<%=s.key%>\"><%=s.title%></label></li>"
|
||||
<% end%>
|
||||
$("#main-wrap").before("<div id='dialog-batch-modify-status' title='"+"<%= t('ask.batch_modify_status') %>'>"+
|
||||
"<div style='clear:both;'></div><div><ul>"+ li_statuses +"</ul></div>"+
|
||||
"</div>");
|
||||
}else{
|
||||
$('[name="status_key"]').prop('checked',false);
|
||||
}
|
||||
$( "#dialog-batch-modify-status" ).dialog({
|
||||
resizable: true,
|
||||
minHeight: 100,
|
||||
maxHeight: 400,
|
||||
modal: true,
|
||||
buttons: {
|
||||
"<%= t(:confirm) %>": function(){
|
||||
var status_key = $('[name="status_key"]:checked').val();
|
||||
if(status_key){
|
||||
if(window.confirm("<%=t(:sure?)%>")){
|
||||
var data = new FormData();
|
||||
var csrf_token = document
|
||||
.querySelector("meta[name='csrf-token']")
|
||||
.getAttribute("content");
|
||||
var csrf_param = document
|
||||
.querySelector("meta[name='csrf-param']")
|
||||
.getAttribute("content");
|
||||
if (csrf_token && csrf_param) {
|
||||
data.append(csrf_param, csrf_token);
|
||||
}
|
||||
window.batch_select_asks.forEach(function(val){
|
||||
data.append('ids[]', val);
|
||||
});
|
||||
data.append("status_key", status_key);
|
||||
$.ajax({
|
||||
url: "<%=batch_modify_status_admin_asks_path%>",
|
||||
method: 'POST',
|
||||
data: data,
|
||||
headers: {
|
||||
// 'Content-Type': 'multipart/form-data',
|
||||
// 使用 multipart/form-data 在此不需要設定 Content-Type。
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Authorization': `Bearer ${ csrf_token }`,
|
||||
},
|
||||
contentType: false, //required
|
||||
processData: false, // required
|
||||
statusCode: {
|
||||
204: reload_tbody,
|
||||
403: function() {
|
||||
alert( "Edit status failed!" );
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
$( this ).dialog( "close" );
|
||||
},
|
||||
"<%= t(:cancel) %>": function() {
|
||||
$( this ).dialog( "close" );
|
||||
$( this ).remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).on("click", ".delete_asks_btn", function(){
|
||||
if(window.confirm("<%=t(:sure?)%>")){
|
||||
if(window.confirm("<%=t(:sure?)%>")){
|
||||
batch_delete_asks();
|
||||
}
|
||||
}
|
||||
})
|
||||
$(document).on("click", ".batch_modify_status_btn", function(){
|
||||
batch_edit_status_asks();
|
||||
})
|
||||
</script>
|
||||
<div>
|
||||
<form>
|
||||
<h4><%= t(:category) %></h4>
|
||||
<select name="category" id="submit_when_change">
|
||||
<% @cats_relations.each do |id, title| %>
|
||||
<option value="<%=id%>" <%= @category_id == id ? 'selected' : '' %>><%= title %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr class="sort-header">
|
||||
<th style="width: 1em;"></th>
|
||||
<% @table_fields.each do |f| %>
|
||||
<% tmp = f.to_s.gsub(/ask\./,'') %>
|
||||
<% if true #@ask_setting.default_setting[tmp].nil? || @ask_setting.default_setting[tmp] %>
|
||||
<%= thead(f) %>
|
||||
<% end %>
|
||||
<%= thead(f) %>
|
||||
<% end %>
|
||||
<% @table_ext_fields.each do |f, v| %>
|
||||
<%= ask_thead(f, v['field'][I18n.locale.to_s]) %>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -23,42 +192,56 @@
|
|||
%>
|
||||
<% @askquestions.each do |b| %>
|
||||
<tr>
|
||||
<td><%= b.get_serial_number(last_serial_number, display_length) %></td>
|
||||
<td>
|
||||
<span class='label <%=situation_class_relation[b.situation]%>'><%= situation_trans[b.situation] %></span>
|
||||
</td>
|
||||
<td>
|
||||
<%= b.category.title rescue 'category not set' %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<% if can_edit_or_delete?(b) %>
|
||||
<li><a href="/<%= I18n.locale %>/admin/asks/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
|
||||
<li><a href="#" class="delete text-error" rel="/admin/asks/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
|
||||
<% end %>
|
||||
<li><a href="/<%= I18n.locale %>/admin/asks/<%=b.id.to_s%>/print" target="_blank"><%= t('ask.print') %></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<% if b.situation == 'is_published' %>
|
||||
<%= link_to b.title,((Page.where(:module=>'ask').first.url+"?item=#{b.id}") rescue "javascript:alert('#{t('ask.no_index_page')}')") %>
|
||||
<% else %>
|
||||
<%= b.title %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% if @ask_setting.default_setting['name'].nil? || @ask_setting.default_setting['name'] %>
|
||||
<td>
|
||||
<%= b.name %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% if @ask_setting.default_setting['phone'] %>
|
||||
<% is_editable = can_edit_or_delete?(b) %>
|
||||
<td><% if is_editable %><input type="checkbox" class="batch_select" data-id="<%= b.id %>"><% end %></td>
|
||||
<% @table_fields_default_fields.each do |f| %>
|
||||
<% case f %>
|
||||
<% when 'serial_number' %>
|
||||
<td><%= b.get_serial_number(last_serial_number, display_length) %></td>
|
||||
<% when 'situation' %>
|
||||
<td>
|
||||
<span class='label <%=situation_class_relation[b.situation]%>'><%= situation_trans[b.situation] %></span>
|
||||
</td>
|
||||
<% when 'ask_category_id' %>
|
||||
<td>
|
||||
<%= b.category.title rescue 'category not set' %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<% if is_editable %>
|
||||
<li><a href="/<%= I18n.locale %>/admin/asks/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
|
||||
<li><a href="#" class="delete text-error" rel="/admin/asks/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
|
||||
<% end %>
|
||||
<li><a href="/<%= I18n.locale %>/admin/asks/<%=b.id.to_s%>/print" target="_blank"><%= t('ask.print') %></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<% when 'title' %>
|
||||
<td>
|
||||
<% if b.situation == 'is_published' %>
|
||||
<%= link_to b.title,((Page.where(:module=>'ask').first.url+"?item=#{b.id}") rescue "javascript:alert('#{t('ask.no_index_page')}')") %>
|
||||
<% else %>
|
||||
<%= b.title %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% when 'name' %>
|
||||
<td>
|
||||
<%= b.name %>
|
||||
</td>
|
||||
<% when 'phone' %>
|
||||
<td><%= b.phone %></td>
|
||||
<% end %>
|
||||
<% if @ask_setting.default_setting['appointment'] %>
|
||||
<% when 'appointment' %>
|
||||
<td><%= b.appointment.strftime("%Y-%m-%d %H:%M") rescue nil %></td>
|
||||
<% when 'created_at' %>
|
||||
<td><%= b.created_at.strftime("%Y-%m-%d %H:%M") rescue nil %></td>
|
||||
<% when 'ip' %>
|
||||
<td><%= b.ip %></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% @table_ext_fields.each do |f, v| %>
|
||||
<td>
|
||||
<%= show_on_front(f,v,b.custom_values[f],true) %>
|
||||
</td>
|
||||
<% end %>
|
||||
<td><%= b.created_at.strftime("%Y-%m-%d %H:%M") rescue nil %></td>
|
||||
<td><%= b.ip %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
@ -67,5 +250,13 @@
|
|||
<%=
|
||||
content_tag :div, class: "bottomnav clearfix" do
|
||||
content_tag :div, paginate(@askquestions), class: "pagination pagination-centered"
|
||||
content_tag :div, link_to(I18n.t('ask.display_fields_setting'), backend_table_setting_admin_asks_path + (@category_id.present? ? "?category_id=#{@category_id}" : ''), :class=>'btn btn-primary' ) + link_to(t("ask.delete_selected"), "javascript:void(0)", :class=>"btn btn-danger delete_asks_btn hide", :style=>'margin-left: 0.5em;') + link_to(t("ask.batch_modify_status"), "javascript:void(0)", :class=>"btn btn-success batch_modify_status_btn hide", :style=>'margin-left: 0.5em;'), class: 'pull-right'
|
||||
end
|
||||
%>
|
||||
%>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#submit_when_change").on("change",function(){
|
||||
$(this)[0].form.submit();
|
||||
})
|
||||
})
|
||||
</script>
|
|
@ -0,0 +1,47 @@
|
|||
<% cat = Category.where(:id=>params[:category_id]).first %>
|
||||
<%= form_for @ask_list_setting,method: 'post',url: @url,html: { class: 'form-horizontal main-forms prekiewable' } do |f| %>
|
||||
<fieldset>
|
||||
<h3><%= t('ask.backend_table_setting') %> - <%= cat ? cat.title : t(:all) %></h3>
|
||||
<h4>
|
||||
<%= I18n.t("ask.default_head_for_table") %>
|
||||
</h4>
|
||||
<% tmp = AskListSetting::DefaultFields
|
||||
%>
|
||||
<% tmp.each do |k| %>
|
||||
<dik class="control-group">
|
||||
<dik class="control-label">
|
||||
<%= f.label "default_fields_#{k}", I18n.t("ask.#{k}",default: I18n.t("mongoid.attributes.ask_question.#{k}")) %>
|
||||
</dik>
|
||||
<dik class="controls">
|
||||
<%= f.check_box :default_fields, {:checked=> @ask_list_setting.default_fields.include?(k), :multiple=> true}, k, nil %>
|
||||
<%= f.label "default_fields_#{k}", I18n.t(:enable), {:style=> 'display: inline-block'} %>
|
||||
</dik>
|
||||
</dik>
|
||||
<% end %>
|
||||
<% @ask_list_setting.custom_fields_list.each do |title, data| %>
|
||||
<h4>
|
||||
<%= title %>
|
||||
</h4>
|
||||
<% data.each do |k,name| %>
|
||||
<dik class="control-group">
|
||||
<dik class="control-label">
|
||||
<%= f.label "custom_fields#{k}", name %>
|
||||
</dik>
|
||||
<dik class="controls">
|
||||
<%= f.check_box :custom_fields, {:checked=> @ask_list_setting.custom_fields.include?(k), :multiple=> true}, k, nil %>
|
||||
<%= f.label "custom_fields_#{k}", I18n.t(:enable), {:style=> 'display: inline-block'} %>
|
||||
</dik>
|
||||
</dik>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= hidden_field_tag :id, @ask_list_setting.id %>
|
||||
<dik class="control-group">
|
||||
<%= f.submit t(:submit), class: 'btn btn-primary' %>
|
||||
</dik>
|
||||
</fieldset>
|
||||
<style type="text/css">
|
||||
form.form-horizontal .controls{
|
||||
margin-left: 1em;
|
||||
}
|
||||
</style>
|
||||
<% end %>
|
|
@ -0,0 +1,16 @@
|
|||
<%= form_for @ask_list_setting,method: 'post',url: @url,html: { class: 'form-horizontal main-forms previewable' } do |f| %>
|
||||
<fieldset>
|
||||
<% tmp = f.object.default_fields %>
|
||||
<% tmp.each do |k| %>
|
||||
<% f.fields_for :default_fields, tmp do |f| %>
|
||||
<% f.fields_for k, tmp[k] do |f| %>
|
||||
<%= f.label :key %>
|
||||
<%= f.check_box :is_enabled %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="control-group">
|
||||
<%= f.submit t(:submit), class: 'btn btn-primary' %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
|
@ -53,8 +53,8 @@
|
|||
width: 100%;
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.ask-question .ask-question-form.multi-col.form-horizontal div[data-list="fields"]{
|
||||
float: left;
|
||||
|
|
54
ask.gemspec
54
ask.gemspec
|
@ -1,40 +1,22 @@
|
|||
$:.push File.expand_path("../lib", __FILE__)
|
||||
# -*- encoding: utf-8 -*-
|
||||
# stub: ask 0.0.1 ruby lib
|
||||
|
||||
# Maintain your gem's version:
|
||||
require "ask/version"
|
||||
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
|
||||
if bundle_update_flag
|
||||
app_path = File.expand_path(__dir__)
|
||||
template_path = ENV['PWD'] + '/app/templates'
|
||||
all_template = Dir.glob(template_path+'/*/')
|
||||
puts 'copying ask module'
|
||||
all_template.each do |folder|
|
||||
if folder.split('/')[-1] != 'mobile'
|
||||
begin
|
||||
system ('cp -r '+ app_path + '/modules/ ' + folder)
|
||||
rescue
|
||||
puts 'error copy'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
#syst
|
||||
# Describe your gem and declare its dependencies:
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "ask"
|
||||
s.version = Ask::VERSION
|
||||
s.authors = ["RulingDigital"]
|
||||
s.email = ["orbit@rulingcom.com"]
|
||||
s.homepage = "http://www.rulingcom.com"
|
||||
s.summary = "Ask for orbit"
|
||||
s.description = "Ask for orbit"
|
||||
s.license = "MIT"
|
||||
s.name = "ask".freeze
|
||||
s.version = "0.0.1"
|
||||
|
||||
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||||
s.test_files = Dir["test/**/*"]
|
||||
s.metadata = {
|
||||
"_require" => "#{File.expand_path("../app/models/ask_setting", __FILE__)}",
|
||||
"global_hash" => "{last_ticket_key: (AskSetting.pluck(:last_ticket_key)[0].to_i rescue 0), last_serial_number: (AskSetting.pluck(:last_serial_number)[0].to_i rescue 0)}"
|
||||
}
|
||||
# s.add_dependency ~> "gotcha"
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
||||
s.metadata = { "_require" => "/home/rulingcom/.rvm/gems/ruby-2.1.10/bundler/gems/ask-50f9c1b5f4c9/app/models/ask_setting", "global_hash" => "{last_ticket_key: (AskSetting.pluck(:last_ticket_key)[0].to_i rescue 0), last_serial_number: (AskSetting.pluck(:last_serial_number)[0].to_i rescue 0)}" } if s.respond_to? :metadata=
|
||||
s.require_paths = ["lib".freeze]
|
||||
s.authors = ["RulingDigital".freeze]
|
||||
s.date = "2022-10-01"
|
||||
s.description = "Ask for orbit".freeze
|
||||
s.email = ["orbit@rulingcom.com".freeze]
|
||||
s.files = ["MIT-LICENSE".freeze, "README.rdoc".freeze, "Rakefile".freeze, "app/assets/javascripts/admin/ask.js".freeze, "app/assets/javascripts/ask".freeze, "app/assets/javascripts/jquery.ui.datepicker.monthyearpicker.js".freeze, "app/assets/stylesheets/admin/ask.css".freeze, "app/assets/stylesheets/ask".freeze, "app/assets/stylesheets/ask/ask.css".freeze, "app/assets/stylesheets/custom_field.css".freeze, "app/assets/stylesheets/jquery-ui-timepicker-addon.css".freeze, "app/assets/stylesheets/yearpicker.css".freeze, "app/controllers/admin/ask_acknowledgements_controller.rb".freeze, "app/controllers/admin/ask_admins_controller.rb".freeze, "app/controllers/admin/asks_controller.rb".freeze, "app/controllers/asks_controller.rb".freeze, "app/helpers/admin/asks_helper.rb".freeze, "app/models/ask_acknowledgement.rb".freeze, "app/models/ask_admin.rb".freeze, "app/models/ask_category_print_setting.rb".freeze, "app/models/ask_category_setting.rb".freeze, "app/models/ask_category_setting_index.rb".freeze, "app/models/ask_file.rb".freeze, "app/models/ask_image.rb".freeze, "app/models/ask_print_setting.rb".freeze, "app/models/ask_question.rb".freeze, "app/models/ask_setting.rb".freeze, "app/models/ask_setting_index.rb".freeze, "app/models/ask_ticket_status.rb".freeze, "app/uploaders/ask_image_uploader.rb".freeze, "app/views/admin/ask_acknowledgements".freeze, "app/views/admin/ask_acknowledgements/index.html.erb".freeze, "app/views/admin/ask_admins".freeze, "app/views/admin/ask_admins/edit.html.erb".freeze, "app/views/admin/ask_admins/index.html.erb".freeze, "app/views/admin/asks".freeze, "app/views/admin/asks/_ask_setting.html.erb".freeze, "app/views/admin/asks/_category_print_setting.html.erb".freeze, "app/views/admin/asks/_category_setting_field.html.erb".freeze, "app/views/admin/asks/_default_ask_setting.html.erb".freeze, "app/views/admin/asks/_form.html.erb".freeze, "app/views/admin/asks/_index.html.erb".freeze, "app/views/admin/asks/_print_format_explain.html.erb".freeze, "app/views/admin/asks/_show_default_ask_setting.html.erb".freeze, "app/views/admin/asks/category_setting.html.erb".freeze, "app/views/admin/asks/edit.html.erb".freeze, "app/views/admin/asks/email.html.erb".freeze, "app/views/admin/asks/export.html.erb".freeze, "app/views/admin/asks/index.html.erb".freeze, "app/views/admin/asks/order_fields.html.erb".freeze, "app/views/admin/asks/print.html.erb".freeze, "app/views/admin/asks/print_format_explain.html.erb".freeze, "app/views/admin/asks/print_setting.html.erb".freeze, "app/views/admin/asks/setting.html.erb".freeze, "app/views/admin/asks/ticket_status.html.erb".freeze, "app/views/asks".freeze, "app/views/asks/email.html.erb".freeze, "app/views/asks/index.html.erb".freeze, "app/views/asks/published_index.erb".freeze, "app/views/asks/show.html.erb".freeze, "app/views/asks/sorry.html.erb".freeze, "app/views/asks/thank.html.erb".freeze, "app/views/layouts/back_end_with_jquery_first.html.erb".freeze, "config/locales/en.yml".freeze, "config/locales/zh_tw.yml".freeze, "config/routes.rb".freeze, "lib/ask".freeze, "lib/ask.rb".freeze, "lib/ask/engine.rb".freeze, "lib/ask/version.rb".freeze, "lib/tasks/ask_tasks.rake".freeze]
|
||||
s.homepage = "http://www.rulingcom.com".freeze
|
||||
s.licenses = ["MIT".freeze]
|
||||
s.rubygems_version = "3.0.8".freeze
|
||||
s.summary = "Ask for orbit".freeze
|
||||
|
||||
s.installed_by_version = "3.0.8" if s.respond_to? :installed_by_version
|
||||
end
|
||||
|
|
|
@ -2,6 +2,13 @@ en:
|
|||
situation: Status
|
||||
sex: Sex
|
||||
ask:
|
||||
batch_modify_status: "Batch Modify Status"
|
||||
delete_selected: "Delete Selected"
|
||||
backend_table_setting: Backend Table Setting
|
||||
ask_category_id: Category
|
||||
default_head_for_table: Default Head for Table
|
||||
situation: Status
|
||||
display_fields_setting: Display Fields Setting
|
||||
go_back: "Go back"
|
||||
this_field_is_default_custom_fields: "This field is default custom fields(Not editable)"
|
||||
display_discard_fields: "Display discard fields"
|
||||
|
@ -118,7 +125,7 @@ en:
|
|||
agree_usage: Agree related usage rule
|
||||
ask_category_id: Ask Category
|
||||
recaptcha: Recaptcha
|
||||
sex: Sex
|
||||
sex: Sex
|
||||
name: Name
|
||||
identity: Identity
|
||||
mail: Email
|
||||
|
|
|
@ -6,6 +6,13 @@ zh_tw:
|
|||
errors:
|
||||
verification_failed: 驗證碼錯誤
|
||||
ask:
|
||||
batch_modify_status: "批次修改狀態"
|
||||
delete_selected: "刪除所選"
|
||||
backend_table_setting: 後台表格設定
|
||||
ask_category_id: 類別
|
||||
default_head_for_table: 表格預設表頭
|
||||
situation: 狀態
|
||||
display_fields_setting: 顯示欄位設定
|
||||
go_back: "回上一頁"
|
||||
this_field_is_default_custom_fields: "此欄位為預設客製化欄位(不可修改)"
|
||||
display_discard_fields: "顯示捨棄的欄位"
|
||||
|
|
|
@ -54,9 +54,12 @@ Rails.application.routes.draw do
|
|||
namespace :admin do #backend
|
||||
resources :asks do
|
||||
collection do
|
||||
delete 'delete'
|
||||
post 'batch_modify_status'
|
||||
get ':id/print', to: 'asks#print'
|
||||
get 'export'
|
||||
get 'setting'
|
||||
get 'backend_table_setting'
|
||||
get 'category_setting'
|
||||
post 'get_category_setting_field'
|
||||
post 'category_setting_save'
|
||||
|
@ -73,6 +76,7 @@ Rails.application.routes.draw do
|
|||
delete 'delete_ticket_status'
|
||||
post 'print_setting_save'
|
||||
post 'setting_save'
|
||||
post 'ask_list_setting_save'
|
||||
post 'get_new_setting_index'
|
||||
post 'get_new_category_setting_index'
|
||||
post 'export', to: 'asks#do_export'
|
||||
|
|
|
@ -26,6 +26,7 @@ module Ask
|
|||
end
|
||||
begin
|
||||
require File.expand_path('../../../app/models/ask_setting', __FILE__)
|
||||
require File.expand_path('../../../app/models/ask_list_setting', __FILE__)
|
||||
require File.expand_path('../../../app/models/ask_category_setting', __FILE__)
|
||||
require File.expand_path('../../../app/models/ask_setting_index', __FILE__)
|
||||
if defined?(AskSetting)
|
||||
|
@ -41,6 +42,16 @@ module Ask
|
|||
AskCategorySetting.all.update_all(email_regex_enable: ask_setting.email_regex_enable,email_regex: ask_setting.email_regex)
|
||||
end
|
||||
end
|
||||
if defined?(AskListSetting)
|
||||
ask_list_setting = AskListSetting.first
|
||||
if ask_list_setting.nil?
|
||||
ask_list_setting = AskListSetting.create()
|
||||
elsif AskListSetting.count > 1
|
||||
AskListSetting.where(:category_id=>nil)[1..-1].each do |a|
|
||||
a.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
if defined?(AskSettingIndex)
|
||||
if AskSettingIndex.first.nil?
|
||||
AskSettingIndex.create()
|
||||
|
@ -139,6 +150,7 @@ module Ask
|
|||
:priority=>10,
|
||||
:active_for_action=>{'admin/asks'=>'exports'},
|
||||
:available_for => 'managers'
|
||||
|
||||
# context_link 'new_',
|
||||
# :link_path=>"new_admin_ask_path" ,
|
||||
# :priority=>2,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.ask-question .controls > *{
|
||||
display: block;
|
||||
|
@ -28,7 +28,7 @@
|
|||
.ask-question .form-horizontal .control-group .controls{
|
||||
margin: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
min-width: 10em;
|
||||
|
@ -36,7 +36,7 @@
|
|||
padding-left: 0;
|
||||
width: 100%;
|
||||
padding: 0.5em;
|
||||
justify-content: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.ask-question .form-horizontal input[type="text"],.ask-question .form-horizontal select{
|
||||
width: 97%;
|
||||
|
|
Loading…
Reference in New Issue