From dcc5fc39a7685195a7f59495407156270f1496b3 Mon Sep 17 00:00:00 2001 From: iCross Date: Wed, 29 May 2013 15:14:34 +0800 Subject: [PATCH] ask module: dropdown, icon, big5 encoding, redirect, admin, send mail --- app/jobs/send_ask_notice_mail.rb | 10 ++++ app/jobs/send_ask_reply_mail.rb | 9 ++++ .../ask_acknowledgements_controller.rb | 21 ++++++++ .../ask/back_end/ask_admins_controller.rb | 54 +++++++++++++++++++ .../ask/back_end/ask_questions_controller.rb | 2 +- .../ask/back_end/ask_replies_controller.rb | 12 ++--- .../ask/front_end/ask_questions_controller.rb | 7 +++ .../ask/app/mailers/ask_mailer.rb | 7 ++- .../ask/app/models/ask_acknowledgement.rb | 6 +++ .../ask/app/models/ask_admin.rb | 6 +++ .../ask/app/views/ask_mailer/notice.html.erb | 35 ++++++++++++ .../ask_acknowledgements/index.html.erb | 14 +++++ .../back_end/ask_admins/_ask_admin.html.erb | 13 +++++ .../ask/back_end/ask_admins/_form.html.erb | 19 +++++++ .../ask/back_end/ask_admins/create.js.erb | 2 + .../ask/back_end/ask_admins/destroy.js.erb | 1 + .../panel/ask/back_end/ask_admins/edit.js.erb | 1 + .../ask/back_end/ask_admins/index.html.erb | 23 ++++++++ .../ask/back_end/ask_admins/update.js.erb | 4 ++ .../ask/back_end/ask_questions/edit.html.erb | 2 +- .../ask/back_end/ask_replies/create.js.erb | 1 - .../ask/back_end/ask_replies/update.js.erb | 1 - .../front_end/ask_questions/create.html.erb | 5 -- .../ask/front_end/ask_questions/create.js.erb | 7 +++ .../front_end/ask_questions/index.html.erb | 18 +++++-- .../ask/config/locales/en.yml | 10 +++- .../ask/config/locales/zh_tw.yml | 10 +++- vendor/built_in_modules/ask/config/routes.rb | 3 +- vendor/built_in_modules/ask/init.rb | 10 +++- 29 files changed, 285 insertions(+), 28 deletions(-) create mode 100644 app/jobs/send_ask_notice_mail.rb create mode 100644 app/jobs/send_ask_reply_mail.rb create mode 100644 vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_acknowledgements_controller.rb create mode 100644 vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_admins_controller.rb create mode 100644 vendor/built_in_modules/ask/app/models/ask_acknowledgement.rb create mode 100644 vendor/built_in_modules/ask/app/models/ask_admin.rb create mode 100644 vendor/built_in_modules/ask/app/views/ask_mailer/notice.html.erb create mode 100644 vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_acknowledgements/index.html.erb create mode 100644 vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/_ask_admin.html.erb create mode 100644 vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/_form.html.erb create mode 100644 vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/create.js.erb create mode 100644 vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/destroy.js.erb create mode 100644 vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/edit.js.erb create mode 100644 vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/index.html.erb create mode 100644 vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/update.js.erb delete mode 100644 vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_replies/create.js.erb delete mode 100644 vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_replies/update.js.erb delete mode 100644 vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/create.html.erb create mode 100644 vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/create.js.erb diff --git a/app/jobs/send_ask_notice_mail.rb b/app/jobs/send_ask_notice_mail.rb new file mode 100644 index 00000000..9a82c7e3 --- /dev/null +++ b/app/jobs/send_ask_notice_mail.rb @@ -0,0 +1,10 @@ +class SendAskNoticeMail + @queue = :mail + + def self.perform(ask_admin_id, ask_question_id) + ask_admin = AskAdmin.find(ask_admin_id) + ask_question = AskQuestion.find(ask_question_id) + AskMailer.notice(ask_admin, ask_question).deliver + end + +end diff --git a/app/jobs/send_ask_reply_mail.rb b/app/jobs/send_ask_reply_mail.rb new file mode 100644 index 00000000..9f892d52 --- /dev/null +++ b/app/jobs/send_ask_reply_mail.rb @@ -0,0 +1,9 @@ +class SendAskReplyMail + @queue = :mail + + def self.perform(ask_question_id) + ask_question = AskQuestion.find(ask_question_id) + AskMailer.reply(ask_question).deliver + end + +end diff --git a/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_acknowledgements_controller.rb b/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_acknowledgements_controller.rb new file mode 100644 index 00000000..c894bb42 --- /dev/null +++ b/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_acknowledgements_controller.rb @@ -0,0 +1,21 @@ +class Panel::Ask::BackEnd::AskAcknowledgementsController < OrbitBackendController + include AdminHelper + include OrbitControllerLib::DivisionForDisable + + def initialize + super + @app_title = 'ask_acknowledgement' + end + + def index + @ask_acknowledgement = AskAcknowledgement.first || AskAcknowledgement.create + @url = panel_ask_back_end_ask_acknowledgement_path(@ask_acknowledgement) + end + + def update + @ask_acknowledgement = AskAcknowledgement.first + @ask_acknowledgement.update_attributes(params[:ask_acknowledgement]) + redirect_to panel_ask_back_end_ask_acknowledgements_path, notice: t('ask.save_success') + end + +end diff --git a/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_admins_controller.rb b/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_admins_controller.rb new file mode 100644 index 00000000..5b79779d --- /dev/null +++ b/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_admins_controller.rb @@ -0,0 +1,54 @@ +class Panel::Ask::BackEnd::AskAdminsController < OrbitBackendController + + include AdminHelper + include OrbitControllerLib::DivisionForDisable + + def initialize + super + @app_title = 'ask_admins' + end + + def index + @ask_admins = AskAdmin.all + @ask_admin = AskAdmin.new + @url = panel_ask_back_end_ask_admins_path + end + + def create + @ask_admin = AskAdmin.new(params[:ask_admin]) + @ask_admin.save + + respond_to do |format| + format.js + end + end + + def edit + @ask_admin = AskAdmin.find(params[:id]) + @url = panel_ask_back_end_ask_admin_path(@ask_admin) + + respond_to do |format| + format.js + end + end + + def update + @ask_admin = AskAdmin.find(params[:id]) + @url = panel_ask_back_end_ask_admin_path(@ask_admin) + @ask_admin.update_attributes(params[:ask_admin]) + + respond_to do |format| + format.js + end + end + + def destroy + @ask_admin = AskAdmin.find(params[:id]) + @ask_admin.destroy + + respond_to do |format| + format.js + end + end + +end diff --git a/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_questions_controller.rb b/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_questions_controller.rb index 7cd5bb9b..bb6b273f 100644 --- a/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_questions_controller.rb +++ b/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_questions_controller.rb @@ -80,6 +80,6 @@ class Panel::Ask::BackEnd::AskQuestionsController < OrbitBackendController ask_question.ask_reply.comment ] end end - send_data csv, type: 'text/csv', filename: "#{t('ask.ask')}#{date_start}-#{date_end}.csv" + send_data csv.encode('Big5'), type: 'text/csv', filename: "Questions-#{date_start}-#{date_end}.csv" end end diff --git a/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_replies_controller.rb b/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_replies_controller.rb index 3d6582b3..2498669c 100644 --- a/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_replies_controller.rb +++ b/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_replies_controller.rb @@ -1,5 +1,3 @@ -require File.expand_path('../../../../../mailers/ask_mailer', __FILE__) - class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController include AdminHelper @@ -16,19 +14,15 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController if @ask_question.ask_reply.send_email? ::AskMailer.reply(@ask_question).deliver end - respond_to do |format| - format.js - end + redirect_to panel_ask_back_end_ask_questions_path, notice: t('ask.reply_success') end def update @ask_reply = AskReply.find(params[:id]) @ask_reply.update_attributes(params[:ask_reply]) if @ask_reply.send_email? - ::AskMailer.reply(@ask_reply.ask_question).deliver - end - respond_to do |format| - format.js + Resque.enqueue(SendAskReplyMail, @reply.ask_question.id) end + redirect_to panel_ask_back_end_ask_questions_path, notice: t('ask.reply_success') end end diff --git a/vendor/built_in_modules/ask/app/controllers/panel/ask/front_end/ask_questions_controller.rb b/vendor/built_in_modules/ask/app/controllers/panel/ask/front_end/ask_questions_controller.rb index 03fb9ae0..5b985a8d 100644 --- a/vendor/built_in_modules/ask/app/controllers/panel/ask/front_end/ask_questions_controller.rb +++ b/vendor/built_in_modules/ask/app/controllers/panel/ask/front_end/ask_questions_controller.rb @@ -14,7 +14,14 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController def create @ask_question = AskQuestion.new(params[:ask_question]) if verify_recaptcha model: @ask_question, private_key: '6Lfl7OESAAAAAD4rl5S16-zjt5yiKNYJ6jsqdwmL' + @ask_acknowledgement = AskAcknowledgement.first @ask_question.save + AskAdmin.all.each do |ask_admin| + Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id) + end + end + respond_to do |format| + format.js end end diff --git a/vendor/built_in_modules/ask/app/mailers/ask_mailer.rb b/vendor/built_in_modules/ask/app/mailers/ask_mailer.rb index 1868688f..5f0ebb88 100644 --- a/vendor/built_in_modules/ask/app/mailers/ask_mailer.rb +++ b/vendor/built_in_modules/ask/app/mailers/ask_mailer.rb @@ -1,4 +1,3 @@ -# encoding: utf-8 class AskMailer < ActionMailer::Base default from: 'orbit_test@rulingcom.com' @@ -6,4 +5,10 @@ class AskMailer < ActionMailer::Base @ask_question = ask_question mail(:to => @ask_question.email, :subject => "#{t('ask.reply')}:#{@ask_question.title}") end + + def notice(ask_admin, ask_question) + @ask_admin = ask_admin + @ask_question = ask_question + mail(:to => @ask_admin.email, :subject => "#{t('ask.new_question')}:#{@ask_question.title}") + end end diff --git a/vendor/built_in_modules/ask/app/models/ask_acknowledgement.rb b/vendor/built_in_modules/ask/app/models/ask_acknowledgement.rb new file mode 100644 index 00000000..6ba7f7bd --- /dev/null +++ b/vendor/built_in_modules/ask/app/models/ask_acknowledgement.rb @@ -0,0 +1,6 @@ +class AskAcknowledgement + include Mongoid::Document + include Mongoid::Timestamps + + field :content, type: String +end diff --git a/vendor/built_in_modules/ask/app/models/ask_admin.rb b/vendor/built_in_modules/ask/app/models/ask_admin.rb new file mode 100644 index 00000000..3d2b6fc5 --- /dev/null +++ b/vendor/built_in_modules/ask/app/models/ask_admin.rb @@ -0,0 +1,6 @@ +class AskAdmin + include Mongoid::Document + include Mongoid::Timestamps + + field :email, type: String +end diff --git a/vendor/built_in_modules/ask/app/views/ask_mailer/notice.html.erb b/vendor/built_in_modules/ask/app/views/ask_mailer/notice.html.erb new file mode 100644 index 00000000..9ddcda5d --- /dev/null +++ b/vendor/built_in_modules/ask/app/views/ask_mailer/notice.html.erb @@ -0,0 +1,35 @@ + + + + + + +

<%= @ask_question.title %>

+ + + + + + + + + + + + + + + + + + + + + + + + + +
<%= AskQuestion.human_attribute_name(:name) %>:<%= @ask_question.name %>
<%= AskQuestion.human_attribute_name(:identity) %>:<%= @ask_question.identity %>
<%= AskQuestion.human_attribute_name(:email) %>:<%= @ask_question.email %>
<%= AskQuestion.human_attribute_name(:phone) %>:<%= @ask_question.phone %>
<%= AskQuestion.human_attribute_name(:tax) %>:<%= @ask_question.tax %>
<%= AskQuestion.human_attribute_name(:content) %>:<%= @ask_question.content %>
+ + diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_acknowledgements/index.html.erb b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_acknowledgements/index.html.erb new file mode 100644 index 00000000..e1583b34 --- /dev/null +++ b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_acknowledgements/index.html.erb @@ -0,0 +1,14 @@ +
+ <%= form_for @ask_acknowledgement, url: @url, html: { class: 'form-horizontal' } do |f| %> +
+ <%= f.label :content, t('ask.acknowledgement'), class: 'control-label' %> +
+ <%= f.text_area :content, rows: 10 %> +
+
+
+ <%= f.submit t('submit'), class: 'btn btn-primary' %> + <%= f.button t('cancel'), type: 'reset', class: 'btn' %> +
+ <% end %> +
diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/_ask_admin.html.erb b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/_ask_admin.html.erb new file mode 100644 index 00000000..a0afbe7d --- /dev/null +++ b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/_ask_admin.html.erb @@ -0,0 +1,13 @@ + + + <%= ask_admin.email %> + <%if at_least_module_manager %> +
+ +
+ <% end -%> + + diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/_form.html.erb b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/_form.html.erb new file mode 100644 index 00000000..c2cea3fe --- /dev/null +++ b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/_form.html.erb @@ -0,0 +1,19 @@ +<%= form_for(@ask_admin, :remote => true, :url => @url) do |f| %> + +

<%= @ask_admin.new_record? ? t(:add) : t(:edit) %>

+ +
+
+ <%= f.label :email, class: 'control-label' %> +
+ <%= f.text_field :email, class: 'input-xxlarge' %> +
+
+
+ +
+ <%= f.submit t(:submit), class: 'btn btn-primary' %> +
+ +<% end %> + diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/create.js.erb b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/create.js.erb new file mode 100644 index 00000000..ff74c733 --- /dev/null +++ b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/create.js.erb @@ -0,0 +1,2 @@ +$('<%= j render :partial => 'ask_admin', :collection => [@ask_admin] %>').appendTo('#ask-admins').hide().fadeIn(); +$("#new_ask_admin")[0].reset(); diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/destroy.js.erb b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/destroy.js.erb new file mode 100644 index 00000000..338cc2fb --- /dev/null +++ b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @ask_admin %>").fadeOut(); diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/edit.js.erb b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/edit.js.erb new file mode 100644 index 00000000..40061b9f --- /dev/null +++ b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/edit.js.erb @@ -0,0 +1 @@ +$("#form > form").replaceWith("<%= j render "form" %>"); diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/index.html.erb b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/index.html.erb new file mode 100644 index 00000000..c73aaea3 --- /dev/null +++ b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/index.html.erb @@ -0,0 +1,23 @@ +<%= flash_messages %> + + + + + <%= render :partial => 'ask_admin', :collection => @ask_admins %> + +
+ +
<%= render :partial => "form" if at_least_module_manager%>
+ diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/update.js.erb b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/update.js.erb new file mode 100644 index 00000000..83abbfa3 --- /dev/null +++ b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_admins/update.js.erb @@ -0,0 +1,4 @@ +$("#<%= dom_id @ask_admin %>").replaceWith("<%= j render :partial => 'ask_admin', :collection => [@ask_admin] %>"); +<% @ask_admin = AskAdmin.new(:display => 'List') # reset for new form %> +$(".edit_ask_admin").replaceWith("<%= j render "form" %>") +$(".new_ask_admin")[0].reset(); diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/edit.html.erb b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/edit.html.erb index c962c166..cf4fa408 100644 --- a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/edit.html.erb +++ b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/edit.html.erb @@ -1,5 +1,5 @@
- <%= form_for @ask_question.ask_reply, url: @url, remote: true do |f| %> + <%= form_for @ask_question.ask_reply, url: @url do |f| %> diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_replies/create.js.erb b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_replies/create.js.erb deleted file mode 100644 index d9cd3d5f..00000000 --- a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_replies/create.js.erb +++ /dev/null @@ -1 +0,0 @@ -alert('<%= t('ask.reply_success') %>'); diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_replies/update.js.erb b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_replies/update.js.erb deleted file mode 100644 index d9cd3d5f..00000000 --- a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_replies/update.js.erb +++ /dev/null @@ -1 +0,0 @@ -alert('<%= t('ask.reply_success') %>'); diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/create.html.erb b/vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/create.html.erb deleted file mode 100644 index a310ecce..00000000 --- a/vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/create.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<% if @ask_question.errors.empty? %> - alert('<%= t('ask.ask_question_success') %>'); -<% else %> - alert('<%= @ask_question.errors.full_messages.join('\n') %>'); -<% end %> diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/create.js.erb b/vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/create.js.erb new file mode 100644 index 00000000..57fcc5ac --- /dev/null +++ b/vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/create.js.erb @@ -0,0 +1,7 @@ +<% if @ask_question.errors.empty? %> + $('#acknowledgement').html('

<%= t('ask.save_success') %>!

<%= @ask_acknowledgement.content %>

'); + $('html,body').scrollTop(0); +<% else %> + alert('<%= @ask_question.errors.full_messages.join('\n') %>'); + Recaptcha.reload() +<% end %> diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/index.html.erb b/vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/index.html.erb index e38359fe..2a6cc873 100644 --- a/vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/index.html.erb +++ b/vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/index.html.erb @@ -1,4 +1,11 @@ +
+
<%= form_for @ask_question, url: panel_ask_front_end_ask_questions_path(standalone: true), remote: true, html: {class: 'form-horizontal'} do |f| %>
@@ -16,7 +23,11 @@
<%= f.label :identity, class: 'control-label required' %>
- <%= f.text_field :identity %> + <%= f.select :identity, options_for_select( [t('ask.teacher'), + t('ask.stuff'), + t('ask.student'), + t('ask.schoolfellow'), + t('ask.others')].map{|i| [i, i]} ) %>
@@ -67,10 +78,7 @@ }); $('#new-ask-question form') .submit(function() { - $.post($(this).attr('action'), $(this).serializeArray(), function(response) { - eval(response) - Recaptcha.reload() - }); + $.post($(this).attr('action'), $(this).serializeArray()); return false; }); }); diff --git a/vendor/built_in_modules/ask/config/locales/en.yml b/vendor/built_in_modules/ask/config/locales/en.yml index faab2903..8ff7dc55 100644 --- a/vendor/built_in_modules/ask/config/locales/en.yml +++ b/vendor/built_in_modules/ask/config/locales/en.yml @@ -7,7 +7,15 @@ en: to: To widget: index: Form - ask_question_success: Successfully saved,jump back now + save_success: Successfully saved + teacher: Teacher + stuff: Stuff + student: Student + schoolfellow: Schoolfellow + others: Others + acknowledgement: Acknowledgement + admin: Administrator + new_question: New question mongoid: attributes: ask_question: diff --git a/vendor/built_in_modules/ask/config/locales/zh_tw.yml b/vendor/built_in_modules/ask/config/locales/zh_tw.yml index c463cccd..7d597233 100644 --- a/vendor/built_in_modules/ask/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/ask/config/locales/zh_tw.yml @@ -12,7 +12,15 @@ zh_tw: no: 否 widget: index: 表單 - ask_question_success: 儲存成功 + save_success: 儲存成功 + teacher: 教師 + stuff: 職員 + student: 學生 + schoolfellow: 校友 + others: 其他 + acknowledgement: 感謝詞 + admin: 管理者 + new_question: 新的發問 mongoid: attributes: ask_question: diff --git a/vendor/built_in_modules/ask/config/routes.rb b/vendor/built_in_modules/ask/config/routes.rb index a6d2d3aa..6ba0ed45 100644 --- a/vendor/built_in_modules/ask/config/routes.rb +++ b/vendor/built_in_modules/ask/config/routes.rb @@ -12,8 +12,9 @@ Rails.application.routes.draw do resources :ask_replies end - resources :ask_categories + resources :ask_acknowledgements + resources :ask_admins end namespace :front_end do diff --git a/vendor/built_in_modules/ask/init.rb b/vendor/built_in_modules/ask/init.rb index 8ef6526f..0b20d558 100644 --- a/vendor/built_in_modules/ask/init.rb +++ b/vendor/built_in_modules/ask/init.rb @@ -22,7 +22,7 @@ module Ask end side_bar do - head_label_i18n 'ask.ask', icon_class: 'icons-text' + head_label_i18n 'ask.ask', icon_class: 'icons-light-bulb' available_for [:admin,:manager,:sub_manager] active_for_controllers({ private: ['ask_questions'] }) head_link_path "panel_ask_back_end_ask_questions_path" @@ -32,6 +32,14 @@ module Ask active_for_action: {:ask_categories=>:index}, available_for: [:all] + context_link 'ask.acknowledgement', link_path: 'panel_ask_back_end_ask_acknowledgements_path', + priority: 1, + available_for: [:all] + + context_link 'ask.admin', link_path: 'panel_ask_back_end_ask_admins_path', + priority: 1, + available_for: [:all] + context_link 'ask.export', link_path: 'export_panel_ask_back_end_ask_questions_path', priority: 1, available_for: [:all]
<%= AskQuestion.human_attribute_name(:name) %>:<%= @ask_question.name %>