From 730b6156cee66d36650c5f1e91d74c464ea9a4c4 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 10 May 2020 11:35:10 +0200 Subject: [PATCH] Fix lints in app/views/navigation --- app/views/navigation/_feed.haml | 10 ------- app/views/navigation/_guest.haml | 12 ++++---- app/views/navigation/_main.haml | 28 +++++++++---------- app/views/navigation/_moderation.haml | 18 ++++++------ app/views/navigation/_notification.haml | 12 ++++---- app/views/navigation/main/_notifications.haml | 8 +++--- app/views/navigation/main/_profile.haml | 20 ++++++------- 7 files changed, 49 insertions(+), 59 deletions(-) delete mode 100644 app/views/navigation/_feed.haml diff --git a/app/views/navigation/_feed.haml b/app/views/navigation/_feed.haml deleted file mode 100644 index acbfaeec..00000000 --- a/app/views/navigation/_feed.haml +++ /dev/null @@ -1,10 +0,0 @@ -%nav.navbar.navbar-light.navbar-static-top.j2-navbar.d-flex.d-sm-none.bg-white{role: "navigation"} - %a.navbar-brand{href: "/"} Timelines - %button.navbar-toggler{"data-target" => "#j2-tl-navbar-collapse", "data-toggle" => "collapse", type: "button"} - %span.sr-only Toggle navigation - %span.navbar-toggler-icon - #j2-tl-navbar-collapse.collapse.navbar-collapse - %ul.nav.navbar-nav - = nav_entry "Public", public_timeline_path - - current_user.groups.each do |group| - = nav_entry group.display_name, group_timeline_path(group.name) \ No newline at end of file diff --git a/app/views/navigation/_guest.haml b/app/views/navigation/_guest.haml index d06d91c8..a15899c2 100644 --- a/app/views/navigation/_guest.haml +++ b/app/views/navigation/_guest.haml @@ -1,10 +1,10 @@ -%nav.navbar.navbar-dark.navbar-expand-lg.bg-primary.fixed-top{role: "navigation"} - .container{class: ios_web_app? ? "ios-web-app" : ''} - %a.navbar-brand{href: "/"}= APP_CONFIG['site_name'] - %button.navbar-toggler{"data-target" => "#j2-main-navbar-collapse", "data-toggle" => "collapse", type: "button"} +%nav.navbar.navbar-dark.navbar-expand-lg.bg-primary.fixed-top{ role: 'navigation' } + .container{ class: ios_web_app? ? 'ios-web-app' : '' } + %a.navbar-brand{ href: '/' }= APP_CONFIG['site_name'] + %button.navbar-toggler{ data: { target: '#j2-main-navbar-collapse', toggle: :collapse }, type: :button } %span.sr-only Toggle navigation %span.navbar-toggler-icon - #j2-main-navbar-collapse.collapse.navbar-collapse + .collapse.navbar-collapse#j2-main-navbar-collapse %ul.nav.navbar-nav.ml-auto = nav_entry t('views.sessions.create'), new_user_session_path - = nav_entry t('views.sessions.new'), new_user_registration_path \ No newline at end of file + = nav_entry t('views.sessions.new'), new_user_registration_path diff --git a/app/views/navigation/_main.haml b/app/views/navigation/_main.haml index 8e0aea46..9b71da82 100644 --- a/app/views/navigation/_main.haml +++ b/app/views/navigation/_main.haml @@ -1,28 +1,28 @@ -%nav.navbar.navbar-themed.navbar-expand-lg.bg-primary.fixed-top{role: "navigation"} - .container{class: ios_web_app? ? "ios-web-app" : ''} - %a.navbar-brand{href: "/"}= APP_CONFIG['site_name'] - %button.navbar-toggler{"data-target" => "#j2-main-navbar-collapse", "data-toggle" => "collapse", type: "button"} +%nav.navbar.navbar-themed.navbar-expand-lg.bg-primary.fixed-top{ role: 'navigation' } + .container{ class: ios_web_app? ? 'ios-web-app' : '' } + %a.navbar-brand{ href: '/' }= APP_CONFIG['site_name'] + %button.navbar-toggler{ data: { target: '#j2-main-navbar-collapse', toggle: :collapse }, type: :button } %span.sr-only Toggle navigation %span.navbar-toggler-icon - #j2-main-navbar-collapse.collapse.navbar-collapse + .collapse.navbar-collapse#j2-main-navbar-collapse %ul.nav.navbar-nav.mr-auto = nav_entry t('views.navigation.timeline'), root_path - = nav_entry t('views.navigation.inbox'), "/inbox", badge: inbox_count + = nav_entry t('views.navigation.inbox'), '/inbox', badge: inbox_count - if APP_CONFIG.dig(:features, :discover, :enabled) || current_user.mod? = nav_entry t('views.navigation.discover'), discover_path %ul.nav.navbar-nav - unless @user.nil? - unless @user == current_user - %li.nav-item.d-none.d-sm-block{"data-toggle" => "tooltip", "data-placement" => "bottom", title: t('views.actions.group')} - %a.nav-link{href: '#', data: { target: "#modal-group-memberships", toggle: :modal }} + %li.nav-item.d-none.d-sm-block{ data: { toggle: 'tooltip', placement: 'bottom' }, title: t('views.actions.group') } + %a.nav-link{ href: '#', data: { target: '#modal-group-memberships', toggle: :modal } } %i.fa.fa-users.hidden-xs %span.d-none.d-sm-inline.d-md-none= t('views.actions.group') - = render "navigation/main/notifications" - %li.nav-item.d-none.d-sm-block{"data-toggle" => "tooltip", "data-placement" => "bottom", title: t('views.actions.ask_question')} - %a.nav-link{href: "#", name: "toggle-all-ask", "data-target" => "#modal-ask-followers", "data-toggle" => "modal"} + = render 'navigation/main/notifications' + %li.nav-item.d-none.d-sm-block{ data: { toggle: 'tooltip', placement: 'bottom' }, title: t('views.actions.ask_question') } + %a.nav-link{ href: '#', name: 'toggle-all-ask', data: { target: '#modal-ask-followers', toggle: :modal } } %i.fa.fa-pencil-square-o - = render "navigation/main/profile" + = render 'navigation/main/profile' = render 'modal/ask' -%button.btn.btn-primary.btn-fab.d-block.d-sm-none{"data-target" => "#modal-ask-followers", "data-toggle" => "modal", :type => "button"} - %i.fa.fa-pencil-square-o \ No newline at end of file +%button.btn.btn-primary.btn-fab.d-block.d-sm-none{ data: { target: '#modal-ask-followers', toggle: :modal }, type: 'button' } + %i.fa.fa-pencil-square-o diff --git a/app/views/navigation/_moderation.haml b/app/views/navigation/_moderation.haml index e97f466d..1dddb1bc 100644 --- a/app/views/navigation/_moderation.haml +++ b/app/views/navigation/_moderation.haml @@ -1,13 +1,13 @@ -%nav.navbar.navbar-light.bg-light.navbar-static-top.j2-navbar.d-flex.d-sm-none{role: "navigation"} - %a.navbar-brand{href: moderation_path} Moderation - %button.navbar-toggler{"data-target" => "#j2-tl-navbar-collapse", "data-toggle" => "collapse", type: "button"} +%nav.navbar.navbar-light.bg-light.navbar-static-top.j2-navbar.d-flex.d-sm-none{ role: 'navigation' } + %a.navbar-brand{ href: moderation_path } Moderation + %button.navbar-toggler{ data: { target: '#j2-tl-navbar-collapse', toggle: :collapse }, type: :button } %span.sr-only Toggle navigation %span.navbar-toggler-icon - #j2-tl-navbar-collapse.collapse.navbar-collapse + .collapse.navbar-collapse#j2-tl-navbar-collapse %ul.nav.navbar-nav = nav_entry t('views.moderation.tabs.all'), moderation_path - = nav_entry t('views.general.answer').pluralize(2) , moderation_path('answer') - = nav_entry t('views.general.comment').pluralize(2), moderation_path('comment') - = nav_entry t('views.general.user').pluralize(2) , moderation_path('user') - = nav_entry t('views.general.question').pluralize(2), moderation_path('question') - = nav_entry 'Priority', moderation_priority_path + = nav_entry t('views.general.answer').pluralize(2), moderation_path('answer') + = nav_entry t('views.general.comment').pluralize(2), moderation_path('comment') + = nav_entry t('views.general.user').pluralize(2), moderation_path('user') + = nav_entry t('views.general.question').pluralize(2), moderation_path('question') + = nav_entry 'Priority', moderation_priority_path diff --git a/app/views/navigation/_notification.haml b/app/views/navigation/_notification.haml index c2be678a..a1352411 100644 --- a/app/views/navigation/_notification.haml +++ b/app/views/navigation/_notification.haml @@ -1,12 +1,12 @@ -%nav.navbar.navbar-light.bg-white.navbar-static-top.j2-navbar.d-flex.d-sm-none{role: "navigation"} - %a.navbar-brand{href: notifications_path} Notifications - %button.navbar-toggler{"data-target" => "#j2-tl-navbar-collapse", "data-toggle" => "collapse", type: "button"} +%nav.navbar.navbar-light.bg-white.navbar-static-top.d-flex.d-sm-none{ role: 'navigation' } + %a.navbar-brand{ href: notifications_path } Notifications + %button.navbar-toggler{ data: { target: '#j2-tl-navbar-collapse', toggle: :collapse }, type: :button } %span.sr-only Toggle navigation %span.navbar-toggler-icon - #j2-tl-navbar-collapse.collapse.navbar-collapse + .collapse.navbar-collapse#j2-tl-navbar-collapse %ul.nav.navbar-nav - = nav_entry "New Notifications", notifications_path - = nav_entry "All Notifications", notifications_path('all') + = nav_entry 'New Notifications', notifications_path + = nav_entry 'All Notifications', notifications_path('all') = nav_entry t('views.notifications.tabs.answer'), notifications_path('answer') = nav_entry t('views.notifications.tabs.smile'), notifications_path('smile') = nav_entry t('views.notifications.tabs.comment'), notifications_path('comment') diff --git a/app/views/navigation/main/_notifications.haml b/app/views/navigation/main/_notifications.haml index a8b5988a..80f43d9c 100644 --- a/app/views/navigation/main/_notifications.haml +++ b/app/views/navigation/main/_notifications.haml @@ -1,7 +1,7 @@ = nav_entry t('views.navigation.notifications'), notifications_path, badge: notification_count, class: 'd-block d-sm-none' - notifications = Notification.for(current_user).where(new: true).limit(4) %li.nav-item.dropdown.d-none.d-sm-block - %a.nav-link.dropdown-toggle{href: "#", "data-toggle" => "dropdown"} + %a.nav-link.dropdown-toggle{ href: '#', data: { toggle: :dropdown } } - if notification_count.nil? %i.fa.fa-bell-o - else @@ -9,11 +9,11 @@ %span.sr-only Notifications %span.badge= notification_count .dropdown-menu.dropdown-menu-right.notification-dropdown - - if notifications.count == 0 + - if notifications.count.zero? .dropdown-item.text-center.p-2 %i.fa.fa-bell-o.notification__bell-icon %p No new notifications. - %a.dropdown-item.text-center{href: notifications_path('all')} + %a.dropdown-item.text-center{ href: notifications_path('all') } %i.fa.fa-fw.fa-chevron-right Show all notifications - else @@ -21,6 +21,6 @@ .dropdown-item = render "notifications/type/#{notification.target_type.downcase}", notification: notification - %a.dropdown-item.text-center{href: notifications_path} + %a.dropdown-item.text-center{ href: notifications_path } %i.fa.fa-fw.fa-chevron-right Show all new notifications diff --git a/app/views/navigation/main/_profile.haml b/app/views/navigation/main/_profile.haml index 2aef7ad5..ae054665 100644 --- a/app/views/navigation/main/_profile.haml +++ b/app/views/navigation/main/_profile.haml @@ -1,37 +1,37 @@ %li.nav-item.dropdown.profile--image-dropdown - %a.nav-link.dropdown-toggle.p-sm-0{href: "#", "data-toggle" => "dropdown"} - %img.avatar-md.d-none.d-sm-inline{src: current_user.profile_picture.url(:small)} + %a.nav-link.dropdown-toggle.p-sm-0{ href: '#', data: { toggle: :dropdown } } + %img.avatar-md.d-none.d-sm-inline{ src: current_user.profile_picture.url(:small) } %span.d-inline.d-sm-none = current_user.screen_name %b.caret .dropdown-menu %h6.dropdown-header.d-none.d-sm-block= current_user.screen_name - %a.dropdown-item{href: show_user_profile_path(current_user.screen_name)} + %a.dropdown-item{ href: show_user_profile_path(current_user.screen_name) } %i.fa.fa-fw.fa-user = t('views.navigation.show') - %a.dropdown-item{href: edit_user_registration_path} + %a.dropdown-item{ href: edit_user_registration_path } %i.fa.fa-fw.fa-cog = t('views.navigation.settings') .dropdown-divider - if current_user.has_role?(:administrator) - %a.dropdown-item{href: rails_admin_path} + %a.dropdown-item{ href: rails_admin_path } %i.fa.fa-fw.fa-cogs = t('views.navigation.admin') - %a.dropdown-item{href: sidekiq_web_path} + %a.dropdown-item{ href: sidekiq_web_path } %i.fa.fa-fw.fa-bar-chart = t('views.navigation.sidekiq') - %a.dropdown-item{href: pghero_path} + %a.dropdown-item{ href: pghero_path } %i.fa.fa-fw.fa-database Database Monitor - %a.dropdown-item{href: announcement_index_path} + %a.dropdown-item{ href: announcement_index_path } %i.fa.fa-fw.fa-info Announcements .dropdown-divider - if current_user.mod? - %a.dropdown-item{href: moderation_path} + %a.dropdown-item{ href: moderation_path } %i.fa.fa-fw.fa-gavel = t('views.navigation.moderation') .dropdown-divider - %a.dropdown-item{href: destroy_user_session_path, data: {method: :delete} } + %a.dropdown-item{ href: destroy_user_session_path, data: { method: :delete } } %i.fa.fa-fw.fa-sign-out = t 'views.sessions.destroy'