I have submitted my GSoC application. I will probably add more details and modify some part but it is mostly the finish. I hope to get a feed back when you have looked at it :)
navap
aCiD2: Okay now I'm trying to call UserDate.format from within my function how do I do that? I currently have http://gist.github.com/348548
The function is sitting inside UserDate.pm so I thought just using format() would work. Guess not.
er wait, the error is a syntax error.
line 12 near ". format"
ruaok hands navap a rubber duck
I take it that means it's an obvious mistake?
ruaok
I don't see it right off.
what is format() ?
is that one of your functions or does it belong to a perl module?
navap
That's the function in UserDate.pm
s/the/the other/
It's not mine.
ruaok
ah.
navap
It's what uses the user prefs to return a date back in the correct time zone.
ruaok looks at the UserDate.pm
ruaok
don't you want $self->format($future) ?
navap
Yes I did, that worked. Thanks!
ruaok
:-)
navap
hmm is it bad form to start sticking html into the perl code like how I'm doing there?
I'm also not using gettext there for the expiration string.
ruaok
navap: yes.
HTML should be kept in the templates and no where else.
move that text to the template too.
only prepare the actual date string in perl.
and even then we need to respect the date formatting options the user has selected.
if we still have those. ;)
navap
So then I'l have sub countdown return a hash and then use those to create the expiration strings?
I don't need date formatting to say that the edit expires in 9 hours 5 min, do I? :)
So I should use something that ends up like UserDate.countdown->delta, UserDate.countdown->diff->hours ?
In the templates.
ruaok
well, you can return a hash to the controller.
the controller should then simplify the output into something nice and easy for the template to display.
the format from above is a little too complex for the templateing engine
navap
Well if I want to use gettext in the templates then I can only return the numercial date/time values right?
brianfreud
ruaok: I was talking to acid2 earlier; I think I should go ahead and ask for RE after all. I can always ticket for some other RE to do a change if I think there's a potential conflict of interest, or I need help doing it, but there's some proposals coming down which will mean a lot of trivial AR edits - easy to do, but a flood on jira and dev time unless I just do them
ruaok
navap: correct.
like: $c->stash->{hours} = $hours
same for minutes.
or whatever else.
then in the template you can use the hours variable and minutes var.
brianfreud: hmmm.
navap
How would I use that hours variable? edit.hours? Or just [% hours %] ?
ruaok
navap: the latter.
brianfreud: you have a habit of unleashing a torrent of changes.
navap
Okie dokie, /me goes to experiment.
ruaok
I would very much like you to go through one of the existing editors to help vet your changes if you don't mind.
navap
ruaok: Oh and one more thing, should my countdown function be in MB::S::Edit or MB::S::Plugin::UserDate ?
brianfreud
ruaok: Sure
ruaok
edit, I would think.
navap
It's date related so I'm leaning towards the latter, but it could be either..
brianfreud
I don't really want it, lol; I just also don't want to hit acid2 w more than I have to :)
ruaok
the plugin doesn;'t feel like the right place.
or maybe in a utils module of sorts.
brianfreud: you can also hit murdos or luks.
navap
brianfreud: Or me
brianfreud
well, the tickets are in jira - anyone who wants to do any open AR one, just look under nikki's assigned open
navap
I don't get the entire flood that Jira sends out, so you need to point me at specific tickets.
brianfreud
:P
navap
heh why are they all dumped under her?
brianfreud
she was the only one editing ARs for a while
I wish I only got the jira emails once :P
jira emails me any time anyone does *anything*, then I get it all a second time via bugs
navap
I'm not subscribed to mb-bugs, I only get the emails that jira sends directly to me (either because it pertains to my ticket or a ticked I'm watching because I'm interested in it)
aCiD2
navap: I'm still not quite clear what you're trying to do. You have a date, and you want display "N days, n hours" left or something?
navap
ruaok: I've included MB::S::Plugin::UserDate into MB::S::Edit, but UserDate->format($future) doesn't work because it Can't locate object method "format" via package "UserDate"
aCiD2: Yes
aCiD2
Right, well this is certainly template specific - but it doesn't matter about the user preferences, because (5 hours is 5 hours anywhere)
navap
aCiD2: It works just fine now, except that I'm generating the html within the perl code. So now I just need to move that stuff over to the templnates.
aCiD2: Right, but I'm also displaying the exact time using a <dfn> tag.
So a user can hover over "5 hours 3 min" and see the exact date/time that the edit expires.
aCiD2
So I think this should go in MB::S::Filters and be passed a translation string
But I'm not sure TT filters can do that...
Ok, you can - but it'll have to be: [% edit.expires FILTER countdown('{days} days, {hours} hours') %] but this is actually a fairly complex problem as that would require 4 translation strings I believe
as it has 2 plurals
navap
Yeah, hour/hours and minute/minutes
aCiD2
Right, so I don't know how our translation system handles that
navap
day will always either be days or day depending on how far away the expireation is.
aCiD2
I will quickly whip up a commit for you that will add a countdown filter
navap
er no nevermind, it will always be days :)
Awesome :)
aCiD2
But it's not going to be complete - I'm just going to do enough for you to get it working. Then I need to put a thinking cap on and think about how to do it properly :)
But it will be a filter - you'll be calling it in the same way regardless
ruaok
philip6137: "please list a series of MBIDs as examples" you failed to do that on your application. :)
brianfreud
lol, now define a MBID ;)
aCiD2
navap: please pull acid2/countdown into your branch (and read the commit message :)
now, bed time
navap
brianfreud: Oh boy, loaded question :p
brianfreud: Although the best answer to that would just be giving musicbrainz.org/doc/MBID as the answer
aCiD2: Thanks! I'll pull now.
hmm actually, I don't want to screw this up. What process should I use to merge that branch into mine?
alastairp: ping; Are you able to help me with some git?
alastairp
heh
doubt it :)
fire away
navap__ joined the channel
navap__
I want to merge aCiD2's branch into mine, what's the best process to use?
Do I use git checkout --track acid2/countdown to create a local branch and then merge the two branches together?
The massive IF statement is a beast, but as far as I can tell it's the most efficent way to display what I want and also keep the templates/perl code separate.
Of course, if you have a better way...I'm all ears :)
Oh, and is it possible to PROCESS a BLOCK like I'm trying to do in line 80 of root/edit/info.tt?
warp
time-of-day
navap
time-of-day warp
warp
perhaps that BLOCK should be a MACRO
navap
I tried that, but I kept getting errors when I tried to make it a MACRO.
unexpected end of directive [% MACRO expiration_time(edit.expires_time) %]
warp
it's never clear to me on github how to see the branch a commit is in
navap
Look at the menu, there's a branch menu dropdown.
er, "switch branch" dropdown.
warp
I see the 'Switch Branches (7)' dropdown
but the current branch isn't marked
navap
Oh whoops, I was on a different page. Yeah I don't think you can tell what branch a commit is in.
warp
I want to know the branch of your commit, so I can do git fetch navap, git checkout navap/branch-goes-here
navap
It's the editpage2 branch.
Isn't it by design that a commit isn't attached to a specific branch? After all, when you branch the commits get "copied" right?
warp
possibly, but that's not terribly useful :)
navap
heh
warp
[% MACRO expiration_time(edit) BLOCK %]
you probably left off BLOCK at the end when turning it into a macro.
navap
Nope I tried it with BLOCK as well, I get a similar error as above.
warp
I don't get that error now, I did without BLOCK.
navap
hmm I'm now getting file error - expiration_time: not found
warp
that's the leftover PROCESS expiration_time
in the halfway commented bit
navap
Oh, crap. I thought both lines would have been commented out.
warp
yes, the commenting of template toolkit doesn't work very well.
navap
Ah the hash has to right next to the percent sign, [%#- works for multi-line comments.
But not [%-#
warp
aah
navap
pronik`: ping
"navap created mb_server and everyone else forked it. This is the family tree."
hahaha that should be read nice and sloowly....
That is some interesting phrasing by github :p
warp
lol
navap
I read it quickly just as I clicked a link and the page changed, lol
warp
hm, odd.
MBS-268 is already fixed in master and next when I run them locally, but not on test.musicbrainz.org even though that is running the same next.
navap
Oh yeah? I can beat that. I just got an edit note email and the particular edit note isn't visible on the edit's page.