Moved JS into its own file.
[catagits/Gitalist.git] / root / wrapper.tt2
index dd52ce9..8426d65 100755 (executable)
   -%] (Gitalist)</title>
   [% INCLUDE '_header_feeds.tt2' %]
    
-       <link rel="stylesheet" type="text/css" href="[% c.uri_for('/static/css/core.css') %]" />
-       <link rel="shortcut icon" href="[% c.uri_for('/static/git-favicon.png') %]" type="image/png" />
+       <link rel="stylesheet" type="text/css" href="[% c.uri_for('/core.css') %]" />
+       <link rel="shortcut icon" href="[% c.uri_for('/static/favicon.ico') %]" />
+       <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
+       <script src="[% c.uri_for('/static/js/site.js') %]"></script>
 </head>
 
 <body>
                        <a href="[% c.uri_for('/') %]" id="logo"><img src="[% c.uri_for('/static/i/logo.png') %]" alt="Gitalist" /></a>
 
                        <div class="search">
-                               [% IF Repository; INCLUDE 'nav/search.tt2'; ELSE; %]
-                               
-                               <form method="get" action="[% c.uri_for_action('/search') %]" enctype="application/x-www-form-urlencoded">
-          <p class="projsearch">Search:
-           <input type="text" name="s" value="[% search_text %]" />
-          </p>
-         </form>
+                       [% IF Repository; INCLUDE 'nav/search.tt2'; ELSE; %]
+                       
+                       <!--
+                       [%# FIXME - Search submits to blank(ish) page %]
+                       <form method="get" action="[% c.uri_for_action('/search') %]" enctype="application/x-www-form-urlencoded">
+                          <p class="projsearch">Search:
+                           <input type="text" name="s" value="[% search_text %]" />
+                          </p>
+                       </form>
+                       -->
                        [% END %]
                        </div>
                </div>
                        [% IF c.req.captures.size == 1; SET path = 'repository'; ELSE; SET path = 'ref'; END %]
                        
                        <ul>
-                               
-                               [%# FIXME: tree path  #%]
-                                       [%- IF Repository %]
-                                               [% SET tree_path = c.uri_for_action('/' _ path _ '/shortlog', c.req.captures).replace("/shortlog","/HEAD/tree") %]
-                                       [% ELSE %]
-                                               [% SET tree_path = c.uri_for_action('/' _ path _ '/tree', c.req.captures) %]
-                                       [% END %]
-                                       
-                               <li [% 'class="selected"' IF c.action.name.match('tree') %]><a href="[% tree_path %]" id="tree">Tree</a></li>
-
+                               <li[% ' class="selected"' IF c.action.name.match('tree') %]><a href="[% c.uri_for_action('/ref/tree', c.req.captures) || c.uri_for_action('/repository/tree', c.req.captures) %]" id="tree">Tree</a></li>
 
-                               <li [% 'class="selected"' IF c.action.name.match('longlog') %]><a href="[% c.uri_for_action('/' _ path _ '/longlog', c.req.captures) %]" id="log_full">Long log</a></li>
+                               <li[% ' class="selected"' IF c.action.name.match('longlog') %]><a href="[% c.uri_for_action('/' _ path _ '/longlog', c.req.captures) %]" id="log_full">Long log</a></li>
                                
-                               <li [% 'class="selected"' IF c.action.name.match('shortlog') %]><a href="[% c.uri_for_action('/' _ path _ '/shortlog', c.req.captures) %]" id="log_short">Short log</a></li>
+                               <li[% ' class="selected"' IF c.action.name.match('shortlog') %]><a href="[% c.uri_for_action('/' _ path _ '/shortlog', c.req.captures) %]" id="log_short">Short log</a></li>
 
                                
                                <li id="branch_selector">
-                                       [%# FIXME: convert to c.uri_for_action  #%]
-                                       
                                        Branches 
-                                       <select onchange="document.location.href='/[% Repository.name %]/'+this.options[this.selectedIndex].text + '/shortlog';">
+                                       <select id='branch-list'>
                                                <option value="">HEAD</option>
-                                       
-                                       [% FOREACH branch_head IN Repository.heads %]
-                                               <option [% "selected" IF c.req.path.search(branch_head.name) %]>[% branch_head.name %]</option>
+                                       [% FOREACH branch IN Repository.heads %]
+                                               <option value="[% branch.name %]">[% branch.name %]</option>
                                        [% END %]
                                        
                                        </select>
                                [% END %]
                        [%- END %]
                        
+                       
                        [%- 
-                               c.action.name
-                                       .replace("_"," ")
-                                       .replace("log", " log")
-                                       .replace("fancy","")
-                                       .replace("index","Repositories") 
-                                       FILTER ucfirst 
+                               
+                               #FIXME on a history view of a folder, don't show extra actions in dropdown
+                               SET on_file_page = 1;
+                               
+                               SET actions_list = {
+                                               "blob"          => 1,
+                                               "raw"           => 1,
+                                               "blame"         => 1,
+                                               "history"       => 1,
+                                       };
+                                       
+                               SET action_name = c.action.name
+                                                                       .replace("_"," ")
+                                                                       .replace("log", " log")
+                                                                       .replace("fancy","")
+                                                                       .replace("index","Repositories");
+                               action_name_ucfirst = action_name FILTER ucfirst;
+                               IF actions_list.$action_name && on_file_page;
+                                       '<a href="#" id="actions_nav_link"><span>' _ action_name_ucfirst _ '</span></a>';
+                               ELSE;
+                                       action_name_ucfirst;
+                               END;
+                               
                        -%]
-                       
-       
-                       
+
                        </h1>
        
+                       [%- 
+                               IF actions_list.$action_name;
+                               '<ul id="actions_nav_list">';
+                                       FOREACH action IN actions_list;
+                                               action_output = action.key FILTER ucfirst;
+                                               NEXT IF action_output == action_name_ucfirst;   
+                                               action = action.key;
+                                               '<li><a href="' _ c.uri_for("/")  _ c.req.path.replace(action_name, action) _ '">' _ action_output _ '</a></li>';
+                                       END;                    
+                               '</ul>';
+                               END;
+                       -%]
+               
        </div>
 </div>
 
-
+       
 <div id="content_holder">
        <div id="content" class="sub_holder">
                <div id="content_inner">
 <div id="footer_holder">
        <div id="footer" class="sub_holder">
                
-               <p>[% IF Repository; Repository.description | html; END; %]</p>
+               <p>[% IF Repository; Repository.description | html IF Repository.description != "Unnamed repository; edit this file to name it for gitweb." ; END; %]</p>
        
                <a title="git homepage" href="http://git-scm.org"><img src="[% c.uri_for('/logo.png') %]" id="git_logo" alt="git" /></a>
                
        [% USE Dumper %]
        <pre>
        [% Repository.path %]
-       [%# Dumper.dump(c.req.path) %]
+       [% Dumper.dump(c.req.args) %]
        </pre>
        
        </div>
 </div>
 
+<span id="current-uri">[%
+      # A bit of smoke and mirrors to get the /repository/shortlog URIs working
+      cur_act = '' _ c.action;
+      cur_uri = cur_act.match("log") || cur_act.match("^ref")
+              ? '/ref/' _ cur_act.replace("^(repository|ref)/", '')
+             : cur_act;
+      # XXX I just want an empty list!
+      IF c.req.args.size > 0;
+          c.uri_for_action(cur_uri, [Repository.name, 'HEAD'], c.req.args);
+      ELSE;
+          c.uri_for_action(cur_uri, [Repository.name, 'HEAD']);
+      END;
+%]</span>
+
 </body>
 </html>
 [%- END -%]