You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/03/24 20:30:03 UTC

[2/2] allura git commit: [#7817] Replace "mount point" field with URL field, on tool creation forms

[#7817] Replace "mount point" field with URL field, on tool creation forms


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/4ada51eb
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/4ada51eb
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/4ada51eb

Branch: refs/heads/hs/7817
Commit: 4ada51ebad22ad78c691dd65ef5f39f45e5798c3
Parents: cde1ffc
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Mar 23 16:50:51 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Tue Mar 24 15:29:32 2015 -0400

----------------------------------------------------------------------
 .../ext/admin/templates/project_tools.html      | 49 ++++++++++++++++++--
 1 file changed, 44 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/4ada51eb/Allura/allura/ext/admin/templates/project_tools.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/project_tools.html b/Allura/allura/ext/admin/templates/project_tools.html
index a51f750..ca372ce 100644
--- a/Allura/allura/ext/admin/templates/project_tools.html
+++ b/Allura/allura/ext/admin/templates/project_tools.html
@@ -26,6 +26,7 @@
 {% block header %}Tools{% endblock %}
 
 {% block content %}
+{% set full_url = h.absurl(c.project.url()) %}
   <h3>Click to install</h3>
   <div class="nested-grid-container">
     {% for tool in installable_tools %}
@@ -46,10 +47,14 @@
   <form method="post" action="update_mounts?limit={{limit}}&page={{page}}" id="install_form" style="display:none">
     <input type="hidden" name="new.ordinal" value="{{total_mounts}}"/>
     <input type="hidden" name="new.ep_name" class="new_ep_name">
-    <label class="grid-13">Label</label>
-    <div class="grid-13"><input type="text" name="new.mount_label" class="new_mount_label"></div>
-    <label class="grid-13">Mount Point</label>
-    <div class="grid-13"><input type="text" name="new.mount_point" class="new_mount_point"></div>
+    <label class="grid-13" for="new.mount_label">Label</label>
+    <div class="grid-13"><input type="text" name="new.mount_label" class="new_mount_label" title="This will be the name displayed in your project toolbar.">
+    </div>
+      <label class="grid-13" for="new.mount_point">Url Path</label>
+      <div class="grid-13">
+        <input id="id_url_input" type="text" name="new.mount_point" title="The url for this tool relative to {{ full_url }} " class="new_mount_point">
+       <p><span id="full-url-preview" data-url="{{full_url}}"></span></p>
+    </div>
     <div class="grid-13">
       <small>
         * The mount point is the name of the tool as it will appear in a URL.
@@ -172,13 +177,40 @@
 {% endblock %}
 
 {% block extra_js %}
-<script type="text/javascript">
+<script>
     var defaults = {
         {% for tool in installable_tools %}
         '{{tool.name}}':{'default_label':'{{tool.app.default_mount_label}}','default_mount':'{{tool.app.default_mount_point}}'}{% if not loop.last %},{% endif %}
         {% endfor %}
     };
 </script>
+<script>
+/* Real-time preview of a Url Path (aka mount point). */
+
+    var url_preview = $('#full-url-preview'); // "Preview Url Path" displayed on when creating a new tool.
+    var full_url = $(url_preview).data().url; // Full url path of current project.
+
+    // Update the url path preview as they type.
+    $('#id_url_input').keyup(function(){
+        url_preview.html(full_url + '<strong class="url-keyword">' + $(this).val() + "</strong>");
+    });
+
+    // Set url_preview to the Url Path Defaults when creating a new tool.
+    $('.installable_tool').find('a').on('click', function () {
+        // Add the link tool's 'nice name'.
+        defaults['external link'] = defaults.link
+        var tool_name = $.trim($(this).text().toLowerCase());
+
+        // If a tool has a default url path, use it for an initial preview.
+        if (defaults[tool_name]) {
+            url_preview.html(full_url + '<strong class="url-keyword">' + defaults[tool_name].default_mount + "</strong>");
+        }
+        else {
+            // No defaults for this tool, so we use the base url to ensure the url_preview is reset.
+            url_preview.html(full_url);
+        }
+    });
+</script>
 {% endblock %}
 
 {% block extra_css %}
@@ -195,5 +227,12 @@ div.isnt_sorted > ul.deck {
 #configure_grouping_form input[name=grouping_threshold] {
     width: 1.5em;
 }
+#full-url-preview{
+  color: white;
+  font-size: small;
+}
+#full-url-preview .url-keyword{
+  color: orange;
+}
 </style>
 {% endblock %}