mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-10 23:07:47 +00:00
Only serializing unresolved enterprise issues, styling tweaks and fixes for index
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
angular.module("admin.enterprises").controller "EnterpriseIndexRowCtrl", ($scope) ->
|
||||
$scope.statusText = ->
|
||||
issueCount = (issue for issue in $scope.enterprise.issues when !issue.resolved).length
|
||||
if issueCount > 0
|
||||
$scope.statusClass = "issue"
|
||||
$scope.status = ->
|
||||
if $scope.enterprise.issues.length > 0
|
||||
"issue"
|
||||
else if $scope.enterprise.warnings.length > 0
|
||||
"warning"
|
||||
else
|
||||
warningCount = (warning for warning in $scope.enterprise.warnings when !warning.resolved).length
|
||||
if warningCount > 0
|
||||
$scope.statusClass = "warning"
|
||||
else
|
||||
$scope.statusClass = "ok"
|
||||
"ok"
|
||||
|
||||
|
||||
$scope.producerText = ->
|
||||
@@ -42,7 +39,6 @@ angular.module("admin.enterprises").controller "EnterpriseIndexRowCtrl", ($scope
|
||||
$scope.updateRowText = ->
|
||||
$scope.producer = $scope.producerText()
|
||||
$scope.package = $scope.packageText()
|
||||
$scope.status = $scope.statusText()
|
||||
$scope.producerError = ($scope.producer == "Choose")
|
||||
$scope.packageError = ($scope.package == "Choose")
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
angular.module("admin.enterprises").controller 'indexStatusPanelCtrl', ($scope, $filter) ->
|
||||
$scope.issues = $filter('filter')($scope.object.issues, {resolved: false })
|
||||
$scope.warnings = $filter('filter')($scope.object.warnings, {resolved: false})
|
||||
$scope.issues = $scope.object.issues
|
||||
$scope.warnings = $scope.object.warnings
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
%td.resolve
|
||||
%div{ ng: { bind: { html: "issue.link" } } }
|
||||
%tr{ ng: { repeat: "warning in warnings"} }
|
||||
%td.severity.text-center
|
||||
%td.severity
|
||||
%i.icon-warning-sign.warning
|
||||
%td.description
|
||||
%span{ bo: { bind: "warning.description" } }
|
||||
|
||||
@@ -96,6 +96,8 @@
|
||||
}
|
||||
|
||||
td.severity {
|
||||
text-align: center;
|
||||
|
||||
i {
|
||||
font-size: 1.5rem;
|
||||
|
||||
|
||||
@@ -59,16 +59,6 @@ tr.panel-toggle-row {
|
||||
}
|
||||
}
|
||||
|
||||
&.selected {
|
||||
background-color: #ffffff;
|
||||
border-left: 2px solid #444444;
|
||||
border-right: 2px solid #444444;
|
||||
border-top: 2px solid #444444;
|
||||
* {
|
||||
color: #1b3c56;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
background-color: #d0e2f6;
|
||||
@@ -87,10 +77,23 @@ tr.panel-toggle-row {
|
||||
border-bottom: 2px solid #444444;
|
||||
|
||||
&.selected {
|
||||
background-color: #ffffff;
|
||||
border-left: 2px solid #444444;
|
||||
border-right: 2px solid #444444;
|
||||
border-top: 2px solid #444444;
|
||||
border-bottom: none;
|
||||
|
||||
&:hover {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
* {
|
||||
color: #1b3c56;
|
||||
}
|
||||
|
||||
i.status::before {
|
||||
opacity: 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,32 +23,34 @@ class Api::Admin::IndexEnterpriseSerializer < ActiveModel::Serializer
|
||||
end
|
||||
|
||||
def issues
|
||||
[
|
||||
{
|
||||
resolved: shipping_methods_ok?,
|
||||
description: "#{object.name} currently has no shipping methods.",
|
||||
link: "<a class='button fullwidth' href='#{spree.new_admin_shipping_method_path}'>Create New</a>"
|
||||
},
|
||||
{
|
||||
resolved: payment_methods_ok?,
|
||||
description: "#{object.name} currently has no payment methods.",
|
||||
link: "<a class='button fullwidth' href='#{spree.new_admin_payment_method_path}'>Create New</a>"
|
||||
},
|
||||
{
|
||||
resolved: object.confirmed?,
|
||||
description: "Email confirmation is pending. We've sent a confirmation email to #{object.email}.",
|
||||
link: "<a class='button fullwidth' href='#{enterprise_confirmation_path(enterprise: { id: object.id, email: object.email } )}' method='post'>Resend Email</a>"
|
||||
}
|
||||
]
|
||||
issues = []
|
||||
|
||||
issues << {
|
||||
description: "#{object.name} currently has no shipping methods.",
|
||||
link: "<a class='button fullwidth' href='#{spree.new_admin_shipping_method_path}'>Create New</a>"
|
||||
} unless shipping_methods_ok?
|
||||
|
||||
issues << {
|
||||
description: "#{object.name} currently has no payment methods.",
|
||||
link: "<a class='button fullwidth' href='#{spree.new_admin_payment_method_path}'>Create New</a>"
|
||||
} unless shipping_methods_ok?
|
||||
|
||||
issues << {
|
||||
description: "Email confirmation is pending. We've sent a confirmation email to #{object.email}.",
|
||||
link: "<a class='button fullwidth' href='#{enterprise_confirmation_path(enterprise: { id: object.id, email: object.email } )}' method='post'>Resend Email</a>"
|
||||
} unless object.confirmed?
|
||||
|
||||
issues
|
||||
end
|
||||
|
||||
def warnings
|
||||
[
|
||||
{
|
||||
resolved: object.visible,
|
||||
description: "#{object.name} is not visible and so cannot be found on the map or in searches",
|
||||
link: "<a class='button fullwidth' href='#{edit_admin_enterprise_path(object)}'>Edit</a>"
|
||||
}
|
||||
]
|
||||
warnings = []
|
||||
|
||||
warnings << {
|
||||
description: "#{object.name} is not visible and so cannot be found on the map or in searches",
|
||||
link: "<a class='button fullwidth' href='#{edit_admin_enterprise_path(object)}'>Edit</a>"
|
||||
} unless object.visible
|
||||
|
||||
warnings
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
%h5{ ng: { bind: "producer" } }
|
||||
%td.package.panel-toggle.text-center{ ng: { show: 'columns.package.visible', class: "{error: packageError}" }, name: "package" }
|
||||
%h5{ ng: { bind: "package" } }
|
||||
%td.status.panel-toggle.text-center{ ng: { show: 'columns.status.visible' }, bo: { class: "statusClass" }, name: "status" }
|
||||
%td.status.panel-toggle.text-center{ ng: { show: 'columns.status.visible' }, name: "status" }
|
||||
%i.status{ bo: { class: "status" } }
|
||||
%td.manage{ ng: { show: 'columns.manage.visible' } }
|
||||
%a.button.fullwidth{ bo: { href: 'enterprise.edit_path' } }
|
||||
|
||||
Reference in New Issue
Block a user