Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
25 Feb 2009 at 22:36 UTC
Updated:
6 Feb 2010 at 15:39 UTC
Jump to comment: Most recent file
Comments
Comment #1
merlinofchaos commentedAt this time this is left exclusively up to CSS. You have to do that in your theme. Views doesn't add CSS for you.
Comment #2
itrivino commentedBut, does Views module apply some sort of class to each column, so I could do that with CSS?
Comment #3
merlinofchaos commentedYes, it does.
Comment #4
bendiy commentedIs there a chance that this could go into Views 3? There is a big need to right align numeric columns and currency amounts.
I understand the need to separate content from design. However, having to edit the CSS file every time you create a View is a hassle. The CSS class on each column is unique to the column name, so you have to have a CSS entry for each column name on each View you want to change the alignment on. That's a lot of editing and maintaining.
The Views Calc module does a great job of giving a column alignment option, but it would be nice to have it's "Justification" option on the standard Views Table style.
I've migrated the Views Calc Justification setting to Views' Table style. I would like to submit a patch for this if you're open to it and I have time to port it to the latest Dev release.
Comment #5
bendiy commentedI know this was marked as won't fix, but I'm submitting this patch for review. See my comments above.
The patch applies to Views 6.x-2.8.
I'm not sure why the patch wants to override all of the includes/admin.inc file, but here are the two lines that were changed in the admin.inc file:
Please review.
Thanks!
Comment #6
bendiy commentedHere's the patch...
Comment #7
dawehnerCan you please update your local views, and try to apply your short difference?
A patch of 200KB for this kind of stuff is funny :)
The line endings of some files where changed.
Comment #8
bendiy commentedI believe it's fixed now. See the attached patch.
Comment #9
dagmarYou have to clean up the output. http://drupal.org/writing-secure-code
Is 'justify-none' class neccesary if there isn't aligment defined?
Why you don't simply put '' => t('None')
Comment #10
bendiy commented@#9 dagmar, thanks for the feedback. You are correct.
I've wrapped the output in check_plain() and changed the 'justify-none' to ''. I also moved the 'views-' part of the CSS class into the views_plugin_style_table.inc file so it doesn't print if 'None' is selected.
Please review the attached.
Thanks!
Comment #11
bendiy commentedChanging status to "needs review".
Comment #12
dagmarFrom: http://drupal.org/patch/create
Sorry, you must create patches from views directory. I don't have my views directory in sites/all/modules so this patch doesn't apply.
You should use a variable populated in theme.inc instead of the check_plain here.
You can define a new variable named i.e. $fields_alings, and use this to define css class alingment. Also, provide a new line in the tpl.php file to let know themers what is for.
Use !empty() instead of isset().
Comment #13
Bilmar commentedsubscribing
Comment #14
bendiy commented@#13 dagmar - Thanks for the coaching.
I've created a new patch to address all of your issues. This is against Views 2 DRUPAL-6--2 version.
List of changes:
I'm not sure if views_css_safe() is the correct function to use or if I should be using check_plain() instead in theme.inc.
Please review.
Thanks!
Comment #15
dagmarExcellent!, only two minors things.
Maybe is better put the options in this order:
Left
Center
Right
And in line 87 you should erase the white spaces.
Please name the pacth views-383994.patch next time.
After that you will get my RTBC. Nice job!
Comment #16
merlinofchaos commentedMy stance on this kind of thing has softened, and for tables, column align seems like an acceptable field in tables. Keep up the work on this patch.
I am not sure if it will be considered for 2.x, however (I know, I'm a pain), because with 3.0 in full swing, we are trying to limit changes to the 2.x branch to be critical features and bug fixes only.
Comment #17
bendiy commented@#15
Attached is a, hopefully, final patch. I've change the order to Left, Center, Right. I've removed the white spaces.
@#16
It would be nice to see. If it's approved, hopefully it's not too late. I will port this to Views 3.0 in the future, but it will probably be a few weeks.
Comment #18
dagmarThe patch applies for views 3, there is not necessary a reroll.
Nice work @bendiy.
Comment #19
bendiy commentedGreat. Thanks!
Comment #20
merlinofchaos commentedCommitted to 3.x branch for D6 and D7.
Comment #22
dawehnerremote tag