Bulk add templates regarding GHOPProgram Views.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Fri, 28 Aug 2009 13:15:56 +0200
changeset 2828 a0f221472487
parent 2827 58e2a02e35b4
child 2829 ebc8976cd8f6
Bulk add templates regarding GHOPProgram Views. Reviewed by: to-be-reviewed
app/soc/templates/modules/ghop/program/allocation/allocation.html
app/soc/templates/modules/ghop/program/allocation/heading.html
app/soc/templates/modules/ghop/program/allocation/row.html
app/soc/templates/modules/ghop/program/list/heading.html
app/soc/templates/modules/ghop/program/list/row.html
app/soc/templates/modules/ghop/program/tag/difficulty.html
app/soc/templates/modules/ghop/program/tag/task_type.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/modules/ghop/program/allocation/allocation.html	Fri Aug 28 13:15:56 2009 +0200
@@ -0,0 +1,23 @@
+{% extends "soc/models/list.html" %}
+
+{% block scripts %}
+{{ block.super }}
+
+<script type="text/javascript">
+  var RETURN_URL = "{{ return_url }}";
+  $(document).ready(function(){
+    $('[id^=id_spin_slot_count_]').spin({min:0});
+  });
+</script>
+{% endblock %}
+
+{% block body %}
+<form method="POST">
+<input style="font-weight: bold" type="submit" value="Submit"/></span>
+{% if error_message %}
+<div class="error">{{ error_message|safe }}</div>
+{% endif %}
+{{ block.super }}
+</form>
+{% endblock %}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/modules/ghop/program/allocation/heading.html	Fri Aug 28 13:15:56 2009 +0200
@@ -0,0 +1,5 @@
+<tr align="left">
+  <th>Name</th>
+  <th>Task Quota Limits</th>
+</tr>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/modules/ghop/program/allocation/row.html	Fri Aug 28 13:15:56 2009 +0200
@@ -0,0 +1,11 @@
+<tr class="off" onmouseover="this.className='on'" onmouseout="this.className='off'" name="name">
+  <td><div class="name">{{ list.item.name }}</div></td>
+  <td>
+    <div class="slots" id="id_slot_count_{{ list.item.link_id }}">
+    <input type="text" id="id_spin_slot_count_{{ list.item.link_id }}"
+     name="{{ list.item.link_id }}" size="10" 
+     value="{{ list.item.task_quota_limit }}"/>
+    </div>
+  </td>
+</tr>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/modules/ghop/program/list/heading.html	Fri Aug 28 13:15:56 2009 +0200
@@ -0,0 +1,5 @@
+<tr align="left">
+  <th>Program Name</th>
+  <th>Program Owner</th>
+</tr>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/modules/ghop/program/list/row.html	Fri Aug 28 13:15:56 2009 +0200
@@ -0,0 +1,11 @@
+<tr class="off" onmouseover="this.className='on'; do_redirect=true" onmouseout="this.className='off'" 
+onclick="if (do_redirect) document.location.href='{{ list.redirect }}'" name="link_id">
+  <td align="right">
+   <div class="title">
+    <a class="noul" onclick="do_redirect=false"
+     href="{{ list.redirect }}">{{ list.item.name }}</a>
+   </div>
+  </td>
+  <td><div class="scope_path">{{ list.item.scope_path}}</div></td>
+</tr>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/modules/ghop/program/tag/difficulty.html	Fri Aug 28 13:15:56 2009 +0200
@@ -0,0 +1,113 @@
+{% extends "soc/models/edit.html" %}
+{% comment %}
+Licensed 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.
+{% endcomment %}
+
+{% block stylesheet %}
+{{ block.super }}
+<link rel='stylesheet' href='/soc/content/css/jquery-ui-sortable-090806.css' 
+type='text/css' media='all' />
+{% endblock %}
+
+{% block scripts %}
+  {{ block.super }}
+  <script type="text/javascript" src="/jquery/jquery-in-place-edit.js"></script>
+  <script type="text/javascript" src="/jquery/jquery-ui.sortable.js"></script>
+  <script type="text/javascript">
+   var submit_handler = function(element, id, value) {
+	   $.get("/ghop/program/difficulty_tag_edit", 
+	         { 'tag_data': [$("#"+id).attr("name"), value], 
+    	       'program_key_name': '{{ program_key_name }}' },
+           function(data) {
+    	       if (!data) {
+    	    	   $("#"+id).remove();
+    	       } else {
+    	         $("#"+id).attr('name', data);
+    	       }
+    	     }
+     );
+	  return true;
+	};
+
+	var cancel_handler = function(element) {
+	  // Nothing
+	  return true;
+	};
+
+	// Enable in-place-edit
+	$(document).ready(function(){
+	      
+	  // paragraph, list examples
+	  $(".in-place-edit").children().inPlaceEdit({
+	    submit : submit_handler,
+	    cancel : cancel_handler
+	  }); 
+
+	  $("#dynamic-add").sortable({
+		  update : function () {
+		    var order = $('#dynamic-add').sortable('toArray');
+		    var new_order = new Array();
+	      for (i in order) {
+		      if (order[i])
+			      new_order[i] = $("#"+order[i]).attr("name");
+	      }
+		    $.get("/ghop/program/difficulty_tag_edit", 
+		          { 'order': new_order,
+	              'program_key_name': '{{ program_key_name }}' }
+        ); 
+		  } 
+		});
+	});
+  </script>
+{% endblock %}
+
+{% block body %}
+To add new tags click on Add button. To edit a tag click on the tag. To 
+delete a tag click on it and make its content empty. To order them drag and
+drop the tags.
+<ul class="in-place-edit" id="dynamic-add">
+ {% for difficulty in difficulties %}
+ <li id="existing-{{ forloop.counter }}" 
+ name="{{ difficulty.tag }}" class="handle">{{ difficulty.tag }}</li>
+ {% endfor %}
+</ul>
+<p>
+ <input style="font-weight: bold" type="button" 
+ value="Add" onclick="return add()"/>
+</p>
+
+<script type="text/javascript">
+ var index = 0;
+
+ function add() {
+   $('#dynamic-add').append(
+	     '<li id="category-new-' + index + '" name="" class="handle">Type name here...</li>');
+
+   var new_element = $("#category-new-" + index);
+   new_element.inPlaceEdit({
+     submit : submit_handler,
+     cancel : cancel_handler
+   });
+
+   new_element.click();
+
+   new_element.find('.field').focus();
+   new_element.find('.field').select();
+
+   index = index + 1;
+
+   return false;
+ }
+</script>
+{% endblock %}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/modules/ghop/program/tag/task_type.html	Fri Aug 28 13:15:56 2009 +0200
@@ -0,0 +1,112 @@
+{% extends "soc/models/edit.html" %}
+{% comment %}
+Licensed 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.
+{% endcomment %}
+
+{% block stylesheet %}
+{{ block.super }}
+<link rel='stylesheet' href='/soc/content/css/jquery-ui-sortable-090806.css' 
+type='text/css' media='all' />
+{% endblock %}
+
+{% block scripts %}
+  {{ block.super }}
+  <script type="text/javascript" src="/jquery/jquery-in-place-edit.js"></script>
+  <script type="text/javascript" src="/jquery/jquery-ui.sortable.js"></script>
+  <script type="text/javascript">
+   var submit_handler = function(element, id, value) {
+     $.get("/ghop/program/type_tag_edit", 
+           { 'tag_data': [$("#"+id).attr("name"), value], 
+             'program_key_name': '{{ program_key_name }}' },
+           function(data) {
+             if (!data) {
+               $("#"+id).remove();
+             } else {
+               $("#"+id).attr('name', data);
+             }
+           }
+     );
+    return true;
+  };
+
+  var cancel_handler = function(element) {
+    // Nothing
+    return true;
+  };
+
+  // Enable in-place-edit
+  $(document).ready(function(){
+        
+    // paragraph, list examples
+    $(".in-place-edit").children().inPlaceEdit({
+      submit : submit_handler,
+      cancel : cancel_handler
+    });
+
+    $("#dynamic-add").sortable({
+      update : function () {
+        var order = $('#dynamic-add').sortable('toArray');
+        var new_order = new Array();
+        for (i in order) {
+          if (order[i])
+            new_order[i] = $("#"+order[i]).attr("name");
+        }
+        $.get("/ghop/program/type_tag_edit", 
+              { 'order': new_order,
+                'program_key_name': '{{ program_key_name }}' }
+        ); 
+      } 
+    });
+  });
+  </script>
+{% endblock %}
+
+{% block body %}
+To add new tags click on Add button. To edit a tag click on the tag. To 
+delete a tag click on it and make its content empty. To order them drag and
+drop the tags.
+<ul class="in-place-edit" id="dynamic-add">
+ {% for task_type in task_types %}
+ <li id="existing-{{ forloop.counter }}" 
+ name="{{ task_type.tag }}" class="handle">{{ task_type.tag }}</li>
+ {% endfor %}
+</ul>
+<p>
+ <input style="font-weight: bold" type="button" 
+ value="Add" onclick="return add()"/>
+</p>
+
+<script type="text/javascript">
+ var index = 0;
+
+ function add() {
+   $('#dynamic-add').append('<li id="category-new-' + index + '" name="" class="handle">Type name here...</li>');
+
+   var new_element = $("#category-new-" + index);
+   new_element.inPlaceEdit({
+     submit : submit_handler,
+     cancel : cancel_handler
+   });
+
+   new_element.click();
+
+   new_element.find('.field').focus();
+   new_element.find('.field').select();
+
+   index = index + 1;
+
+   return false;
+ }
+</script>
+{% endblock %}
+