1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

various fix

- handle stripe limitation: plan cannot exceed 1 year
- [bug] unable to change password
- [bug] incorrect value of plans durations in admin list
- [css] plan price was exceeding width of the container
This commit is contained in:
Sylvain 2016-03-24 15:39:24 +01:00
parent ac0712e5bb
commit e81cc1597a
11 changed files with 67 additions and 48 deletions

View File

@ -525,6 +525,8 @@ After modifying any values concerning the localisation, restart the application
This may happens when the `application.yml` file is missing.
To solve this issue copy `config/application.yml.default` to `config/application.yml`.
This is required before the first start.
- Due to a stripe limitation, you won't be ble to create plans longer than one year.
<a name="related-documentation"></a>

View File

@ -207,6 +207,10 @@ Application.Controllers.controller "EditMemberController", ["$scope", "$state",
## The user to edit
$scope.user = memberPromise
## Should the passord be modified?
$scope.password =
change: false
## the user subscription
if $scope.user.subscribed_plan? and $scope.user.subscription?
$scope.subscription = $scope.user.subscription
@ -371,6 +375,10 @@ Application.Controllers.controller "NewMemberController", ["$scope", "$state", "
## Form action on the above URL
$scope.method = 'post'
## Should the passord be set manually or generated?
$scope.password =
change: false
## Default member's profile parameters
$scope.user =
plan_interval: ''

View File

@ -50,6 +50,10 @@ Application.Controllers.controller "EditProfileController", ["$scope", "$rootSco
## mapping of fields to disable
$scope.preventField = {}
## Should the passord be modified?
$scope.password =
change: false
## Angular-Bootstrap datepicker configuration for birthday
$scope.datePicker =
format: $locale.DATETIME_FORMATS.shortDate

View File

@ -31,7 +31,7 @@ h5 {
&:after {
position: absolute;
top: 18px;
left: 0px;
left: 0;
content: '';
width: 35%;
height: 1px;
@ -65,7 +65,7 @@ p {
font-family: $font-proxima-condensed;
font-size: rem-calc(16);
line-height: rem-calc(24);
margin: 1.038em 0px 30px 0px;
margin: 1.038em 0 30px 0;
font-weight: 600;
}
}
@ -79,7 +79,7 @@ dd {
}
//
//
// -------------------------
.col-0{clear:left;}
@ -151,7 +151,7 @@ dd {
[ui-view].ng-leave {
opacity: 1;
/*padding-left: 0px;*/
/*padding-left: 0px;*/
// -webkit-transform:translate3d(0, 0, 0);
// -moz-transform:translate3d(0, 0, 0);
// transform:translate3d(0, 0, 0);

View File

@ -220,13 +220,13 @@
.amount {
padding-top: 16px;
font-weight: bold;
font-size: rem-calc(26);
font-size: 1vw;
color: white;
}
.period {
position: relative;
top: -14px;
font-size: rem-calc(14);
top: -6px;
font-size: 0.75vw;
color: white;
}
}

View File

@ -9,7 +9,7 @@
}
> .btn,
> .btn-group,
> .btn-toolbar,
> .btn-toolbar
{
margin-top: 14px;
}

View File

@ -169,7 +169,7 @@
&:hover,
&:focus,
&:active,
&.active,
&.active
{
> a{
i{
@ -191,7 +191,7 @@
}
li:hover,
li:focus,
li:active,
li:active
{
> ul{
display: block !important;
@ -349,7 +349,7 @@
display: block !important;
position: absolute;
left: 0;
top: 0px;
top: 0;
bottom: 0;
width: $off-screen-nav-width;
visibility: visible;
@ -384,7 +384,7 @@
overflow: hidden;
position: absolute;
width: 100%;
top: 0px;
top: 0;
bottom: 0;
left: 0;
right: 0;

View File

@ -47,7 +47,7 @@
<tr ng-repeat="plan in plans | orderBy:orderPlans">
<td>{{getPlanType(plan.type)}}</td>
<td>{{plan.base_name}}</td>
<td>{{ plan.interval | planIntervalFilter }}</td>
<td>{{ plan.interval | planIntervalFilter:plan.interval_count }}</td>
<td>{{getGroupFromId(groups, plan.group_id).name}}</td>
<td>{{plan.ui_weight}}</td>
<td>{{plan.amount | currency}}</td>

View File

@ -74,7 +74,7 @@
<input type="checkbox"
name="user[is_allow_contact]"
ng-model="user.is_allow_contact"
value="true"/> {{ 'i_authorize_Fablab_users_registered_on_the_site_to_contact_me' }}
value="true"/> {{ 'i_authorize_Fablab_users_registered_on_the_site_to_contact_me' | translate }}
</div>
<!-- accept cgu -->

View File

@ -5,7 +5,7 @@
<div class="row m-t">
<div class="col-sm-3 col-sm-offset-1">
<div class="form-group m-t-lg">
<div class="form-group m-t-lg">
<div class="fileinput text-center" data-provides="fileinput" ng-class="fileinputClass(user.profile.user_avatar.attachment_url)">
<div class="fileinput-new thumbnail rounded thumb-128-wrapper" style="width: 140px; height: 140px;">
<img src="<%= image_path("no_avatar.png") %>" class="img-circle">
@ -123,11 +123,12 @@
<div class="form-group" ng-hide="preventPassword">
<button class="btn btn-warning btn-block"
ng-click="change_password = !change_password; $event.stopPropagation(); $event.preventDefault()" translate>{{ 'change_password' }}</button>
ng-click="password.change = !password.change; $event.stopPropagation(); $event.preventDefault()"
translate>{{ 'change_password' }}</button>
</div>
<div class="form-group" ng-class="{'has-error': userForm['user[password]'].$dirty && userForm['user[password]'].$invalid}" ng-if="change_password">
<div class="form-group" ng-class="{'has-error': userForm['user[password]'].$dirty && userForm['user[password]'].$invalid}" ng-if="password.change">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-key"></i> </span>
<input type="password"
@ -143,7 +144,7 @@
<span class="help-block" ng-show="userForm['user[password]'].$dirty && userForm['user[password]'].$error.minlength" translate>{{ 'password_is_too_short_(minimum_8_characters)' }}</span>
</div>
<div class="form-group" ng-class="{'has-error': userForm['user[password_confirmation]'].$dirty && userForm['user[password_confirmation]'].$invalid}" ng-if="change_password">
<div class="form-group" ng-class="{'has-error': userForm['user[password_confirmation]'].$dirty && userForm['user[password_confirmation]'].$invalid}" ng-if="password.change">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-key"></i> </span>
<input type="password"

View File

@ -18,44 +18,48 @@
def create
authorize Plan
if plan_params[:type] and plan_params[:type] == 'PartnerPlan'
begin
if plan_params[:type] and plan_params[:type] == 'PartnerPlan'
partner = User.find(params[:plan][:partner_id])
partner = User.find(params[:plan][:partner_id])
if plan_params[:group_id] == 'all'
plans = PartnerPlan.create_for_all_groups(plan_params)
if plans
plans.each { |plan| partner.add_role :partner, plan }
render json: { plan_ids: plans.map(&:id) }, status: :created
else
render status: :unprocessable_entity
end
if plan_params[:group_id] == 'all'
plans = PartnerPlan.create_for_all_groups(plan_params)
if plans
plans.each { |plan| partner.add_role :partner, plan }
render json: { plan_ids: plans.map(&:id) }, status: :created
else
render status: :unprocessable_entity
end
else
@plan = PartnerPlan.new(plan_params)
if @plan.save
partner.add_role :partner, @plan
render :show, status: :created
else
render json: @plan.errors, status: :unprocessable_entity
end
end
else
if plan_params[:group_id] == 'all'
plans = Plan.create_for_all_groups(plan_params)
if plans
render json: { plan_ids: plans.map(&:id) }, status: :created
else
render status: :unprocessable_entity
@plan = PartnerPlan.new(plan_params)
if @plan.save
partner.add_role :partner, @plan
render :show, status: :created
else
render json: @plan.errors, status: :unprocessable_entity
end
end
else
@plan = Plan.new(plan_params)
if @plan.save
render :show, status: :created, location: @plan
if plan_params[:group_id] == 'all'
plans = Plan.create_for_all_groups(plan_params)
if plans
render json: { plan_ids: plans.map(&:id) }, status: :created
else
render status: :unprocessable_entity
end
else
render json: @plan.errors, status: :unprocessable_entity
@plan = Plan.new(plan_params)
if @plan.save
render :show, status: :created, location: @plan
else
render json: @plan.errors, status: :unprocessable_entity
end
end
end
rescue Stripe::InvalidRequestError => e
render json: {error: e.message}, status: :unprocessable_entity
end
end