From d87fae457b3ac1287d30db20f5475556ca4036ab Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Thu, 14 Dec 2017 17:48:04 +0100 Subject: [PATCH] More slim converts --- .slim-lint.yml | 33 +++++++++++++++++++ app/views/account/_login_text.html.slim | 6 ++-- app/views/issues/_change_author.html.erb | 8 ----- app/views/issues/_change_author.html.slim | 5 +++ app/views/issues/_change_author_bulk.html.erb | 6 ---- .../issues/_change_author_bulk.html.slim | 4 +++ app/views/issues/_new_ticket_message.html.erb | 7 ---- .../issues/_new_ticket_message.html.slim | 3 ++ app/views/projects/_members_box.html.slim | 18 +++++----- app/views/welcome/_overview_bottom.html.slim | 8 ++--- app/views/welcome/_overview_right.html.slim | 6 ++-- app/views/welcome/_overview_top.html.slim | 6 ++-- 12 files changed, 67 insertions(+), 43 deletions(-) delete mode 100644 app/views/issues/_change_author.html.erb create mode 100644 app/views/issues/_change_author.html.slim delete mode 100644 app/views/issues/_change_author_bulk.html.erb create mode 100644 app/views/issues/_change_author_bulk.html.slim delete mode 100644 app/views/issues/_new_ticket_message.html.erb create mode 100644 app/views/issues/_new_ticket_message.html.slim diff --git a/.slim-lint.yml b/.slim-lint.yml index e770df49..18027360 100644 --- a/.slim-lint.yml +++ b/.slim-lint.yml @@ -1,3 +1,36 @@ linters: LineLength: max: 140 + RuboCop: + ignored_cops: + - Layout/AlignArray + - Layout/AlignHash + - Layout/AlignParameters + - Layout/BlockEndNewline + - Layout/FirstParameterIndentation + - Layout/IndentArray + - Layout/IndentationConsistency + - Layout/IndentationWidth + - Layout/IndentHash + - Layout/MultilineArrayBraceLayout + - Layout/MultilineAssignmentLayout + - Layout/MultilineBlockLayout + - Layout/MultilineHashBraceLayout + - Layout/MultilineMethodCallBraceLayout + - Layout/MultilineMethodCallIndentation + - Layout/MultilineMethodDefinitionBraceLayout + - Layout/MultilineOperationIndentation + - Layout/TrailingBlankLines + - Layout/TrailingWhitespace + - Lint/BlockAlignment + - Lint/EndAlignment + - Lint/Void + - Metrics/BlockLength + - Metrics/BlockNesting + - Metrics/LineLength + - Naming/FileName + - Rails/OutputSafety + - Style/FrozenStringLiteralComment + - Style/IfUnlessModifier + - Style/Next + - Style/WhileUntilModifier diff --git a/app/views/account/_login_text.html.slim b/app/views/account/_login_text.html.slim index cae7fd97..7d03053f 100644 --- a/app/views/account/_login_text.html.slim +++ b/app/views/account/_login_text.html.slim @@ -1,5 +1,5 @@ - login_text = Additionals.settings[:account_login_bottom] - if login_text.present? - br - .login-additionals - = textilizable(login_text) + br + .login-additionals + = textilizable(login_text) diff --git a/app/views/issues/_change_author.html.erb b/app/views/issues/_change_author.html.erb deleted file mode 100644 index c2adf755..00000000 --- a/app/views/issues/_change_author.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<% if show_issue_change_author?(issue) && issue.safe_attribute?('author_id') %> -

<%= form.select :author_id, issue_author_options_for_select(issue.project, issue), { required: true } %>

- -<%= javascript_tag do %> -$('#change_author').insertBefore($('#issue_tracker_id').parent()); -<% end %> - -<% end %> diff --git a/app/views/issues/_change_author.html.slim b/app/views/issues/_change_author.html.slim new file mode 100644 index 00000000..5bf8159b --- /dev/null +++ b/app/views/issues/_change_author.html.slim @@ -0,0 +1,5 @@ +- if show_issue_change_author?(issue) && issue.safe_attribute?('author_id') + p#change_author + = form.select :author_id, issue_author_options_for_select(issue.project, issue), { required: true } + javascript: + $('#change_author').insertBefore($('#issue_tracker_id').parent()); diff --git a/app/views/issues/_change_author_bulk.html.erb b/app/views/issues/_change_author_bulk.html.erb deleted file mode 100644 index c02d628d..00000000 --- a/app/views/issues/_change_author_bulk.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<% if @project && User.current.allowed_to?(:edit_issue_author, @project) %> -

- <%= label_tag('issue[author_id]', l(:field_author)) %> - <%= select_tag('issue[author_id]', content_tag('option', l(:label_no_change_option), :value => '') + issue_author_options_for_select(@project)) %> -

-<% end %> diff --git a/app/views/issues/_change_author_bulk.html.slim b/app/views/issues/_change_author_bulk.html.slim new file mode 100644 index 00000000..83a36d05 --- /dev/null +++ b/app/views/issues/_change_author_bulk.html.slim @@ -0,0 +1,4 @@ +- if @project && User.current.allowed_to?(:edit_issue_author, @project) + p#change_author + = label_tag('issue[author_id]', l(:field_author)) + = select_tag('issue[author_id]', content_tag('option', l(:label_no_change_option), value: '') + issue_author_options_for_select(@project)) diff --git a/app/views/issues/_new_ticket_message.html.erb b/app/views/issues/_new_ticket_message.html.erb deleted file mode 100644 index 6922e900..00000000 --- a/app/views/issues/_new_ticket_message.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% unless @issue.new_ticket_message.blank? %> - -
- <%= textilizable(@issue.new_ticket_message).html_safe %> -
- -<% end %> \ No newline at end of file diff --git a/app/views/issues/_new_ticket_message.html.slim b/app/views/issues/_new_ticket_message.html.slim new file mode 100644 index 00000000..a7a46063 --- /dev/null +++ b/app/views/issues/_new_ticket_message.html.slim @@ -0,0 +1,3 @@ +- unless @issue.new_ticket_message.blank? + .nodata.nodata-left + = textilizable(@issue.new_ticket_message).html_safe diff --git a/app/views/projects/_members_box.html.slim b/app/views/projects/_members_box.html.slim index ce7e4bd5..6561519b 100644 --- a/app/views/projects/_members_box.html.slim +++ b/app/views/projects/_members_box.html.slim @@ -1,11 +1,11 @@ - if @users_by_role.any? - view_roles = memberbox_view_roles - - if view_roles.count>0 - .members.box - h3 = l(:label_member_plural) - p - - view_roles.each do |role| - = h role - ' : - = @users_by_role[role].sort.collect{|u| link_to_user u}.join(', ').html_safe - br + - if view_roles.count > 0 + .members.box + h3 = l(:label_member_plural) + p + - view_roles.each do |role| + = h role + ' : + = @users_by_role[role].sort.collect { |u| link_to_user u }.join(', ').html_safe + br diff --git a/app/views/welcome/_overview_bottom.html.slim b/app/views/welcome/_overview_bottom.html.slim index 0f52d252..537c085c 100644 --- a/app/views/welcome/_overview_bottom.html.slim +++ b/app/views/welcome/_overview_bottom.html.slim @@ -1,5 +1,5 @@ - overview_bottom = Additionals.settings[:overview_bottom] -- unless overview_bottom.blank? - .clear_both - .overview-bottom.wiki.box - = textilizable(overview_bottom) +- if overview_bottom.present? + .clear_both + .overview-bottom.wiki.box + = textilizable(overview_bottom) diff --git a/app/views/welcome/_overview_right.html.slim b/app/views/welcome/_overview_right.html.slim index 97976883..98afad98 100644 --- a/app/views/welcome/_overview_right.html.slim +++ b/app/views/welcome/_overview_right.html.slim @@ -1,4 +1,4 @@ - overview_right = Additionals.settings[:overview_right] -- unless overview_right.blank? - .overview-right.wiki.box - = textilizable(overview_right) +- if overview_right.present? + .overview-right.wiki.box + = textilizable(overview_right) diff --git a/app/views/welcome/_overview_top.html.slim b/app/views/welcome/_overview_top.html.slim index 3e5289c9..3a38f9f9 100644 --- a/app/views/welcome/_overview_top.html.slim +++ b/app/views/welcome/_overview_top.html.slim @@ -1,4 +1,4 @@ - overview_top = Additionals.settings[:overview_top] -- unless overview_top.blank? - .overview-top.wiki.box - = textilizable(overview_top) +- if overview_top.present? + .overview-top.wiki.box + = textilizable(overview_top)