| {#- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| -#} |
| {% extends g.theme.master %} |
| |
| |
| {% block title %}{{c.project.name}} / Metadata{% endblock %} |
| |
| {% block header %}{% if c.project.is_user_project %}Profile Metadata{% else %}Project Admin{% endif %}{% endblock %} |
| |
| {% block content %} |
| {% if c.project.deleted %} |
| <div class="notice">This project has been deleted and is not visible to non-admin users</div> |
| {% endif %} |
| {{c.metadata_admin.display(value=metadata_admin_value, |
| allow_project_delete=allow_project_delete)}} |
| {% endblock %} |
| |
| {% block extra_js %} |
| <script type="text/javascript" src="{{g.forge_static('js/jquery.maxlength.min.js')}}"></script> |
| <script type="text/javascript"> |
| /*global confirm: true*/ |
| $(document).ready(function () { |
| $.maxlength.setDefaults({feedbackText : '{r} characters left'}) |
| |
| var $metadata_form = $('#metadata_form'); |
| var $removal_original = $('input[name=removal]:checked'); |
| var $removal_delete_cb = $('#removal_delete_cb'); |
| var currently_deleted = $removal_delete_cb.is(':checked'); |
| var $support_page_url_cb = $('#support_page_url_cb'); |
| var $removal_moved_cb = $('#removal_moved_cb'); |
| var $support_page_url = $('input[name=support_page_url]'); |
| var $moved_to_url = $('input[name=moved_to_url]'); |
| var update_url = function(check_cb, url_input){ |
| if(check_cb.is(':checked')){ |
| url_input.prop('disabled', false); |
| } |
| else{ |
| url_input.prop('disabled', true); |
| url_input.val(''); |
| } |
| }; |
| |
| // manage url input state for support page and removal |
| update_url($support_page_url_cb, $support_page_url); |
| update_url($removal_moved_cb, $moved_to_url); |
| $('input[name=summary]').maxlength({max: 70}); |
| $('textarea[name=short_description]').maxlength({max: 1000}); |
| $('input[name=support_page]').change(function(){ |
| update_url($support_page_url_cb, $support_page_url); |
| }); |
| $('#delete-icon').click(function(e) { |
| e.preventDefault(); |
| if (confirm('Remove project icon? This cannot be undone.')) { |
| $(this).after('<input type="hidden" name="delete_icon" value="Delete Icon" />') |
| .closest('form').submit(); |
| } |
| }); |
| $('#edit-icon').click(function(e) { |
| e.preventDefault(); |
| var $this = $(this); |
| var $parent = $this.closest('#project-icon'); |
| $('#project-icon-upload').removeClass('hidden'); |
| }); |
| if($('#project-icon-upload .error').length) { |
| $('#project-icon-upload').removeClass('hidden'); |
| } |
| $('input[name=removal]').change(function(){ |
| update_url($removal_moved_cb, $moved_to_url); |
| // confirmation for delete |
| if($(this).val()==='deleted' && !currently_deleted){ |
| if(confirm('Are you sure you want to delete this project?')){ |
| $metadata_form.append('<input type="hidden" name="delete" value="true">'); |
| $('#metadata_form').submit(); |
| } |
| else{ |
| $removal_original.prop('checked', true); |
| } |
| } |
| {% if not allow_project_undelete %} |
| else if($(this).val()!=='deleted' && currently_deleted){ |
| alert('You may not undelete a project that has already been deleted.'); |
| $removal_original.prop('checked', true); |
| } |
| {% else %} |
| else if($(this).val()!=='deleted' && currently_deleted){ |
| if(confirm('Are you sure you want to undelete this project?')){ |
| $metadata_form.append('<input type="hidden" name="undelete" value="true">'); |
| $('#metadata_form').submit(); |
| } |
| else{ |
| $removal_original.prop('checked', true); |
| } |
| } |
| {% endif %} |
| }); |
| }); |
| </script> |
| {% endblock %} |
| |
| {% block extra_css %} |
| <style type="text/css"> |
| .grid-9 input[type="text"], .grid-9 select, .grid-9 textarea{ |
| width: 95% |
| } |
| .grid-9 input[type="radio"]{ |
| vertical-align: middle |
| } |
| textarea[name="short_description"]{ |
| height: 100px; |
| } |
| </style> |
| {% endblock %} |