mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
Add a new column email_address to enterprises. Use this new field for public display of contact details. The old field enterprise.email is still used internally. It is still displayed on orders and emails sent to customers. A new enterprise has the owner's email address by default now. Fix GH #757
70 lines
2.6 KiB
Plaintext
70 lines
2.6 KiB
Plaintext
- owner_email = @enterprise.andand.owner.andand.email || ""
|
||
- full_permissions = (spree_current_user.admin? || spree_current_user == @enterprise.andand.owner)
|
||
|
||
-if @enterprise.pending_any_confirmation?
|
||
.alert-box
|
||
- email = @enterprise.confirmed? ? @enterprise.unconfirmed_email : @enterprise.email
|
||
Email confirmation is pending.
|
||
We've sent a confirmation email to
|
||
%strong= "#{email}."
|
||
= link_to('Resend', main_app.enterprise_confirmation_path(enterprise: { id: @enterprise.id, email: email } ), method: :post)
|
||
%a.close{ href: "#" } ×
|
||
|
||
.row
|
||
.three.columns.alpha
|
||
=f.label :owner_id, 'Owner'
|
||
- if full_permissions
|
||
%span.required *
|
||
%div{'ofn-with-tip' => "The primary user responsible for this enterprise."}
|
||
%a What's this?
|
||
.eight.columns.omega
|
||
- if full_permissions
|
||
= f.hidden_field :owner_id, class: "select2 fullwidth", 'user-select' => 'Enterprise.owner'
|
||
- else
|
||
= owner_email
|
||
|
||
.row
|
||
.three.columns.alpha
|
||
= f.label :email, 'Notifications'
|
||
- if full_permissions
|
||
%span.required *
|
||
.with-tip{'data-powertip' => "Notifications about orders will be send to this email address."}
|
||
%a What's this?
|
||
.eight.columns.omega
|
||
- if full_permissions
|
||
= f.text_field :email, { placeholder: "eg. gustav@truffles.com", "ng-model" => "Enterprise.email" }
|
||
- else
|
||
= @enterprise.email
|
||
.row{ ng: { hide: "pristineEmail == null || pristineEmail == Enterprise.email"} }
|
||
.alpha.three.columns
|
||
|
||
.omega.eight.columns
|
||
Note: A new email address may need to be confirmed prior to use
|
||
|
||
.row
|
||
.three.columns.alpha
|
||
=f.label :user_ids, 'Managers'
|
||
- if full_permissions
|
||
%span.required *
|
||
%div{'ofn-with-tip' => "The other users with permission to manage this enterprise."}
|
||
%a What's this?
|
||
.eight.columns.omega
|
||
- if full_permissions
|
||
%table
|
||
%tr
|
||
%td
|
||
- # Ignore this input in the submit
|
||
= hidden_field_tag :ignored, :new_manager, class: "select2 fullwidth", 'user-select' => 'newManager', 'ng-model' => 'newManager'
|
||
%td.actions
|
||
%a{ 'ng-click' => 'addManager(newManager)', :class => "icon-plus no-text" }
|
||
%tr.animate-repeat{ ng: { repeat: 'manager in Enterprise.users' }}
|
||
%td
|
||
= hidden_field_tag "enterprise[user_ids][]", nil, multiple: true, 'ng-value' => 'manager.id'
|
||
{{ manager.email }}
|
||
%td.actions
|
||
%a{ 'ng-click' => 'removeManager(manager)', :class => "icon-trash no-text" }
|
||
- else
|
||
- @enterprise.users.each do |manager|
|
||
= manager.email
|
||
%br
|