Posts Tagged css
v0.3 Release - Fixing the Problems with my Patch for bug 459727
Posted by Sid in Mercurial Project, Open Source on December 3rd, 2008
I’ve been busy trying to fix problems that had arised regarding the patch I submitted for bug 459727. All that is being done right now is fixing various small problems but the overall functionality remains the same. So the following are the solutions to the problems that jorendorff identified:
To calculate the max SELECT COUNT(*) FROM … should be used
Changed my implementation to use gettotalpushlogentries(conn) which performs a select statement. I’ve gotten rid of getMaxEntries() since it is no longer required.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | def pushes_worker(repo, startID=0, endID=None): stmt = 'SELECT id, user, date, rev, node from pushlog INNER JOIN changesets ON id = pushid WHERE id > ? %s ORDER BY id ASC, rev ASC' args = (startID,) if endID is not None: stmt = stmt % 'and id <= ?' args = (startID, endID) else: stmt = stmt % "" if os.path.basename(repo.path) != '.hg': repo.path = os.path.join(repo.path, '.hg') conn = sqlite.connect(os.path.join(repo.path, 'pushlog2.db')) pushes = {} for id, user, date, rev, node in conn.execute(stmt, args): mergeData = [] ctx = repo.changectx(node) if len(ctx.parents()) > 1: for cs in ctx.parents(): mergeData.append(hex(cs.node()) + '|-|' + clean(person(cs.user())) + '|-|' + clean(cs.description())) if id in pushes: pushes[id]['changesets'].append(node) pushes[id]['mergeData'].append(mergeData) else: pushes[id] = {'user': user, 'date': date, 'changesets': [node], 'formattedDate': util.datestr(localdate(date)), 'individualChangeset': hex(ctx.node()), 'author': clean(person(ctx.user())), 'desc': clean(ctx.description()), 'mergeData': mergeData, 'max': gettotalpushlogentries(conn) } return pushes |
`new Function(”return ” + entries.responseText) ()` is saying
`eval(entries.responseText)`, perhaps use `JSON.parse (entries.responseText)`
I haven’t implemented this yet because I want more information on why the way I have done is not the appropriate way. I’ve asked on the bug page (comment 12)but haven’t heard back yet
The page loads more results when the user scrolls. What if the initial results don’t fill up the window?
I added the following CSS to always show a scrollbar no matter what. This should allow the user to scroll even if the initial entries don’t fill up the page.
html { overflow: scroll; overflow-x: auto; }
getMaxEntriesis called, then ’start’ is used once the user scrolls. But the user might scroll before the first result comes back, while start is still zero — a race condition
I changed the implementation to check the value of the start variable before more entries are allowed to load onScroll. If the value of start is still 0 then no entries are allowed to load. The following is the code:
$(window).scroll(function() { if(start > 0) { if($(window).scrollTop() == $(document).height() - $(window).height()) { renderMorePushLogResults(); } } });
Better to move CSS and formatting to stylesheets where possible
I removed explicitly setting the styles of the rows. Now I am just setting the class name of the row so that it uses the preexisting styles for that class name. View lines 37-43 for the code
The JS code isn’t consistently indented
It should be correctly formatted now. View here
This patch seems to contain some non-ASCII characters. Bugzilla doesn’t render it properly
Used &mdash in the places where non-ASCII characters were being used. View lines 73 and 121
In a few places the b tag is used where the server uses the strong tag
Changed the b tags to use strong. View lines 73 and 121
I will be putting up a new patch very soon…
EDIT:
The new patches have been posted here
v0.3 Release - 1st Iteration of the Graph View
Posted by Sid in Mercurial Project, Open Source on December 2nd, 2008
I’ve been working hard trying to get the graph view working for the gitweb_mozilla template. Earlier, I documented the problems I was having. That is all resolved now and I’m moving on to bigger and better things.
So my goal was to get the graph to the stage of the coal template, which I am using as a reference and then make further improvements from there to make it look similar to the rest of the gitweb_mozilla pages.
To do this I created a new template called graph.tmpl which can be viewed by typing {url}/graph in the address bar. This is where the graph will be drawn. You can view the code it has here. However, with just this code my graph wasn’t rendering properly. The following is what it looked like: http://sidkalra.com/files/mercurial/graphView1.png. I couldn’t quite figure out why this was happening. It seemed like the graph was drawing properly and the data was appearing properly too and yet they weren’t coming together. Something was missing from the puzzle…
I showed my problem to a friend, Tiago Moreira who happened to be sitting right next to me as the time. He was able to point out that it might be a CSS problem, something I failed to consider. This was definately a lead and I had a look at the coal template’s css file and the answer hit me in the face straight away. The canvas tag was assigned a z-index of 5.
canvas { position: absolute; z-index: 5; top: -0.7em; margin: 0; }
This means that anything in the canvas tag will have a higher priority over everything else and it will also allow the data in other tags (in this case the two ul tags with the ids graphnodes and nodebgs) to slip in underneath the canvas giving the following result: http://sidkalra.com/files/mercurial/graphView2.png
Now my graph view looks similar to the one that the coal template has. My next objectives are to improve it greatly by making it look similar to the other pages in the gitweb_mozilla theme as I mentioned above and adding more changeset information to the each row. Basically the end goal is for it to look similar to the pushlog but with the graph drawn in as well.
Playing with Mercurial styles
Posted by Sid in Mercurial Project, Open Source on September 29th, 2008
As a sort of “Hello World” type of exercise jorendorff recommended that I play around with the styles in hgweb. I had 2 goals to achieve
- My mission is to get the gitweb_mozilla style working on my computer
- Then edit the templates to make the whole page orange
I downloaded a repository provided by bsmeberg called hgpoller. This would be my development playground. Now, I thought that my next step would be to make changes to hgpoller\.hg\hgrc to change the style. I tried that by adding
[web]
style=gitweb_mozilla
This didn’t work as planned. The style reverted to the default. What I didn’t realize is that Mercurial gets its style specifications from the Mercurial.ini file (in Windows). The style must be adjusted from there. When I added style=gitweb_mozilla to that file the change worked and I got the appropriate result. To make Mercurial take its style information from the hgpoller\.hg\hgrc file I added the following line with some help from jorendorff
[web]
templates=<template-dir>
Now, I can easily make changes to the hgrc file which will be reflected on hgpoller. You may be wondering how do I see the repo in a browser? To do that one needs to use the hg serve command which will start a hgweb server on port 8000 on your machine. Then one can just visit http://localhost:8000/
My objective was to get the gitweb_mozilla style working on my machine but I couldn’t find that style listed in my templates directory. The reason being that I needed to clone that style from hg.mozilla.org (thanks for pointing that out djc).
After getting the style operating the next step involved getting the bugzilla links working. The key to that is the hgpoller\buglink.py file. It has to be enabled by entering the following in hgpoller\.hg\hgrc
[extensions]
buglink=<path-to-buglink.py>
After doing all that I was finally able to achieve my first goal which gave me this result http://sidkalra.com/files/mercurial/my_gitweb_mozilla.png
The next step was to alter the style, in this case change the whole page to orange. To do this one has to alter the <your-template-folde>\static\styles-gitweb.css file. I added the background-color attribute to the body area and set it to orange like so…
body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid #d9d8d1; border-width:1px; margin:10px; background-color:Orange; }
which gave this result http://sidkalra.com/files/mercurial/my_gitweb_mozilla_orange.png
Mission Accomplished!