Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* 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
cdparra committed Oct 19, 2017
2 parents f342744 + 50524cc commit 9c13581
Show file tree
Hide file tree
Showing 38 changed files with 1,476 additions and 639 deletions.
116 changes: 60 additions & 56 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,12 @@
'*://etherpad.appcivist.org/**',
'*://testetherpad.appcivist.org/**',
'*://www.youtube.com/**',
'*://youtube.com/**',
'*://youtu.be/**',
'*://drive.google.com/**',
'*://docs.google.com/**'
'*://docs.google.com/**',
'*://vimeo.com/**',
'*://player.vimeo.com/**'
]);

/**
Expand Down Expand Up @@ -310,61 +314,61 @@
abstract: true,
template: '<div ui-view></div>'
})
// .state('v2.assembly.aid.campaign.new', {
// url: '/new',
// controller: 'v2.CampaignFormWizardCtrl',
// templateUrl: 'app/v2/partials/campaign/form.html',
// access: {
// requiresLogin: true
// }
// })
// .state('v2.assembly.aid.campaign.start', {
// url: '/start',
// redirect: 'v2.assembly.aid.campaign.new.description',
// access: {
// requiresLogin: true
// },
// ncyBreadcrumb: {
// parent: 'v2.assembly.aid.home',
// label: 'New Campaign'
// }
// })
// .state('v2.assembly.aid.campaign.new.description', {
// url: '/description',
// controller: 'v2.CampaignFormCtrl',
// templateUrl: 'app/v2/partials/campaign/form.description.html',
// access: {
// requiresLogin: true
// },
// ncyBreadcrumb: {
// parent: 'v2.assembly.aid.home',
// label: 'New Campaign description'
// }
// })
// .state('v2.assembly.aid.campaign.new.milestones', {
// url: '/milestones',
// controller: 'v2.CampaignFormCtrl',
// templateUrl: 'app/v2/partials/campaign/form.milestones.html',
// access: {
// requiresLogin: true
// },
// ncyBreadcrumb: {
// parent: 'v2.assembly.aid.home',
// label: 'New Campaign Milestones'
// }
// })
// .state('v2.assembly.aid.campaign.new.stages', {
// url: '/stages',
// controller: 'v2.CampaignFormCtrl',
// templateUrl: 'app/v2/partials/campaign/form.stages.html',
// access: {
// requiresLogin: true
// },
// ncyBreadcrumb: {
// parent: 'v2.assembly.aid.home',
// label: 'New Campaign Stages'
// }
// })
.state('v2.assembly.aid.campaign.new', {
url: '/new',
controller: 'v2.CampaignFormWizardCtrl',
templateUrl: 'app/v2/partials/campaign/form.html',
access: {
requiresLogin: true
}
})
.state('v2.assembly.aid.campaign.start', {
url: '/start',
redirect: 'v2.assembly.aid.campaign.new.description',
access: {
requiresLogin: true
},
ncyBreadcrumb: {
parent: 'v2.assembly.aid.home',
label: 'New Campaign'
}
})
.state('v2.assembly.aid.campaign.new.description', {
url: '/description',
controller: 'v2.CampaignFormCtrl',
templateUrl: 'app/v2/partials/campaign/form.description.html',
access: {
requiresLogin: true
},
ncyBreadcrumb: {
parent: 'v2.assembly.aid.home',
label: 'New Campaign description'
}
})
.state('v2.assembly.aid.campaign.new.milestones', {
url: '/milestones',
controller: 'v2.CampaignFormCtrl',
templateUrl: 'app/v2/partials/campaign/form.milestones.html',
access: {
requiresLogin: true
},
ncyBreadcrumb: {
parent: 'v2.assembly.aid.home',
label: 'New Campaign Milestones'
}
})
.state('v2.assembly.aid.campaign.new.stages', {
url: '/stages',
controller: 'v2.CampaignFormCtrl',
templateUrl: 'app/v2/partials/campaign/form.stages.html',
access: {
requiresLogin: true
},
ncyBreadcrumb: {
parent: 'v2.assembly.aid.home',
label: 'New Campaign Stages'
}
})
.state('v2.assembly.aid.campaign.cid', {
url: '/:cid',
controller: 'v2.CampaignDashboardCtrl',
Expand Down
29 changes: 28 additions & 1 deletion app/services/appCivistService.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,11 @@ appCivistApp.factory('Contributions', function ($resource, localStorageService,
});
},

authUserFeedback: function (assemblyId, campaignId, contributionId) {
return $resource(getServerBaseUrl(localStorageService) + '/assembly/:aid/campaign/:cid/contribution/:coid/userfeedback',
{ aid: assemblyId, cid: campaignId, coid: contributionId });
},

userFeedback: function (assemblyId, campaignId, contributionId) {
return $resource(getServerBaseUrl(localStorageService) + '/assembly/:aid/campaign/:cid/contribution/:coid/feedback', { aid: assemblyId, cid: campaignId, coid: contributionId }, { 'update': { method: 'PUT' } });
},
Expand Down Expand Up @@ -1455,7 +1460,8 @@ appCivistApp.factory('Space', ['$resource', 'localStorageService', 'Contribution
* @param {number} rsid - The resource ID.
*/
deleteResource(sid, rsid) {
return $resource(getServerBaseUrl(localStorageService) + '/space/:sid/resource/:rsid', { sid: sid, rsid: rsid }, { 'delete': { method: 'DELETE' } }).delete().$promise;
return $resource(getServerBaseUrl(localStorageService) + '/space/:sid/resource/:rsid', { sid: sid, rsid: rsid },
{ 'delete': { method: 'DELETE' } }).delete().$promise;
},

/**
Expand Down Expand Up @@ -1493,6 +1499,27 @@ appCivistApp.factory('Space', ['$resource', 'localStorageService', 'Contribution
data => data,
error => Notify.show('Error loading contributions from server', 'error')
)
},

addContributionToResourceSpace(aid, cid, sid, contribution) {
var rsp;
rsp = $resource(getServerBaseUrl(localStorageService) + '/assembly/:aid/contribution/:cid/space/:sid',
{aid: aid, cid: cid, sid: sid}).save(contribution);

return rsp.$promise.then(
data => data,
error => Notify.show('Error adding contribution to resource space', 'error')
)
},
removeContributionFromResourceSpace(aid, cid, sid) {
var rsp;
rsp = $resource(getServerBaseUrl(localStorageService) + '/assembly/:aid/contribution/:cid/space/:sid',
{aid: aid, cid: cid, sid: sid}).delete();

return rsp.$promise.then(
data => data,
error => Notify.show('Error adding contribution to resource space', 'error')
)
}
};
}
Expand Down
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>
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();
}
)
}
}
})();
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;
}
}
}
}
}
}
5 changes: 4 additions & 1 deletion app/v2/controllers/campaign/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
function init() {
initScopeFunctions();
initScopeContent();
setListOfLinkedAssemblies();
// setListOfLinkedAssemblies();
loadCampaignTemplates();
}

function initScopeFunctions() {
Expand Down Expand Up @@ -484,7 +485,9 @@
}, function(error) {
$scope.templateErrors.push(error);
});
}

function loadCampaignTemplates() {
var templateRes = Campaigns.templates().query();
templateRes.$promise.then(function(templates) {
$scope.templates = templates;
Expand Down
Loading

0 comments on commit 9c13581

Please sign in to comment.