diff --git a/beat/web/plotters/static/plotters/app/factories/plotterparameterFactory.js b/beat/web/plotters/static/plotters/app/factories/plotterparameterFactory.js index f665814e2b01f2acca565a541a136034013ea8eb..d6292c515f27646969a63c3f2448dcca1fa9d8b1 100644 --- a/beat/web/plotters/static/plotters/app/factories/plotterparameterFactory.js +++ b/beat/web/plotters/static/plotters/app/factories/plotterparameterFactory.js @@ -30,7 +30,7 @@ app.factory('plotterparameterFactory', ['$http', function($http) return $http({ headers: {'Content-Type': 'application/json'}, - url: urlBase + '/' + user + '/' + plotterparameter_name + '/' + plotterparameter_version + '/', + url: urlBase + '/' + plotterparameter_user + '/' + plotterparameter_name + '/' + plotterparameter_version + '/', method: "GET", }) diff --git a/beat/web/plotters/templates/plotterparameters/panels/actions.html b/beat/web/plotters/templates/plotterparameters/panels/actions.html index a50c974f78c27802f2519f1224a208e27837a272..0f6d48208a3b801fd61b026a1d0cc6ab3ca24d86 100644 --- a/beat/web/plotters/templates/plotterparameters/panels/actions.html +++ b/beat/web/plotters/templates/plotterparameters/panels/actions.html @@ -22,34 +22,43 @@ {% load plotter_tags %} <div class="btn-group btn-group-sm action-buttons pull-right"> + {% if display_count %} <!-- Experiment count, works for all --> + {% visible_reports object as reports %} + <a class="btn btn-default btn-references" href="{{ object.get_absolute_url }}#reports" data-toggle="tooltip" data-placement="bottom" title="Reports using this plotterparameter"><span class="badge">{{ reports.count }}</span></a> {% else %} - {% ifequal request.user.username object.author.username %} - <!-- Delete, needs to be the owner --> - {% if object.deletable %} - <a class="btn btn-default btn-delete" onclick="modal_delete('plotterparameter', '{{ object.fullname }}', '{% url 'api_plotters:all_plotterparameter' %}', '{% url 'plotters:plotterparameter-list' request.user.username %}');" data-toggle="tooltip" data-placement="bottom" title="Delete"><i class="fa fa-times fa-lg"></i></a> - {% endif %} + {% ifequal request.user.username object.author.username %} {% ifequal object.get_sharing_display 'Private' %} <a id="refresh-button" class="btn btn-default btn-save" data-toggle="tooltip" data-placement="bottom" data-plotter="{{object.plotter}}" title="Test parameters" testplotterparameters><i class="fa fa-refresh fa-lg"></i></a> <a id="save-button" class="btn btn-default btn-save" data-toggle="tooltip" data-placement="bottom" data-plotter="{{object.plotter}}" title="Save" saveplotterparameter><i class="fa fa-floppy-o fa-lg"></i></a> - {% endifequal %} + {% endifequal %} + {% endif %} + + {% ifequal request.user.username object.author.username %} + + {% ifnotequal object.get_sharing_display 'Public' %} + <a class="btn btn-default btn-share" href="{{ object.get_absolute_url }}#sharing" data-toggle="tooltip" data-placement="bottom" title="Share"><i class="fa fa-share-square-o fa-lg"></i></a> + {% endifnotequal %} + + + <!-- Delete, needs to be the owner --> + {% if object.deletable %} + <a class="btn btn-default btn-delete" onclick="modal_delete('plotterparameter', '{{ object.fullname }}', '{% url 'api_plotters:all_plotterparameter' %}', '{% url 'plotters:plotterparameter-list' request.user.username %}');" data-toggle="tooltip" data-placement="bottom" title="Delete"><i class="fa fa-times fa-lg"></i></a> + {% endif %} <!-- New version, needs to be the owner --> <a class="btn btn-default btn-new-version" href="{% url 'plotters:new-version' object.author.username object.name object.version %}" data-toggle="tooltip" data-placement="bottom" title="New version"><i class="fa fa-copy fa-lg"></i></a> {% endifequal %} - {% endif %} {% if not request.user.is_anonymous %} - <!-- Fork button, needs to be logged in --> <a class="btn btn-default btn-fork" href="{% url 'plotters:fork' object.author.username object.name object.version %}" data-toggle="tooltip" data-placement="bottom" title="Fork"><i class="fa fa-code-fork fa-lg"></i></a> - {% endif %} {%comment%} diff --git a/beat/web/plotters/templates/plotterparameters/plotterparameter.html b/beat/web/plotters/templates/plotterparameters/plotterparameter.html index 81bfd31690b741e368003c18cea83f58a582d3dd..a62a5c9f424c61f20648a83024f44c74bcc21a8c 100644 --- a/beat/web/plotters/templates/plotterparameters/plotterparameter.html +++ b/beat/web/plotters/templates/plotterparameters/plotterparameter.html @@ -109,12 +109,12 @@ <div id="title" class="row"> - <div class="{% if owner %}col-sm-9 vertical-center{% else %}col-sm-12{% endif %}"{% if owner %} onmouseover="expand_breadcrumb(this, 9, 3);" onmouseout="reset_breadcrumb(this, 9, 3);"{% endif %}> + <div class="col-sm-9 vertical-center" onmouseover="expand_breadcrumb(this, 9, 3);" onmouseout="reset_breadcrumb(this, 9, 3);"> {% contribution_breadcrumb_plotterparameter plotterparameter %} <!-- Note: keep no space between divs here! --> - </div>{% if owner %}<div class="col-sm-3 vertical-center"> + </div><div class="col-sm-3 vertical-center"> {% plotterparameter_actions plotterparameter False %} - </div>{% endif %} + </div> </div> diff --git a/beat/web/plotters/views.py b/beat/web/plotters/views.py index d41c4aa8389248ca85d41cf1ba022d83a52b8a37..b7af439eff020cdaea8888d0424ba3b3d4f6d055 100644 --- a/beat/web/plotters/views.py +++ b/beat/web/plotters/views.py @@ -906,7 +906,8 @@ def fork(request, author_name, plotterparameter_name, version): description = fork_of.description - parameters = {'plotterparameter_author': request.user.username, + parameters = { + 'plotterparameter_author': author_name, 'plotterparameter_name': plotterparameter_name, 'plotterparameter_version': version, 'fork_of': fork_of, @@ -914,6 +915,7 @@ def fork(request, author_name, plotterparameter_name, version): 'description': description.replace('\n', '\\n'), 'errors': '', 'edition': False, + 'request_user': request.user.username, } return render_to_response('plotterparameters/plotterparameter.html',