Skip to content
This repository has been archived by the owner on Feb 20, 2020. It is now read-only.

WIP Feature/saving #353

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion app/directives/group-page-buckets/group-page-buckets.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ global.cobudgetApp.directive 'groupPageBuckets', () ->
restrict: 'E'
template: require('./group-page-buckets.html')
replace: true
controller: ($scope, $location) ->
controller: ($scope, $location, Dialog) ->

$scope.showBucket = (bucketId) ->
$location.path("/buckets/#{bucketId}")
Expand All @@ -16,4 +16,16 @@ global.cobudgetApp.directive 'groupPageBuckets', () ->
$scope.hideArchivedBuckets = ->
$scope.archivedBucketsShown = false

$scope.confirmSaving = (membership) ->
params =
membership:
saved_funds_at: moment()
membership.remote.update(membership.id, params)

$scope.indicateSaving = (membership) ->
Dialog.confirm({
content: "Thanks! This will help group admins know that the funds have not been abandoned."
}).then ->
$scope.confirmSaving(membership)

return
11 changes: 11 additions & 0 deletions app/directives/group-page-buckets/group-page-buckets.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@
</div>
</div>
</md-list-item>

<md-divider class="group-page__buckets-divider"></md-divider>

<md-list-item ng-if="membership.balance > 1" md-no-ink ng-click="indicateSaving(membership)" class="group-page__buckets-list-item">
<div layout="column" flex class="group-page__bucket-container">
<div layout="row" layout-align="start center" class="group-page__bucket-indicate-saving">
<small>Nothing strike your fancy? Click to save funds for later.</small>
</div>
</div>
</md-list-item>

</md-list>
</md-card>

Expand Down
6 changes: 6 additions & 0 deletions app/directives/group-page-buckets/group-page-buckets.scss
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@
font-weight: 400;
}

.group-page__bucket-indicate-saving {
color: #767676;
font-style: italic;
}

@media (max-width: 380px) {
.group-page__bucket-title {
@include fontMedium;
Expand All @@ -208,3 +213,4 @@
@include fontTiny;
}
}

4 changes: 2 additions & 2 deletions app/directives/group-page-funders/group-page-funders.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ global.cobudgetApp.directive 'groupPageFunders', () ->

$scope.downloadCSV = ->
timestamp = moment().format('YYYY-MM-DD-HH-mm-ss')
filename = "#{$scope.group.name}-member-data-#{timestamp}"
filename = "#{$scope.group.name}-member-report-#{timestamp}"
params =
url: "#{config.apiPrefix}/memberships.csv?group_id=#{$scope.group.id}"
url: "#{config.apiPrefix}/memberships/report.csv?group_id=#{$scope.group.id}"
filename: filename
DownloadCSV(params)

Expand Down
11 changes: 10 additions & 1 deletion app/directives/group-page-funders/group-page-funders.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h2 class="group-page__funders-subheader">Members</h2>
<span flex></span>

<div class="group-page__funders-admin-btn" layout="row" layout-align="center center" ng-click="downloadCSV()" ng-if="membership.isAdmin">
<div class="group-page__funders-admin-btn-label">Download as CSV</div>
<div class="group-page__funders-admin-btn-label">Download Membership Report</div>
</div>
</div>

Expand All @@ -32,6 +32,15 @@ <h2 class="group-page__funders-subheader">Members</h2>
<span class="group-page__funder-admin-label" ng-if="funderMembership.isAdmin">(admin)</span>
</div>

<md-button layout="column" layout-align="center end" class="group-page__funder-saving-container" ng-if="funderMembership.id == membership.id">
<span class="group-page__funder-saving"
ng-class=""
ng-click="indicateSaving(membership)"
>
save?
</span>
</md-button>

<div layout="column" layout-align="center end" class="group-page__funder-balance-container">
<span class="group-page__funder-balance"
ng-class="{'group-page__funder-balance-btn' : membership.isAdmin, 'group-page__funder-balance-personal' : funderMembership.id == membership.id, 'group-page__funder-balance-other' : funderMembership.id != membership.id}"
Expand Down
2 changes: 1 addition & 1 deletion app/models/membership-model.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ global.cobudgetApp.factory 'MembershipModel', (BaseModel) ->
@singular: 'membership'
@plural: 'memberships'
@indices: ['groupId', 'memberId']
@serializableAttributes: ['isAdmin', 'closedAdminHelpCardAt', 'closedMemberHelpCardAt']
@serializableAttributes: ['isAdmin', 'closedAdminHelpCardAt', 'closedMemberHelpCardAt', 'savedFundsAt']

relationships: ->
@belongsTo 'member', from: 'users'
Expand Down