mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge branch 'master' of github.com:sharelatex/web-sharelatex
This commit is contained in:
commit
1e1f57a80b
6 changed files with 59 additions and 13 deletions
|
@ -97,7 +97,7 @@ module.exports = SubscriptionController =
|
|||
else
|
||||
SubscriptionViewModelBuilder.buildUsersSubscriptionViewModel user, (error, subscription, groups) ->
|
||||
return next(error) if error?
|
||||
logger.log user: user, subscription:subscription, hasSubOrIsGroupMember:hasSubOrIsGroupMember, "showing subscription dashboard"
|
||||
logger.log user: user, subscription:subscription, hasSubOrIsGroupMember:hasSubOrIsGroupMember, groups:groups, "showing subscription dashboard"
|
||||
plans = SubscriptionViewModelBuilder.buildViewModel()
|
||||
res.render "subscriptions/dashboard",
|
||||
title: "your_subscription"
|
||||
|
|
|
@ -27,6 +27,13 @@ module.exports =
|
|||
logger.log adminUserId:adminUserId, userToRemove_id:userToRemove_id, "removing user from group subscription"
|
||||
SubscriptionGroupHandler.removeUserFromGroup adminUserId, userToRemove_id, ->
|
||||
res.send()
|
||||
|
||||
removeSelfFromGroup: (req, res)->
|
||||
adminUserId = req.query.admin_user_id
|
||||
userToRemove_id = req.session.user._id
|
||||
logger.log adminUserId:adminUserId, userToRemove_id:userToRemove_id, "removing user from group subscription after self request"
|
||||
SubscriptionGroupHandler.removeUserFromGroup adminUserId, userToRemove_id, ->
|
||||
res.send()
|
||||
|
||||
renderSubscriptionGroupAdminPage: (req, res)->
|
||||
user_id = req.session.user._id
|
||||
|
|
|
@ -24,6 +24,8 @@ module.exports =
|
|||
webRouter.post '/subscription/group/user', AuthenticationController.requireLogin(), SubscriptionGroupController.addUserToGroup
|
||||
webRouter.get '/subscription/group/export', AuthenticationController.requireLogin(), SubscriptionGroupController.exportGroupCsv
|
||||
webRouter.delete '/subscription/group/user/:user_id', AuthenticationController.requireLogin(), SubscriptionGroupController.removeUserFromGroup
|
||||
webRouter.delete '/subscription/group/user', AuthenticationController.requireLogin(), SubscriptionGroupController.removeSelfFromGroup
|
||||
|
||||
|
||||
webRouter.get '/user/subscription/:subscription_id/group/invited', AuthenticationController.requireLogin(), SubscriptionGroupController.renderGroupInvitePage
|
||||
webRouter.post '/user/subscription/:subscription_id/group/begin-join', AuthenticationController.requireLogin(), SubscriptionGroupController.beginJoinGroup
|
||||
|
|
|
@ -9,7 +9,7 @@ module.exports =
|
|||
conditions = _id:user_id
|
||||
update = {}
|
||||
plan = PlansLocator.findLocalPlanInSettings(plan_code)
|
||||
logger.log user_id:user_id, plan:plan, plan_code:plan_code, "updating users features"
|
||||
logger.log user_id:user_id, features:plan.features, plan_code:plan_code, "updating users features"
|
||||
update["features.#{key}"] = value for key, value of plan.features
|
||||
User.update conditions, update, (err)->
|
||||
callback err, plan.features
|
||||
|
|
|
@ -46,11 +46,13 @@ block content
|
|||
-if (groups.length != 0)
|
||||
each groupSubscription in groups
|
||||
p !{translate("member_of_group_subscription", {admin_email: "<strong>" + groupSubscription.admin_id.email + "</strong>"})}
|
||||
span
|
||||
button.btn.btn-danger(ng-click="removeSelfFromGroup('#{groupSubscription.admin_id._id}')") #{translate("leave_group")}
|
||||
- else if (subscription)
|
||||
case subscription.state
|
||||
when "free-trial"
|
||||
p !{translate("on_free_trial_expiring_at", {expiresAt:"<strong>" + subscription.expiresAt + "</strong>"})}
|
||||
p !{translate("choose_a_plan_below")}
|
||||
|
||||
when "active"
|
||||
p !{translate("currently_subscribed_to_plan", {planName:"<strong>" + subscription.name + "</strong>"})}
|
||||
a(href, ng-click="changePlan = true") !{translate("change_plan")}.
|
||||
|
@ -103,9 +105,7 @@ block content
|
|||
mixin printPlans(plans.individualMonthlyPlans)
|
||||
mixin printPlans(plans.individualAnnualPlans)
|
||||
|
||||
|
||||
|
||||
.card(ng-if="view == 'cancelation'")
|
||||
.card(ng-if="view == 'cancelation'")
|
||||
.page-header
|
||||
h1 #{translate("Cancel Subscription")}
|
||||
|
||||
|
@ -122,8 +122,7 @@ block content
|
|||
|
||||
div(ng-show="showDowngradeToStudent", style="text-align: center")
|
||||
span(ng-controller="ChangePlanFormController")
|
||||
p
|
||||
!{translate("interested_in_cheaper_plan",{price:'{{studentPrice}}'})}
|
||||
p !{translate("interested_in_cheaper_plan",{price:'{{studentPrice}}'})}
|
||||
button(type="submit", ng-click="downgradeToStudent()", ng-disabled='inflight').btn.btn-success #{translate("yes_please")}
|
||||
p
|
||||
|
|
||||
|
@ -147,7 +146,6 @@ block content
|
|||
ga('send', 'event', 'subscription-funnel', 'cancelation')
|
||||
})
|
||||
|
||||
|
||||
script(type='text/ng-template', id='confirmChangePlanModalTemplate')
|
||||
.modal-header
|
||||
h3 #{translate("change_plan")}
|
||||
|
@ -166,4 +164,22 @@ block content
|
|||
span(ng-show="inflight") #{translate("processing")}...
|
||||
|
||||
|
||||
script(type='text/ng-template', id='LeaveGroupModalTemplate')
|
||||
.modal-header
|
||||
h3 #{translate("leave_group")}
|
||||
.modal-body
|
||||
p #{translate("sure_you_want_to_leave_group")}
|
||||
.modal-footer
|
||||
button.btn.btn-default(
|
||||
ng-disabled="inflight"
|
||||
ng-click="cancel()"
|
||||
) #{translate("cancel")}
|
||||
button.btn.btn-danger(
|
||||
ng-disabled="state.inflight"
|
||||
ng-click="confirmLeaveGroup()"
|
||||
)
|
||||
span(ng-hide="inflight") #{translate("leave_now")}
|
||||
span(ng-show="inflight") #{translate("processing")}...
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -53,11 +53,9 @@ define [
|
|||
|
||||
price = ""
|
||||
|
||||
|
||||
|
||||
App.controller "ConfirmChangePlanController", ($scope, $modalInstance, $http)->
|
||||
|
||||
$scope.confirmChangePlan = ->
|
||||
|
||||
body =
|
||||
plan_code: $scope.plan.planCode
|
||||
_csrf : window.csrfToken
|
||||
|
@ -74,8 +72,23 @@ define [
|
|||
$scope.cancel = () ->
|
||||
$modalInstance.dismiss('cancel')
|
||||
|
||||
App.controller "LeaveGroupModalController", ($scope, $modalInstance, $http)->
|
||||
$scope.confirmLeaveGroup = ->
|
||||
$scope.inflight = true
|
||||
$http({
|
||||
url: "/subscription/group/user",
|
||||
method: "DELETE",
|
||||
params: {admin_user_id: $scope.admin_id, _csrf: window.csrfToken}
|
||||
}).success ->
|
||||
location.reload()
|
||||
.error ->
|
||||
console.log "something went wrong changing plan"
|
||||
|
||||
App.controller "UserSubscriptionController", ($scope, MultiCurrencyPricing, $http, sixpack) ->
|
||||
$scope.cancel = () ->
|
||||
$modalInstance.dismiss('cancel')
|
||||
|
||||
|
||||
App.controller "UserSubscriptionController", ($scope, MultiCurrencyPricing, $http, sixpack, $modal) ->
|
||||
freeTrialEndDate = new Date(subscription?.trial_ends_at)
|
||||
|
||||
sevenDaysTime = new Date()
|
||||
|
@ -120,6 +133,7 @@ define [
|
|||
$scope.cancelSubscription = ->
|
||||
body =
|
||||
_csrf : window.csrfToken
|
||||
|
||||
$scope.inflight = true
|
||||
$http.post("/user/subscription/cancel", body)
|
||||
.success ->
|
||||
|
@ -130,6 +144,13 @@ define [
|
|||
console.log "something went wrong changing plan"
|
||||
|
||||
|
||||
$scope.removeSelfFromGroup = (admin_id)->
|
||||
$scope.admin_id = admin_id
|
||||
$modal.open(
|
||||
templateUrl: "LeaveGroupModalTemplate"
|
||||
controller: "LeaveGroupModalController"
|
||||
scope: $scope
|
||||
)
|
||||
|
||||
$scope.switchToCancelationView = ->
|
||||
sixpack.participate 'cancelation-options-view', ['basic', 'downgrade-options'], (view, rawResponse)->
|
||||
|
|
Loading…
Reference in a new issue