From 5dc8f21b7b8db7b1871e8b2d7ddb67b5061d368d Mon Sep 17 00:00:00 2001 From: Matt-Yorkley Date: Thu, 27 Jul 2017 13:50:59 +0100 Subject: [PATCH] Show confirmed status in enterprise managers UI --- .../stylesheets/admin/enterprises.css.scss | 22 +++++++++++++++++-- app/serializers/api/admin/user_serializer.rb | 6 ++++- .../admin/enterprises/form/_users.html.haml | 4 +++- config/locales/en.yml | 2 ++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/admin/enterprises.css.scss b/app/assets/stylesheets/admin/enterprises.css.scss index 5768ebaf27..4fdd14e3b7 100644 --- a/app/assets/stylesheets/admin/enterprises.css.scss +++ b/app/assets/stylesheets/admin/enterprises.css.scss @@ -1,3 +1,21 @@ -form[name="enterprise_form"] div.row.warning { - color: #DA7F52; +form[name="enterprise_form"] { + div.row.warning { + color: #DA7F52; + } + + table.managers { + i.confirmation { + float: right; + font-size: 1.5em; + cursor: pointer; + + &.confirmed { + color: #1ece1e; + } + + &.unconfirmed { + color: #ed9524; + } + } + } } diff --git a/app/serializers/api/admin/user_serializer.rb b/app/serializers/api/admin/user_serializer.rb index c080a8fd6a..50ed69433c 100644 --- a/app/serializers/api/admin/user_serializer.rb +++ b/app/serializers/api/admin/user_serializer.rb @@ -1,7 +1,7 @@ require 'open_food_network/last_used_address' class Api::Admin::UserSerializer < ActiveModel::Serializer - attributes :id, :email + attributes :id, :email, :confirmed has_one :ship_address, serializer: Api::AddressSerializer has_one :bill_address, serializer: Api::AddressSerializer @@ -15,4 +15,8 @@ class Api::Admin::UserSerializer < ActiveModel::Serializer object.bill_address || OpenFoodNetwork::LastUsedAddress.new(object.email).last_used_bill_address end + + def confirmed + object.confirmed? + end end diff --git a/app/views/admin/enterprises/form/_users.html.haml b/app/views/admin/enterprises/form/_users.html.haml index 64b728f1e9..02b6bca253 100644 --- a/app/views/admin/enterprises/form/_users.html.haml +++ b/app/views/admin/enterprises/form/_users.html.haml @@ -44,7 +44,7 @@ %a= t('admin.whats_this') .eight.columns.omega - if full_permissions - %table + %table.managers %tr %td - # Ignore this input in the submit @@ -55,6 +55,8 @@ %td = hidden_field_tag "enterprise[user_ids][]", nil, multiple: true, 'ng-value' => 'manager.id' {{ manager.email }} + %i.confirmation.confirmed.fa.fa-check-circle{ 'ofn-with-tip' => t('.email_confirmed'), ng: {show: 'manager.confirmed'} } + %i.confirmation.unconfirmed.fa.fa-exclamation-triangle{ 'ofn-with-tip' => t('.email_not_confirmed'), ng: {show: '!manager.confirmed'} } %td.actions %a{ ng: {click: 'removeManager(manager)', class: "{disabled: manager.id == Enterprise.owner.id}"}, :class => "icon-trash no-text" } - else diff --git a/config/locales/en.yml b/config/locales/en.yml index b566878a54..50f687f18c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -570,6 +570,8 @@ en: notifications_note: 'Note: A new email address may need to be confirmed prior to use' managers: Managers managers_tip: The other users with permission to manage this enterprise. + email_confirmed: "Email confirmed" + email_not_confirmed: "Email not confirmed" actions: edit_profile: Edit Profile properties: Properties