You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2016/01/21 17:48:49 UTC

[2/4] allura git commit: [#7921] ticket:887 Remove old code

[#7921] ticket:887 Remove old code

* deleted templates/project_tools.html, js/projects_tools.js,
* admin_main.ProjectAdminController.tools, admin_main.W.install_modal


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

Branch: refs/heads/ib/7921
Commit: 83add7384167ffb5ec9113aa7cfd37854663c018
Parents: 58852a0
Author: Denis Kotov <de...@gmail.com>
Authored: Thu Jan 14 22:09:18 2016 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Thu Jan 21 17:14:44 2016 +0200

----------------------------------------------------------------------
 Allura/allura/ext/admin/admin_main.py           |  22 ---
 .../ext/admin/templates/project_tools.html      | 149 -------------------
 Allura/allura/public/nf/js/project_tools.js     |  71 ---------
 3 files changed, 242 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/83add738/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 45d5cc8..ecdd76e 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -54,8 +54,6 @@ log = logging.getLogger(__name__)
 class W:
     markdown_editor = ffw.MarkdownEdit()
     label_edit = ffw.LabelEdit()
-    install_modal = ffw.Lightbox(
-        name='install_modal', trigger='a.install_trig')
     explain_export_modal = ffw.Lightbox(
         name='explain_export', trigger='#why_export')
     group_card = aw.GroupCard()
@@ -265,26 +263,6 @@ class ProjectAdminController(BaseController):
     def tools_moved(self, **kw):
         return {}
 
-    @without_trailing_slash
-    @expose('jinja:allura.ext.admin:templates/project_tools.html')
-    def tools(self, page=None, limit=200, **kw):
-        c.markdown_editor = W.markdown_editor
-        c.label_edit = W.label_edit
-        c.install_modal = W.install_modal
-        c.page_list = W.page_list
-        mounts = c.project.ordered_mounts()
-        total_mounts = len(mounts)
-        limit, page = h.paging_sanitizer(limit, page or total_mounts / int(limit), total_mounts)
-        start = page * limit
-        return dict(
-            page=page,
-            limit=limit,
-            total_mounts=total_mounts,
-            mounts=mounts[start:start + limit],
-            installable_tools=AdminApp.installable_tools_for(c.project),
-            roles=M.ProjectRole.query.find(
-                dict(project_id=c.project.root_project._id)).sort('_id').all(),
-            categories=M.ProjectCategory.query.find(dict(parent_id=None)).sort('label').all())
 
     @expose()
     @require_post()

http://git-wip-us.apache.org/repos/asf/allura/blob/83add738/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
deleted file mode 100644
index 7b2bc20..0000000
--- a/Allura/allura/ext/admin/templates/project_tools.html
+++ /dev/null
@@ -1,149 +0,0 @@
-{#-
-       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 %}
-{% from 'allura:templates/jinja_master/sidebar_menu.html' import sidebar_item with context %}
-
-{% do g.register_forge_css('css/forge/deck.css') %}
-{% do g.register_forge_js('js/project_tools.js', location='body_js_tail') %}
-
-{% block title %}{{c.project.name}} / Tools{% endblock %}
-
-{% 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 %}
-      <span class="tcenter grid-4 installable_tool">
-        <a class="install_trig" data-tool="{{ tool['name'] }}">
-          <span class="tool_title">{{ tool['app'].tool_label }}{{' (%s)' % tool.app.status if tool.app.status != 'production' else ''}}</span><br />
-          <img src="{{ g.theme.app_icon_url(tool['name'], 32) or 'unk.png' }}" alt="">
-        </a>
-      </span>
-    {% endfor %}
-    <span class="tcenter grid-4 installable_tool">
-      <a class="install_trig" data-tool="">
-        <span class="tool_title">Subproject</span><br />
-        <img src="{{ g.theme.app_icon_url('subproject', 32) }}" alt="">
-      </a>
-    </span>
-  </div>
-  <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" 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 id="install_options">{# js inserts form fields here #}</div>
-    <div class="grid-13">&nbsp;</div>
-    <hr>
-    <div class="grid-13">&nbsp;</div>
-    <div class="grid-13">
-      <input type="submit" value="Save" name="new.install"> <a href="#" class="close btn link">Cancel</a>
-    </div>
-    {{lib.csrf_token()}}
-  </form>
-  {{c.install_modal.display(content='<h1>Install <span id="install_tool_label">Tool</span></h1>')}}
-
-<div>
-  {{c.page_list.display(page=page, limit=limit, count=total_mounts)}}
-</div>
-<h3>Installed tools</h3>
-<p>
-    Sortable - define top menu order by moving tools with your mouse.
-</p>
-<div id="sortable" class="clearfix fourcol">
-    {% for mount in mounts %}
-        {% if 'ac' in mount %}
-            {% set app = mount['ac'].load()(c.project, mount['ac']) %}
-            {% set links = app.admin_menu() %}
-            {% set label = mount['ac'].options['mount_label'] if mount['ac'].options['mount_label'] != 'Tool Name' else mount['ac'].options['mount_point'] %}
-
-            <div class="fleft {%if app.tool_label.lower()=='admin' or (app.tool_label.lower() in app.project.neighborhood.get_anchored_tools().keys())%}isnt_sorted{%endif%}">
-                <ul class="deck">
-                    <li class="tcenter">
-                        <span class="tool_title">{{ label }}</span><br />
-                        <img src="{{ g.theme.app_icon_url(app, 48) }}" alt="">
-                    </li>
-                    {% for link in links %}
-                      {{sidebar_item(link)}}
-                    {% endfor %}
-                    {{sidebar_item(app.admin_menu_delete_button)}}
-                </ul>
-                {# for ordering #}
-                <input type="hidden" class="mount_point" value="{{mount['ac'].options.mount_point}}"/>
-            </div>
-        {% endif %}
-        {% if 'sub' in mount and not mount['sub'].deleted %}
-            <div class="fleft">
-                <ul class="deck">
-                    <li class="tcenter">
-                        <span class="tool_name">{{ mount['sub'].name }}</span><br />
-                        <img src="{{ g.theme.app_icon_url('subproject', 48) }}" alt="">
-                    </li>
-                </ul>
-            </div>
-        {% endif %}
-    {% endfor %}
-    </div>
-</div>
-<div style="clear:both">
-  {{c.page_list.display(page=page, limit=limit, count=total_mounts)}}
-</div>
-<div><!--dummy-->
-
-<h3 style="clear:left">Grouping</h3>
-<form method="POST" action="configure_tool_grouping?limit={{limit}}&page={{page}}" id="configure_grouping_form">
-    <label>Threshold for grouping tools by type:
-        <input name="grouping_threshold" value="{{c.project.get_tool_data('allura', 'grouping_threshold', 1)}}"/>
-    </label>
-    <br/><input type="submit" value="Change"/>
-    {{lib.csrf_token()}}
-</form>
-{% endblock %}
-
-{% block extra_css %}
-<style type="text/css">
-.pad .fourcol .fleft {
-  min-height: 200px;
-}
-div.isnt_sorted > ul.deck {
-    cursor: not-allowed;
-}
-#configure_grouping_form {
-    padding-left: 10px;
-}
-#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 %}

http://git-wip-us.apache.org/repos/asf/allura/blob/83add738/Allura/allura/public/nf/js/project_tools.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/project_tools.js b/Allura/allura/public/nf/js/project_tools.js
deleted file mode 100644
index ce8d28b..0000000
--- a/Allura/allura/public/nf/js/project_tools.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-       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.
-*/
-
-(function() {
-
-    // sorting
-    $('#sortable').sortable({items: ".fleft:not(.isnt_sorted)"}).bind( "sortupdate", function (e) {
-        var sortables = $('#sortable .fleft');
-        var tools = 0;
-        var subs = 0;
-        var params = {'_session_id':$.cookie('_session_id')};
-        var action = $('#install_form').attr('action');
-        var limit = action.match(/limit=(\d+)/)[1];
-        var page = action.match(/page=(\d+)/)[1];
-        var first_tool_ordinal = parseInt(limit) * parseInt(page);
-        for (var i = 0, len = sortables.length; i < len; i++) {
-            var item = $(sortables[i]);
-            var mount_point = item.find('input.mount_point');
-            var shortname = item.find('input.shortname');
-            if (mount_point.length) {
-                params['tools-' + tools + '.mount_point'] = mount_point.val();
-                params['tools-' + tools + '.ordinal'] = i + first_tool_ordinal;
-                tools++;
-            }
-            if (shortname.length) {
-                params['subs-' + subs + '.shortname'] = shortname.val();
-                params['subs-' + subs + '.ordinal'] = i + first_tool_ordinal;
-                subs++;
-            }
-        }
-        $.ajax({
-            type: 'POST',
-            url: 'update_mount_order',
-            data: params,
-            success: function(xhr, textStatus, errorThrown) {
-                $('#messages').notify('Tool order updated, refresh this page to see the updated project navigation.',
-                                      {status: 'confirm'});
-            },
-            error: function(xhr, textStatus, errorThrown) {
-                $('#messages').notify('Error saving tool order.',
-                                      {status: 'error'});
-            }
-        });
-    });
-    // fix firefox scroll offset bug
-    var userAgent = navigator.userAgent.toLowerCase();
-    if(userAgent.match(/firefox/)) {
-      $('#sortable').bind( "sortstart", function (event, ui) {
-        ui.helper.css('margin-top', $(window).scrollTop() );
-      });
-      $('#sortable').bind( "sortbeforestop", function (event, ui) {
-        ui.helper.css('margin-top', 0 );
-      });
-    }
-})();