incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [37/50] git commit: [#5561] Added button to maximize a few repo pages
Date Wed, 09 Oct 2013 12:48:53 GMT
[#5561] Added button to maximize a few repo pages

And fix a bug on commit diff list

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


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

Branch: refs/heads/cj/6422
Commit: d21a572b4224693f15730ff5df92ffe2f2e83fc5
Parents: 74b7854
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Mon Sep 30 17:13:06 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri Oct 4 17:35:59 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/app_globals.py                |  2 ++
 Allura/allura/nf/allura/css/site_style.css      | 22 +++++++++++++++++
 Allura/allura/public/nf/js/maximize-content.js  | 26 ++++++++++++++++++++
 Allura/allura/templates/jinja_master/lib.html   | 12 +++++++++
 .../allura/templates/jinja_master/master.html   |  2 ++
 .../templates/jinja_master/theme_macros.html    |  1 +
 Allura/allura/templates/repo/commit.html        | 19 ++++++++------
 Allura/allura/templates/repo/diff.html          |  7 +++++-
 Allura/allura/templates/repo/file.html          |  2 ++
 9 files changed, 85 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d21a572b/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index e684383..0da0eee 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -163,6 +163,8 @@ class Globals(object):
             unsecure=Icon(')', 'ico-unlock'),
             star=Icon('S', 'ico-star'),
             watch=Icon('E', 'ico-watch'),
+            expand=Icon('`', 'ico-expand'),
+            restore=Icon('J', 'ico-restore'),
             # Permissions
             perm_read=Icon('E', 'ico-focus'),
             perm_update=Icon('0', 'ico-sync'),

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d21a572b/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index acee986..8fa6df3 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -3190,3 +3190,25 @@ ul.dropdown ul li a:hover {
     background-image: -moz-linear-gradient(100% 100% 90deg, rgb(0,0,0), rgb(90,90,90) 100%);
     border: 1px solid black;
 }
+
+.content-maximized #top_nav,
+.content-maximized #page-body,
+.content-maximized #content_base > div:last-child,
+.content-maximized #content_base .codebrowser
+{
+    width: 100%;
+}
+
+.content-maximized #content_base .diffbrowser {
+    width: auto;
+}
+
+.content-maximized #sidebar,
+.content-maximized #maximize-content,
+#restore-content {
+    display: none;
+}
+
+.content-maximized #restore-content {
+    display: inline;
+}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d21a572b/Allura/allura/public/nf/js/maximize-content.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/maximize-content.js b/Allura/allura/public/nf/js/maximize-content.js
new file mode 100644
index 0000000..f985741
--- /dev/null
+++ b/Allura/allura/public/nf/js/maximize-content.js
@@ -0,0 +1,26 @@
+/*
+       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.
+*/
+
+$(document).ready(function() {
+    $('#maximize-content, #restore-content').click(function(e) {
+        $('body').toggleClass('content-maximized');
+        e.preventDefault();
+        return false;
+    });
+});

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d21a572b/Allura/allura/templates/jinja_master/lib.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/lib.html b/Allura/allura/templates/jinja_master/lib.html
index 4ca02e9..147b296 100644
--- a/Allura/allura/templates/jinja_master/lib.html
+++ b/Allura/allura/templates/jinja_master/lib.html
@@ -133,6 +133,18 @@
   {% endfor %}
 {% endmacro %}
 
+{%- macro maximize_content_button() %}
+    {% do g.register_forge_js('js/maximize-content.js') %}
+    <a id="maximize-content" href="#">
+      <b data-icon="{{g.icons.expand.char}}" class="ico {{g.icons.expand.css}}" title="Maximize">
</b> Maximize
+    </a>
+    <a id="restore-content" href="#">
+      <b data-icon="{{g.icons.restore.char}}" class="ico {{g.icons.restore.css}}" title="Restore">
</b> Restore
+    </a>
+{%- endmacro %}
+
+
+
 {% macro markdown_syntax(id='') %}
 <a class="markdown_syntax_toc_crumb" href="#md_ex_toc{{id}}">Back</a>
 <h1>Markdown Syntax Guide</h1>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d21a572b/Allura/allura/templates/jinja_master/master.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/master.html b/Allura/allura/templates/jinja_master/master.html
index 8060240..e297b03 100644
--- a/Allura/allura/templates/jinja_master/master.html
+++ b/Allura/allura/templates/jinja_master/master.html
@@ -71,9 +71,11 @@
   </head>
 
   <body{% block body_attrs %}{% endblock %} id="forge">
+    {% block body_top_js %}
     {% for blob in g.resource_manager.emit('body_top_js') %}
       {{ blob }}
     {% endfor %}
+    {% endblock %}
     {{theme_macros.header(g.login_url, '/auth/logout')}}
     {% set flash = tg.flash_obj.render('flash', use_js=False) %}
     <section id="page-body" class="{{g.document_class(neighborhood)}}">

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d21a572b/Allura/allura/templates/jinja_master/theme_macros.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/theme_macros.html b/Allura/allura/templates/jinja_master/theme_macros.html
index 5439e0f..9f7a4f2 100644
--- a/Allura/allura/templates/jinja_master/theme_macros.html
+++ b/Allura/allura/templates/jinja_master/theme_macros.html
@@ -122,3 +122,4 @@
         <iframe src="{{g.login_fragment_url}}"></iframe>
     </div>
 {%- endmacro %}
+

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d21a572b/Allura/allura/templates/repo/commit.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/commit.html b/Allura/allura/templates/repo/commit.html
index a6f5179..dd0dafe 100644
--- a/Allura/allura/templates/repo/commit.html
+++ b/Allura/allura/templates/repo/commit.html
@@ -17,6 +17,7 @@
        under the License.
 -#}
 {% extends 'allura:templates/repo/repo_master.html' %}
+{% import 'allura:templates/jinja_master/lib.html' as lib with context %}
 
 {% do g.register_forge_css('css/forge/diff.css') %}
 
@@ -29,19 +30,25 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a>
{{commit_labels(
 {%- endblock %}
 
 {% block actions %}
+{{ lib.maximize_content_button() }}
 <a href="{{commit.url()}}log/">
   <b data-icon="{{g.icons.history.char}}" class="ico {{g.icons.history.css}}" title="History">
</b> History
 </a>
 {% endblock %}
 
-{% block extra_js %}
+{% block body_top_js %}
 {{ super() }}
   <script type="text/javascript">
     var MAX_REQUESTS = 5; // max simultaneous load requests
     var WAIT_FOR = 500;   // wait for 100ms when requests queue is full and try again
     var diff_queue = [];  // queue of diffs waiting for load
     var called_count = 0; // count of running load requests
+  </script>
+{% endblock %}
 
+{% block extra_js %}
+{{ super() }}
+  <script type="text/javascript">
     function ld(diff, callback) {
       $(diff.selector).load(encodeURI(diff.url), callback);
     }
@@ -148,12 +155,10 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a>
{{commit_labels(
                 {% else %}
                     <img src="{{g.forge_static('images/spinner.gif')}}" class="loading_icon"
alt="Loading..."/>
                     <script type="text/javascript">
-                        $(document).ready(function() {
-                          diff_queue.push({
-                            selector: '#diff-{{loop.index}}',
-                            url: '{{commit.url()}}tree/{{h.really_unicode(file)}}?barediff={{prev[0]._id
if prev else ''}}'
-                          });
-                        });
+                      diff_queue.push({
+                        selector: '#diff-{{loop.index}}',
+                        url: '{{commit.url()}}tree/{{h.really_unicode(file)}}?barediff={{prev[0]._id
if prev else ''}}'
+                      });
                     </script>
                 {% endif %}
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d21a572b/Allura/allura/templates/repo/diff.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/diff.html b/Allura/allura/templates/repo/diff.html
index a724896..217e48f 100644
--- a/Allura/allura/templates/repo/diff.html
+++ b/Allura/allura/templates/repo/diff.html
@@ -17,6 +17,7 @@
        under the License.
 -#}
 {% extends 'allura:templates/repo/repo_master.html' %}
+{% import 'allura:templates/jinja_master/lib.html' as lib with context %}
 {% do g.register_forge_css('css/forge/hilite.css') %}
 {% do g.register_forge_css('css/forge/diff.css') %}
 
@@ -35,6 +36,10 @@
 <a href="{{b.url()}}">{{b.commit.shorthand_id()}}</a>
 {% endblock %}
 
+{% block actions %}
+{{ lib.maximize_content_button() }}
+{% endblock %}
+
 {% block content %}
   {% if a.has_image_view and b.has_image_view %}
   <div class="grid-19">
@@ -46,7 +51,7 @@
          title="{{h.text.truncate(b.commit._id, 10)}}"/>
   </div>
   {% else %}
-  <div class="clip grid-19">
+  <div class="clip grid-19 diffbrowser">
     <h3>
       <span class="ico-l"><b data-icon="{{g.icons['table'].char}}" class="ico {{g.icons['table'].css}}"></b>
{{h.really_unicode(a.filename) or h.html.literal('&nbsp;')}}</span>
       <span class="fright">

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d21a572b/Allura/allura/templates/repo/file.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/file.html b/Allura/allura/templates/repo/file.html
index 04f7205..965332b 100644
--- a/Allura/allura/templates/repo/file.html
+++ b/Allura/allura/templates/repo/file.html
@@ -17,6 +17,7 @@
        under the License.
 -#}
 {% extends 'allura:templates/repo/repo_master.html' %}
+{% import 'allura:templates/jinja_master/lib.html' as lib with context %}
 {% do g.register_forge_css('css/forge/hilite.css') %}
 
 {% block title %}
@@ -31,6 +32,7 @@
 {% endblock %}
 
 {% block actions %}
+{{ lib.maximize_content_button() }}
 <a href="{{blob.commit.url()}}log/?path={{ blob.path() }}">
   <b data-icon="{{g.icons.history.char}}" class="ico {{g.icons.history.css}}" title="History">
</b> History
 </a>


Mime
View raw message