Skip to content

Commit

Permalink
import logic
Browse files Browse the repository at this point in the history
  • Loading branch information
qinmingyuan committed Dec 5, 2023
1 parent cdfa363 commit 9e22021
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 12 deletions.
7 changes: 5 additions & 2 deletions app/views/datum/panel/table_lists/_button.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<% if @data_list.type == 'Datum::DataImport' %>
<%= link_to 'Import', { action: 'new_import' }, data: { turbo_frame: 'modal' }, class: 'button is-primary' %>
<%= button_to({ action: 'new_import' }, class: 'button is-small is-primary') do %>
<i class="fa-solid fa-plus"></i>
<span class="pl-1"><%= t('.new_import.title') %></span>
<% end %>
<% else %>
<%= link_to({ action: 'new'}, data: { turbo_frame: 'modal' }, class: 'button is-link') do %>
<%= button_to({ action: 'new'}, class: 'button is-small is-link') do %>
<i class="fa-solid fa-plus"></i>
<span class="pl-1"><%= t('.new.title') %></span>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<li><%= link_to t('.data_lists.index.title'), { controller: 'data_lists', type: @data_list.type } %></li>
<li><%= link_to t('.data_exports.index.title'), { controller: 'data_exports' } %></li>
<li class="is-active"><%= t('.title') %></li>
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
<%= turbo_stream.append 'body' do %>
<div data-controller="visit"></div>
<% end %>
<%= turbo_stream.append 'body', partial: 'visit' %>
4 changes: 3 additions & 1 deletion app/views/datum/panel/table_lists/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<%= render layout: 'index_table', locals: { cache_key: Datum::TableList.column_names.hash } do %>
<%= render 'index_actions' %>

<%= render layout: 'index_table' do %>
<%= render partial: 'index_tbody', layout: 'index_tr', collection: @table_lists, as: :model %>
<% end %>

Expand Down
3 changes: 0 additions & 3 deletions app/views/datum/panel/table_lists/new_import.html.erb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= turbo_stream.append 'body', partial: 'import', layout: 'modal' %>
4 changes: 4 additions & 0 deletions config/locales/en.controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ en:
index:
title: Reports
table_lists:
index:
title: Tables
new_import:
title: Import
find:
title: Report
run:
Expand Down
4 changes: 2 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
resources :table_lists do
collection do
get :direct
get 'import' => :new_import
post 'import' => :create_import
match :new_import, via: [:get, :post]
post :create_import
end
member do
match :chart, via: [:get, :post]
Expand Down

0 comments on commit 9e22021

Please sign in to comment.