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.

Refactor watcher_tag and watcher_link to use css selectors for the replace action (Feature #416)


Added by Gregor Schmidt at 2011-05-17 04:14 pm. Updated at 2011-05-27 06:01 pm.


Status:Closed Start date:2011-05-17
Priority:Normal Due date:
Assignee:Eric Davis % Done:

0%

Category:Refactoring
Target version:2.0.0
Remote issue URL: Affected version:master

Description

When using the watcher_tag and watcher_link helpers, one has to know the IDs of all other watcher_link related elements on the page, to make sure, that they are properly updated. This can easily become tedious when trying to build bigger pages or when generating watcher links using AJAX, when you have no idea, what the rest of the page looks like.

I'm proposing to use arbitrary css selectors to identify the elements, that should be replaced instead. This would decouple the different links and avoids the need to have unique HTML ids.


Associated revisions

Revision 508b23cf
Added by Gregor Schmidt at 2011-05-17 08:03 pm

[#416] Watcher links work using of css selectors instead of ids

Revision 2c2ed958
Added by Gregor Schmidt at 2011-05-17 08:03 pm

[#416] Re-Adding watcher_tag for backwards compatibility

adding deprecation warning

Revision e3f54d47
Added by Gregor Schmidt at 2011-05-17 08:03 pm

[#416] :class might be nil or a symbol - then + will not work as expected

Revision 4635a8c2
Added by Gregor Schmidt at 2011-05-17 08:03 pm

[#416] using a simpler approach to replace node with partial

Revision ae76abd1
Added by Gregor Schmidt at 2011-05-17 08:03 pm

[#416] updating watcher controller tests to new functionality

unfortunately assert_select_rjs is not too clever - therefor we need to fall back to string matching for the more complex cases

Revision a5b43954
Added by Gregor Schmidt at 2011-05-17 08:03 pm

[#416] introducing separate rjs view to reduce controller code

Revision 4fff4308
Added by Gregor Schmidt at 2011-05-17 08:03 pm

[#416] removing reference to now unused local variable

Revision 3893ef9f
Added by Gregor Schmidt at 2011-05-17 08:22 pm

[#416] updating watcher_tag in news/show to use watcher_link

History

Updated by Gregor Schmidt at 2011-05-17 06:41 pm

The pull request is at https://github.com/chiliproject/chiliproject/pull/59.

Please note

  • This pull request already includes the changes for #311, which are - at the time of this writing - not yet merged into unstable.
  • I have deprecated the WatchersHelper#watcher_tag method, since wrapping the link in an additional span is no longer needed. The methods may therefore be removed at a later point.

I know, this whole pull request looks like a lot of changes including more complex rjs code. On the other hand, we are opening the way for plugins to add watcher links in more places and reduce the coupling between different parts of the UI.

I'm happy to hear any feedback on this one.

  • Assignee deleted (Gregor Schmidt)
  • Status changed from Open to Ready for review

Updated by Eric Davis at 2011-05-20 10:47 pm

  • Category set to Refactoring

Updated by Gregor Schmidt at 2011-05-23 04:10 pm

There is an error, when watching an issue using the right-click menu. I'm looking into it.

  • Status changed from Ready for review to Open

Updated by Gregor Schmidt at 2011-05-23 04:34 pm

Ok, I've mixed things up. The error only occurs using the old implementation. The refactored one, works w/o errors.

Also, the error is only shown in development when rjs debugging is active. So this is not a real issue for production sites.

  • Status changed from Open to Ready for review

Updated by Eric Davis at 2011-05-27 06:01 pm

I really like how this was changed. I've been using jquery and I like how flexible css selectors can be.

Merged into unstable in 46f66ad

  • Assignee set to Eric Davis
  • Status changed from Ready for review to Closed

Also available in: Atom PDF