I'd like to promote my new module to a full project.
It's called Better Blocks, and it outright replaces the core block UI with a really nice one that divides the regions of the theme into vertical tabs. Each tab contains a listing of the blocks in that region, and they're sortable just like with the core UI (although this module uses jQuery UI's Sortable plugin, not TableDrag). The vertical tabs are set up as drop zones, so you can drag a block to a tab to change its region. There is also a live search box to filter blocks by name, similar to what the Module Filter module provides.
Better Blocks also includes the ability to preview your block configuration before committing it to the database. Once you arrange your blocks how you want to, you can go into "preview mode", which lets you browse your site like normal, with the changes to the blocks reflected. In preview mode, there's a widget at the bottom of the screen that informs you that you are, in fact, looking at a preview, and provides buttons to go back to the edit form, throw out the changes, or save the changes to the DB.
The sandbox link is here: https://drupal.org/sandbox/phenaproxima/2237839
To clone the module from git:
git clone --branch 7.x-1.x git.drupal.org:sandbox/phenaproxima/2237839.git better_blocks
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | Screen Shot 2014-04-24 at 8.10.10 PM.png | 18.47 KB | mraichelson |
Comments
Comment #1
phenaproximaFixed a missing plural.
Comment #2
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxphenaproxima2237839git
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #3
phenaproximaFixed warnings and such generated by the automated reviewer.
Comment #4
prabeen.giri commentedI did a very quick test and I could not see any major flaws on the code side while I kind of felt its missing comments in some places. On the other hand, on the UI and from usability perspective, there is no easy way to search block on all regions. Search you have on the UI only search for the active region or selected region/tab. Let's say if I want to search for 'powered by drupal' block and it belongs to 'disabled' tab and let say active tab or region is 'content', then there is no easy way to find the block 'powered by drupal' which belongs to some other region (disabled). This can be a issue from the usability perspective when the block number grows bigger. To find any block to switch the region we have to go through all the regions as opposed to the browser search we can use in the traditional block UI that Drupal gives.
I would love to get the feedback on this comment.
Comment #5
phenaproximaThat is something I'm working on. For the time being, though, I figured that something is better than nothing.
Comment #6
mraichelson commentedI will second prabeen.giri on the search UI note though it sounds like that's in-progress anyway.
The couple of notes I'd add being...
$(document).ready()to usingDrupal.behaviors.mymodule.attachwhen possible. There's some notes around that here: Managing JavaScript in Drupal 7 - Behaviors.I did see there was some code in there around adjusting the weights on blocks, have you tried seeing how that plays with blocks being managed using the Context module in the same regions?
In the past there have been other applications where people were asked to remove SASS/Less/non-drupal/etc. files if they were for things that weren't going to be edited/maintained by the end-user.
That said: this is really nice and I'd definitely consider rolling it into new site builds moving forward.
Comment #7
phenaproximaOooh, the Context thing is a good catch. That definitely needs to be looked at.
I added the dependency on Block, and code to prevent form submission with the Enter key. I agree about moving the JS to into a behavior, and will take care of that soon. And I concur that images should be in a subdirectory.
The reason I'd prefer to leave the Sass files lying around is because I wrote those styles for Seven, but developers might want to override them for Bartik or another theme, and in that case I figure it'd be nicer to provide the Sass rather than just compiled CSS :)
Comment #8
phenaproximaCleaned up the file structure and moved the JS into Drupal.behaviors.
Comment #9
phenaproxima@mraichelson: I took a cursory look at Context's block reaction plugin (
context_reaction_block), and I think that it will play nicely with Better Blocks. I believe that Context will act *after* Better Blocks, becausecontext_reaction_block->execute()is receiving a fully built$pagearray, whereas Better Blocks implementshook_block_list_alter()(which is itself invoked, ultimately, by the Block module's implementation ofhook_page_build()).So, in terms of the page rendering flow, Better Blocks sits more or less at the same place that the core Block module does (which makes sense, since its entire purpose is to override part of the core block system). Context is further along in the pipeline. So anything Better Blocks does may well be overridden by Context, which is as it should be, since that's basically the point of Context.
All that being said, I actually need to, like, test this -- but theoretically, that's what I think will happen.
Comment #10
mraichelson commentedLooks like the behavior with Context is working right (after a quick poking about with it, anyway).
I do get new blocks outside the better blocks interface when adding new blocks (that aren't assigned to a region from the block add/edit screen) until I clear the site cache (after which they show up in the right place).
Comment #11
gmclelland commentedFYI.. Just from a quick read, this sounds a lot like https://drupal.org/project/node_level_blocks
Comment #12
gmclelland commentedSorry, nevermind the comment in #11. It looks like this module provides a better block overview page.
Comment #13
znaeff commentedHi.
Provide Git link please in description.
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/phenaproxima/2237839.git better_blocks
Comment #14
phenaproximaComment #15
phenaproximaComment #16
santiwww commentedI didn't find any big nor minor error, only one thing to point out:
In module from line 41 there are 2 statements to check $theme_key, one with check_plain() and second with isset(), combining both of them you'll get same result with less code, only one "theme is not good" message is needed, it could be something like:
Comment #17
magicleaves commentedCodeSniffer says:
FILE: /var/www/drupal-7-pareview/pareview_temp/better_blocks.js
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
69 | ERROR | Whitespace found at end of line
--------------------------------------------------------------------------------
FILE: /var/www/drupal-7-pareview/pareview_temp/better_blocks.module
--------------------------------------------------------------------------------
FOUND 12 ERROR(S) AFFECTING 10 LINE(S)
--------------------------------------------------------------------------------
7 | ERROR | Whitespace found at end of line
373 | ERROR | Missing function doc comment
375 | ERROR | Whitespace found at end of line
393 | ERROR | Whitespace found at end of line
397 | ERROR | Whitespace found at end of line
401 | ERROR | Missing function doc comment
408 | ERROR | is_integer() is a function name alias, use is_int() instead
408 | ERROR | Calls to inbuilt PHP functions must be lowercase; expected
| | "strpos" but found "strPos"
418 | ERROR | There should be no white space after an opening "("
418 | ERROR | There should be no white space before a closing ")"
420 | ERROR | Whitespace found at end of line
440 | ERROR | Missing function doc comment
--------------------------------------------------------------------------------
FILE: /var/www/drupal-7-pareview/pareview_temp/css/better_blocks.css
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
11 | ERROR | Expected exactly one new line before closing brace of class
| | definition
36 | ERROR | Expected exactly one new line before closing brace of class
| | definition
--------------------------------------------------------------------------------
Comment #18
PA robot commentedClosing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).
I'm a robot and this is an automated message from Project Applications Scraper.