allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [2/3] allura git commit: [#8231] make viewable extensions dialog work nicer
Date Tue, 18 Sep 2018 17:59:49 GMT
[#8231] make viewable extensions dialog work nicer


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

Branch: refs/heads/db/8231
Commit: 4ebec5c77eef13b19cf01f6db57b1a1f09f8acd2
Parents: 96cb9d0
Author: Dave Brondsema <dave@brondsema.net>
Authored: Tue Sep 18 13:46:27 2018 -0400
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Tue Sep 18 13:46:27 2018 -0400

----------------------------------------------------------------------
 Allura/allura/lib/repository.py                 |  4 ++--
 .../allura/templates/repo/admin_extensions.html | 23 +++++---------------
 2 files changed, 8 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/4ebec5c7/Allura/allura/lib/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/repository.py b/Allura/allura/lib/repository.py
index d89f4c2..c176a63 100644
--- a/Allura/allura/lib/repository.py
+++ b/Allura/allura/lib/repository.py
@@ -258,8 +258,8 @@ class RepoAdminController(DefaultAdminController):
     @expose()
     @require_post()
     def set_extensions(self, **post_data):
-        self.repo.additional_viewable_extensions = post_data[
-            'additional_viewable_extensions']
+        self.repo.additional_viewable_extensions = post_data['additional_viewable_extensions']
+        redirect(request.referer)
 
     @without_trailing_slash
     @expose('jinja:allura:templates/repo/default_branch.html')

http://git-wip-us.apache.org/repos/asf/allura/blob/4ebec5c7/Allura/allura/templates/repo/admin_extensions.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/admin_extensions.html b/Allura/allura/templates/repo/admin_extensions.html
index e09a77a..f3801cf 100644
--- a/Allura/allura/templates/repo/admin_extensions.html
+++ b/Allura/allura/templates/repo/admin_extensions.html
@@ -16,12 +16,14 @@
        specific language governing permissions and limitations
        under the License.
 -#}
-<form>
+{% import 'allura:templates/jinja_master/lib.html' as lib with context %}
+
+<form method="post" action="{{c.project.url()}}admin/{{app.config.options.mount_point}}/set_extensions">
   <label class="grid-13">Extensions:</label>
   <div class="grid-13">
     {% if allow_config %}
       <input type="text" name="additional_viewable_extensions"
-             id="additional_viewable_extensions" title="e.g., .svnignore,.gitignore,.ini"
+             id="additional_viewable_extensions" placeholder=".ini, .foo, Makefile"
              {% if additional_viewable_extensions %} value="{{additional_viewable_extensions}}"{%
endif %}/>
     {% else %}
       <span>{{additional_viewable_extensions}}</span>
@@ -33,21 +35,8 @@
   <hr>
   <div class="grid-13">&nbsp;</div>
   <div class="grid-13">
-    <input type="button" onclick="save_extensions()" value="Save">
+    <input type="button" value="Save" class="submit">
+    {{lib.csrf_token()}}
   </div>
   {% endif %}
 </form>
-{% if allow_config %}
-  <script type="text/javascript">
-    function save_extensions() {
-        var cval = $.cookie('_session_id');
-        $.post('{{c.project.url()}}admin/{{app.config.options.mount_point}}/set_extensions',
{
-            additional_viewable_extensions: $('#additional_viewable_extensions').val(),
-            _session_id:cval
-        },
-        function () {
-            location.reload();
-        });
-    }
-  </script>
-{% endif %}


Mime
View raw message