Skip to content

Commit

Permalink
Merge branch 'release/1.12.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
pirhoo committed Feb 12, 2015
2 parents 1c80f50 + 536f7bc commit 3edb838
Show file tree
Hide file tree
Showing 42 changed files with 543 additions and 284 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[License](https://github.com/jplusplus/detective.io/blob/master/LICENSE)
[Test coverage](https://coveralls.io/r/jplusplus/detective.io)
[Documentation](http://docs.detective.io/en/latest/)
*Version 1.12.3 Frog*
*Version 1.12.4 Gorilla*

## Installation

Expand Down
2 changes: 1 addition & 1 deletion app/detective/bundle/bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "detective",
"version": "1.12.3",
"version": "1.12.4",
"dependencies": {
"angular": "1.2.16",
"angular-cookies": "1.2.16",
Expand Down
11 changes: 10 additions & 1 deletion app/detective/bundle/client/app/base.dj.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@
{% for picture_url in meta.pictures %}
<meta property="og:image" content="{{ picture_url }}">
{% endfor %}
<meta name="viewport" content="width=device-width">

<meta name="viewport" id="viewport" content="width=480px, maximum-scale=1, user-scalable=no">
<script>
(function(doc) {
var viewport = doc.getElementById('viewport');
if ( navigator.userAgent.match(/iPad/i) ) {
viewport.setAttribute("content", "width=992px, maximum-scale=1, user-scalable=no");
}
}(document));
</script>

<link rel="dns-prefetch" href="{% static '' %}">
<link rel="icon" type="image/png" href="{% static 'img/favicon.ico' %}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,17 @@ class window.HeaderCtrl
# Watch current topic
@scope.$watch (=>@TopicsFactory.topic), (topic)=> @scope.topic = topic

@scope.shouldShowTopicSearch = @isInTopic
@scope.shouldShowAddEntity = =>
return false unless @isInTopic()
return @scope.user.hasAddPermission(@TopicsFactory.topic.ontology_as_mod)
@isInTopic() and @scope.user.hasAddPermission(@TopicsFactory.topic.ontology_as_mod)

@scope.shouldShowTopicSearch = =>
in_topic = @isInTopic()
in_wrong_state = @isInEmptyState() or @isInInvite() or @isInHome()
in_topic and not in_wrong_state

@scope.toggleUserMenu = @toggleUserMenu
@scope.closeUserMenu = @closeUserMenu
@scope.goToMyProfile = @goToMyProfile
@scope.goToMySettings = @goToMySettings

isInTopic: =>
topic = @TopicsFactory.topic
topic? and not _.isEmpty(topic)

isInEmptyState: =>
state = @state.current
not state? or _.isEmpty(state) or _.isEmpty(state.name)

isInInvite: =>
@state.current.name is 'user-topic-invite'

isInHome: =>
((@state.current.name or '').match(/^home/) or []).length > 0
isInTopic: => @state.params.topic?

toggleUserMenu: =>
@scope.userMenuOpened = not @scope.userMenuOpened
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</div>

<form class="topic-search hidden-xs" role="search" ng-controller="SearchFormCtrl as search">
<div class="btn-group ng-hide" ng-show="shouldShowTopicSearch() || false">
<div class="btn-group ng-hide" ng-show="shouldShowTopicSearch()">
<a class="btn btn-default topic-search__home" href="[[search.topic.link]]" title="[[search.topic.title]]">
[[search.topic.title | characters:25]]
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@

.show-aside:not(.is-home) & {
left:@aside-width;

@media (max-width: @screen-xs-max) {
left:100%;

.header {
.translate(100%, 0);
}
}

}
}

Expand All @@ -38,10 +29,6 @@
.transition(@header-open-speed);
.translate(-100%, 0);

@media (max-width: @screen-xs-max) {
width:100%;
}

&__overlay {
position: absolute;
left:100%;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
angular.module('detective').service 'Modal', ($modal)->
(msg, yesBtn='Yes', noBtn='Cancel')->
modal = $modal.open
templateUrl: '/partial/components/modal/modal.html'
controller: ['$scope', ($scope) =>
$scope.title = msg
$scope.buttons = yes : yesBtn, no : noBtn
$scope.modal = modal
]
return modal.result
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ angular.module('detective').directive "ttTypeahead", ($rootScope, $filter, $comp
do scope.submit
# Watch select event
element.on "typeahead:selected", (ev, individual)->
console.log "selected", lastQuery
if not _.isEmpty(attrs.ttModel)
scope.$apply =>
# workaround to have same types between individual and
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div id="create-topic" class="container topic-form">

<div class="topic-form__header" ng-show="isCreating()">
<div class="topic-form__header topic-form__header--ordered" ng-show="isCreating()">
<h2>Create a new data collection</h2>

<ul class="nav nav-pills topic-form__header__tabs" role="tablist">
Expand Down Expand Up @@ -40,10 +40,23 @@ <h2>
<label class="label label-info" ng-if="!topic.public">private</label>
</small>
</h2>
<ul class="nav nav-pills topic-form__header__tabs" role="tablist">
<li class="topic-form__header__tabs__item" ng-class="{ active: $state.is('user-topic-edit.customize-ontology') }">
<a ui-sref=".customize-ontology">
Customize your structure
</a>
</li>
<li class="topic-form__header__tabs__item" ng-class="{ active: $state.is('user-topic-edit') }">
<a ui-sref="user-topic-edit">
Describe your data collection
</a>
</li>
</ul>
</div>
<div ng-if="isEditing()" ng-include="'partial/main/home/dashboard/create/describe/describe.html'"></div>

<div ui-view></div>
<div ui-view>
<div ng-if="isEditing()" ng-include="'partial/main/home/dashboard/create/describe/describe.html'"></div>
</div>

<a ui-sref="home.dashboard"><i class='fa fa-arrow-left'></i>&nbsp;Go back to your dashboard</a>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,49 @@
margin-bottom:20px;

&__tabs {
counter-reset: tab;

&__item {
position:relative;
margin-right:21px + 10px;
margin-right:10px;

a {
background:mix(white, @body-bg);
&:before {
counter-increment: tab;
content: counter(tab) ". "
}
}
}
}

a:after {
content:"";
border:21px solid transparent;
border-left-color: mix(white, @body-bg);
position:absolute;
top:0;
left:100%;
}
&--ordered {

&.active a:after,
&.active a:hover:after {
border-left-color:@brand-primary;
}
&__tabs {
counter-reset: tab;

& a:hover:after {
border-left-color: @nav-link-hover-bg;
&__item {
margin-right:21px + 10px;

a {
&:before {
counter-increment: tab;
content: counter(tab) ". "
}
}

a:after {
content:"";
border:21px solid transparent;
border-left-color: mix(white, @body-bg);
position:absolute;
top:0;
left:100%;
}

&.active a:after,
&.active a:hover:after {
border-left-color:@brand-primary;
}

& a:hover:after {
border-left-color: @nav-link-hover-bg;
}
}
}
}
Expand Down Expand Up @@ -283,7 +296,7 @@

&.saved {
.form-footer {
color: @panel-success-text;
color: @panel-success-text;
background: @panel-success-heading-bg;
border-color: darken(@panel-success-border, 5);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
class window.EditTopicOntologyCtrl
@$inject: ['$scope', 'Page', '$rootScope', 'TopicsFactory', '$modal']
constructor: (@scope, @Page, @rootScope, @TopicsFactory, @modal)->
@$inject: ['$scope', '$state', 'Page', '$rootScope', 'TopicsFactory', '$modal']
constructor: (@scope, @state, @Page, @rootScope, @TopicsFactory, @modal)->
# Scope methods
@scope.isEditing = @isEditing
@scope.mayLostFieldData = @mayLostFieldData
@scope.mayLostModelData = @mayLostModelData
@scope.hasSelectedModel = @hasSelectedModel
@scope.hasSelectedRelationship = @hasSelectedRelationship
@scope.startEditingModel = @startEditingModel
Expand All @@ -18,15 +21,34 @@ class window.EditTopicOntologyCtrl
@scope.removeRelationship = @removeRelationship
# Initialize variables
do @startOver
# List of current model
@scope.models = @scope.selected_skeleton.ontology or []
# List of current model from diferent contexts
if @scope.selected_skeleton?
@scope.models = @scope.selected_skeleton.ontology
else if @scope.topic?
@scope.models = @scope.topic.ontology_as_json
else
@scope.models = []
# A copy of the initial model
@master = angular.copy(@scope.models)


# Shortcuts
hasSelectedModel : => @scope.selectedModel?
hasSelectedRelationship : => @scope.selectedRelationship?
startEditingModel : (model)=> @scope.selectedModel = model
startEditingRelationship: (relationship)=> @scope.selectedRelationship = relationship
getModel : (name)=> _.find @scope.models, name: name
getModel : (name, models=@scope.models)=> _.find models, name: name
isEditing : => @state.includes("user-topic-edit")
mayLostFieldData : (field, model)=> @isEditing() and @isExistingField(field, model)
mayLostModelData : (model)=> @isEditing() and @isExistingModel(model)

isExistingModel: (model)=>
return !! @getModel(model.name, @master)

isExistingField: (field, model)=>
# Relationship fields resolve a parent model
model = @getModel(field.model, @master) unless model?
return model? and _.find model.fields, name: field.name

startOver: =>
# Panels display
Expand Down Expand Up @@ -64,17 +86,18 @@ class window.EditTopicOntologyCtrl

removeModel: (model)=>
modalInstance = @modal.open
templateUrl: '/partial/main/home/dashboard/create/customize-ontology/remove-model/remove-model.html'
controller: ($scope, $modalInstance)->
$scope.model = model
templateUrl: '/partial/main/home/dashboard/create/customize-ontology/remove-model/remove-model.html'
controller: ($scope, $modalInstance)=>
$scope.mayLostData = @mayLostModelData(model)
$scope.model = model
$scope.ok = -> do $modalInstance.close
$scope.cancel = -> $modalInstance.dismiss 'cancel'
# Removing approved
modalInstance.result.then =>
# Look into the other models
for m, model_index in @scope.models
for m, model_index in @scope.models
# Remove every field related to this model
m.fields = _.filter m.fields, (field)-> field.related_model isnt model.name
m.fields = _.filter m.fields, (field)-> field.related_model isnt model.name
@scope.models = _.without @scope.models, model
do @startOver

Expand All @@ -90,10 +113,11 @@ class window.EditTopicOntologyCtrl

removeRelationship: (relationship)=>
modalInstance = @modal.open
templateUrl: '/partial/main/home/dashboard/create/customize-ontology/remove-relationship/remove-relationship.html'
controller: ($scope, $modalInstance)=>
$scope.relationship = relationship
$scope.getModel = @getModel
templateUrl: '/partial/main/home/dashboard/create/customize-ontology/remove-relationship/remove-relationship.html'
controller: ($scope, $modalInstance)=>
$scope.mayLostData = @mayLostFieldData(relationship)
$scope.relationship = relationship
$scope.getModel = @getModel
$scope.ok = -> do $modalInstance.close
$scope.cancel = -> $modalInstance.dismiss 'cancel'
# Removing approved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ angular.module('detective').directive('ontologyVisualization', ['$timeout', ($ti
width = elem.width()
height = elem.height()
angle = 0
step = (2 * Math.PI) / models_nui.length
step = (2 * Math.PI) / models_nui.length
# And move the models arround the center
models_nui.each ->
x = Math.round(width / 2 + radius * Math.cos(angle) - $(this).width() / 2)
Expand All @@ -34,7 +34,7 @@ angular.module('detective').directive('ontologyVisualization', ['$timeout', ($ti
if field.type == "relationship"
model_name = model.name
related_to = field.related_model
# We create a new connection between
# We create a new connection between
# the model_name and the related_mode
plumb.connect
source: elem.find("[data-identifier='#{model_name}']")
Expand Down Expand Up @@ -64,7 +64,7 @@ angular.module('detective').directive('ontologyVisualization', ['$timeout', ($ti
}
]
]
# Make every model draggable
# Make every model draggable
plumb.draggable plumb.getSelector(".model"),
containment: elem

Expand Down
Loading

0 comments on commit 3edb838

Please sign in to comment.