Add enterprise limit modal

This commit is contained in:
Matt-Yorkley
2018-01-23 20:02:55 +00:00
parent 5c046b76f0
commit d52f9fd43f
5 changed files with 21 additions and 5 deletions

View File

@@ -0,0 +1,11 @@
angular.module('admin.enterprises').directive 'enterpriseLimit', (InfoDialog) ->
restrict: 'A'
scope: {
limit_reached: '=enterpriseLimit',
modal_message: '@modalMessage'
}
link: (scope, element, attr) ->
element.bind 'click', (event)->
if scope.limit_reached
event.preventDefault()
InfoDialog.open 'error', scope.modal_message

View File

@@ -2,7 +2,7 @@
- if flash[:action]
%p= flash[:action]
= form_for @enterprise_set, url: main_app.bulk_update_admin_enterprises_path, html: {"ng-app" => "admin.enterprises"} do |f|
= form_for @enterprise_set, url: main_app.bulk_update_admin_enterprises_path do |f|
%table#listing_enterprises.index
%colgroup
%col{style: "width: 25%;"}/

View File

@@ -1,4 +1,4 @@
%div{ ng: { app: 'admin.enterprises', controller: 'enterprisesCtrl' } }
%div{ ng: { controller: 'enterprisesCtrl' } }
.row{ 'ng-hide' => '!loaded' }
.controls{ :class => "sixteen columns alpha", :style => "margin-bottom: 15px;" }
.four.columns.alpha

View File

@@ -1,12 +1,16 @@
- content_for :page_title do
= t('.title')
- content_for :app_wrapper_attrs do
= "ng-app='admin.enterprises'"
- content_for :page_actions do
= render 'admin/shared/user_guide_link'
- if spree_current_user.can_own_more_enterprises?
%li#new_product_link
= button_link_to t('.new_enterprise'), main_app.new_admin_enterprise_path, icon: 'icon-plus', id: 'admin_new_enterprise_link'
%li#new_product_link
- button_href = spree_current_user.can_own_more_enterprises? ? main_app.new_admin_enterprise_path : '#'
- modal_message = t('js.admin.enterprise_limit_reached', contact_email: ContentConfig.footer_email)
= button_link_to t('.new_enterprise'), button_href, icon: 'icon-plus', id: 'admin_new_enterprise_link', 'enterprise-limit' => !spree_current_user.can_own_more_enterprises?, 'modal-message' => modal_message
= admin_inject_monthly_bill_description
= admin_inject_column_preferences module: 'admin.enterprises', action: "enterprises_index"

View File

@@ -2203,6 +2203,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
resolve_errors: Please resolve the following errors
more_items: "+ %{count} More"
admin:
enterprise_limit_reached: "You have reached your enterprise limit. Write to %{contact_email} if you need to increase it."
modals:
got_it: Got it
tag_rule_help: