allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetm...@apache.org
Subject [24/45] allura git commit: [#7817] Replace "mount point" field with URL field, on tool creation forms
Date Mon, 30 Mar 2015 12:26:40 GMT
[#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/1f1a2c5c
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/1f1a2c5c
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/1f1a2c5c

Branch: refs/heads/ib/7837
Commit: 1f1a2c5c401bd35bfcef209346d4fed612e60e26
Parents: b233388
Author: Heith Seewald <hseewald@slashdotmedia.com>
Authored: Mon Mar 23 16:50:51 2015 -0400
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Mar 25 15:53:49 2015 +0000

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


http://git-wip-us.apache.org/repos/asf/allura/blob/1f1a2c5c/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 %}


Mime
View raw message