Skip to content

Commit

Permalink
Minerals: changed Tags page to preselect Mineral when selected from M…
Browse files Browse the repository at this point in the history
…inerals Pg
  • Loading branch information
NathanNovak committed Aug 14, 2018
1 parent 70b0a4f commit 4c0d698
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions www/app/spot/spot/spot.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
vm.featureLevelTags = [];
vm.featureLevelTagsToDisplay = [];
vm.mineralTags = [];
vm.minerals = false;
vm.selectedType = 'all';
vm.spotLevelTags = [];
vm.spotLevelTagsToDisplay = [];
Expand Down Expand Up @@ -286,6 +287,8 @@
function createTag() {
vm.addTagModal.hide();
var id = HelpersFactory.getNewId();
$log.log($state.current.name);
if ($state.current.name === 'app.spotTab.minerals') TagFactory.setIsMineralsTag(true);
vm.submit('/app/tags/' + id);
}

Expand Down
6 changes: 5 additions & 1 deletion www/app/tag/tag.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,11 @@
var id = $state.params.tag_id;
vm.data = ProjectFactory.getTag(id);
vm.data.id = id; // Just in case vm.tag is undefined

var isMineralsTag = TagFactory.getIsMineralsTag();
if (isMineralsTag) {
vm.data.type = 'mineral';
TagFactory.setIsMineralsTag(false);
}
if (vm.data.color) vm.color = vm.data.color;

if (vm.data.type === 'geologic_unit') FormFactory.setForm('rock_unit');
Expand Down
13 changes: 12 additions & 1 deletion www/app/tag/tag.factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
var activeTags = [];
var isActiveTagging = false;
var tagTypeLabels = {};
var isMineralTag = false;

activate();

Expand All @@ -23,13 +24,15 @@
'getActiveTags': getActiveTags,
'getAddNewActiveTag': getAddNewActiveTag,
'getGeologicUnits': getGeologicUnits,
'getIsMineralsTag': getIsMineralsTag,
'getNumTaggedFeatures': getNumTaggedFeatures,
'getTagTypeLabel': getTagTypeLabel,
'removeActiveTag': removeActiveTag,
'removeActiveTagging': removeActiveTagging,
'setActiveTagging': setActiveTagging,
'setActiveTags': setActiveTags,
'setAddNewActiveTag': setAddNewActiveTag
'setAddNewActiveTag': setAddNewActiveTag,
'setIsMineralsTag': setIsMineralsTag
};

/**
Expand Down Expand Up @@ -96,6 +99,10 @@
return addNewActiveTag;
}

function getIsMineralsTag() {
return isMineralTag;
}

function getNumTaggedFeatures(tag) {
var count = 0;
if (tag && tag.features) {
Expand Down Expand Up @@ -142,5 +149,9 @@
function setAddNewActiveTag(inBool) {
addNewActiveTag = inBool;
}

function setIsMineralsTag(inBool) {
isMineralTag = inBool;
}
}
}());

0 comments on commit 4c0d698

Please sign in to comment.