add data_count, title textarea, published_index order desc, show name field

This commit is contained in:
rulingcom 2026-06-09 15:52:09 +08:00
parent b1fb3cc44c
commit 20cfcb85b5
3 changed files with 14 additions and 4 deletions

View File

@ -343,7 +343,7 @@ class AsksController < ApplicationController
}
]
end.to_h
ask_questions = AskQuestion.where(:situation => 'is_published', :category_id.in => category_ids)
ask_questions = AskQuestion.where(:situation => 'is_published', :category_id.in => category_ids).order_by(created_at: :desc)
if page_data_count != 0
ask_questions = ask_questions.page(1).per(page_data_count)
end
@ -724,7 +724,7 @@ class AsksController < ApplicationController
id = field_name
case field
when 'title'
f1['content'] = text_field_tag(field_name,nil,placeholder: placeholder,required: required)
f1['content'] = text_area_tag(field_name,nil,placeholder: placeholder,required: required)
when 'name'
f1['content'] = text_field_tag(field_name,nil,data: (required ? {"fv-validation" => "required;", "fv-messages" => "必填欄位;"} : {}),required: required,placeholder: placeholder)
when 'sex'

View File

@ -67,6 +67,14 @@
<%= label_tag nil,ask.title, :class=> 'control-label' %>
</div>
</div>
<% if ask.name.present? %>
<div class="control-group">
<%= label_tag nil,t('mongoid.attributes.ask_question.name'), :class=> 'control-label' %>
<div class="controls">
<%= label_tag nil,ask.name, :class=> 'control-label' %>
</div>
</div>
<% end %>
<%= ask_setting.custom_fields.collect do |k,v|
required_pattern = v['required']=='true' ? '*' : ''
"<div class=\"control-group\">
@ -83,4 +91,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@ -124,6 +124,8 @@ module Ask
end
widget_methods ["widget"]
widget_settings [{"data_count"=>10}]
data_count 1..50
default_data_count 10
taggable "AskQuestion"
begin
show_option_items data_item
@ -220,4 +222,4 @@ module Ask
end
end
end
end
end