diff --git a/app/controllers/asks_controller.rb b/app/controllers/asks_controller.rb index c07a05c..dd9b0b4 100644 --- a/app/controllers/asks_controller.rb +++ b/app/controllers/asks_controller.rb @@ -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' diff --git a/app/views/asks/show.html.erb b/app/views/asks/show.html.erb index 1a8d0bb..04e6826 100644 --- a/app/views/asks/show.html.erb +++ b/app/views/asks/show.html.erb @@ -67,6 +67,14 @@ <%= label_tag nil,ask.title, :class=> 'control-label' %> + <% if ask.name.present? %> +
+ <%= label_tag nil,t('mongoid.attributes.ask_question.name'), :class=> 'control-label' %> +
+ <%= label_tag nil,ask.name, :class=> 'control-label' %> +
+
+ <% end %> <%= ask_setting.custom_fields.collect do |k,v| required_pattern = v['required']=='true' ? '*' : '' "
@@ -83,4 +91,4 @@
- \ No newline at end of file + diff --git a/lib/ask/engine.rb b/lib/ask/engine.rb index 0dfc200..e57dfa4 100644 --- a/lib/ask/engine.rb +++ b/lib/ask/engine.rb @@ -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 \ No newline at end of file +end