From 2739cf47ba82656b71c44dc24d6ec8531a22830f Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 16 Sep 2015 14:00:06 -0400 Subject: [PATCH] Prevent change visibility of a repo in the UI when disallowed by billing plan Fixes #486 - Extracts out the check plan logic and UI from the new repo page into its own directive (repo-count-checker) - Adds the new directive to the repo settings panel - Some additional UI improvements for the repo settings panel --- .../repo-view/repo-panel-settings.css | 12 +++ .../css/directives/ui/repo-count-checker.css | 26 ++++++ static/directives/repo-count-checker.html | 24 ++++++ .../repo-view/repo-panel-settings.html | 33 +++++--- static/js/directives/ui/repo-count-checker.js | 81 +++++++++++++++++++ static/js/pages/new-repo.js | 76 ----------------- static/js/services/user-service.js | 4 + static/partials/new-repo.html | 26 +----- 8 files changed, 173 insertions(+), 109 deletions(-) create mode 100644 static/css/directives/ui/repo-count-checker.css create mode 100644 static/directives/repo-count-checker.html create mode 100644 static/js/directives/ui/repo-count-checker.js diff --git a/static/css/directives/repo-view/repo-panel-settings.css b/static/css/directives/repo-view/repo-panel-settings.css index ff626b9ba..8925365eb 100644 --- a/static/css/directives/repo-view/repo-panel-settings.css +++ b/static/css/directives/repo-view/repo-panel-settings.css @@ -29,6 +29,18 @@ margin-top: -7px !important; } +.repo-panel-settings-element .repo-count-checker { + margin-top: 20px; +} + +.repo-panel-settings-element .co-alert { + margin-bottom: 0px; +} + +.repo-panel-settings-element .panel-body { + border-bottom: 0px; +} + @media (max-width: 767px) { .repo-panel-settings-element .delete-btn { float: none; diff --git a/static/css/directives/ui/repo-count-checker.css b/static/css/directives/ui/repo-count-checker.css new file mode 100644 index 000000000..d357afdba --- /dev/null +++ b/static/css/directives/ui/repo-count-checker.css @@ -0,0 +1,26 @@ +.repo-count-checker .btn { + margin-top: 0px !important; +} + +.repo-count-checker .co-alert { + margin-bottom: 6px !important; + padding-right: 120px; +} + +.repo-count-checker .co-alert .btn { + position: absolute; + top: 10px; + right: 10px; +} + +@media (max-width: 767px) { + .repo-count-checker .co-alert { + padding-right: 10px; + } + + .repo-count-checker .co-alert .btn { + position: relative; + margin-top: 20px; + margin-bottom: 10px; + } +} \ No newline at end of file diff --git a/static/directives/repo-count-checker.html b/static/directives/repo-count-checker.html new file mode 100644 index 000000000..4b89b1204 --- /dev/null +++ b/static/directives/repo-count-checker.html @@ -0,0 +1,24 @@ +
+
+
+ In order to make this repository private under + your personal namespace + organization {{ repo.namespace }}, you will need to upgrade your plan to + + {{ planRequired.title }} + . + This will cost ${{ planRequired.price / 100 }}/month. + Upgrade now +
+ or did you mean to have this repository under the {{ user.organizations[0].name }} namespace? +
+
+
+
+
+ This organization has reached its private repository limit. Please contact your administrator. +
+
+
+ \ No newline at end of file diff --git a/static/directives/repo-view/repo-panel-settings.html b/static/directives/repo-view/repo-panel-settings.html index b49d835b2..d6c6d7996 100644 --- a/static/directives/repo-view/repo-panel-settings.html +++ b/static/directives/repo-view/repo-panel-settings.html @@ -22,12 +22,10 @@
- +
-
Repository Settings
- +
Repository Visibility
-
@@ -44,12 +42,23 @@
This repository is currently public and is visible to all users, and may be pulled by all users.
- -
- + +
+
+
+
+ + + +
+
Delete Repository
+
+
+
+
- -