Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmackay committed Jul 5, 2016
2 parents ffbbeb4 + 4c3e968 commit d2b328e
Show file tree
Hide file tree
Showing 18 changed files with 63 additions and 53 deletions.
12 changes: 0 additions & 12 deletions app/common/controllers/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,4 @@ function NavigationController(Authentication, ConfigEndpoint, BootstrapConfig, $
// function canCreatePost() {
// return $rootScope.loggedin || !vm.site.private;
// };

// Move to mode bar (or associated service)
// function canRegister() {
// return !vm.site.private;
// };

// Move to mode bar (or associated service)
// function logoutClick(e) {
// e.preventDefault();
// e.stopPropagation();
// Authentication.logout();
// };
}
27 changes: 13 additions & 14 deletions app/common/directives/filter-system/overflow-toggle.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
module.exports = OverflowToggleDirective;

OverflowToggleDirective.$inject = [];
function OverflowToggleDirective() {
OverflowToggleDirective.$inject = ['$parse'];
function OverflowToggleDirective($parse) {
return {
restrict: 'A',
scope: {
hasOverflow: '&'
},
link: OverflowToggleController
};
}

function OverflowToggleController($scope, $element) {
var toggle = $element[0].querySelector('.form-field-toggle');
function OverflowToggleController($scope, $element, $attrs) {
var toggle = $element[0].querySelector('.form-field-toggle');
var hasOverflow = angular.bind({}, $parse($attrs.hasOverflow), $scope);

$scope.$watch($scope.hasOverflow, function (hasOverflow) {
$element.toggleClass('has-overflow', hasOverflow);
});
$scope.$watch(hasOverflow, function (hasOverflow) {
$element.toggleClass('has-overflow', hasOverflow);
});

angular.element(toggle).on('click', function () {
$scope.hasOverflow() ? $element.toggleClass('show-overflow') : '';
});
angular.element(toggle).on('click', function () {
hasOverflow() ? $element.toggleClass('show-overflow') : '';
});
}
}

13 changes: 10 additions & 3 deletions app/common/directives/publish-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ function (
RoleEndpoint,
_
) {
$scope.showRoles = !!$scope.post.published_to.length;

$scope.canSeeThis = function () {
if ($scope.post.published_to && $scope.post.published_to.length) {
return $scope.post.published_to.join(', ');
return _.map($scope.post.published_to, function (role) {
return $scope.roles[role].display_name;
}).join(', ');
} else if ($scope.post.status === 'draft') {
return $translate.instant('post.just_you');
} else {
Expand All @@ -34,7 +37,7 @@ function (
};

RoleEndpoint.query().$promise.then(function (roles) {
$scope.roles = roles;
$scope.roles = _.indexBy(roles, 'name');
});

$scope.checkIfAllSelected = function () {
Expand All @@ -44,15 +47,19 @@ function (
$scope.toggleRole = function (role) {
if (role === 'draft' || role === '') {
$scope.post.published_to = [];
$scope.showRoles = false;
} else if ($scope.checkIfAllSelected()) {
// All check boxes selected, therefore publish to everyone
$scope.post.published_to = [];
$scope.showRoles = false;
}

$scope.post.status = role === 'draft' ? role : 'published';

};

$scope.toggleRolesView = function () {
$scope.showRoles = true;
};
}];
return {
restrict: 'E',
Expand Down
1 change: 1 addition & 0 deletions app/common/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"share": "Share",
"general" : "General",
"surveys" : "Surveys",
"add_survey" : "Add Survey",
"edit_survey" : "Edit Survey",
"data_sources" : "Data Sources",
"import" : "Import",
Expand Down
5 changes: 3 additions & 2 deletions app/common/services/maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ function (
className: 'custom-map-marker ' + className,
html: '<svg class="iconic" style="fill:' + color + ';"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../../img/iconic-sprite.svg#map-marker"></use></svg><span class="iconic-bg" style="background-color:' + color + ';""></span>',
iconSize: size,
iconAnchor: size,
popupAnchor: [-16, -32]
iconAnchor: [size[0] / 2, size[1]],
popupAnchor: [0, 0 - size[1]]
});
}

Expand Down Expand Up @@ -191,6 +191,7 @@ function (
// Disable 'Leaflet prefix on attributions'
this.map().then(function (map) {
map.attributionControl.setPrefix(false);
map.setMaxBounds([[-90,-360],[90,360]]);
});

return this;
Expand Down
10 changes: 8 additions & 2 deletions app/frame/directives/mode-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ module.exports = [
'Registration',
'ModalService',
'$rootScope',
'ModalService',
'ConfigEndpoint',
function (
Features,
Authentication,
Registration,
ModalService,
$rootScope
$rootScope,
ConfigEndpoint
) {
return {
restrict: 'E',
Expand All @@ -24,6 +25,7 @@ function (
$scope.activeMode = 'map';
$scope.moreActive = false;
$scope.isActivityAvailable = false;
$scope.canRegister = false;

$scope.hasManageSettingsPermission = $rootScope.hasManageSettingsPermission;
$scope.showMore = showMore;
Expand All @@ -47,6 +49,10 @@ function (
Features.loadFeatures().then(function () {
$scope.isActivityAvailable = Features.isViewEnabled('activity');
});

ConfigEndpoint.get({id: 'site'}, function (site) {
$scope.canRegister = !site.private;
});
}

// Show account settings
Expand Down
1 change: 1 addition & 0 deletions app/post/views/filters/filter-category.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CategorySelectDirective.$inject = ['TagEndpoint'];
function CategorySelectDirective(TagEndpoint) {
return {
restrict: 'E',
replace: true,
scope: {},
require: 'ngModel',
link: CategorySelectLink,
Expand Down
1 change: 1 addition & 0 deletions app/post/views/filters/filter-form.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ FormSelectDirective.$inject = ['FormEndpoint'];
function FormSelectDirective(FormEndpoint) {
return {
restrict: 'E',
replace: true,
scope: {},
require: 'ngModel',
link: FormSelectLink,
Expand Down
1 change: 1 addition & 0 deletions app/post/views/filters/filter-location.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ LocationFilterDirective.$inject = ['Geocoding', '$q'];
function LocationFilterDirective(Geocoding, $q) {
return {
restrict: 'E',
replace: true,
scope: {
centerPointModel: '=',
withinKmModel: '='
Expand Down
1 change: 1 addition & 0 deletions app/post/views/filters/filter-visible-to.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ VisibleToSelectDirective.$inject = [];
function VisibleToSelectDirective() {
return {
restrict: 'E',
replace: true,
scope: {
statusModel: '=',
publishedToModel: '='
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function (

TagEndpoint.saveCache(category).$promise.then(function (response) {
if (response.id) {
Notify.notify('notify.tag.save_success', { name: category.tag });
Notify.notify('notify.category.save_success', { name: category.tag });
addAnother ? $route.reload() : $location.path(whereToNext);
}
}, function (errorResponse) { // error
Expand Down
3 changes: 2 additions & 1 deletion app/setting/directives/setting-survey-editor.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ function SurveyEditorController(
ModalService.close();
}
$scope.editAttribute = attribute;
ModalService.openTemplate('<survey-attribute-editor></survey-attribute-editor>', 'survey.edit_field', '', $scope, true, true);
var title = attribute.id ? 'survey.edit_field' : 'survey.add_field';
ModalService.openTemplate('<survey-attribute-editor></survey-attribute-editor>', title, '', $scope, true, true);
}

function addNewAttribute(attribute) {
Expand Down
24 changes: 13 additions & 11 deletions server/www/templates/common/publish-selector/publish-selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
</svg>
</legend>
<div class="dropdown-menu init" dropdown-menu>
<div class="form-fieldgroup">
<div class="form-fieldgroup" dropdown>
<div class="form-field radio">
<input
name="{{post.id}}_draft"
name="{{post.id}}"
id="{{post.id}}_draft"
value="draft"
type="radio"
Expand All @@ -27,22 +27,24 @@

<div class="form-field radio">
<input
name="{{post.id}}_everyone"
name="{{post.id}}"
id="{{post.id}}_everyone"
value=""
type="radio"
ng-checked="post.status==='published' && post.published_to.length === 0"
ng-click="toggleRole('')">
<label for="{{post.id}}_everyone" translate="post.everyone">Everyone</label>
</div>
<div class="form-field radio" dropdown>
<input
dropdown-toggle
auto-close="disabled"
ng-checked="post.published_to.length"
type="radio">
<label for="{{post.id}}_everyone" translate="post.specific_roles">Specific roles...</label>
<div class="form-fieldgroup" dropdown-menu>
<div class="form-field radio">
<input
name="{{post.id}}"
id="{{post.id}}_roles"
auto-close="disabled"
ng-checked="post.published_to.length"
value="roles"
type="radio" ng-click="toggleRolesView()">
<label for="{{post.id}}_roles" translate="post.specific_roles">Specific roles...</label>
<div class="form-fieldgroup" dropdown-menu ng-show="showRoles">
<div class="form-field checkbox" ng-repeat="role in roles">
<input
id="{{role.id}}"
Expand Down
2 changes: 1 addition & 1 deletion server/www/templates/frame/mode-bar.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
</a>
</li>

<li ng-hide="currentUser" ng-show="canRegister()">
<li ng-show="!currentUser && canRegister">
<a ng-click="register()" data-modal="signup">
<svg class="iconic">
<use xlink:href="../../img/iconic-sprite.svg#person"></use>
Expand Down
2 changes: 1 addition & 1 deletion server/www/templates/posts/modify/post-tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</div>
</div>

<fieldset id="categories" ng-show="isFirstStage(visibleStage)">
<fieldset id="categories" ng-show="isFirstStage(visibleStage) && categories.length">
<legend translate="post.modify.form.categories">Categories</legend>
<div class="form-field checkbox" ng-repeat="category in categories">
<label for="cat1">
Expand Down
2 changes: 1 addition & 1 deletion server/www/templates/posts/views/filters/filter-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<input checklist-value="form.id" checklist-model="selectedForms" type="checkbox" name="selectedForms" > {{ ::form.name }}
</label>
</div>
<div class="form-field checkbox" ng-class="{ overflow : (forms.length > 2) }">
<div class="form-field checkbox" ng-class="{ overflow : (forms.length > 1) }">
<label>
<input checklist-value="'none'" checklist-model="selectedForms" type="checkbox" name="selectedForms" > <span translate="nav.unknown">Unknown</span>
</label>
Expand Down
4 changes: 2 additions & 2 deletions server/www/templates/settings/datasources/datasources.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ <h1 class="mode-context-title" translate>app.data_sources</h1>
<p><em translate>settings.data_sources.hint_turn_on_off</em></p>
</div>

<div class="listing card" ng-repeat="provider in providers.results | orderBy:'name'">
<div class="listing card">

<!-- TODO: fix active class toggle -->
<div class="listing-item active" is-open="panelVisible[provider.id]" dropdown auto-close="disabled" ng-if="available_providers[provider.id]">
<div class="listing-item active" ng-repeat="provider in providers.results | orderBy:'name'" is-open="panelVisible[provider.id]" dropdown auto-close="disabled" ng-if="available_providers[provider.id]">

<div class="listing-item-secondary">
<button type="button" class="button-beta button-flat listing-item-toggle" dropdown-toggle>
Expand Down
5 changes: 3 additions & 2 deletions server/www/templates/settings/surveys/modify/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<li><a href="/settings" translate>app.settings</a></li>
<li><a href="/settings/surveys" translate>app.surveys</a></li>
</ol>
<h1 class="mode-context-title" translate>app.edit_survey</h1>
<h1 ng-show="survey.id" class="mode-context-title" translate>app.edit_survey</h1>
<h1 ng-show="!survey.id" class="mode-context-title" translate>app.add_survey</h1>
</header>

<span class="mode-context-trigger" dropdown-toggle>
Expand Down Expand Up @@ -47,7 +48,7 @@ <h1 class="mode-context-title" translate>app.edit_survey</h1>
<div class="form-field form-field-adapt">
<label translate>app.description</label>
<textarea name="description" data-min-rows='1' rows='1' ng-model="survey.description"></textarea>
</div>
</div>
<color-picker color-container="survey"></color-picker>
<fieldset class="custom-fieldset init" dropdown auto-close="outsideClick">
<legend class="dropdown-trigger init" data-toggle="dropdown-menu" dropdown-toggle>
Expand Down

0 comments on commit d2b328e

Please sign in to comment.