Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorHeinrich Lee Yu <heinrich@gitlab.com>2018-12-06 03:51:30 +0300
committerHeinrich Lee Yu <hleeyu@gmail.com>2019-01-07 06:16:58 +0300
commit3c026971149c95f076b8c50a52ddbfed139d5b20 (patch)
tree6bf0e1e8e28968887156dd524dc37e498229a9e6 /app/views
parent876ab436fabf2f44e2a6912262f980256b7c9736 (diff)
Import CSV Backend
Process CSV uploads async using a worker then email results
Diffstat (limited to 'app/views')
-rw-r--r--app/views/notify/import_issues_csv_email.html.haml18
-rw-r--r--app/views/notify/import_issues_csv_email.text.erb11
-rw-r--r--app/views/projects/issues/_nav_btns.html.haml2
-rw-r--r--app/views/projects/issues/import_csv/_modal.html.haml4
4 files changed, 32 insertions, 3 deletions
diff --git a/app/views/notify/import_issues_csv_email.html.haml b/app/views/notify/import_issues_csv_email.html.haml
new file mode 100644
index 00000000000..a6a797a5fb7
--- /dev/null
+++ b/app/views/notify/import_issues_csv_email.html.haml
@@ -0,0 +1,18 @@
+- text_style = 'font-size:16px; text-align:center; line-height:30px;'
+
+%p{ style: text_style }
+ Your CSV import for project
+ %a{ href: project_url(@project), style: "color:#3777b0; text-decoration:none;" }
+ = @project.full_name
+ has been completed.
+
+%p{ style: text_style }
+ #{pluralize(@results[:success], 'issue')} imported successfully.
+
+- if @results[:errors].present?
+ %p{ style: text_style }
+ Errors found on line #{'number'.pluralize(@results[:errors].size)}: #{@results[:errors].join(', ')}.
+
+- unless @results[:valid_file]
+ %p{ style: text_style }
+ Error parsing CSV file.
diff --git a/app/views/notify/import_issues_csv_email.text.erb b/app/views/notify/import_issues_csv_email.text.erb
new file mode 100644
index 00000000000..54a1762c4ec
--- /dev/null
+++ b/app/views/notify/import_issues_csv_email.text.erb
@@ -0,0 +1,11 @@
+Your CSV import for project <%= @project.full_name %> (<%= project_url(@project) %>) has been completed.
+
+<%= pluralize(@results[:success], 'issue') %> imported successfully.
+
+<% if @results[:errors].present? %>
+Errors found on line <%= 'number'.pluralize(@results[:errors].size) %>: <%= @results[:errors].join(', ') %>.
+<% end %>
+
+<% unless @results[:valid_file] %>
+Error parsing CSV file.
+<% end %>
diff --git a/app/views/projects/issues/_nav_btns.html.haml b/app/views/projects/issues/_nav_btns.html.haml
index 4a4b8a9fcad..fd6559e37ba 100644
--- a/app/views/projects/issues/_nav_btns.html.haml
+++ b/app/views/projects/issues/_nav_btns.html.haml
@@ -1,5 +1,5 @@
- show_feed_buttons = local_assigns.fetch(:show_feed_buttons, true)
-- show_import_button = local_assigns.fetch(:show_import_button, true) && Feature.enabled?(:issues_import_csv)
+- show_import_button = local_assigns.fetch(:show_import_button, true) && Feature.enabled?(:issues_import_csv) && can?(current_user, :import_issues, @project)
- show_export_button = local_assigns.fetch(:show_export_button, true)
.nav-controls.issues-nav-controls
diff --git a/app/views/projects/issues/import_csv/_modal.html.haml b/app/views/projects/issues/import_csv/_modal.html.haml
index e8576a2f17d..03a6c79ff74 100644
--- a/app/views/projects/issues/import_csv/_modal.html.haml
+++ b/app/views/projects/issues/import_csv/_modal.html.haml
@@ -13,9 +13,9 @@
%p
= _("Your issues will be imported in the background. Once finished, you'll get a confirmation email.")
.form-group
- = label_tag :file, _('Upload CSV File'), class: 'label-bold'
+ = label_tag :file, _('Upload CSV file'), class: 'label-bold'
%div
- = file_field_tag :file, accept: '.csv', required: true
+ = file_field_tag :file, accept: 'text/csv', required: true
%p.text-secondary
= _('It must have a header row and at least two columns: the first column is the issue title and the second column is the issue description. The separator is automatically detected.')
%p.text-secondary