Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switched to using rails-timeago to make keeping on top of new versions o... #4281

Merged
merged 1 commit into from
Jan 20, 2014
Merged

Switched to using rails-timeago to make keeping on top of new versions o... #4281

merged 1 commit into from
Jan 20, 2014

Conversation

Ruxton
Copy link
Contributor

@Ruxton Ruxton commented Jul 4, 2013

Provides a solution to #4280

Didn't remove the current helper, as it makes setting the title a lot easier than manually setting it in the same style on every usage.

@jhass
Copy link
Member

jhass commented Jul 6, 2013

This currently breaks if the locale is set to something other than English:

Uncaught TypeError: Cannot call method 'replace' of undefined jquery.timeago.js?body=1:86
substitute jquery.timeago.js?body=1:86
$.extend.inWords jquery.timeago.js?body=1:97
inWords jquery.timeago.js?body=1:176
refresh jquery.timeago.js?body=1:156
v.isFunction.s jquery.min.js:2
functions.init jquery.timeago.js?body=1:129
(anonymous function) jquery.timeago.js?body=1:148
v.extend.each jquery.min.js:2
v.fn.v.each jquery.min.js:2
$.fn.timeago jquery.timeago.js?body=1:147
app.views.Base.Backbone.View.extend.renderPluginWidgets views.js?body=1:69
app.views.Base.Backbone.View.extend.render views.js?body=1:35
app.views.InfScroll.app.views.Base.extend.addPostView infinite_stream_view.js?body=1:35
Backbone.Events.trigger backbone.js?body=1:163
_.extend._onModelEvent backbone.js?body=1:844
Backbone.Events.trigger backbone.js?body=1:170
_.extend.add backbone.js?body=1:631
options.success backbone.js?body=1:759
l jquery.min.js:2
c.fireWith jquery.min.js:2
T jquery.min.js:2
r jquery.min.js:2

@Flaburgan
Copy link
Member

@Ruxton any news about that?

@Ruxton
Copy link
Contributor Author

Ruxton commented Jul 16, 2013

Sorry, just busy atm, i'll be able to look into it more in a week or so, if anyone else has time before that please feel free.

@carolinagc
Copy link
Contributor

After reading this thread http://stackoverflow.com/questions/11116372/replacing-time-ago-in-words-with-timeago-jquery-plugin-in-i18n-ized-rails-3-2-ap
There is a suggestion to set up an initializer for timeago

config/initializers/timeago.rb

Rails::Timeago.default_options limit: proc { 20.days.ago }, nojs: true
Rails::Timeago.locales = [:en, :it, :ja]

May that help?

@Flaburgan
Copy link
Member

What's the status of this? Can't wait to see it merged!

@Flaburgan
Copy link
Member

I'd love to see that merged before the next release.

@Ruxton
Copy link
Contributor Author

Ruxton commented Jan 16, 2014

ping @Flaburgan @carolinagc @MrZyx

je suis votre héros

@Flaburgan
Copy link
Member

@Ruxton nice! But a space is missing between the "a" and the "environ".

@Ruxton
Copy link
Contributor Author

Ruxton commented Jan 17, 2014

@Flaburgan then the translations need to be fixed ;) config/locales/javascript/

@jhass
Copy link
Member

jhass commented Jan 17, 2014

Could you maybe squash the commits together please?

@Ruxton
Copy link
Contributor Author

Ruxton commented Jan 20, 2014

@MrZyx Is all squished together now, it makes me nervous squishing commits over such a long period.

Make note:

This doesn't use the translations from rails-timeago, instead I re-worked the old code in https://github.com/diaspora/diaspora/blob/develop/app/assets/javascripts/widgets/timeago.js that loaded the diaspora translations. By default timeago loads just english, you can then tell it to load "all other languages". The way we're handling it, Diaspora loads the translation in for english and whatever language the user has selected. This takes place in the timeago widget.

This way it all stays working with our current way of managing translations (something I know next to nothing about). If this doesn't work for X,Y,Z language, look in config/locales/javascript

jhass added a commit that referenced this pull request Jan 20, 2014
…stead_of_vendored_js

Switched to using rails-timeago to make keeping on top of new versions o...
@jhass jhass merged commit a3113cc into diaspora:develop Jan 20, 2014
@jhass
Copy link
Member

jhass commented Jan 20, 2014

Thank you!

@Flaburgan
Copy link
Member

I merged that this morning on diaspora-fr.org and now we have a 500 when going to /notifications

Started GET "/notifications?per_page=5&_=1390220137788" for 78.246.133.156 at 2014-01-20 13:15:57 +0100
Processing by NotificationsController#index as JSON
  Parameters: {"per_page"=>"5", "_"=>"1390220137788"}
  Rendered notifications/_notify_popup_item.haml (125.4ms)
Completed 500 Internal Server Error in 142.6ms

ActionView::Template::Error (undefined method `timeago_tag' for #<#<Class:0x000054e2dcd9f8>:0x000054e2f090d8>):
    2:   = person_image_tag n.actors.first, :thumb_small
    3:   = notification_message_for(n)
    4:   %div
    5:     = timeago(n.created_at)
    6:     = link_to t('notifications.index.mark_unread'), "#", :class => "unread-setter"
  app/helpers/application_helper.rb:21:in `timeago'
  app/views/notifications/_notify_popup_item.haml:5:in `_app_views_notifications__notify_popup_item_haml___2567007846141630530_182291713920'
  app/controllers/notifications_controller.rb:40:in `block in index'
  app/controllers/notifications_controller.rb:39:in `each'
  app/controllers/notifications_controller.rb:39:in `index'
  lib/rack/chrome_frame.rb:39:in `call'
  lib/unicorn_killer.rb:35:in `call'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants