ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Add and html id to the flash messages (Feature #677)


Added by Jérôme Bataille at 2011-10-31 05:03 pm. Updated at 2011-11-07 10:26 am.


Status:Open Start date:2011-10-31
Priority:Normal Due date:
Assignee:Eric Davis % Done:

0%

Category:User interface
Target version:-
Remote issue URL: Affected version:

Description

This will give the abilty to update the flash messages in Ajax after Ajax / remote actions.

We propose the following html css id (depending if its a notice or error flash.) :

flash_{notice|error}


feature_cp_677_add_id_to_flash_messages_V2.4.0.diff (568 Bytes) Jérôme Bataille, 2011-10-31 05:07 pm


History

Updated by Jérôme Bataille at 2011-10-31 05:07 pm

  • File feature_cp_677_add_id_to_flash_messages_V2.4.0.diff added

Updated by Holger Just at 2011-10-31 05:13 pm

Thanks for your patch. We will review it soon for inclusion.

As a small sidenote, I'd like to ask you to not assign issues to people yourself though. We use the assignment to track who of the core people works on an issue. Because of that, people generally assign issue to themselves if they start working on it to prevent useless double-work as well as to make sure we don't miss issues.

  • Assignee deleted (Eric Davis)

Updated by Jérôme Bataille at 2011-10-31 05:29 pm

Thanks for you so quick reply.
Ok with your sidenote.

Updated by Felix Schäfer at 2011-10-31 11:00 pm

I just had a quick look at the patch: it looks good so far, but please don't include comments about what you have changed or what issue the change is related to in the future. Comments in the code should document the code, commit messages are the right place to comment changes.

If you want more control over the commit messages of changes you contribute and/or want to appear as the author of the change, please consider using git and GitHub's pull request feature (or git's own format-patch), thanks :-)

Updated by Jérôme Bataille at 2011-11-02 08:55 am

Felix Schäfer wrote:

I just had a quick look at the patch: it looks good so far, but please don't include comments about what you have changed or what issue the change is related to in the future. Comments in the code should document the code, commit messages are the right place to comment changes.

I agree this avoids an unnecessary redundancy.

If you want more control over the commit messages of changes you contribute and/or want to appear as the author of the change, please consider using git and GitHub's pull request feature (or git's own format-patch), thanks :-)

I have already created a fork https://github.com/Utopism/chiliproject
And I will look at the pull request feature.

Updated by Eric Davis at 2011-11-06 11:49 pm

+1 on the feature idea, -1 on this patch.

While this code might work, it won't work for your origional purpose: updating the flash messages from ajax. I've done this in plugins to let me explain.

When the page is loaded, render_flash_messages is run which creates divs for each of the current flash messages (important). They get the CSS class and an id.

But if there isn't any current flash messages, then no divs are created. Thus, if the page loads successfully then there will be no flash divs rendered to the page and your Ajax won't be able to update anything at all. In other words, the DOM won't have the elements unless those specific flash types were sent on the page load already.

The good news is that I already have a work around for this. Instead of only showing the flash divs when they are used, we should show them on every page and hide them if they are empty (display:none has worked the best). That way they are always there and you can always update them. For example in jquery:

1jQuery('#flashError').html('There was an error...').show();

I'm setting this issue back to Open so it can be addressed this way. I might be able to create a patch for it after I finish the major design change (#263).

  • Assignee set to Eric Davis
  • Category set to User interface
  • Status changed from Ready for review to Open

Updated by Jérôme Bataille at 2011-11-07 10:26 am

Okay Eric,

In fact when I used this enhancement, the Ajax updating the flash message was creating a div if there was none.
I suppose your solution is more DRY, thanks.
Tell me when you think you will be able to bring the patch.

Also available in: Atom PDF