Example #1
0
 toggleDueDates(event) {
   event.preventDefault()
   this.$dueDates.toggleClass('hidden')
   $(event.currentTarget).text(
     this.$dueDates.hasClass('hidden')
       ? I18n.t('show_due_dates', 'Show Due Dates')
       : I18n.t('hide_due_dates', 'Hide Due Dates')
   )
 }
Example #2
0
function initEntries (initialEntry) {
  if (canReadReplies()) {
    data.fetch({
      success () {
        entriesView.render()
        Backbone.history.start({
          pushState: true,
          root: `${ENV.DISCUSSION.APP_URL}/`
        })
        if (initialEntry) {
          const fetchedModel = entries.get(initialEntry.id)
          if (fetchedModel) { entries.remove(fetchedModel) }
          entries.add(initialEntry)
          entriesView.render()
          router.navigate(`entry-${initialEntry.get('id')}`, true)
        }
      }
    })

    topicView.on('addReply', (entry) => {
      entries.add(entry)
      router.navigate(`entry-${entry.get('id')}`, true)
    })

    if (!ENV.DISCUSSION.MANUAL_MARK_AS_READ) MarkAsReadWatcher.init()
  } else {
    $('#discussion_subentries span').text(I18n.t('You must log in to view replies'))
  }
}
import I18n from 'i18n!discussions'
import _ from 'underscore'
import Backbone from 'Backbone'
import DiscussionTopicsCollection from 'compiled/collections/DiscussionTopicsCollection'
import DiscussionListView from 'compiled/views/DiscussionTopics/DiscussionListView'
import IndexView from 'compiled/views/DiscussionTopics/IndexView'

const DiscussionIndexRouter = Backbone.Router.extend({

  // Public: I18n strings.
  messages: {
    lists: {
      open: I18n.t('discussions', 'Discussions'),
      locked: I18n.t('closed_for_comments', 'Closed for Comments'),
      pinned: I18n.t('pinned_discussions', 'Pinned Discussions')
    },
    help: {
      title: I18n.t('ordered_by_recent_activity', 'Ordered by Recent Activity')
    },
    toggleMessage: I18n.t('toggle_message', 'toggle section visibility')
  },

  // Public: Routes to respond to.
  routes: {
    '': 'index'
  },

  initialize () {
    ['moveModel', '_onPipelineEnd', '_onPipelineLoad'].forEach(method => this[method] = this[method].bind(this))
    this.discussions = {
      open: this._createListView('open', {