Add routing and links for import

This commit is contained in:
Bernie Chiu 2013-10-16 17:03:18 +08:00 committed by Manson Wang
parent 83a8433e52
commit e2ec8f134e
6 changed files with 30 additions and 0 deletions

View File

@ -85,6 +85,13 @@ class Panel::Survey::BackEnd::SurveysController < OrbitBackendController
redirect_to panel_survey_back_end_surveys_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
def set_import
@survey = ::Survey.find(params[:id])
end
def import
end
def export
@survey = ::Survey.find(params[:id])
@chart_data, @survey_questions, @survey_answers = @survey.generate_chart_data

View File

@ -14,6 +14,7 @@
<li><%= link_to t('survey.jump'), jump_panel_survey_back_end_survey_path(survey, :page => params[:page]) %></li>
<li><%= link_to t('survey.set_answers'), set_answers_panel_survey_back_end_survey_path(survey, :page => params[:page]) %></li>
<li><%= link_to t('survey.export_csv'), export_panel_survey_back_end_survey_path(survey, :format => :csv), :target => '_blank' %></li>
<li><%= link_to t('survey.import_csv'), set_import_panel_survey_back_end_survey_path(survey), :target => '_blank' %></li>
<li><%= link_to t('survey.chart'), result_panel_survey_front_end_survey_path(survey, :force_chart => true, :standalone => true), :target => '_blank' %></li>
<li><%= link_to t(:delete_), panel_survey_back_end_survey_path(survey), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
<% end -%>

View File

@ -0,0 +1,18 @@
<%= form_tag import_panel_survey_back_end_survey_path(@survey), multipart: true do %>
<table class="table main-list">
<thead>
<tr>
<th class="span2">匯入的問卷</th>
<th class="span2">原始匯出檔案</th>
<th class="span2"></th>
</tr>
</thead>
<tbody id="tbody_surveys" class="sort-holder">
<tr>
<td><%= @survey.title %></td>
<td><%= file_field_tag :file %></td>
<td><%= submit_tag t("survey.import_csv"), :class => 'btn' %></td>
</tr>
</tbody>
</table>
<% end %>

View File

@ -23,6 +23,7 @@ en:
answers_list: Answers List
export_csv: Export CSV
import_csv: Import CSV
chart: Chart
set_answers: Set Answers
duplicate_it: Duplicate It

View File

@ -24,6 +24,7 @@ zh_tw:
answers_list: 結果清單
export_csv: 匯出CSV
import_csv: 匯入CSV
chart: 結果圖表
set_answers: 設定結果
duplicate_it: 複製問卷

View File

@ -9,6 +9,8 @@ Rails.application.routes.draw do
end
member do
get 'export'
get 'set_import'
post 'import'
get 'set_answers'
get 'jump'
get 'duplicate_it'