A frequently requested feature for Commons is the ability to post short "status update" messages and have them appear in the site's activity stream, similar to Twitter, Facebook and Google Plus.

This meta issue lays out the planned changes to Commons to provide this functionality.We can then break this down into smaller, more actionable issues. Overall, the plan is to provide a revised browsing and content creation widget for both the "What's going on" page (site homepage) and group browsing widgets. We've validated these designs with some internal usability testing at Acquia, and I hope that we'll share the results of those studies soon in a blog post.

Please note revised designs in comment #10

Screenshot_4_12_13_2_40_PM.png

Screenshot_4_12_13_2_47_PM.png

The change here adds consistency to the way that users browse and create post content both on the site frontage, and on group home pages.

One notable enhancement is that a simplified content creation form is presented for each group-enabled content type so that users can create new content directly from the browsing widget without the need to load a new page. Users have the option to "Go to full form" to access a new page with the complete node creation form.

For the "Post" content type, users are presented with only the Body field by default, and the activity stream entires for post creation will contain the beginning of the body of the post, making it easier to read status updates in an activity stream. Users can still use the "post" content type for longer updates, such as blog posts. Our intention here is to avoid confusion e.g. #1322322: Status messages are replacing nodes around the different content types in Commons by eliminating duplicative content types with arbitrary distinctions (e.g., blog post and discussion in Commons 2.x).

In general, it seems like the breakdown of technical tasks will include:

- Commons BW refactoring
-- Creation widget
--- API for generating simplified node form
--- API for determining which entity types should be in the widget (Sitewide, group-specific)
--Browsing widget
--- Refactor the browsing widget view
--- Indicate that old functions are deprecated.
-Posts activity stream message refactoring
-- Any other refactoring to Commons content type modules to work with the new BW
- Group homepage refactoring
- Site homepage refactoring

An interactive prototype of this functionality can be viewed at https://projects.invisionapp.com/share/UHDGZNJ2#/screens/6176006.

Screenshot_4_12_13_2_49_PM.png

Screenshot_4_12_13_2_49_PM.png

CommentFileSizeAuthor
#60 Screenshot_5_8_13_10_58_AM.png44.9 KBezra-g
#59 1969088-commons_wikis-partial_node_form-58.patch7.73 KBitamar
#58 1969088-commons_activity_streams-partial_node_form-58.patch4.38 KBitamar
#58 1969088-commons_bw-partial_node_form-58.patch19.7 KBitamar
#58 1969088-commons_events-partial_node_form-58.patch1.41 KBitamar
#58 1969088-commons_groups-partial_node_form-58.patch9.33 KBitamar
#58 1969088-commons_origins-partial_node_form-58.patch164.36 KBitamar
#58 1969088-commons_polls-partial_node_form-58.patch11.52 KBitamar
#58 1969088-commons_posts-partial_node_form-58.patch11.08 KBitamar
#58 1969088-commons_profile-partial_node_form-58.patch1.54 KBitamar
#58 1969088-commons_q_a-partial_node_form-58.patch8.28 KBitamar
#58 1969088-commons_site_homepage-partial_node_form-58.patch1.17 KBitamar
#57 1969088-commons_bw-partial_node_form-56.patch12.65 KBezra-g
#55 1969088-commons_bw-partial_node_form-55.patch12.59 KBezra-g
#55 1969088-commons_bw-partial_node_form-55.patch12.59 KBezra-g
#55 1969088-commons_site_homepage-partial_node_form-55.patch1.69 KBezra-g
#53 1969088-commons_bw-partial_node_form-53.patch17.62 KBitamar
#53 interdiff_44.diff1.26 KBitamar
#46 1969088-commons_groups-partial_node_form-46.patch5.21 KBitamar
#45 1969088-commons_activity_streams-partial_node_form-45.patch4.38 KBitamar
#45 1969088-commons_bw-partial_node_form-45.patch17.53 KBitamar
#45 1969088-commons_events-partial_node_form-45.patch1.41 KBitamar
#45 1969088-commons_groups-partial_node_form-45.patch36.37 KBitamar
#45 1969088-commons_origins-partial_node_form-45.patch164.63 KBitamar
#45 1969088-commons_polls-partial_node_form-45.patch11.52 KBitamar
#45 1969088-commons_posts-partial_node_form-45.patch11.08 KBitamar
#45 1969088-commons_profile-partial_node_form-45.patch1.54 KBitamar
#45 1969088-commons_q_a-partial_node_form-45.patch8.28 KBitamar
#45 1969088-commons_site_homepage-partial_node_form-45.patch663 bytesitamar
#45 1969088-commons_wikis-partial_node_form-45.patch7.73 KBitamar
#44 1969088-commons_bw-partial_node_form-44.patch17.53 KBitamar
#44 1969088-commons_wikis-partial_node_form-44.patch7.16 KBitamar
#43 partial-node-form-wiki-title-display.png78.27 KBZarabadoo
#43 partial-node-form-wiki-titles.png37.92 KBZarabadoo
#41 partial-node-question.png47.55 KBZarabadoo
#41 partial-node-poll.png87.68 KBZarabadoo
#41 partial-node-wiki.png68.25 KBZarabadoo
#36 1969088-commons_activity_streams-partial_node_form-36.patch4.38 KBitamar
#36 1969088-commons_bw-partial_node_form-36.patch14.23 KBitamar
#36 1969088-commons_groups-partial_node_form-36.patch9.23 KBitamar
#36 1969088-commons_origins-partial_node_form-36.patch164.63 KBitamar
#36 1969088-commons_polls-partial_node_form-36.patch11.18 KBitamar
#36 1969088-commons_posts-partial_node_form-36.patch10.66 KBitamar
#36 1969088-commons_q_a-partial_node_form-36.patch7.12 KBitamar
#36 1969088-commons_site_homepage-partial_node_form-36.patch663 bytesitamar
#36 1969088-commons_wikis-partial_node_form-36.patch10.19 KBitamar
#36 node_created.png52.39 KBitamar
#34 Screenshot_5_1_13_11_45_AM.png72.41 KBezra-g
#34 Screenshot_5_1_13_11_33_AM.png131.93 KBezra-g
#33 1969088-commons_bw-partial_node_form-32.patch13.5 KBitamar
#26 1969088-commons_bw-partial_node_form-26.patch13.34 KBitamar
#24 1969088-commons_bw-partial_node_form-24.patch11.96 KBitamar
#24 1969088-commons_origins-partial_node_form-24.patch167.8 KBitamar
#21 1969088-commons_bw-partial_node_form-20.patch11.83 KBitamar
#21 1969088-commons_groups-partial_node_form-20.patch8.05 KBitamar
#21 1969088-commons_origins-partial_node_form-20.patch164.56 KBitamar
#21 1969088-commons_polls-partial_node_form-20.patch11.06 KBitamar
#21 1969088-commons_posts-partial_node_form-20.patch9.65 KBitamar
#21 1969088-commons_q_a-partial_node_form-20.patch6.99 KBitamar
#21 1969088-commons_site_homepage-partial_node_form-20.patch663 bytesitamar
#21 1969088-commons_wikis-partial_node_form-20.patch10.2 KBitamar
#21 homepage.png96.62 KBitamar
#15 1969088-commons_bw-partial_node_form-15.patch7.08 KBitamar
#15 1969088-commons_groups-partial_node_form-15.patch1.98 KBitamar
#15 1969088-commons_qa-partial_node_form-15.patch4.19 KBitamar
#15 question.png24.23 KBitamar
#15 all.png22.99 KBitamar
#13 1969088-commons_bw-partial_node_form-13.patch7.41 KBitamar
#13 1969088-commons_origins-partial_node_form-13.patch162.25 KBitamar
#13 1969088-commons_posts-partial_node_form-13.patch4.34 KBitamar
#13 1969088-commons_profile-partial_node_form-11.patch1.65 KBitamar
#13 group_bw.png84.15 KBitamar
#13 group_bw_small.png37.43 KBitamar
#11 group_bw.png141.44 KBitamar
#11 1969088-commons_bw-partial_node_form-11.patch4.97 KBitamar
#11 1969088-commons_origins-partial_node_form-11.patch164.08 KBitamar
#11 1969088-commons_posts-partial_node_form-11.patch1.76 KBitamar
#11 1969088-commons_profile-partial_node_form-11.patch1.65 KBitamar
#10 skitch-2.jpeg79.53 KBezra-g
#10 skitch-1.jpeg93.29 KBezra-g
#7 group_bw.png52.73 KBitamar
#7 1969088-commons_bw-partial_node_form-7.patch11.04 KBitamar
#7 1969088-commons_posts-partial_node_form-7.patch2.53 KBitamar
#6 parital_node_form.png45.79 KBitamar
#6 parital_node_form_posted.png63 KBitamar
#6 1969088-partial_node_form-6.patch3.94 KBitamar
Screenshot_4_12_13_2_59_PM-2.png40.51 KBezra-g
Screenshot_4_12_13_2_49_PM.png43.33 KBezra-g
Screenshot_4_12_13_2_49_PM.png29.2 KBezra-g
Screenshot_4_12_13_2_47_PM.png75.35 KBezra-g
Screenshot_4_12_13_2_40_PM.png94.49 KBezra-g

Comments

ezra-g’s picture

Issue tags: +gizra commons

Some of this work may include Gizra folks.

dustin@pi’s picture

lightsurge’s picture

Looks good, not sure about the 'Go to full form', though. Do people really see these little UI widgets as forms, or is that more of a techy thing? If people don't see these as forms, then 'going to the full form' wouldn't make sense.

Also, it's pretty obscure.. not sure I'd see it unless I was looking for it.

Just a thought, perhaps, for the post type for example, you could rename the post button 'Quick post', and have another secondary button 'Advanced Post' which stuffs the content user has entered into the body field of the full node form and lets the user do all the advanced stuff?

jasonwhat’s picture

Agreed, I think "Full screen" or "More posting options" makes more sense.

Overall, this is definitely the right direction. Great work. Any idea on the timeframe for this to go live in Commons?

amitaibu’s picture

  • Add A settings on the field UI commons_bw_form_field_ui_field_edit_form_alter(), on group-content nodes - "Show in Tabbed widget"
  • When displaying the tabs, we can field_attach_form() the node-type and include only the needed fields. We probably will need to take care of validate and submit.
itamar’s picture

Status: Active » Needs work
StatusFileSize
new3.94 KB
new63 KB
new45.79 KB

Patch adds the node forms to the group browsing widget.
We still need to theme it and set some fields to be shown on the form by default.

Creating a post:
parital_node_form.png

parital_node_form_posted.png

itamar’s picture

Revising the previous patch; Allowing the content modules to embed the "Partial form" in their tab.
Notice it's currently implemented only for commons_posts.

group_bw.png

dustin@pi’s picture

That looks really good. This makes perfect for posts and will be an amazing feature ... but is a little strange for Wikis.

The way my institution is currently using the Commons 2.x wikis, each group has a wiki main page and then content arranged under that main page. We have groups for each academic program/year and the tutors structure the content by course and lecture number from the main wiki page. We use notifications for time sensitive information (i.e. the printer is being fixed, special presentation on Friday, etc.) but wikis pages are treated as permanent pages.

If you look at the screen shot posted here: http://drupal.org/node/1932528#comment-7150668 that's a pretty big page to be typing into the box.

My suggestion:

  • Add a "wiki main page" as a field on the group (via commons_wiki)
  • If the field has a value: show the teaser for the wiki main page and the current create wiki page button
  • If it doesn't exist yet show the partial node form (commons_bw_partial_node_form) and on save of the partial node form update the field "wiki main page" on the group (what hook would this be done in?)

If there's agreement on this approach I'd be willing to create a patch for commons_wikis once commons_bw stabilizes.

ezra-g’s picture

Status: Needs work » Postponed

Thanks for this feedback, Dustin@PI.

Agreed, the current Commons BW ability to have a different view for each content type in a group is handy, especially in the event that a river of news listing isn't sufficient for a particular content type.

We're working on a revision to the design that would keep the short form above but also keep the tabbed browsing widget with a dedicated view for each tab, similar to what itamar's patch shows in comment #7.

We hope to have this design posted by end of day Monday.

Since keeping the tabbed browsing widget and extending it to the homepage would likely reduce the implementation effort here, I'm marking the issue as postponed until Monday.

ezra-g’s picture

Status: Postponed » Active
StatusFileSize
new93.29 KB
new79.53 KB

Here are updated designs as mentioned in #9.

Setting back to "active."

skitch-2.jpeg

skitch-1.jpeg

itamar’s picture

Updating the patch to the new design. Currently implemented only for posts.
group_bw.png

amitaibu’s picture

Minor issues:

+++ b/commons_bw.moduleundefined
@@ -23,13 +23,155 @@ function commons_bw_form_alter(&$form, &$form_state, $form_id) {
+  // Map views shown on the BW to their bundle.
+  $views_bundles = array(
+    'commons_bw_posts' => 'post',
+    'commons_bw_q_a' => 'question',
+    'commons_bw_wikis' => 'wiki',
+    'commons_bw_polls' => 'poll',

This should be declared by each module.

+++ b/commons_bw.moduleundefined
@@ -23,13 +23,155 @@ function commons_bw_form_alter(&$form, &$form_state, $form_id) {
+    $view->attachment_before .= render($form);

Lets convert this to a "header" views handler. Less hacky.

+++ b/commons_bw.moduleundefined
@@ -23,13 +23,155 @@ function commons_bw_form_alter(&$form, &$form_state, $form_id) {
+  ¶

Spaces.

+++ b/commons_bw.moduleundefined
@@ -23,13 +23,155 @@ function commons_bw_form_alter(&$form, &$form_state, $form_id) {
+      'query' => array('og_group_ref' => $group_id),

GROUP_AUDIENCE_FIELD

itamar’s picture

Re-rolling;
- Adding the mini node form as a views area handler.
- Improving the theming.

group_bw.png

group_bw_small.png

Notice that the implementation is still only for posts.

ezra-g’s picture

Status: Needs review » Needs work

I think this was primarily set to "needs review" for a broad validation of the approach.

This seems like a great approach. Awesome work, itamar!

I filed #1979150: Add jQuery Placeholder library to packaging whitelist to add the jQuery Placeholder library to the Drupal.org packaging whitelist so that we can include it in the next release of Commons.

To help us align on expectations for what's still "needs work" here:

A) The requirements for the library suggest that we'll either need jQuery 1.6 (and therefore Jquery update module) or to use version 1.8.7 of the Placeholder library. My general preference is to avoid jQuery update if we can, at least in the short term, since we're likely to have a reduced chance of side effects by not introducing jQuery update. I suggest we have a separate followup issue to evaluate jQuery update if that seems necessary.

B) Note that the "Posts" short form is also intended to appear on the "All" tab.

C) Refactoring of the site frontpage

D) Updating the "Post created" message type per the screenshot in the OP.

E) We'll need to provide an upgrade path for existing sites in the form of a hook_update_N() implementation to revert the relevant Views and Panels pages

F) Integrations for the other Commons group-enabled modules - See the interactive prototpye linked from the OP for which fields should be enabled for which content types.

Please note that zarabadoo will take care of any styling/themeing changes that need to happen to make this appear as expected, so feel free to disregard those bits :).

Thanks again - Excited to see this moving forward!

itamar’s picture

Work in progress.
- Adding the post form to the all tab.
- Adding the questions form.

Both 1969088-commons_profile-partial_node_form-11.patch and 1969088-commons_origins-partial_node_form-13.patch are unchanged.
question.png

all.png

ezra-g’s picture

I've been testing 15 by creating a new site-specific image gallery feature, and this approach is working spectacularly. I love how I can customize the presentation of the short form with hook_form_commons_bw_partial_node_form_alter()! Excellent work!

ezra-g’s picture

One thing I've noticed experimenting with adding content types to the browsing widget with #15 is that if the body field isn't configured to appear in the short form, I get the following error when submitting the short form:

"EntityMetadataWrapperException: Unable to get the data property value as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (line 444 of /Users/ezra/Developer/htdocs/dev/acquia/commons_nightly/commons/latest-2/profiles/commons/modules/contrib/entity/includes/entity.wrapper.inc)."

ezra-g’s picture

Correction: We actually get this error whenever the body field is blank, even if it does appear in the form. This is problematic with a content type such as an image gallery where the body isn't presented but other fields are presented.

cherrysuede’s picture

i'm looking to move my site to drupal commons - and one of the things our users do is post photos(multiple) and video (links) as posts in groups.. will that be possible with this "quick post" ?

Case is the events have "pre-event" posts and "post-event" posts - they went and want to share the things they saw... took photos etc - what you are describing here would be perfect!

skomorokh’s picture

Nice! How about "Longer post..." for the expand-form link title?

Will this work without depending on commons_wysiwyg? Current dc project is for a more technical user base and we're using Markdown. Seems like it will since one of the above is using the Filtered HTML text format.

itamar’s picture

- Adding the browsing widget to the homepage.
- Adding the partial form to all BW content types.
- Fixing problem described under #17.
- Updating the "created" text on nodes

homepage.png

amitaibu’s picture

off topic: ezra-g, let's talk in our scrum about the whole separation of modules, it makes it much harder to contribute and review.

amitaibu’s picture

+ if (!empty($node->{OG_AUDIENCE_FIELD}) && $wrapper->{OG_AUDIENCE_FIELD}->count() == 1) {

We can use og_is_group_content_type()

$variables['submitted'] = t('!type created @interval ago in the !group group by !user', $placeholders);

Let's always show the titles of all groups. make sure to entity_access('view'...) each title

+ if (!empty($node->{OG_AUDIENCE_FIELD}) && $wrapper->{OG_AUDIENCE_FIELD}->count() == 1) {

We can use og_is_group_content_type()

$variables['submitted'] = t('!type created @interval ago in the !group group by !user', $placeholders);

Let's always show the titles of all groups. make sure to entity_access('view'...) each title

+++ b/commons_bw.moduleundefined
@@ -20,16 +30,164 @@ function commons_bw_form_alter(&$form, &$form_state, $form_id) {
+  $form['#id'] = 'commons-bw-partial-' . $bundle . '-node-form';

drupal_css_id()

+++ b/commons_bw.moduleundefined
@@ -20,16 +30,164 @@ function commons_bw_form_alter(&$form, &$form_state, $form_id) {
+    '#path' => 'node/add/' . $bundle,

str_replace('_', '-', $bundle)

+++ b/commons_bw.moduleundefined
@@ -20,16 +30,164 @@ function commons_bw_form_alter(&$form, &$form_state, $form_id) {
+  array_unshift($form['#pre_render'], 'commons_bw_partial_node_form_after_build');

Explain why it needs to be first.

+++ b/commons_bw.moduleundefined
@@ -20,16 +30,164 @@ function commons_bw_form_alter(&$form, &$form_state, $form_id) {
+      $form[$field_name][LANGUAGE_NONE][0]['value']['#id'] .= '-' . $form['#bundle'];

hyphen in bundle, drupal_css_id()

+++ b/commons_bw.moduleundefined
@@ -20,16 +30,164 @@ function commons_bw_form_alter(&$form, &$form_state, $form_id) {
+ * Validation handler; Save the nodes.

Save => Validate.

+++ b/commons_bw.moduleundefined
@@ -112,3 +270,39 @@ function commons_bw_quicktabs_tabstyles() {
+  switch ($view->name) {
+    case 'commons_bw_posts':
+      $empty_message = t('No posts have been created.');
+      break;
+    case 'commons_bw_all':
+      $empty_message = t('Nobody has posted yet.');
+      break;
+    case 'commons_bw_q_a':
+      $empty_message = t('No questions have been asked.');
+      break;
+    case 'commons_bw_wikis':
+      $empty_message = t('No wikis have been added.');
+      break;
+    case 'commons_bw_polls':
+      $empty_message = t('No polls have been added.');

This should move into an info hook provided per module.

itamar’s picture

Status: Needs work » Needs review
StatusFileSize
new167.8 KB
new11.96 KB

Fixing #23

itamar’s picture

Status: Needs review » Needs work

There's a problem with the image ajax upload on the post field; Currently, when uploading an image with the Upload button on the "All" tab, it fails because for some reason file_ajax_upload() expects the form_build_id of the posts form instead of the all's form_build_id.

itamar’s picture

Status: Needs work » Needs review
StatusFileSize
new13.34 KB

Fixing the ajax upload issue.
Avoiding rendering several copies of the same form, and instead, moving the form that needs to be duplicated from tab to tab with javascript.

itamar’s picture

Assigned: Unassigned » itamar
Status: Needs review » Needs work

Moving back to "needs work" for adding the "Refine by" checkboxes (Following/ Not following/ Featured).

itamar’s picture

Status: Needs work » Needs review

Because the filters issue as not as trivial as I expected, I'm setting this as ready and opening a new issue for the filters.

lightsurge’s picture

+  // If the node has no title, try to create one from the body.
+  if (empty($node->title_field) && empty($node->title) && !empty($wrapper->body) && $wrapper->body->value()) {
+    $node->title = truncate_utf8(check_plain(strip_tags($wrapper->body->value->value())), 30, TRUE, TRUE);
+  }

check_plain() runs htmlspecialchars() which I thought wasn't good in terms of saving node title to database?

Maybe could use truncate_utf8(filter_var($wrapper->body->value->value(), FILTER_SANITIZE_STRING), 30, TRUE, TRUE);

lightsurge’s picture

Actually, auto_nodetitle.module does this $output = preg_replace('/[\t\n\r\0\x0B]/', '', strip_tags($output)); which is probably better.

http://drupalcode.org/project/auto_nodetitle.git/blob/refs/heads/7.x-1.x...

ezra-g’s picture

Status: Needs review » Needs work

#26 doesn't apply. @itamar, can you re-roll?

ezra-g’s picture

Status: Needs work » Needs review

False alarm, sorry about that.

itamar’s picture

Re-rolling #26. and fixing the problem of htmlentities being left encoded on posts titles.

ezra-g’s picture

Status: Needs review » Needs work
StatusFileSize
new131.93 KB
new72.41 KB

Thanks, itamar.

#33 resolves the issues I was having with the body field at #17.

This is close to RTBC.

A) The content creation forms are being presented to anonymous users, as shown in this screenshot.

Screenshot_5_1_13_11_33_AM.png

B) When there is a form validation error on the body field, the validation error message displayed is incomplete, per the screenshot below:

Screenshot_5_1_13_11_45_AM.png

C) When displaying form validation errors for forms submitted in tabs other than the "All" tab, it would be ideal to add the Quicktabs query string so that the user is presented with the form she just attempted to submit where she can correct her error. I don't see this as a blocker and would be fine addressing in a followup issue.

And, D and E from #14

D) Updating the "Post created" message type per the screenshot in the OP.

E) We'll need to provide an upgrade path for existing sites in the form of a hook_update_N() implementation to revert the relevant Views and Panels pages

For E, we also need to enable the Title module where applicable.

On a related note, this issue has been a valuable example of why #1983606: Move some of the Commons_* modules into the Commons distro repo is important. Thanks for your excellent work here despite the complexity of rolling patches to so many projects.

itamar’s picture

A) The content creation forms are being presented to anonymous users, as shown in this screenshot.

This issue should be resolved with #1984824: Anonymous users are able to create group content

itamar’s picture

Resolving issues B, C and D.

E:
It seems that it's not necessary to revert the views and panels; If they were not overridden, then applying the patch and clearing the cache will suffice to update them, and if they were overridden , then reverting them will delete the personal changes.
About the title module: I verified that when applying the patches on a 3.x installation and clearing the cache, I get the wanted title fields.

node_created.png

ezra-g’s picture

Thanks, itamar. I'll review this in detail a bit later today.

I wanted to clarify what I'm referring to when I say the Post created activity stream message:

The requested change is that posts use the format "Bob posted [node title]" rather than the current "Bob created" so that posts can function more like status updates. I believe Commons already has TimeAgo formatting on the activity streams, though in my review later I'll compare the changes here to what's currently in Commons.

This is depicted in the OP screenshot:

 Post activity stream messages

I'm fine addressing this in a followup issue.

Zarabadoo’s picture

From 1969088-commons_bw-partial_node_form-36.patch:

+++ b/includes/views/handlers/commons_bw_handler_node_partial_form.incundefined
@@ -0,0 +1,42 @@
+    return render(drupal_get_form("commons_bw_partial_node_form__$bundle", $bundle, $group_id));

This gives me the following error. I am running PHP 5.4, so it may not be an issue, but I figured it does not hurt to mention it.

Only variables should be passed by reference in commons_bw_handler_node_partial_form->render()

ezra-g’s picture

Thanks for the feedback, Zarabadoo!

Given the current pain around re-rolling here and the fact that 5.4 isn't officially recommended, I suggest we address this in a followup issue.

jpontani’s picture

That warning isn't dependent on a specific PHP version. It's because render() calls drupal_render(), which tries to set the #printed attribute on each element to be rendered, but is unable to since the array is just the return from drupal_get_form.

To get rid of the warning, it should be something like:

  $form = drupal_get_form("commons_bw_partial_node_form__$bundle", $bundle, $group_id);
  return render($form);
Zarabadoo’s picture

StatusFileSize
new68.25 KB
new87.68 KB
new47.55 KB

The source order of the form could use some love. I am in the process of theming and finding things are out of place without specific styling. The screens are annotated, but it mostly boils down to 3 items.

  • The submit button should be consistently placed at the bottom of the form.
  • The title should be consistently placed at the top. It may also make sens to avoid using #markup and instead use theme_html_tag() so that the theme can easily add attributes.
  • The "Go to full form" link should come before the submit link. Semantically this makes sense as you would want to go to the full form before submitting the form.

The consistency will make things easier to theme without using absolute positioning and also allow for adding wrappers where needed.

ezra-g’s picture

Status: Needs review » Needs work

I think this is 98% RTBC. Commons_BW looks great and the changes are functioning as expected.

Here are the remaining issues I see, which we can address here through discussion and in new followup issues - I'd commit the relevant bits but want to get your input before doing so:

+++ b/commons_wikis.features.field_base.incundefined
@@ -0,0 +1,43 @@
+/**
+ * Implements hook_field_default_field_bases().
+ */
+function commons_wikis_field_default_field_bases() {
+ $field_bases = array();
+
+ // Exported field_base: 'title_field'
+ $field_bases['title_field'] = array(
+ 'active' => '1',
+ 'cardinality' => '1',
+ 'deleted' => '0',
+ 'entity_types' => array(),
+ 'field_name' => 'title_field',
+ 'foreign keys' => array(
+ 'format' => array(
+ 'columns' => array(
+ 'format' => 'format',
+ ),
+ 'table' => 'filter_format',
+ ),
+ ),
+ 'indexes' => array(
+ 'format' => array(
+ 0 => 'format',
+ ),
+ ),
+ 'locked' => '0',
+ 'module' => 'text',
+ 'settings' => array(
+ 'max_length' => 255,
+ ),
+ 'translatable' => '1',
+ 'type' => 'text',
+ );
+
+ return $field_bases;

A) If we have a field_base definition for title in Commons Wikis, then we're making Commons Wikis a dependency for any other module that wishes to have a title field. Since Title module handles moving from core to FieldAPI-controlled titles, could we instead use an update hook to migrate the title field for the relevant content types? And:

B) I see that Title module's Views integration is smart enough that we don't have to use different title fields depending on where the title is stored. However, for sites that want the internationalization/multilingual benefits of Title module, as well as consistent DX, it seems to me like it's worth just standardizing on Title module for all the content types since it may later be enabled anyhow.

@itamar/amitaibu: Do you agree?

From my perspective A/B are the only things we should sort out before committing and moving onto followup issues.

Let's address the following in followup issues:
C)

+++ b/commons_groups.views_default.incundefined@@ -102,8 +98,10 @@ function commons_groups_views_default_views() {- 'event' => 'event',     'answer' => 'answer',+ 'group' => 'group',+ 'page' => 'page',+ 'event' => 'event'

Currently, Commons Groups doesn't depend on having any of the content modules enabled and in my view that should continue to be the case. Let's dynamically set these values instead of hardcoding content type names in. This could happen in a followup issue.

D) I mentioned on a call but I should have posted in the issue queue: Because we're likely to standardize on Media module for attaching images, my sense is that we should avoid introducing an image field and later removing it from the Distribution or having to migrate data. I'll take on the work of removing that field before committing, and moving it to a separate module for the project that funded this work.

E) Let's address the Posts activity stream message in a followup issue.

Leaving as "needs review" for feedback from itamar/amitaibu on A/B.

Zarabadoo’s picture

To expand on the wiki title issues, they certainly do cause issues. If a wiki is created via the partial form, the title is missing from the teasers. If you go to the full form, there are 2 title fields.

partial-node-form-wiki-title-display.png

partial-node-form-wiki-titles.png

itamar’s picture

Status: Needs work » Needs review
StatusFileSize
new7.16 KB
new17.53 KB

Patch addresses point #42 A/B by moving the title_field base to commons_bw, and by creating there title instances for all content types. @ezra-g Please let me know if you find this a reasonable solution.

In addition, I included the suggestion in #40, and fixed the form elements ordering according to #41.

Notice that the problem described in #43 should not happen with the title module enabled.

itamar’s picture

The patch 1969088-commons_groups-partial_node_form-45.patch is wrong, and should be replaced with 1969088-commons_groups-partial_node_form-46.patch. The rest seem fine to me.

ezra-g’s picture

Thanks, itamar. Can you respond to 42 A/B and 43? These were the remaining issues identified as blockers to committing.

itamar’s picture

@ezra-g, both 42 A/B and 43 are addressed in the latest patches, see comment #44.

ezra-g’s picture

Sorry, I missed this:

Patch addresses point #42 A/B by moving the title_field base to commons_bw, and by creating there title instances for all content types. @ezra-g Please let me know if you find this a reasonable solution.

Alternatively, is there an API function or setting within Title module we could use instead to set the Title fields? The Commons content type modules currently mostly avoid dependencies on other parts of Commons, so it would be ideal to keep that pattern in place.

If not, however, commons_bw seems like a reasonable place to put the dependency.

itamar’s picture

Alternatively, is there an API function or setting within Title module we could use instead to set the Title fields? The Commons content type modules currently mostly avoid dependencies on other parts of Commons, so it would be ideal to keep that pattern in place.

@ezra-g, @amitaibu
I believe we can use title_field_replacement_toggle('node', $bundle, 'title') in an hook_update in each of the content modules, without the need to define the title field in the "features". Would that be better?

ezra-g’s picture

title_field_replacement_toggle('node', $bundle, 'title') does seem preferable to me. Either in the individual modules themselves or in commons_bw.module in a hook_modules_enabled() implementation for types that will show in the widget both seem like good places to me.

Thanks!

ezra-g’s picture

Apologies for the back and forth: Let's continue with #45 as-is with the title field base in commons_bw: It works great for ~95% of use cases and someone who doesn't want to use the Commons_bw() can use hook_system_info_alter() to remove the dependency.

In addition to preventing you from having to re-roll, it also makes it somewhat easier to provide support for Commons sites by checking on the status of the field. We should be able to make some assumptions about how the application works and having Title module and Commons_BW seem like reasonable ones to me.

I'll do a functional review of this on Monday morning, but I suspect it's RTBC.

Thanks, itamar!

itamar’s picture

Fixing a slight problem that arose when we enabled the title field on all content type.

Zarabadoo’s picture

+++ b/commons_bw.moduleundefined
@@ -20,16 +30,222 @@ function commons_bw_form_alter(&$form, &$form_state, $form_id) {
+  $classes = array(
+    'node',
+    'user-picture-available',
+    'commons-bw-partial-node-form',
+    "commons-bw-partial-node-form-$bundle",
+  );
+  $form['#prefix'] = '<div class="' . implode(' ', $classes) . '">';
+  $form['#suffix'] = '</div>';

'user-picture-available' is a class added by the theme for styling purposes and can be added in the theme. It is not critical to move it now, but it is something that I wanted to point out for future reference.

Update:

Something else that would need done here is to use

$form['#theme_wrappers'][] = 'container';
$form['#attributes']['class'] = $classes;

instead of #prefix and #suffix.

ezra-g’s picture

I'm experiencing exactly the same 2 problems zarabadoo described in #43.

I suspect that that somewhere in the code flow title_field_replacement_toggle() or Title module in general does something to avoid duplication with the core title field that we're not getting using the Features exporting approach. #1704536: Attach title field automatically when a new entity bundle is created may hold some clues but I haven't looked into it yet.

I re-rolled the patches to Commons_BW and Commons_site_homepage to revert their respective features. Commons_Bw also needed a hook_system_info_alter() implementation to add the field_instance lines to commons_bw.info.

This is so close!

ezra-g’s picture

Looks like the magic function we want is title_field_replacement_toggle().

ezra-g’s picture

Actually, the problem here seems to be that Title module was not enabled.

I made title a dependency of Commons_bw, and added a module_enable() to commons_bw for good measure. This resolved the problems with wiki titles.

However, on the groups directory, group titles are not showing in the teasers.

Fwiw, I also noticed at admin/content that content created from the full content creation form has language set to "Language neutral" vs content submitted in the BW, which has "Undefined language ()".

itamar’s picture

Addressing latest issues, except of #54:

$form['#theme_wrappers'][] = 'container';
$form['#attributes']['class'] = $classes;
instead of #prefix and #suffix.

It's not possible to add the class in the proper way because commons origins prints the form classes separately from its attributes array.

This time I verified that everything works as I expected not only on fresh install but also when applying the patches on an existing 3.x installation.

itamar’s picture

Status: Needs work » Needs review
StatusFileSize
new7.73 KB

Adding one missing patch.

ezra-g’s picture

Status: Needs review » Needs work
StatusFileSize
new44.9 KB

On an upgrading site, I still have the same problem as in #57:

However, on the groups directory, group titles are not showing in the teasers.

Screenshot_5_8_13_10_58_AM.png

Also:

+  foreach (node_type_get_types() as $node_type) {
+    title_field_replacement_toggle('node', $node_type->type, 'title');
+    title_field_replacement_batch_set('node', $node_type->type, 'title'); +  }

This will toggle the field to the opposite of its current value. For sites that have Title module enabled already for translation, it will *disable* the field.

However, in my re-roll in #57, I found that adding a call to the Title API was wasn't necessary to resolve the issues from #43/55 - Did you find different results?

ezra-g’s picture

I'm testing on a fresh install to see if the issues with disappearing group titles happen with just Commons dev + Title module. If so, we can address in a followup.

ezra-g’s picture

Status: Needs work » Needs review
ezra-g’s picture

ezra-g’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

BarisW’s picture

So glad to have this in, thanks a lot for all the work.
While we're at it; can we also tag users in status updates?

See #1993134: Add possibility to tag users in status updates

BarisW’s picture

Can someone explain me how to get this working? I've tried using 7.x-3.x-dev but I don't see this appearing.

I'm working on a large Commons 3 project and the client really wants this in.
I'm not sure if we can wait for the next release of Commons? Can someone shine a light on this?

ezra-g’s picture

@BarisW , try packaging all of Commons with build-commons-dev.make, and copying the files over your existing installation. If that doesn't work, please file a new issue on the topic of testing dev updates and we'll take it up there.

Thanks!

Honestly Illustrated’s picture

Status: Closed (fixed) » Active

Coming here from a query on "drupal commons "what's going on"", and although the micro-tasks here are meant to be broken out into separate issues, the macro of this doesn't seem complete... so I'm wondering if anyone noticed that System automatically closed the issue. :)

Incidentally, I'm actually here looking for the right way to filter things out of the "what's going on" feed. Specifically, on filter criteria like content type or "publish to front page". I've found the "/activity" feed view, and that covers the home page block as well, but "what's going on" is a Panels pane that I'm not finding admin UI configuration for yet, if it exists.

ezra-g’s picture

Status: Active » Closed (fixed)

Incidentally, I'm actually here looking for the right way to filter things out of the "what's going on" feed. Specifically, on filter criteria like content type or "publish to front page". I've found the "/activity" feed view, and that covers the home page block as well, but "what's going on" is a Panels pane that I'm not finding admin UI configuration for yet, if it exists.

Please file a new support request. Thanks.

Honestly Illustrated’s picture

No worries. I must have been tired anyway, to think this issue was related to "what's going on" just because Google said so.

#1919576: How to edit view of "What's going on" panel on homepage has already brought my #70 comment as a feature request. I'll add my related paragraph there.

Honestly Illustrated’s picture

Issue summary: View changes

Updated designs.

ezra-g’s picture

Marking as read only.