Skip to content

Commit

Permalink
Merge 91f2625 into 59aa5cc
Browse files Browse the repository at this point in the history
  • Loading branch information
jnation3406 committed Jun 6, 2019
2 parents 59aa5cc + 91f2625 commit 5e0685b
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 35 deletions.
Expand Up @@ -14,7 +14,7 @@ <h4>
Principal Investigator: {{ object.pi.first_name }} {{ object.pi.last_name }}
<a href="mailto:{{ object.pi.email }}">{{ object.pi.email }}</a>
</h4>
<h4>Co Investigators <small><i id="toggleci" class="fa fa-eye"></i></h4>
<h4>Co Investigators <small><i id="toggleci" class="fa fa-eye"></i></small></h4>
{% if not user.profile.simple_interface or user == object.pi %}
<table class="table" id="cilist">
<thead>
Expand All @@ -37,15 +37,15 @@ <h4>Co Investigators <small><i id="toggleci" class="fa fa-eye"></i></h4>
<td>
{% if mem.time_limit < 0 %}No Limit{% else %}{{ mem.time_limit_hours | floatformat:3 }}{% endif %}
{% if user == object.pi %}
&nbsp;<i class="fa fa-pencil memlimit" data-membership="{{ mem.id }}"></i>
<a href="#" class="memlimit"><i class="fas fa-edit" data-membership="{{ mem.id }}"></i></a>
<form method="POST" action="{% url 'proposals:membership-limit' pk=mem.id %}" class="form-inline limitform" style="display: none">
{% csrf_token %}
<div class="form-group">
<input name="time_limit" type="number" class="form-control" style="width: 100px" step="0.001"
<div class="form-group mr-md-2 mb-md-1">
<input name="time_limit" type="number" min="-1" class="form-control" style="width: 90px" step="0.01"
{% if mem.time_limit > 0 %} value="{{ mem.time_limit_hours | floatformat:3 }}" {% endif %} />
</div>
<button type="submit" class="btn btn-default remove-limit">Remove Limit</button>
<button type="submit" class="btn btn-default">Set Limit</button>
<button type="submit" class="btn btn-outline-secondary remove-limit mr-md-2">Remove Limit</button>
<button type="submit" class="btn btn-outline-secondary">Set Limit</button>
</form>
{% endif %}
</td>
Expand Down Expand Up @@ -82,7 +82,7 @@ <h4>Time Allocation</h4>
{% for ta in ta.list %}
<tr class="bg-grey">
<td></td>
<td>{{ ta.instrument_name }}</td>
<td>{{ ta.instrument_type }}</td>
<td colspan="2"></td>
</tr>
<tr>
Expand Down Expand Up @@ -127,7 +127,7 @@ <h4>Time Allocation</h4>
<form method="POST" action="" class="form">
{% csrf_token %}
{% bootstrap_form form=notification_form %}
<button type="submit" class="btn btn-default">Save</button>
<button type="submit" class="btn btn-outline-secondary">Save</button>
</form>
<br/>
<dl>
Expand All @@ -143,11 +143,11 @@ <h4>Time Allocation</h4>
</div>
<form method="POST" action="{% url 'proposals:membership-global' pk=object.id %}" class="form-inline">
{% csrf_token %}
<div class="form-group">
<input name="time_limit" type="number" class="form-control" style="width: 100px" step="0.001" placeholder="Hours"/>
<div class="form-group mr-md-2">
<input name="time_limit" type="number" class="form-control" style="width: 90px" min="-1" step="0.01" placeholder="Hours"/>
</div>
<button type="submit" class="btn btn-default remove-limit">Remove Limit</button>
<button type="submit" class="btn btn-default">Set Global Limit</button>
<button type="submit" class="btn btn-outline-secondary remove-limit mr-md-2">Remove Limit</button>
<button type="submit" class="btn btn-outline-secondary">Set Global Limit</button>
</form>
<br/>
<strong>Invite Co-Investigators</strong>
Expand All @@ -161,11 +161,11 @@ <h4>Time Allocation</h4>
</div>
<form method="POST" action="{% url 'proposals:invite' pk=object.id %}" class="form-inline">
{% csrf_token %}
<div class="form-group">
<div class="form-group mr-md-2">
<label class="sr-only" for="email">Invite a Co-Investigator</label>
<input name="email" class="form-control" placeholder="Email Address(s)"/>
</div>
<button type="submit" class="btn btn-default">Add</button>
<button type="submit" class="btn btn-outline-secondary">Add</button>
</form>
<br/>
<dl>
Expand Down Expand Up @@ -196,7 +196,8 @@ <h4>Time Allocation</h4>
$(this).parent().find('input[name="time_limit"]').val('-1');
});

$('.memlimit').click(function(){
$('.memlimit').click(function(event){
event.preventDefault();
$('.limitform').hide();
$(this).next().first().show();
})
Expand Down
Expand Up @@ -31,9 +31,9 @@ <h4>
<div class="row">
<div class="col-md-12">
<form method="get" action="" class="form-inline pull-right">
{% bootstrap_field filter.form.active %}
{% bootstrap_field filter.form.semester %}
{% bootstrap_button button_type="submit" content="Filter" %}
{% bootstrap_field filter.form.active form_group_class="form-group mr-md-3" %}
{% bootstrap_field filter.form.semester form_group_class="form-group mr-md-3" %}
{% bootstrap_button button_type="submit" content="Filter" button_class="btn-outline-secondary" %}
</form>
<table class="table table-striped">
<thead>
Expand Down
Expand Up @@ -21,29 +21,29 @@
<div class="form form-inline">
<div class="form-group">
<label for="semester" class="control-label">Semester</label>
<select class="form-control" onchange="location = this.value">
<select class="form-control ml-md-1" onchange="location = this.value">
{% for semester in semesters %}
<option value="{% url 'proposals:semester-admin' semester %}"
{% if object == semester %} selected {% endif %}>
{{ semester }}
</option>
{% endfor %}
</select>
<div class="checkbox">
<div class="checkbox ml-md-2">
<label>
<input id="completed" type="checkbox" onclick="selectCompleted()"> Completed
</label>
</div>
</div>
</div>
</div>
</div>
<table id="semester-table" class="table table-striped">
</select>
</select>
<thead>
<tr>
<th>Proposal</th>
<th>Class</th>
<th>Instrument</th>
<th>PI</th>
<th>Priority</th>
<th>Std Alloc</th>
Expand All @@ -63,7 +63,7 @@
<td><a href="{% url 'proposals:detail' ta.proposal.id %}">{{ ta.proposal.id }}</a></td>
<td>{{ ta.proposal.pi.first_name }} {{ ta.proposal.pi.last_name }}</td>
<td>{{ ta.proposal.tac_priority }}</td>
<td>{{ ta.instrument_name }}</td>
<td>{{ ta.instrument_type }}</td>
<td>{{ ta.std_allocation|floatformat }}</td>
<td {% if ta.std_allocation > 0 and ta.std_time_used >= ta.std_allocation %} class="bg-danger" {% endif %}>
{{ ta.std_time_used|floatformat }}
Expand Down Expand Up @@ -93,10 +93,10 @@
</div>
{% endblock %}
{% block extra_javascript %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.12.2/bootstrap-table.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.14.2/bootstrap-table.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.3/FileSaver.min.js"></script>
<script src="https://cdn.lco.global/script/tableExport.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.12.2/extensions/export/bootstrap-table-export.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.14.2/extensions/export/bootstrap-table-export.min.js"></script>
<script type="text/javascript">
$('#semester-table').bootstrapTable({
sortName: 'proposal',
Expand Down
4 changes: 2 additions & 2 deletions observation_portal/requestgroups/test/test_api.py
Expand Up @@ -2129,7 +2129,7 @@ def setUp(self):

def test_contention_no_auth(self):
response = self.client.get(
reverse('api:contention', kwargs={'instrument_name': '1M0-SCICAM-SBIG'})
reverse('api:contention', kwargs={'instrument_type': '1M0-SCICAM-SBIG'})
)
self.assertNotEqual(response.json()['contention_data'][1]['All Proposals'], 0)
self.assertEqual(response.json()['contention_data'][2]['All Proposals'], 0)
Expand All @@ -2138,7 +2138,7 @@ def test_contention_staff(self):
user = mixer.blend(User, is_staff=True)
self.client.force_login(user)
response = self.client.get(
reverse('api:contention', kwargs={'instrument_name': '1M0-SCICAM-SBIG'})
reverse('api:contention', kwargs={'instrument_type': '1M0-SCICAM-SBIG'})
)
self.assertNotEqual(response.json()['contention_data'][1][self.request.request_group.proposal.id], 0)
self.assertNotIn(self.request.request_group.proposal.id, response.json()['contention_data'][2])
Expand Down
12 changes: 6 additions & 6 deletions observation_portal/requestgroups/views.py
Expand Up @@ -199,24 +199,24 @@ def get(self, request):
class ContentionView(APIView):
permission_classes = (AllowAny,)

def get(self, request, instrument_name):
def get(self, request, instrument_type):
if request.user.is_staff:
contention = Contention(instrument_name, anonymous=False)
contention = Contention(instrument_type, anonymous=False)
else:
contention = Contention(instrument_name)
contention = Contention(instrument_type)
return Response(contention.data())


class PressureView(APIView):
permission_classes = (AllowAny,)

def get(self, request):
instrument_name = request.GET.get('instrument')
instrument_type = request.GET.get('instrument')
site = request.GET.get('site')
if request.user.is_staff:
pressure = Pressure(instrument_name, site, anonymous=False)
pressure = Pressure(instrument_type, site, anonymous=False)
else:
pressure = Pressure(instrument_name, site)
pressure = Pressure(instrument_type, site)
return Response(pressure.data())


Expand Down
Expand Up @@ -254,7 +254,7 @@ <h3>{% trans 'Application status' %}:
<p>Once you submit your application, you will no longer be able to edit it.</p>
{% endblocktrans %}
{% buttons %}
<a href="#" class="btn btn-default" id="save">{% trans 'Save' %}</a>
<a href="#" class="btn btn-info mr-md-4" id="save">{% trans 'Save' %}</a>
<a href="#" class="btn btn-success" id="submit">{% trans 'Submit' %}</a>
{% endbuttons %}
{% if form.instance.id %}
Expand Down
2 changes: 1 addition & 1 deletion observation_portal/urls.py
Expand Up @@ -62,7 +62,7 @@
url(r'profile/', ProfileApiView.as_view(), name='profile'),
url(r'airmass/', AirmassView.as_view(), name='airmass'),
url(r'instruments/', InstrumentsInformationView.as_view(), name='instruments_information'),
url(r'contention/(?P<instrument_name>.+)/', ContentionView.as_view(), name='contention'),
url(r'contention/(?P<instrument_type>.+)/', ContentionView.as_view(), name='contention'),
url(r'pressure/', PressureView.as_view(), name='pressure'),
url(r'last_changed/', ObservationPortalLastChangedView.as_view(), name='last_changed'),
url(r'last_scheduled/', LastScheduledView.as_view(), name='last_scheduled')
Expand Down

0 comments on commit 5e0685b

Please sign in to comment.