Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
robgaston committed Sep 27, 2017
2 parents 6dd3599 + 1675444 commit 3947133
Show file tree
Hide file tree
Showing 85 changed files with 1,497 additions and 484 deletions.
2 changes: 1 addition & 1 deletion arches/app/datatypes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def after_update_all(self):
"""
pass

def transform_import_values(self, value):
def transform_import_values(self, value, nodeid):
"""
Transforms values from probably string/wkt representation to specified
datatype in arches
Expand Down
34 changes: 27 additions & 7 deletions arches/app/datatypes/concept_types.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import uuid
from arches.app.models import models
from arches.app.models import concept
from arches.app.datatypes.base import BaseDataType
from arches.app.models.concept import get_preflabel_from_valueid
from arches.app.search.elasticsearch_dsl_builder import Bool, Match, Range, Term, Nested, Exists
Expand Down Expand Up @@ -68,8 +69,23 @@ def validate(self, value, source=''):
errors.append({'type': 'ERROR', 'message': 'datatype: {0} value: {1} {2} - {3}. {4}'.format(self.datatype_model.datatype, value, source, message, 'This data was not imported.')})
return errors

def transform_import_values(self, value):
return value.strip()
def transform_import_values(self, value, nodeid):
ret = value.strip()
# try:
# uuid.UUID(ret)
# except:
# collection_id = models.Node.objects.get(nodeid=nodeid).config['rdmCollection']
# if collection_id:
# collection = concept.Concept().get_child_concepts(collection_id, ['member'], ['prefLabel'], 'prefLabel')
#
# for c in collection:
# if value == c[3]:
# ret = c[5]
#
# if ret == None:
# ret = value.strip()

return ret

def transform_export_values(self, value, *args, **kwargs):
if 'concept_export_value_type' in kwargs:
Expand Down Expand Up @@ -103,16 +119,20 @@ class ConceptListDataType(BaseConceptDataType):
def validate(self, value, source=''):
errors = []
for v in value:
value = v.strip()
val = v.strip()
try:
models.Value.objects.get(pk=value)
models.Value.objects.get(pk=val)
except ObjectDoesNotExist:
message = "Not a valid domain value"
errors.append({'type': 'ERROR', 'message': 'datatype: {0} value: {1} {2} - {3}. {4}'.format(self.datatype_model.datatype, value, source, message, 'This data was not imported.')})
errors.append({'type': 'ERROR', 'message': 'datatype: {0} value: {1} {2} - {3}. {4}'.format(self.datatype_model.datatype, val, source, message, 'This data was not imported.')})
return errors

def transform_import_values(self, value):
return [v.strip() for v in value.split(',')]
def transform_import_values(self, value, nodeid):
ret = []
concept = ConceptDataType()
for val in [v.strip() for v in value.split(',')]:
ret.append(concept.transform_import_values(val, nodeid))
return ret

def transform_export_values(self, value, *args, **kwargs):
new_values = []
Expand Down
24 changes: 18 additions & 6 deletions arches/app/datatypes/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def validate(self, value, source=''):
errors.append({'type': 'ERROR', 'message': 'datatype: {0} value: {1} {2} - {3}. {4}'.format(self.datatype_model.datatype, value, source, 'not a properly formatted number', 'This data was not imported.')})
return errors

def transform_import_values(self, value):
def transform_import_values(self, value, nodeid):
return float(value)

def append_to_document(self, document, nodevalue, nodeid, tile):
Expand Down Expand Up @@ -136,7 +136,7 @@ def validate(self, value, source=''):

return errors

def transform_import_values(self, value):
def transform_import_values(self, value, nodeid):
return bool(distutils.util.strtobool(str(value)))

def append_search_filters(self, value, node, query, request):
Expand Down Expand Up @@ -167,6 +167,14 @@ def validate(self, value, source=''):

return errors

def transform_import_values(self, value, nodeid):
if type(value) == list:
try:
value = str(datetime(*value).date())
except:
pass
return value

def append_to_document(self, document, nodevalue, nodeid, tile):
document['dates'].append({'date': SortableDate(nodevalue).as_float(), 'nodegroup_id': tile.nodegroup_id, 'nodeid': nodeid})

Expand Down Expand Up @@ -217,7 +225,7 @@ def validate_geom(geom, coordinate_count=0):

return errors

def transform_import_values(self, value):
def transform_import_values(self, value, nodeid):
arches_geojson = {}
arches_geojson['type'] = "FeatureCollection"
arches_geojson['features'] = []
Expand Down Expand Up @@ -362,6 +370,10 @@ def get_layer_config(self, node=None):
for i in range(23):
sql_list.append(None)

try:
simplification = config['simplification']
except KeyError, e:
simplification = 0.3

return {
"provider": {
Expand All @@ -374,7 +386,7 @@ def get_layer_config(self, node=None):
"database": database["NAME"],
"port": database["PORT"]
},
"simplify": settings.VECTOR_TILE_SIMPLIFICATION,
"simplify": simplification,
"queries": sql_list
},
},
Expand Down Expand Up @@ -821,7 +833,7 @@ def manage_files(self, previously_saved_tile, current_tile, request, node):
file_json["url"] = str(file_model.path.url)
file_json["status"] = 'uploaded'

def transform_import_values(self, value):
def transform_import_values(self, value, nodeid):
'''
# TODO: Following commented code can be used if user does not already have file in final location using django ORM:
Expand Down Expand Up @@ -1010,7 +1022,7 @@ def validate(self, value, source=''):
errors.append({'type': 'ERROR', 'message': '{0} is not a valid domain id. Please check the node this value is mapped to for a list of valid domain ids. This data was not imported.'.format(v)})
return errors

def transform_import_values(self, value):
def transform_import_values(self, value, nodeid):
return [v.strip() for v in value.split(',')]

def get_search_terms(self, nodevalue, nodeid=None):
Expand Down
130 changes: 123 additions & 7 deletions arches/app/media/css/arches.css
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@
color: #ccc;
}

.card-grid-item.card-locked .mar-no {
background-color: #ececec;
}

.branch-item {
margin-bottom: 10px;
}
Expand Down Expand Up @@ -931,6 +935,10 @@ a.select2-search-choice-close {
opacity: .825;
}

.related-resources-nodes .library-card {
height: 75px;
}

.library-card.active {
background: #ffffff;
border-left: 5px solid steelblue;
Expand Down Expand Up @@ -1053,6 +1061,24 @@ a.select2-search-choice-close {
text-overflow: ellipsis;
}

.related-resources-nodes .crud-card-subtitle {
top: 50px;
display: flex;
flex-direction: row;
margin-left: -2px;
padding-bottom: 2px;
width: 250px
}

.related-resources-nodes .crud-card-subtitle span {
padding-left: 2px;
padding-right: 2px;
}

.related-resources-nodes .crud-card-main {
width: 250px;
}

.crud-card-link {
position: absolute;
top: 25px;
Expand All @@ -1063,6 +1089,16 @@ a.select2-search-choice-close {
padding: 3px 5px;
}

.load-relations {
color: steelblue;
margin-left: 5px;
}

.load-relations.disabled {
color: #ddd;
margin-left: 5px;
}

.permission-level-icon {
height: 20px;
margin-top: -5px;
Expand Down Expand Up @@ -3044,6 +3080,27 @@ input.cmn-toggle-yes-no:checked+label:after {
margin-bottom: -10px;
}

.node-list-footer {
height: 45px;
position: absolute;
top: 70px;
width: 100%;
border-top: 1px solid #efefef;
padding: 5px;
padding-top: 10px;
margin-left: -5px
}

.node-list-footer a {
color: steelblue;
font-weight: 500;
padding-right: 10px;
}

.node-list-item-icon {
padding-right: 3px;
}

.resource-list a.chosen-single {
background: transparent;
color: #333;
Expand Down Expand Up @@ -3169,6 +3226,11 @@ input.cmn-toggle-yes-no:checked+label:after {
font-weight: 300;
}

.change-password-form .success {
color: steelblue;
padding: 5px;
}

.img-login {
background-image: url(../img/backgrounds/easter_island_night.jpg);
}
Expand Down Expand Up @@ -4231,7 +4293,6 @@ ul.jqtree_common li.jqtree-folder {
min-height: 55px;
background: #f8f8f8;
border-bottom: 1px solid #e9e9e9;
z-index: 2;
}

.ep-form-toolbar div:nth-last-child(2) {
Expand Down Expand Up @@ -5021,6 +5082,9 @@ li.aside-li.active:hover, .library-dark .tab-content {
}

.library-card.relative.selected {
height: 115px;
-webkit-transition: height 0.25s; /* Safari */
transition: height 0.25s;
background: #ffffff;
border-left: 5px solid steelblue;
}
Expand All @@ -5030,6 +5094,11 @@ li.aside-li.active:hover, .library-dark .tab-content {
border-left: 5px solid #ccc;
}

.library-card.relative {
-webkit-transition: height 0.25s; /* Safari */
transition: height 0.25s;
}

.library-card.relative.selected.hovered {
background: #ffffff;
border-left: 5px solid steelBlue;
Expand Down Expand Up @@ -7430,20 +7499,66 @@ a.clear-geojson-button:hover {
}

.hover-rr-node-info {
position: absolute;
top: 50px;
z-index: 1000;
left: 15px;
z-index: 999999;
margin: 10px;
width: 400px;
width: 300px;
padding: 0px;
border: solid 1px #999;
border-radius: 2px;
box-shadow: 0 5px 15px rgba(0,0,0,0.3);
background-color: rgb(249, 249, 249);
opacity: 0.9;
display: flex;
flex-direction: column;
}

.rr-fdg-name {
display: flex;
flex-direction: row;
padding: 5px;
background-color: #f4f4f4;
}

.rr-fdg-details {
display: flex;
flex-direction: column;
}

.rr-fdg-details span {
flex-direction: row;
}

.rr-number {
font-weight: bold;
padding-right: 5px
}

.rr-number.fdg {
font-weight: bold;
font-size: 22px;
text-shadow: 0px 0px 0.08em #fff;
}

.rr-fdg-name .node-list-item-icon {
padding-right: 5px;
padding-top: 2px;
margin-left: -5px;
}

.rr-fdg-edge {
padding-left: 25px;
font-style: italic;
padding-top: 3px;
padding-bottom: 3px;
border-top-style: solid;
border-bottom-style: solid;
border-color: #ddd;
border-width: 1px;
}

.related-node-details {
display: flex;
flex-direction: column;
}

.iiif-widget {
position: relative;
Expand Down Expand Up @@ -7642,6 +7757,7 @@ a.search-query-link-captions:focus {
overflow-y: scroll;
overflow-x: hidden;
transition: all .5s;
margin-top: inherit;
}

.search-title {
Expand Down
Binary file modified arches/app/media/img/help/add-report-to-resource-model.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3947133

Please sign in to comment.