-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* develop: (28 commits) Missing translations Finalized first implementation of Associated Contributions Component Initial version of the contributing ideas modal with text input to search and add other ideas Firs version of contributing ideas modal Missing translations Add attachment in proposal/idea page, including adding resource by URL and embedding of youtube/vimeo videos in media Integrated Add Attachments in Attachments modal Unified design of up/down thumbs icons Show informal score always Unified design of up/down thumbs icons Added cover to list of media resources Added read user feedback and changed styles of thumbs up/down to reflect if the user has voted (in contribution-feedback directive) Missing translations Added read user feedback and changed styles of thumbs up/down to reflect if the user has voted Connected toolbar’s ‘See History’ to history modal in menu through $broadcast message Re-Enabled Campaign creation/editing dashboard Re-Enabled Campaign creation/editing dashboard Re-Enabled Campaign creation/editing dashboard Re-Enabled Campaign creation/editing dashboard Re-Enabled Campaign creation/editing dashboard ...
- Loading branch information
Showing
38 changed files
with
1,476 additions
and
639 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
app/v2/components/associated-contributions-form/associated-contributions-form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div class="row contribution__filter"> | ||
<form> | ||
<input class="btn-sm" type="text" name="contributing-ideas" | ||
ng-model="vm.filters.searchText" | ||
ng-change="vm.searchContributionsInSpace()" | ||
placeholder="{{'Associate contributing idea'|translate}}"> | ||
|
||
<fieldset class="tags"> | ||
<div class="autocomplete" ng-if="vm.filteredContributions && vm.filteredContributions.length > 0"> | ||
<ul class="suggestion-list"> | ||
<li ng-repeat="item in vm.filteredContributions track by $index" ng-click="vm.associateContributionToSpace(item)" | ||
class="suggestion-item" style="min-height: 50px;"> | ||
<span>{{item.title | limitTo:50 }}...</span> | ||
</li> | ||
</ul> | ||
</div> | ||
</fieldset> | ||
</form> | ||
<span class="attachment-spinner" us-spinner="vm.spinnerOptions" spinner-key="associated-ideas-spinner"></span> | ||
</div> |
126 changes: 126 additions & 0 deletions
126
app/v2/components/associated-contributions-form/associated-contributions-form.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
'use strict'; | ||
|
||
(function () { | ||
'use strict'; | ||
|
||
/** | ||
* @name associatedContributions | ||
* @memberof components | ||
* | ||
* @description | ||
* Component that renders allows to search for ideas and associate them to a resource space. | ||
* | ||
* @example | ||
* | ||
* <associated-ideas></associated-ideas> | ||
*/ | ||
|
||
appCivistApp.component('associatedContributionsForm', { | ||
selector: 'associatedContributionsForm', | ||
bindings: { | ||
contributionType: '=', | ||
spaceId: '=', | ||
space: '=', | ||
assemblyId: '=', | ||
campaignId: '=', | ||
campaignSpaceId: '=', | ||
groupId: '=', | ||
parentContributionId: '=' | ||
|
||
}, | ||
controller: associatedContributionsCtrl, | ||
controllerAs: 'vm', | ||
templateUrl: '/app/v2/components/associated-contributions-form/associated-contributions-form.html' | ||
}); | ||
|
||
associatedContributionsCtrl.$inject = ['$scope','Space', 'usSpinnerService']; | ||
|
||
function associatedContributionsCtrl($scope, Space, usSpinnerService) { | ||
this.activate = activate.bind(this); | ||
|
||
/** | ||
* Initialization method. | ||
*/ | ||
this.$onInit = () => { | ||
$scope.$watch('vm.campaignSpaceId', space => { | ||
if (!space ) { | ||
return; | ||
} | ||
this.activate(); | ||
}); | ||
}; | ||
|
||
function activate() { | ||
this.searchContributionsInSpace = searchContributionsInSpace.bind(this); | ||
this.associateContributionToSpace = associateContributionToSpace.bind(this); | ||
this.removeContributionFromSpace = removeContributionFromSpace.bind(this); | ||
this.startSpinner = startSpinner.bind(this); | ||
this.stopSpinner = stopSpinner.bind(this); | ||
this.filters = { | ||
searchText: "", | ||
mode: this.contributionType, | ||
sorting: 'date_desc', | ||
status: "PUBLISHED,INBALLOT,SELECTED" | ||
}; | ||
this.filteredContributions = []; | ||
this.spinnerOptions = { | ||
radius:10, | ||
width:4, | ||
length: 10, | ||
top: '75%', | ||
left: '50%', | ||
zIndex: 1 | ||
}; | ||
$scope.$on('AssociatedContributionForm:RemoveRelatedContribution', | ||
(event, idea) => { | ||
this.removeContributionFromSpace(idea); | ||
} | ||
); | ||
} | ||
|
||
function startSpinner () { | ||
this.spinnerActive = true; | ||
usSpinnerService.spin('associated-ideas-spinner'); | ||
} | ||
|
||
function stopSpinner () { | ||
usSpinnerService.stop('associated-ideas-spinner'); | ||
this.spinnerActive = false; | ||
} | ||
|
||
|
||
function searchContributionsInSpace () { | ||
if (this.filters.searchText){ | ||
this.startSpinner(); | ||
Space.doSearch({rsID:this.campaignSpaceId}, false, this.filters).then( | ||
data => { | ||
let contributions = data ? data.list || [] : []; | ||
this.filteredContributions = contributions; | ||
this.stopSpinner(); | ||
}); | ||
} | ||
} | ||
|
||
function associateContributionToSpace (item) { | ||
this.startSpinner(); | ||
Space.addContributionToResourceSpace(this.assemblyId, item.contributionId, this.spaceId, item).then( | ||
data => { | ||
this.space.relatedContributions.push(item); | ||
this.filteredContributions = []; | ||
this.stopSpinner(); | ||
} | ||
) | ||
} | ||
|
||
function removeContributionFromSpace(item) { | ||
this.startSpinner(); | ||
Space.removeContributionFromResourceSpace(this.assemblyId, item.contributionId, this.spaceId).then( | ||
data => { | ||
_.remove(this.space.relatedContributions, { contributionId: item.contributionId }); | ||
this.filteredContributions = []; | ||
this.stopSpinner(); | ||
} | ||
) | ||
} | ||
} | ||
})(); |
19 changes: 19 additions & 0 deletions
19
app/v2/components/associated-contributions-form/associated-contributions-form.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.contribution__filter { | ||
margin:auto; | ||
.associated__contribution_form { | ||
padding: inherit; | ||
form { | ||
fieldset { | ||
.submit__contribution { | ||
margin-left: 0.6rem; | ||
} | ||
|
||
div { | ||
input[type=file] { | ||
border: none; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.