incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [49/50] git commit: [#5561] Refactored maximize content button to macro
Date Fri, 04 Oct 2013 16:31:17 GMT
[#5561] Refactored maximize content button to macro

Also fixed issue with maximizing diff browser

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/1aee610b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1aee610b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1aee610b

Branch: refs/heads/cj/5561
Commit: 1aee610b0b7b16e3ed2a68b812068dd278e19aa1
Parents: 2b6efeb
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Fri Oct 4 16:28:01 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Fri Oct 4 16:28:12 2013 +0000

----------------------------------------------------------------------
 Allura/allura/nf/allura/css/allura.css          | 14 ------------
 Allura/allura/nf/allura/css/site_style.css      | 21 ++++++++++++++++++
 Allura/allura/public/nf/js/maximize-content.js  |  7 ++++++
 .../templates/jinja_master/theme_macros.html    | 10 +++++++++
 Allura/allura/templates/repo/commit.html        | 14 ++----------
 Allura/allura/templates/repo/diff.html          | 23 +++-----------------
 Allura/allura/templates/repo/file.html          | 13 ++---------
 7 files changed, 45 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1aee610b/Allura/allura/nf/allura/css/allura.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/allura.css b/Allura/allura/nf/allura/css/allura.css
index be450d6..38404f7 100644
--- a/Allura/allura/nf/allura/css/allura.css
+++ b/Allura/allura/nf/allura/css/allura.css
@@ -227,17 +227,3 @@ tr.rev div.markdown_content p {
 #login_overlay iframe {
     width: 400px;
 }
-
-.content-maximized #page-body, .content-maximized #content_base>div:last-child {
-    width: 100%;
-}
-
-.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/1aee610b/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..4ef4eb0 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -3190,3 +3190,24 @@ 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 #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/1aee610b/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..af6ae62
--- /dev/null
+++ b/Allura/allura/public/nf/js/maximize-content.js
@@ -0,0 +1,7 @@
+$(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/1aee610b/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..159f790 100644
--- a/Allura/allura/templates/jinja_master/theme_macros.html
+++ b/Allura/allura/templates/jinja_master/theme_macros.html
@@ -122,3 +122,13 @@
         <iframe src="{{g.login_fragment_url}}"></iframe>
     </div>
 {%- 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 %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1aee610b/Allura/allura/templates/repo/commit.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/commit.html b/Allura/allura/templates/repo/commit.html
index daf5dc9..d420d47 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 g.theme.jinja_macros as theme_macros with context %}
 
 {% do g.register_forge_css('css/forge/diff.css') %}
 
@@ -29,12 +30,7 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a>
{{commit_labels(
 {%- endblock %}
 
 {% block actions %}
-<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>
+{{ theme_macros.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>
@@ -103,12 +99,6 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a>
{{commit_labels(
         }
         return false;
       });
-
-      $('#maximize-content, #restore-content').click(function(e) {
-          $('body').toggleClass('content-maximized');
-          e.preventDefault();
-          return false;
-      });
     });
   </script>
 {% endblock %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1aee610b/Allura/allura/templates/repo/diff.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/diff.html b/Allura/allura/templates/repo/diff.html
index 8024b0f..b93de99 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 g.theme.jinja_macros as theme_macros with context %}
 {% do g.register_forge_css('css/forge/hilite.css') %}
 {% do g.register_forge_css('css/forge/diff.css') %}
 
@@ -36,12 +37,7 @@
 {% endblock %}
 
 {% block actions %}
-<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>
+{{ theme_macros.maximize_content_button() }}
 {% endblock %}
 
 {% block content %}
@@ -55,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">
@@ -83,16 +79,3 @@
     .clip h3 {margin-bottom: 0;}
   </style>
 {% endblock %}
-
-{% block extra_js %}
-{{ super() }}
-  <script type="text/javascript">
-    $(document).ready(function() {
-      $('#maximize-content, #restore-content').click(function(e) {
-          $('body').toggleClass('content-maximized');
-          e.preventDefault();
-          return false;
-      });
-    });
-  </script>
-{% endblock %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1aee610b/Allura/allura/templates/repo/file.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/file.html b/Allura/allura/templates/repo/file.html
index 975ca7f..dad0dea 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 g.theme.jinja_macros as theme_macros with context %}
 {% do g.register_forge_css('css/forge/hilite.css') %}
 
 {% block title %}
@@ -31,12 +32,7 @@
 {% endblock %}
 
 {% block actions %}
-<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>
+{{ theme_macros.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>
@@ -65,11 +61,6 @@
       window.location.href = '#' + $(element).attr('id');
     });
   });
-  $('#maximize-content, #restore-content').click(function(e) {
-      $('body').toggleClass('content-maximized');
-      e.preventDefault();
-      return false;
-  });
 }());
 </script>
 {% endblock %}


Mime
View raw message