diff --git a/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js.coffee b/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js.coffee index 9ecce40a5..148725bf4 100644 --- a/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js.coffee +++ b/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js.coffee @@ -6,7 +6,7 @@ window.Discourse.AdminEmailLogsController = Ember.ArrayController.extend Discour sendTestEmail: -> @set('sentTestEmail', false) - $.ajax + $.ajax url: '/admin/email_logs/test', type: 'POST' data: @@ -14,4 +14,4 @@ window.Discourse.AdminEmailLogsController = Ember.ArrayController.extend Discour success: => @set('sentTestEmail', true) false - \ No newline at end of file + diff --git a/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js.coffee b/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js.coffee index b08a6e9ca..ac1a8177e 100644 --- a/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js.coffee +++ b/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js.coffee @@ -20,11 +20,11 @@ window.Discourse.AdminSiteSettingsController = Ember.ArrayController.extend Disc true ).property('filter', 'content.@each', 'onlyOverridden') - + resetDefault: (setting) -> setting.set('value', setting.get('default')) setting.save() save: (setting) -> setting.save() - cancel: (setting) -> setting.resetValue() \ No newline at end of file + cancel: (setting) -> setting.resetValue() diff --git a/app/assets/javascripts/admin/controllers/admin_users_list_controller.js.coffee b/app/assets/javascripts/admin/controllers/admin_users_list_controller.js.coffee index 01fb4919f..cf2188424 100644 --- a/app/assets/javascripts/admin/controllers/admin_users_list_controller.js.coffee +++ b/app/assets/javascripts/admin/controllers/admin_users_list_controller.js.coffee @@ -12,8 +12,8 @@ window.Discourse.AdminUsersListController = Ember.ArrayController.extend Discour filterUsers: Discourse.debounce(-> @refreshUsers() ,250).observes('username') - - orderChanged: (-> + + orderChanged: (-> @refreshUsers() ).observes('query') diff --git a/app/assets/javascripts/admin/models/admin_user.js.coffee b/app/assets/javascripts/admin/models/admin_user.js.coffee index a4fb524e9..950fb624a 100644 --- a/app/assets/javascripts/admin/models/admin_user.js.coffee +++ b/app/assets/javascripts/admin/models/admin_user.js.coffee @@ -40,13 +40,13 @@ window.Discourse.AdminUser = Discourse.Model.extend canBan: ( -> !@admin && !@moderator ).property('admin','moderator') - + banDuration: (-> banned_at = Date.create(@banned_at) banned_till = Date.create(@banned_till) "#{banned_at.short()} - #{banned_till.short()}" - + ).property('banned_till', 'banned_at') ban: -> @@ -64,7 +64,7 @@ window.Discourse.AdminUser = Discourse.Model.extend error = Em.String.i18n('admin.user.ban_failed', error: "http: #{e.status} - #{e.body}") bootbox.alert error return - + unban: -> $.ajax "/admin/users/#{@id}/unban", type: 'PUT' @@ -75,7 +75,7 @@ window.Discourse.AdminUser = Discourse.Model.extend error = Em.String.i18n('admin.user.unban_failed', error: "http: #{e.status} - #{e.body}") bootbox.alert error return - + impersonate: -> $.ajax "/admin/impersonate" type: 'POST' diff --git a/app/assets/javascripts/admin/models/email_log.js.coffee b/app/assets/javascripts/admin/models/email_log.js.coffee index 7c3da0807..fb5263b7a 100644 --- a/app/assets/javascripts/admin/models/email_log.js.coffee +++ b/app/assets/javascripts/admin/models/email_log.js.coffee @@ -11,7 +11,7 @@ window.Discourse.EmailLog.reopenClass $.ajax url: "/admin/email_logs.json" data: {filter: filter} - success: (logs) -> + success: (logs) -> logs.each (log) -> result.pushObject(Discourse.EmailLog.create(log)) result diff --git a/app/assets/javascripts/admin/models/flagged_post.js.coffee b/app/assets/javascripts/admin/models/flagged_post.js.coffee index cc35232c7..5c1d68be1 100644 --- a/app/assets/javascripts/admin/models/flagged_post.js.coffee +++ b/app/assets/javascripts/admin/models/flagged_post.js.coffee @@ -15,7 +15,7 @@ window.Discourse.FlaggedPost = Discourse.Post.extend message: a.message r ).property() - + lastFlagged: (-> @post_actions[0].created_at ).property() diff --git a/app/assets/javascripts/admin/models/site_customization.js.coffee b/app/assets/javascripts/admin/models/site_customization.js.coffee index fe8780d7e..6ca9e958f 100644 --- a/app/assets/javascripts/admin/models/site_customization.js.coffee +++ b/app/assets/javascripts/admin/models/site_customization.js.coffee @@ -45,7 +45,7 @@ window.Discourse.SiteCustomization = Discourse.Model.extend data: site_customization: data type: if @id then 'PUT' else 'POST' - + delete: -> return unless @id $.ajax diff --git a/app/assets/javascripts/admin/models/site_setting.js.coffee b/app/assets/javascripts/admin/models/site_setting.js.coffee index 8c7299683..afbefbd31 100644 --- a/app/assets/javascripts/admin/models/site_setting.js.coffee +++ b/app/assets/javascripts/admin/models/site_setting.js.coffee @@ -23,19 +23,19 @@ window.Discourse.SiteSetting = Discourse.Model.extend Discourse.Presence, save: -> - # Update the setting + # Update the setting $.ajax "/admin/site_settings/#{@get('setting')}", data: value: @get('value') type: 'PUT' success: => @set('originalValue', @get('value')) - + window.Discourse.SiteSetting.reopenClass - findAll: -> - result = Em.A() + findAll: -> + result = Em.A() $.get "/admin/site_settings", (settings) -> - settings.each (s) -> + settings.each (s) -> s.originalValue = s.value result.pushObject(Discourse.SiteSetting.create(s)) result diff --git a/app/assets/javascripts/admin/routes/admin_customize_route.js.coffee b/app/assets/javascripts/admin/routes/admin_customize_route.js.coffee index 3eacf56f1..7f8139d23 100644 --- a/app/assets/javascripts/admin/routes/admin_customize_route.js.coffee +++ b/app/assets/javascripts/admin/routes/admin_customize_route.js.coffee @@ -1,2 +1,2 @@ Discourse.AdminCustomizeRoute = Discourse.Route.extend - model: -> Discourse.SiteCustomization.findAll() \ No newline at end of file + model: -> Discourse.SiteCustomization.findAll() diff --git a/app/assets/javascripts/admin/routes/admin_email_logs_route.js.coffee b/app/assets/javascripts/admin/routes/admin_email_logs_route.js.coffee index f19abfc71..aee6cc062 100644 --- a/app/assets/javascripts/admin/routes/admin_email_logs_route.js.coffee +++ b/app/assets/javascripts/admin/routes/admin_email_logs_route.js.coffee @@ -1,2 +1,2 @@ Discourse.AdminEmailLogsRoute = Discourse.Route.extend - model: -> Discourse.EmailLog.findAll() \ No newline at end of file + model: -> Discourse.EmailLog.findAll() diff --git a/app/assets/javascripts/admin/routes/admin_flags_active_route.js.coffee b/app/assets/javascripts/admin/routes/admin_flags_active_route.js.coffee index edb08d5b2..fc186fd72 100644 --- a/app/assets/javascripts/admin/routes/admin_flags_active_route.js.coffee +++ b/app/assets/javascripts/admin/routes/admin_flags_active_route.js.coffee @@ -3,4 +3,4 @@ Discourse.AdminFlagsActiveRoute = Discourse.Route.extend setupController: (controller, model) -> c = @controllerFor('adminFlags') c.set('content', model) - c.set('query', 'active') \ No newline at end of file + c.set('query', 'active') diff --git a/app/assets/javascripts/admin/routes/admin_flags_old_route.js.coffee b/app/assets/javascripts/admin/routes/admin_flags_old_route.js.coffee index f51c8f396..02fd66858 100644 --- a/app/assets/javascripts/admin/routes/admin_flags_old_route.js.coffee +++ b/app/assets/javascripts/admin/routes/admin_flags_old_route.js.coffee @@ -3,4 +3,4 @@ Discourse.AdminFlagsOldRoute = Discourse.Route.extend setupController: (controller, model) -> c = @controllerFor('adminFlags') c.set('content', model) - c.set('query', 'old') \ No newline at end of file + c.set('query', 'old') diff --git a/app/assets/javascripts/admin/routes/admin_user_route.js.coffee b/app/assets/javascripts/admin/routes/admin_user_route.js.coffee index 9362aca94..2a9531381 100644 --- a/app/assets/javascripts/admin/routes/admin_user_route.js.coffee +++ b/app/assets/javascripts/admin/routes/admin_user_route.js.coffee @@ -1,2 +1,2 @@ Discourse.AdminUserRoute = Discourse.Route.extend - model: (params) -> Discourse.AdminUser.find(params.username) \ No newline at end of file + model: (params) -> Discourse.AdminUser.find(params.username) diff --git a/app/assets/javascripts/admin/routes/admin_users_list_active_route.js.coffee b/app/assets/javascripts/admin/routes/admin_users_list_active_route.js.coffee index 2ccced531..d666079aa 100644 --- a/app/assets/javascripts/admin/routes/admin_users_list_active_route.js.coffee +++ b/app/assets/javascripts/admin/routes/admin_users_list_active_route.js.coffee @@ -1,2 +1,2 @@ Discourse.AdminUsersListActiveRoute = Discourse.Route.extend - setupController: (c) -> @controllerFor('adminUsersList').show('active') \ No newline at end of file + setupController: (c) -> @controllerFor('adminUsersList').show('active') diff --git a/app/assets/javascripts/admin/routes/admin_users_list_new_route.js.coffee b/app/assets/javascripts/admin/routes/admin_users_list_new_route.js.coffee index 7dcf80a05..a1551a836 100644 --- a/app/assets/javascripts/admin/routes/admin_users_list_new_route.js.coffee +++ b/app/assets/javascripts/admin/routes/admin_users_list_new_route.js.coffee @@ -1,2 +1,2 @@ Discourse.AdminUsersListNewRoute = Discourse.Route.extend - setupController: (c) -> @controllerFor('adminUsersList').show('new') \ No newline at end of file + setupController: (c) -> @controllerFor('adminUsersList').show('new') diff --git a/app/assets/javascripts/admin/routes/admin_users_list_pending_route.js.coffee b/app/assets/javascripts/admin/routes/admin_users_list_pending_route.js.coffee index cec059da8..c3ed405a9 100644 --- a/app/assets/javascripts/admin/routes/admin_users_list_pending_route.js.coffee +++ b/app/assets/javascripts/admin/routes/admin_users_list_pending_route.js.coffee @@ -1,2 +1,2 @@ Discourse.AdminUsersListNewRoute = Discourse.Route.extend - setupController: (c) -> @controllerFor('adminUsersList').show('pending') \ No newline at end of file + setupController: (c) -> @controllerFor('adminUsersList').show('pending') diff --git a/app/assets/javascripts/admin/views/ace_editor_view.js.coffee b/app/assets/javascripts/admin/views/ace_editor_view.js.coffee index 66486cd92..b224d6e3a 100644 --- a/app/assets/javascripts/admin/views/ace_editor_view.js.coffee +++ b/app/assets/javascripts/admin/views/ace_editor_view.js.coffee @@ -6,7 +6,7 @@ Discourse.AceEditorView = window.Discourse.View.extend if @editor && !@skipContentChangeEvent @editor.getSession().setValue(@get('content')) ).observes('content') - + render: (buffer) -> buffer.push("
") buffer.push(Handlebars.Utils.escapeExpression(@get('content'))) if @get('content') diff --git a/app/assets/javascripts/admin/views/admin_customize_view.js.coffee b/app/assets/javascripts/admin/views/admin_customize_view.js.coffee index 26201b41e..203f45518 100644 --- a/app/assets/javascripts/admin/views/admin_customize_view.js.coffee +++ b/app/assets/javascripts/admin/views/admin_customize_view.js.coffee @@ -10,7 +10,7 @@ Discourse.AdminCustomizeView = window.Discourse.View.extend headerActive: (-> @get('selected') == 'header' ).property('selected') - + stylesheetActive: (-> @get('selected') == 'stylesheet' ).property('selected') @@ -26,7 +26,7 @@ Discourse.AdminCustomizeView = window.Discourse.View.extend Mousetrap.bindGlobal ['meta+s', 'ctrl+s'], => @get('controller').save() return false - + willDestroyElement: -> Mousetrap.unbindGlobal('meta+s','ctrl+s') diff --git a/app/assets/javascripts/admin/views/admin_dashboard_view.js.coffee b/app/assets/javascripts/admin/views/admin_dashboard_view.js.coffee index 818209837..11c9ca916 100644 --- a/app/assets/javascripts/admin/views/admin_dashboard_view.js.coffee +++ b/app/assets/javascripts/admin/views/admin_dashboard_view.js.coffee @@ -1,2 +1,2 @@ Discourse.AdminDashboardView = window.Discourse.View.extend - templateName: 'admin/templates/dashboard' \ No newline at end of file + templateName: 'admin/templates/dashboard' diff --git a/app/assets/javascripts/admin/views/admin_email_logs_view.js.coffee b/app/assets/javascripts/admin/views/admin_email_logs_view.js.coffee index b3831370c..fb9165050 100644 --- a/app/assets/javascripts/admin/views/admin_email_logs_view.js.coffee +++ b/app/assets/javascripts/admin/views/admin_email_logs_view.js.coffee @@ -1,2 +1,2 @@ Discourse.AdminEmailLogsView = window.Discourse.View.extend - templateName: 'admin/templates/email_logs' \ No newline at end of file + templateName: 'admin/templates/email_logs' diff --git a/app/assets/javascripts/admin/views/admin_site_settings_view.js.coffee b/app/assets/javascripts/admin/views/admin_site_settings_view.js.coffee index 8319287c3..12bafe215 100644 --- a/app/assets/javascripts/admin/views/admin_site_settings_view.js.coffee +++ b/app/assets/javascripts/admin/views/admin_site_settings_view.js.coffee @@ -1,2 +1,2 @@ Discourse.AdminSiteSettingsView = window.Discourse.View.extend - templateName: 'admin/templates/site_settings' \ No newline at end of file + templateName: 'admin/templates/site_settings' diff --git a/app/assets/javascripts/admin/views/admin_user_view.js.coffee b/app/assets/javascripts/admin/views/admin_user_view.js.coffee index 51124e178..a1f91f54f 100644 --- a/app/assets/javascripts/admin/views/admin_user_view.js.coffee +++ b/app/assets/javascripts/admin/views/admin_user_view.js.coffee @@ -1,2 +1,2 @@ Discourse.AdminUserView = window.Discourse.View.extend - templateName: 'admin/templates/user' \ No newline at end of file + templateName: 'admin/templates/user' diff --git a/app/assets/javascripts/admin/views/admin_view.js.coffee b/app/assets/javascripts/admin/views/admin_view.js.coffee index 377a8913b..84a60b791 100644 --- a/app/assets/javascripts/admin/views/admin_view.js.coffee +++ b/app/assets/javascripts/admin/views/admin_view.js.coffee @@ -1,2 +1,2 @@ Discourse.AdminView = window.Discourse.View.extend - templateName: 'admin/templates/admin' \ No newline at end of file + templateName: 'admin/templates/admin' diff --git a/app/assets/javascripts/discourse.js.coffee b/app/assets/javascripts/discourse.js.coffee index 4e167c149..314ecb349 100644 --- a/app/assets/javascripts/discourse.js.coffee +++ b/app/assets/javascripts/discourse.js.coffee @@ -23,7 +23,7 @@ window.Discourse = Ember.Application.createWithMixins title += "#{@get('title')} - " if @get('title') title += Discourse.SiteSettings.title $('title').text(title) - + title = ("(*) " + title) if !@get('hasFocus') && @get('notify') # chrome bug workaround see: http://stackoverflow.com/questions/2952384/changing-the-window-title-when-focussing-the-window-doesnt-work-in-chrome @@ -43,12 +43,12 @@ window.Discourse = Ember.Application.createWithMixins bus.callbackInterval = Discourse.SiteSettings.anon_polling_interval bus.enableLongPolling = false - + user = @get('currentUser') if user bus.callbackInterval = Discourse.SiteSettings.polling_interval bus.enableLongPolling = true - + if user.admin bus.subscribe "/flagged_counts", (data) -> user.set('site_flagged_posts_count', data.total) @@ -90,13 +90,13 @@ window.Discourse = Ember.Application.createWithMixins # Be wary of looking up the router. In this case, we have links in our - # HTML, say form compiled markdown posts, that need to be routed. - router = Discourse.__container__.lookup('router:main') - router.router.updateURL(path) + # HTML, say form compiled markdown posts, that need to be routed. + router = Discourse.__container__.lookup('router:main') + router.router.updateURL(path) router.handleURL(path) - + # Scroll to the top if we're not replacing state - + # The classes of buttons to show on a post postButtons: (-> @@ -171,7 +171,7 @@ window.Discourse = Ember.Application.createWithMixins before: (data,owner, args) -> if owner window.probes.clear() - + after: (data, owner, args) -> if owner && data.time > 10 f = (name,data) -> @@ -187,7 +187,7 @@ window.Discourse = Ember.Application.createWithMixins for n,v of window.probes continue if n == name || v.time < 1 ary.push(k: n, v: v) - + ary.sortBy((item) -> if item.v && item.v.time then -item.v.time else 0).each (item)-> console.log output if output = f("#{item.k}", item.v) console?.groupEnd?() @@ -219,9 +219,9 @@ window.Discourse = Ember.Application.createWithMixins Discourse.MessageBus.start() Discourse.KeyValueStore.init("discourse_", Discourse.MessageBus) Discourse.insertProbes() - - # subscribe to any site customizations that are loaded + + # subscribe to any site customizations that are loaded $('link.custom-css').each -> split = @href.split("/") id = split[split.length-1].split(".css")[0] diff --git a/app/assets/javascripts/discourse/components/autocomplete.js.coffee b/app/assets/javascripts/discourse/components/autocomplete.js.coffee index 26d89d441..bc6e3dabd 100644 --- a/app/assets/javascripts/discourse/components/autocomplete.js.coffee +++ b/app/assets/javascripts/discourse/components/autocomplete.js.coffee @@ -19,7 +19,7 @@ me = @ div = null - # input is handled differently + # input is handled differently isInput = @[0].tagName == "INPUT" inputSelectedItems = [] @@ -98,7 +98,7 @@ div.css(left: "-1000px") me.parent().append(div) - + mePos = me.position() borderTop = parseInt(me.css('border-top-width')) || 0 @@ -143,11 +143,11 @@ $(@).keypress (e) -> - + if !options.key return - - # keep hunting backwards till you hit a + + # keep hunting backwards till you hit a if e.which == options.key.charCodeAt(0) caretPosition = Discourse.Utilities.caretPosition(me[0]) @@ -165,11 +165,11 @@ return if e.which == 16 if completeStart == null && e.which == 8 && options.key #backspace - + c = Discourse.Utilities.caretPosition(me[0]) next = me[0].value[c] nextIsGood = next == undefined || /\s/.test(next) - + c-=1 initial = c @@ -186,7 +186,7 @@ term = me[0].value.substring(c+1, initial) options.dataSource term, updateAutoComplete return true - + prevIsGood = /[a-zA-Z\.]/.test(prev) @@ -250,6 +250,6 @@ term += "," unless e.which == 8 # backspace options.dataSource term, updateAutoComplete return true - - + + )(jQuery) diff --git a/app/assets/javascripts/discourse/components/bbcode.js.coffee b/app/assets/javascripts/discourse/components/bbcode.js.coffee index a9f62b013..3c9719979 100644 --- a/app/assets/javascripts/discourse/components/bbcode.js.coffee +++ b/app/assets/javascripts/discourse/components/bbcode.js.coffee @@ -17,7 +17,7 @@ Discourse.BBCode = withArgs: "url": (_, href, title) -> "#{title}" "email": (_, address, title) -> "#{title}" - "color": (_, color, content) -> + "color": (_, color, content) -> return content unless /^(\#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?)|(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow)$/.test(color) "#{content}" @@ -28,10 +28,10 @@ Discourse.BBCode = "i": (_, content) -> "#{content}" "u": (_, content) -> "#{content}" "s": (_, content) -> "#{content}" - "spoiler": (_, content) -> "#{content}" + "spoiler": (_, content) -> "#{content}" withArgs: - "size": (_, size, content) -> "#{content}" + "size": (_, size, content) -> "#{content}" # For sane environments that support CSS default: @@ -58,10 +58,10 @@ Discourse.BBCode = Object.keys Discourse.BBCode.replacers, (name, rules) -> parsed = result[name] = [] - Object.keys Object.merge(Discourse.BBCode.replacers.base.withoutArgs, rules.withoutArgs), (tag, val) -> + Object.keys Object.merge(Discourse.BBCode.replacers.base.withoutArgs, rules.withoutArgs), (tag, val) -> parsed.push(regexp: RegExp("\\[#{tag}\\]([\\s\\S]*?)\\[\\/#{tag}\\]", "igm"), fn: val) - Object.keys Object.merge(Discourse.BBCode.replacers.base.withArgs, rules.withArgs), (tag, val) -> + Object.keys Object.merge(Discourse.BBCode.replacers.base.withArgs, rules.withArgs), (tag, val) -> parsed.push(regexp: RegExp("\\[#{tag}=?(.+?)\\\]([\\s\\S]*?)\\[\\/#{tag}\\]", "igm"), fn: val) @parsed = result diff --git a/app/assets/javascripts/discourse/components/caret_position.js.coffee b/app/assets/javascripts/discourse/components/caret_position.js.coffee index dca0de17c..0ddff7a65 100644 --- a/app/assets/javascripts/discourse/components/caret_position.js.coffee +++ b/app/assets/javascripts/discourse/components/caret_position.js.coffee @@ -1,6 +1,6 @@ # caret position in textarea ... very hacky ... sorry (($) -> - + # http://stackoverflow.com/questions/263743/how-to-get-caret-position-in-textarea getCaret = (el) -> if el.selectionStart @@ -15,7 +15,7 @@ rc.setEndPoint "EndToStart", re return rc.text.length 0 - + clone = null $.fn.caretPosition = (options) -> @@ -66,15 +66,15 @@ before = pos - 1 after = pos insertSpaceAfterBefore = false - - # if before and after are \n insert a space + + # if before and after are \n insert a space insertSpaceAfterBefore = true if val[before] is "\n" and val[after] is "\n" guard = (v) -> buf = v.replace(//g,">") buf = buf.replace(/[ ]/g, "​ ​") buf.replace(/\n/g,"
") - + makeCursor = (pos, klass, color) -> l = val.substring(pos, pos + 1) @@ -95,7 +95,7 @@ pos.left = pos.left + letter.width() if letter.hasClass("before") pPos = p.offset() #clone.hide().remove() - + left: pos.left - pPos.left top: (pos.top - pPos.top) - clone.scrollTop() ) jQuery diff --git a/app/assets/javascripts/discourse/components/click_track.js.coffee b/app/assets/javascripts/discourse/components/click_track.js.coffee index eca795052..ad5c3d406 100644 --- a/app/assets/javascripts/discourse/components/click_track.js.coffee +++ b/app/assets/javascripts/discourse/components/click_track.js.coffee @@ -1,4 +1,4 @@ -# We use this object to keep track of click counts. +# We use this object to keep track of click counts. window.Discourse.ClickTrack = # Pass the event of the click here and we'll do the magic! @@ -28,7 +28,7 @@ window.Discourse.ClickTrack = userId = $article.data('user-id') unless userId ownLink = userId and (userId is Discourse.get('currentUser.id')) - + # Build a Redirect URL trackingUrl = "/clicks/track?url=" + encodeURIComponent(href) trackingUrl += "&post_id=" + encodeURI(postId) if postId and (not $a.data('ignore-post-id')) @@ -44,9 +44,9 @@ window.Discourse.ClickTrack = # If they right clicked, change the destination href if e.which is 3 destination = if Discourse.SiteSettings.track_external_right_clicks then trackingUrl else href - $a.attr('href', destination) + $a.attr('href', destination) return true - + # if they want to open in a new tab, do an AJAX request if (e.metaKey || e.ctrlKey || e.which is 2) $.get "/clicks/track", url: href, post_id: postId, topic_id: topicId, redirect: false diff --git a/app/assets/javascripts/discourse/components/div_resizer.js.coffee b/app/assets/javascripts/discourse/components/div_resizer.js.coffee index 03baa9291..19cf0918b 100644 --- a/app/assets/javascripts/discourse/components/div_resizer.js.coffee +++ b/app/assets/javascripts/discourse/components/div_resizer.js.coffee @@ -42,12 +42,12 @@ mousePosition = (e) -> x: e.clientX + document.documentElement.scrollLeft y: e.clientY + document.documentElement.scrollTop - + $.fn.DivResizer = (opts) -> @each -> div = $(this) return if (div.hasClass("processed")) - + div.addClass("processed") staticOffset = null diff --git a/app/assets/javascripts/discourse/components/eyeline.coffee b/app/assets/javascripts/discourse/components/eyeline.coffee index 12ce60f4b..d4837ceed 100644 --- a/app/assets/javascripts/discourse/components/eyeline.coffee +++ b/app/assets/javascripts/discourse/components/eyeline.coffee @@ -44,10 +44,10 @@ class Discourse.Eyeline return true unless markSeen - # If you hit the bottom we mark all the elements as seen. Otherwise, just the first one + # If you hit the bottom we mark all the elements as seen. Otherwise, just the first one unless atBottom - @trigger('saw', detail: $elem) - @trigger('sawTop', detail: $elem) if i == 0 + @trigger('saw', detail: $elem) + @trigger('sawTop', detail: $elem) if i == 0 return false @trigger('sawTop', detail: $elem) if i == 0 @@ -56,9 +56,9 @@ class Discourse.Eyeline # Call this when we know aren't loading any more elements. Mark the rest # as seen flushRest: -> - $(@selector).each (i, elem) => + $(@selector).each (i, elem) => $elem = $(elem) - @trigger('saw', detail: $elem) + @trigger('saw', detail: $elem) -RSVP.EventTarget.mixin(Discourse.Eyeline.prototype) \ No newline at end of file +RSVP.EventTarget.mixin(Discourse.Eyeline.prototype) diff --git a/app/assets/javascripts/discourse/components/key_value_store.coffee b/app/assets/javascripts/discourse/components/key_value_store.coffee index a2afaab84..54c11815c 100644 --- a/app/assets/javascripts/discourse/components/key_value_store.coffee +++ b/app/assets/javascripts/discourse/components/key_value_store.coffee @@ -4,7 +4,7 @@ window.Discourse.KeyValueStore = (-> initialized = false context = "" - + init: (ctx,messageBus) -> initialized = true context = ctx @@ -17,7 +17,7 @@ window.Discourse.KeyValueStore = (-> localStorage.removeItem(k) if k.substring(0, context.length) == context i-- return true - + remove: (key)-> localStorage.removeItem(context + key) diff --git a/app/assets/javascripts/discourse/components/message_bus.js.coffee b/app/assets/javascripts/discourse/components/message_bus.js.coffee index 17fff21da..03dd6f524 100644 --- a/app/assets/javascripts/discourse/components/message_bus.js.coffee +++ b/app/assets/javascripts/discourse/components/message_bus.js.coffee @@ -45,11 +45,11 @@ window.Discourse.MessageBus = ( -> if callbacks.length == 0 setTimeout poll, 500 return - + data = {} callbacks.each (c)-> data[c.channel] = if c.last_id == undefined then -1 else c.last_id - + gotData = false @longPoll = $.ajax "/message-bus/#{clientId}/poll?#{if isHidden() || !@enableLongPolling then "dlp=t" else ""}", @@ -98,7 +98,7 @@ window.Discourse.MessageBus = ( -> subscribe: (channel,func,lastId)-> callbacks.push {channel:channel, func:func, last_id: lastId} @longPoll.abort() if @longPoll - + # Unsubscribe from a channel unsubscribe: (channel) -> # TODO proper globbing diff --git a/app/assets/javascripts/discourse/components/pagedown_editor.js.coffee b/app/assets/javascripts/discourse/components/pagedown_editor.js.coffee index 86468669e..ecde7f823 100644 --- a/app/assets/javascripts/discourse/components/pagedown_editor.js.coffee +++ b/app/assets/javascripts/discourse/components/pagedown_editor.js.coffee @@ -9,7 +9,7 @@ window.Discourse.PagedownEditor = Ember.ContainerView.extend @pushObject Em.View.create(elementId: 'wmd-button-bar') @pushObject Em.TextArea.create(valueBinding: 'parentView.value', elementId: 'wmd-input') @pushObject Em.View.createWithMixins Discourse.Presence, - elementId: 'wmd-preview', + elementId: 'wmd-preview', classNameBindings: [':preview', 'hidden'] hidden: (-> diff --git a/app/assets/javascripts/discourse/components/screen_track.js.coffee b/app/assets/javascripts/discourse/components/screen_track.js.coffee index 0b39486e0..273680ade 100644 --- a/app/assets/javascripts/discourse/components/screen_track.js.coffee +++ b/app/assets/javascripts/discourse/components/screen_track.js.coffee @@ -76,7 +76,7 @@ window.Discourse.ScreenTrack = Ember.Object.extend if (highestSeenByTopic[topicId] || 0) < @highestSeen highestSeenByTopic[topicId] = @highestSeen - + unless Object.isEmpty(newTimings) $.ajax '/topics/timings' data: @@ -93,7 +93,7 @@ window.Discourse.ScreenTrack = Ember.Object.extend @lastFlush = 0 tick: -> - + # If the user hasn't scrolled the browser in a long time, stop tracking time read sinceScrolled = new Date().getTime() - @lastScrolled if sinceScrolled > @PAUSE_UNLESS_SCROLLED @@ -116,7 +116,7 @@ window.Discourse.ScreenTrack = Ember.Object.extend Object.keys @timings, (id) => $element = $(id) - + if ($element.length == 1) elemTop = $element.offset().top elemBottom = elemTop + $element.height() diff --git a/app/assets/javascripts/discourse/components/syntax_highlighting.js.coffee b/app/assets/javascripts/discourse/components/syntax_highlighting.js.coffee index 03db46448..3325961aa 100644 --- a/app/assets/javascripts/discourse/components/syntax_highlighting.js.coffee +++ b/app/assets/javascripts/discourse/components/syntax_highlighting.js.coffee @@ -1,4 +1,4 @@ -# Helper object for syntax highlighting. Uses highlight.js which is loaded +# Helper object for syntax highlighting. Uses highlight.js which is loaded # on demand. window.Discourse.SyntaxHighlighting = diff --git a/app/assets/javascripts/discourse/components/transition_helper.js.coffee b/app/assets/javascripts/discourse/components/transition_helper.js.coffee index ee4a029e9..2334885bd 100644 --- a/app/assets/javascripts/discourse/components/transition_helper.js.coffee +++ b/app/assets/javascripts/discourse/components/transition_helper.js.coffee @@ -1,4 +1,4 @@ -# CSS transitions are a PITA, often we need to queue some js after a transition, this helper ensures +# CSS transitions are a PITA, often we need to queue some js after a transition, this helper ensures # it happens after the transition # diff --git a/app/assets/javascripts/discourse/components/user_search.js.coffee b/app/assets/javascripts/discourse/components/user_search.js.coffee index bd77191c3..3c03f3120 100644 --- a/app/assets/javascripts/discourse/components/user_search.js.coffee +++ b/app/assets/javascripts/discourse/components/user_search.js.coffee @@ -24,8 +24,8 @@ window.Discourse.UserSearch = limit = options.limit || 5 throw "missing callback" unless callback - - #TODO site setting for allowed regex in username ? + + #TODO site setting for allowed regex in username ? if term.match(/[^a-zA-Z0-9\_\.]/) callback([]) return true diff --git a/app/assets/javascripts/discourse/components/utilities.coffee b/app/assets/javascripts/discourse/components/utilities.coffee index 74258a774..69c445f99 100644 --- a/app/assets/javascripts/discourse/components/utilities.coffee +++ b/app/assets/javascripts/discourse/components/utilities.coffee @@ -25,9 +25,9 @@ Discourse.Utilities = return "" unless username size = Discourse.Utilities.translateSize(size) rawSize = (size * (window.devicePixelRatio || 1)).toFixed() - + return template.replace(/\{size\}/g, rawSize) if template - + "/users/#{username.toLowerCase()}/avatar/#{rawSize}?__ws=#{encodeURIComponent(Discourse.BaseUrl || "")}" avatarImg: (options)-> @@ -63,7 +63,7 @@ Discourse.Utilities = caretPosition: (el) -> return el.selectionStart if el.selectionStart - + if document.selection el.focus() r = document.selection.createRange() @@ -121,7 +121,7 @@ Discourse.Utilities = result = text.replace /^`{3}(?:(.*$)\n)?([\s\S]*?)^`{3}/gm, (wholeMatch,m1,m2) -> escaped = Handlebars.Utils.escapeExpression(m2) "
#{escaped}
" - + converter.hooks.chain "postConversion", (text) -> return "" unless text # don't to mention voodoo in pres diff --git a/app/assets/javascripts/discourse/controllers/application_controller.js.coffee b/app/assets/javascripts/discourse/controllers/application_controller.js.coffee index 04b2e38a7..e7f090608 100644 --- a/app/assets/javascripts/discourse/controllers/application_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/application_controller.js.coffee @@ -3,4 +3,4 @@ window.Discourse.ApplicationController = Ember.Controller.extend needs: ['modal'] showLogin: -> - @get('controllers.modal')?.show(Discourse.LoginView.create()) \ No newline at end of file + @get('controllers.modal')?.show(Discourse.LoginView.create()) diff --git a/app/assets/javascripts/discourse/controllers/composer_controller.js.coffee b/app/assets/javascripts/discourse/controllers/composer_controller.js.coffee index 60281b07d..5db48e7cf 100644 --- a/app/assets/javascripts/discourse/controllers/composer_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/composer_controller.js.coffee @@ -24,18 +24,18 @@ window.Discourse.ComposerController = Ember.Controller.extend Discourse.Presence , (error) => composer.set('disableDrafts', false) bootbox.alert error - + saveDraft: -> model = @get('content') model.saveDraft() if model # Open the reply view - # + # # opts: - # action - The action we're performing: edit, reply or createTopic + # action - The action we're performing: edit, reply or createTopic # post - The post we're replying to, if present # topic - The topic we're replying to, if present - # quote - If we're opening a reply from a quote, the quote we're making + # quote - If we're opening a reply from a quote, the quote we're making # open: (opts={}) -> opts.promise = promise = opts.promise || new RSVP.Promise @@ -51,7 +51,7 @@ window.Discourse.ComposerController = Ember.Controller.extend Discourse.Presence controller: @ view.appendTo($('#main')) @set('view', view) - # the next runloop is too soon, need to get the control rendered and then + # the next runloop is too soon, need to get the control rendered and then # we need to change stuff, otherwise css animations don't kick in Em.run.next => Em.run.next => @@ -87,7 +87,7 @@ window.Discourse.ComposerController = Ember.Controller.extend Discourse.Presence if opts.draft composer = Discourse.Composer.loadDraft(opts.draftKey, opts.draftSequence, opts.draft) composer?.set('topic', opts.topic) - + composer = composer || Discourse.Composer.open(opts) @set('content', composer) @@ -119,7 +119,7 @@ window.Discourse.ComposerController = Ember.Controller.extend Discourse.Presence else fail() if typeof fail == "function" else - # it is possible there is some sort of crazy draft with no body ... just give up on it + # it is possible there is some sort of crazy draft with no body ... just give up on it @destroyDraft() @close() success() if typeof success == "function" @@ -133,7 +133,7 @@ window.Discourse.ComposerController = Ember.Controller.extend Discourse.Presence shrink: -> if @get('content.reply') == @get('content.originalText') then @close() else @collapse() - + collapse: -> @saveDraft() @set('content.composeState', Discourse.Composer.DRAFT) @@ -166,7 +166,7 @@ window.Discourse.ComposerController = Ember.Controller.extend Discourse.Presence # ESC key hit hitEsc: -> @shrink() if @get('content.composeState') == @OPEN - + showOptions: -> @get('controllers.modal')?.show(Discourse.ArchetypeOptionsModalView.create(archetype: @get('content.archetype'), metaData: @get('content.metaData'))) diff --git a/app/assets/javascripts/discourse/controllers/controller.js.coffee b/app/assets/javascripts/discourse/controllers/controller.js.coffee index e7815426c..0b92cde21 100644 --- a/app/assets/javascripts/discourse/controllers/controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/controller.js.coffee @@ -1 +1 @@ -Discourse.Controller = Ember.Controller.extend(Discourse.Presence) \ No newline at end of file +Discourse.Controller = Ember.Controller.extend(Discourse.Presence) diff --git a/app/assets/javascripts/discourse/controllers/header_controller.js.coffee b/app/assets/javascripts/discourse/controllers/header_controller.js.coffee index 9bde32aaf..751f72f40 100644 --- a/app/assets/javascripts/discourse/controllers/header_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/header_controller.js.coffee @@ -4,4 +4,4 @@ Discourse.HeaderController = Ember.Controller.extend Discourse.Presence, toggleStar: -> @get('topic')?.toggleStar() - false \ No newline at end of file + false diff --git a/app/assets/javascripts/discourse/controllers/list_categories_controller.js.coffee b/app/assets/javascripts/discourse/controllers/list_categories_controller.js.coffee index ece7d5bf3..2f04fdc26 100644 --- a/app/assets/javascripts/discourse/controllers/list_categories_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/list_categories_controller.js.coffee @@ -14,7 +14,7 @@ Discourse.ListCategoriesController = Ember.ObjectController.extend Discourse.Pre editCategory: (category) -> @get('controllers.modal').show(Discourse.EditCategoryView.create(category: category)) false - + canEdit: (-> u = Discourse.get('currentUser') u && u.admin diff --git a/app/assets/javascripts/discourse/controllers/list_topics_controller.js.coffee b/app/assets/javascripts/discourse/controllers/list_topics_controller.js.coffee index 66466ecf9..98b589273 100644 --- a/app/assets/javascripts/discourse/controllers/list_topics_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/list_topics_controller.js.coffee @@ -9,7 +9,7 @@ Discourse.ListTopicsController = Ember.ObjectController.extend if previousChannel = @get('previousChannel') Discourse.MessageBus.unsubscribe "/#{previousChannel}" @set('previousChannel', null) - + filterMode = @get('controllers.list.filterMode') return unless filterMode @@ -19,7 +19,7 @@ Discourse.ListTopicsController = Ember.ObjectController.extend @set('previousChannel', channel) ).observes('controllers.list.filterMode') - + draftLoaded: (-> draft = @get('content.draft') if(draft) diff --git a/app/assets/javascripts/discourse/controllers/preferences_controller.js.coffee b/app/assets/javascripts/discourse/controllers/preferences_controller.js.coffee index 37e184af8..5435dc742 100644 --- a/app/assets/javascripts/discourse/controllers/preferences_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/preferences_controller.js.coffee @@ -36,7 +36,7 @@ Discourse.PreferencesController = Ember.ObjectController.extend Discourse.Presen @get('content').save (result) => @set('saving', false) if result - @set('content.bio_cooked', Discourse.Utilities.cook(@get('content.bio_raw'))) + @set('content.bio_cooked', Discourse.Utilities.cook(@get('content.bio_raw'))) @set('saved', true) else alert 'failed' @@ -51,4 +51,4 @@ Discourse.PreferencesController = Ember.ObjectController.extend Discourse.Presen @set('passwordProgress','(generating email)') @get('content').changePassword (message)=> @set('changePasswordProgress', false) - @set('passwordProgress', "(#{message})") + @set('passwordProgress', "(#{message})") diff --git a/app/assets/javascripts/discourse/controllers/preferences_email_controller.js.coffee b/app/assets/javascripts/discourse/controllers/preferences_email_controller.js.coffee index a73013ebb..c626ea634 100644 --- a/app/assets/javascripts/discourse/controllers/preferences_email_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/preferences_email_controller.js.coffee @@ -29,7 +29,7 @@ Discourse.PreferencesEmailController = Ember.ObjectController.extend Discourse.P @set('saving', true) @get('content').changeEmail(@get('newEmail')).then => @set('success', true) - , => + , => # Error @set('error', true) @set('saving', false) diff --git a/app/assets/javascripts/discourse/controllers/preferences_username_controller.js.coffee b/app/assets/javascripts/discourse/controllers/preferences_username_controller.js.coffee index d0af0084b..114694094 100644 --- a/app/assets/javascripts/discourse/controllers/preferences_username_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/preferences_username_controller.js.coffee @@ -34,7 +34,7 @@ Discourse.PreferencesUsernameController = Ember.ObjectController.extend Discours @set('saving', true) @get('content').changeUsername(@get('newUsername')).then => window.location = "/users/#{@get('newUsername').toLowerCase()}/preferences" - , => + , => # Error @set('error', true) @set('saving', false) diff --git a/app/assets/javascripts/discourse/controllers/quote_button_controller.js.coffee b/app/assets/javascripts/discourse/controllers/quote_button_controller.js.coffee index 72a8abb93..1f3989e06 100644 --- a/app/assets/javascripts/discourse/controllers/quote_button_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/quote_button_controller.js.coffee @@ -20,7 +20,7 @@ Discourse.QuoteButtonController = Discourse.Controller.extend selectText: (e) -> return unless Discourse.get('currentUser') return unless @get('controllers.topic.content.can_create_post') - + selectedText = Discourse.Utilities.selectedText() return if @get('buffer') == selectedText return if @get('lastSelected') == selectedText @@ -51,20 +51,20 @@ Discourse.QuoteButtonController = Discourse.Controller.extend post: post action: Discourse.Composer.REPLY draftKey: @get('post.topic.draft_key') - + # If the composer is associated with a different post, we don't change it. if composerPost = composerController.get('content.post') composerOpts.post = composerPost if (composerPost.get('id') != @get('post.id')) buffer = @get('buffer') quotedText = Discourse.BBCode.buildQuoteBBCode(post, buffer) - + if composerController.wouldLoseChanges() composerController.appendText(quotedText) else composerController.open(composerOpts).then => composerController.appendText(quotedText) - + @set('buffer', '') false diff --git a/app/assets/javascripts/discourse/controllers/share_controller.js.coffee b/app/assets/javascripts/discourse/controllers/share_controller.js.coffee index 8ed5a3dad..b728c912b 100644 --- a/app/assets/javascripts/discourse/controllers/share_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/share_controller.js.coffee @@ -8,7 +8,7 @@ Discourse.ShareController = Ember.Controller.extend @set('link', url) false - # Close the share controller + # Close the share controller close: -> @set('link', '') false diff --git a/app/assets/javascripts/discourse/controllers/static_controller.js.coffee b/app/assets/javascripts/discourse/controllers/static_controller.js.coffee index a73a9cfb7..b98601df4 100644 --- a/app/assets/javascripts/discourse/controllers/static_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/static_controller.js.coffee @@ -9,13 +9,13 @@ Discourse.StaticController = Ember.Controller.extend $preloaded = $("noscript[data-path=\"#{path}\"]") if $preloaded.length text = $preloaded.text()# + "" - text = text.replace(/\/, '') + text = text.replace(/\/, '') @set('content', text) - else + else jQuery.ajax url: "#{path}.json" success: (result) => @set('content', result) -Discourse.StaticController.reopenClass(pages: ['faq', 'tos', 'privacy']) \ No newline at end of file +Discourse.StaticController.reopenClass(pages: ['faq', 'tos', 'privacy']) diff --git a/app/assets/javascripts/discourse/controllers/topic_admin_menu_controller.js.coffee b/app/assets/javascripts/discourse/controllers/topic_admin_menu_controller.js.coffee index d686e217f..dc342186f 100644 --- a/app/assets/javascripts/discourse/controllers/topic_admin_menu_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/topic_admin_menu_controller.js.coffee @@ -3,4 +3,4 @@ Discourse.TopicAdminMenuController = Ember.ObjectController.extend visible: false show: -> @set('visible', true) - hide: -> @set('visible', false) \ No newline at end of file + hide: -> @set('visible', false) diff --git a/app/assets/javascripts/discourse/controllers/topic_controller.js.coffee b/app/assets/javascripts/discourse/controllers/topic_controller.js.coffee index ebb0f33f4..6449ba373 100644 --- a/app/assets/javascripts/discourse/controllers/topic_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/topic_controller.js.coffee @@ -49,7 +49,7 @@ Discourse.TopicController = Ember.ObjectController.extend Discourse.Presence, unless p.get('can_delete') canDelete = false return false - + canDelete ).property('selectedPosts') @@ -58,7 +58,7 @@ Discourse.TopicController = Ember.ObjectController.extend Discourse.Presence, unless @get('multiSelect') if posts = @get('content.posts') posts.forEach (p) -> p.set('selected', false) - + ).observes('multiSelect') hideProgress: (-> @@ -95,7 +95,7 @@ Discourse.TopicController = Ember.ObjectController.extend Discourse.Presence, replyAsNewTopic: (post) -> composerController = @get('controllers.composer') - #TODO shut down topic draft cleanly if it exists ... + #TODO shut down topic draft cleanly if it exists ... promise = composerController.open action: Discourse.Composer.CREATE_TOPIC draftKey: Discourse.Composer.REPLY_AS_NEW_TOPIC_KEY @@ -103,7 +103,7 @@ Discourse.TopicController = Ember.ObjectController.extend Discourse.Presence, postUrl = "#{location.protocol}//#{location.host}#{post.get('url')}" postLink = "[#{@get('title')}](#{postUrl})" promise.then -> - Discourse.Post.loadQuote(post.get('id')).then (q) -> + Discourse.Post.loadQuote(post.get('id')).then (q) -> composerController.appendText("#{Em.String.i18n("post.continue_discussion", postLink: postLink)}\n\n#{q}") # Topic related @@ -145,14 +145,14 @@ Discourse.TopicController = Ember.ObjectController.extend Discourse.Presence, return unless topic posts = topic.get('posts') return unless posts - posts.clear() - + posts.clear() + @set('content.loaded', false) Discourse.Topic.find(@get('content.id'), @get('postFilters')).then (result) => first = result.posts.first() @set('currentPost', first.post_number) if first $('#topic-progress .solid').data('progress', false) - result.posts.each (p) => + result.posts.each (p) => posts.pushObject(Discourse.Post.create(p, topic)) @set('content.loaded', true) @@ -163,7 +163,7 @@ Discourse.TopicController = Ember.ObjectController.extend Discourse.Presence, @get('content').delete => @set('message', "The topic has been deleted") - @set('loaded', false) + @set('loaded', false) toggleVisibility: -> @get('content').toggleStatus('visible') @@ -226,7 +226,7 @@ Discourse.TopicController = Ember.ObjectController.extend Discourse.Presence, quoteController = @get('controllers.quoteButton') quotedText = Discourse.BBCode.buildQuoteBBCode(quoteController.get('post'), quoteController.get('buffer')) quoteController.set('buffer', '') - + if (composerController.get('content.topic.id') == post.get('topic.id') and composerController.get('content.action') == Discourse.Composer.REPLY) composerController.set('content.post', post) composerController.set('content.composeState', Discourse.Composer.OPEN) diff --git a/app/assets/javascripts/discourse/controllers/user_invited_controller.js.coffee b/app/assets/javascripts/discourse/controllers/user_invited_controller.js.coffee index 345f2f093..dab15f57f 100644 --- a/app/assets/javascripts/discourse/controllers/user_invited_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/user_invited_controller.js.coffee @@ -2,4 +2,4 @@ Discourse.UserInvitedController = Ember.ObjectController.extend rescind: (invite) -> invite.rescind() - false \ No newline at end of file + false diff --git a/app/assets/javascripts/discourse/controllers/user_private_messages_controller.js.coffee b/app/assets/javascripts/discourse/controllers/user_private_messages_controller.js.coffee index 46aef05cc..08f2a9e9c 100644 --- a/app/assets/javascripts/discourse/controllers/user_private_messages_controller.js.coffee +++ b/app/assets/javascripts/discourse/controllers/user_private_messages_controller.js.coffee @@ -2,7 +2,7 @@ Discourse.UserPrivateMessagesController = Ember.ObjectController.extend editPreferences: -> Discourse.routeTo("/users/#{@get('content.username_lower')}/preferences") - + composePrivateMessage: -> composerController = Discourse.get('router.composerController') composerController.open diff --git a/app/assets/javascripts/discourse/helpers/application_helpers.js.coffee b/app/assets/javascripts/discourse/helpers/application_helpers.js.coffee index 5f9558c70..9cb7d0cb2 100644 --- a/app/assets/javascripts/discourse/helpers/application_helpers.js.coffee +++ b/app/assets/javascripts/discourse/helpers/application_helpers.js.coffee @@ -1,16 +1,16 @@ Handlebars.registerHelper 'breakUp', (property, options) -> prop = Ember.Handlebars.get(this, property, options) return "" unless prop - + tokens = prop.match(RegExp(".{1,14}",'g')) return prop if tokens.length == 1 - result = "" + result = "" tokens.each (token, index) -> result += token if token.indexOf(' ') == -1 and (index < tokens.length - 1) - result += "- " + result += "- " result @@ -28,9 +28,9 @@ Handlebars.registerHelper 'categoryLink', (property, options) -> Handlebars.registerHelper 'titledLinkTo', (name, object) -> options = [].slice.call(arguments, -1)[0] - - if options.hash.titleKey - options.hash.title = Em.String.i18n(options.hash.titleKey) + + if options.hash.titleKey + options.hash.title = Em.String.i18n(options.hash.titleKey) if arguments.length is 3 Ember.Handlebars.helpers.linkTo.call(this, name, object, options) @@ -43,7 +43,7 @@ Handlebars.registerHelper 'shortenUrl', (property, options) -> # Remove trailing slash if it's a top level URL url = url.replace(/\/$/, '') if url.match(/\//g).length == 3 - + url = url.replace(/^https?:\/\//, '') url = url.replace(/^www\./, '') url.truncate(80) @@ -68,7 +68,7 @@ Handlebars.registerHelper 'avatar', (user, options) -> title: Em.get(user, 'title') || Em.get(user, 'description') avatarTemplate: Ember.get(user, 'avatar_template') || options.hash.avatarTemplate ) - + Handlebars.registerHelper 'unboundDate', (property, options) -> dt = new Date(Ember.Handlebars.get(this, property, options)) month = Date.SugarMethods.getLocale.method().months[12 + dt.getMonth()] @@ -104,7 +104,7 @@ Handlebars.registerHelper 'date', (property, options) -> val = Ember.Handlebars.get(this, property, options) return new Handlebars.SafeString("—") unless val - + dt = new Date(val) fullReadable = dt.format("{d} {Mon}, {yyyy} {hh}:{mm}") @@ -122,7 +122,7 @@ Handlebars.registerHelper 'date', (property, options) -> return "" unless humanized displayDate = humanized displayDate = displayDate.replace(' ago', '') unless leaveAgo - + new Handlebars.SafeString("#{displayDate}") diff --git a/app/assets/javascripts/discourse/mixins/presence.js.coffee b/app/assets/javascripts/discourse/mixins/presence.js.coffee index 7c34f6c0b..4f4948df0 100644 --- a/app/assets/javascripts/discourse/mixins/presence.js.coffee +++ b/app/assets/javascripts/discourse/mixins/presence.js.coffee @@ -9,7 +9,7 @@ window.Discourse.Presence = Em.Mixin.create when "string" return prop.trim().isBlank() when "object" - return Object.isEmpty(prop) + return Object.isEmpty(prop) false - - present: (name) -> not @blank(name) \ No newline at end of file + + present: (name) -> not @blank(name) diff --git a/app/assets/javascripts/discourse/models/action_summary.js.coffee b/app/assets/javascripts/discourse/models/action_summary.js.coffee index 43023e50b..c07eb4a93 100644 --- a/app/assets/javascripts/discourse/models/action_summary.js.coffee +++ b/app/assets/javascripts/discourse/models/action_summary.js.coffee @@ -29,7 +29,7 @@ window.Discourse.ActionSummary = Em.Object.extend Discourse.Presence, @set('can_undo', true) #TODO: mark all other flag types as acted - + # Add ourselves to the users who liked it if present @users.pushObject(Discourse.get('currentUser')) if @present('users') @@ -45,7 +45,7 @@ window.Discourse.ActionSummary = Em.Object.extend Discourse.Presence, @removeAction() errors = jQuery.parseJSON(error.responseText).errors bootbox.alert(errors[0]) - + # Undo this action undo: -> @@ -57,7 +57,7 @@ window.Discourse.ActionSummary = Em.Object.extend Discourse.Presence, type: 'DELETE' data: post_action_type_id: @get('id') - + clearFlags: -> $.ajax url: "/post_actions/clear_flags" diff --git a/app/assets/javascripts/discourse/models/composer.js.coffee b/app/assets/javascripts/discourse/models/composer.js.coffee index 4873109e3..f61c71885 100644 --- a/app/assets/javascripts/discourse/models/composer.js.coffee +++ b/app/assets/javascripts/discourse/models/composer.js.coffee @@ -18,14 +18,14 @@ window.Discourse.Composer = Discourse.Model.extend val = (Discourse.KeyValueStore.get('composer.showPreview') or 'true') @set('showPreview', val is 'true') @set 'archetypeId', Discourse.get('site.default_archetype') - + archetypesBinding: 'Discourse.site.archetypes' - + creatingTopic: (-> @get('action') == CREATE_TOPIC ).property('action') creatingPrivateMessage: (-> @get('action') == PRIVATE_MESSAGE ).property('action') editingPost: (-> @get('action') == EDIT).property('action') viewOpen: (-> @get('composeState') == OPEN ).property('composeState') - + archetype: (-> @get('archetypes').findProperty('id', @get('archetypeId')) ).property('archetypeId') @@ -44,7 +44,7 @@ window.Discourse.Composer = Discourse.Model.extend togglePreview: -> @toggleProperty('showPreview') Discourse.KeyValueStore.set(key: 'showPreview', value: @get('showPreview')) - + # Import a quote from the post importQuote: -> post = @get('post') @@ -95,7 +95,7 @@ window.Discourse.Composer = Discourse.Model.extend ).property('showPreview') hidePreview: (-> not @get('showPreview') ).property('showPreview') - + # Whether to disable the post button cantSubmitPost: (-> @@ -113,7 +113,7 @@ window.Discourse.Composer = Discourse.Model.extend false ).property('reply', 'title', 'creatingTopic', 'loading') - + # The text for the save button saveText: (-> switch @get('action') @@ -129,20 +129,20 @@ window.Discourse.Composer = Discourse.Model.extend return Em.empty(Em.keys(@get('metaData'))) ).property('metaData') - + wouldLoseChanges: ()-> @get('reply') != @get('originalText') # TODO title check as well # Open a composer - # + # # opts: - # action - The action we're performing: edit, reply or createTopic + # action - The action we're performing: edit, reply or createTopic # post - The post we're replying to, if present # topic - The topic we're replying to, if present - # quote - If we're opening a reply from a quote, the quote we're making + # quote - If we're opening a reply from a quote, the quote we're making # open: (opts={}) -> - + @set('loading', false) topicId = opts.topic.get('id') if opts.topic @@ -151,7 +151,7 @@ window.Discourse.Composer = Discourse.Model.extend opts.tested = true @cancel(=> @open(opts)) return - + @set 'draftKey', opts.draftKey @set 'draftSequence', opts.draftSequence throw 'draft key is required' unless opts.draftKey @@ -177,7 +177,7 @@ window.Discourse.Composer = Discourse.Model.extend Discourse.Post.load opts.postId, (result) => @set('post', result) @set('loading', false) - + # If we are editing a post, load it. if opts.action == EDIT and opts.post @set 'title', @get('topic.title') @@ -186,7 +186,7 @@ window.Discourse.Composer = Discourse.Model.extend @set 'reply', result.get('raw') @set('originalText', @get('reply')) @set('loading', false) - + if opts.title @set('title', opts.title) if opts.draft @@ -196,7 +196,7 @@ window.Discourse.Composer = Discourse.Model.extend false - + save: (opts)-> if @get('editingPost') @editPost(opts) @@ -230,7 +230,7 @@ window.Discourse.Composer = Discourse.Model.extend postNumber = post.get('post_number') posts.each (p,i)-> idx = i if p.get('post_number') == postNumber - + if idx > -1 savedPost.set('topic', @get('topic')) posts.replace(idx, 1, [savedPost]) @@ -244,7 +244,7 @@ window.Discourse.Composer = Discourse.Model.extend @set('composeState', OPEN) promise - + # Create a new Post createPost: (opts)-> @@ -274,9 +274,9 @@ window.Discourse.Composer = Discourse.Model.extend addedToStream = false - # If we're in a topic, we can append the post instantly. + # If we're in a topic, we can append the post instantly. if topic - # Increase the reply count + # Increase the reply count if post post.set('reply_count', (post.get('reply_count') || 0) + 1) @@ -299,17 +299,17 @@ window.Discourse.Composer = Discourse.Model.extend # If we're near the end of the topic, load new posts lastPost = topic.posts.last() - + if lastPost diff = topic.get('highest_post_number') - lastPost.get('post_number') - # If the new post is within a threshold of the end of the topic, + # If the new post is within a threshold of the end of the topic, # add it and scroll there instead of adding the link. if diff < 5 createdPost.set('scrollToAfterInsert', createdPost.get('post_number')) topic.pushPosts([createdPost]) addedToStream = true - + # Save callback createdPost.save (result) => addedPost = false @@ -323,7 +323,7 @@ window.Discourse.Composer = Discourse.Model.extend # We created a new topic, let's show it. @set('composeState', CLOSED) saving = false - + @set('reply', '') @set('createdPost', createdPost) @@ -354,7 +354,7 @@ window.Discourse.Composer = Discourse.Model.extend archetypeId: @get('archetypeId') metaData: @get('metaData') usernames: @get('targetUsernames') - + @set('draftStatus', Em.String.i18n('composer.saving_draft_tip')) Discourse.Draft.save(@get('draftKey'), @get('draftSequence'), data) .then( @@ -417,6 +417,6 @@ Discourse.Composer.reopenClass EDIT: EDIT # Draft key - REPLY_AS_NEW_TOPIC_KEY: REPLY_AS_NEW_TOPIC_KEY + REPLY_AS_NEW_TOPIC_KEY: REPLY_AS_NEW_TOPIC_KEY diff --git a/app/assets/javascripts/discourse/models/draft.js.coffee b/app/assets/javascripts/discourse/models/draft.js.coffee index 09f173f4c..2b69f7d3f 100644 --- a/app/assets/javascripts/discourse/models/draft.js.coffee +++ b/app/assets/javascripts/discourse/models/draft.js.coffee @@ -18,11 +18,11 @@ Discourse.Draft.reopenClass success: (data) => promise.resolve(data) promise - + getLocal: (key, current) -> return current - - # disabling for now to see if it helps with siracusa issue. + + # disabling for now to see if it helps with siracusa issue. local = Discourse.KeyValueStore.get("draft_#{key}") if !current || (local && local.length > current.length) @@ -46,6 +46,6 @@ Discourse.Draft.reopenClass # Discourse.KeyValueStore.set(key: "draft_#{key}", value: data) promise.reject() promise - - + + diff --git a/app/assets/javascripts/discourse/models/invite_list.js.coffee b/app/assets/javascripts/discourse/models/invite_list.js.coffee index 7daff82c3..d08f770a3 100644 --- a/app/assets/javascripts/discourse/models/invite_list.js.coffee +++ b/app/assets/javascripts/discourse/models/invite_list.js.coffee @@ -1,10 +1,10 @@ window.Discourse.InviteList = Discourse.Model.extend Discourse.Presence, - - empty: (-> + + empty: (-> return @blank('pending') and @blank('redeemed') ).property('pending.@each', 'redeemed.@each') -window.Discourse.InviteList.reopenClass +window.Discourse.InviteList.reopenClass findInvitedBy: (user) -> promise = new RSVP.Promise() @@ -16,4 +16,4 @@ window.Discourse.InviteList.reopenClass invitedList.redeemed = (invitedList.redeemed.map (i) -> Discourse.Invite.create(i)) if invitedList.redeemed invitedList.user = user promise.resolve(Discourse.InviteList.create(invitedList)) - promise \ No newline at end of file + promise diff --git a/app/assets/javascripts/discourse/models/mention.js.coffee b/app/assets/javascripts/discourse/models/mention.js.coffee index 7333ae5c1..4ae78839f 100644 --- a/app/assets/javascripts/discourse/models/mention.js.coffee +++ b/app/assets/javascripts/discourse/models/mention.js.coffee @@ -5,7 +5,7 @@ Discourse.Mention = (-> cache = (name, valid) -> localCache[name] = valid return - + lookupCache = (name) -> localCache[name] @@ -19,7 +19,7 @@ Discourse.Mention = (-> cache(name,r.valid) callback(r.valid) return true - + load = (e) -> $elem = $(e) return if $elem.data('mention-tested') @@ -38,4 +38,4 @@ Discourse.Mention = (-> lookup: lookup lookupCache: lookupCache )() - + diff --git a/app/assets/javascripts/discourse/models/model.js.coffee b/app/assets/javascripts/discourse/models/model.js.coffee index 3eadef3e8..9555defbf 100644 --- a/app/assets/javascripts/discourse/models/model.js.coffee +++ b/app/assets/javascripts/discourse/models/model.js.coffee @@ -20,9 +20,9 @@ window.Discourse.Model = Ember.Object.extend col = @get(k) v.each (obj) -> col.pushObject(builder.create(obj)) else - @set(k, v) + @set(k, v) + - window.Discourse.Model.reopenClass # Given an array of values, return them in a hash @@ -33,4 +33,4 @@ window.Discourse.Model.reopenClass collection.each (c) -> obj = klass.create(c) retval[c.id] = obj - retval \ No newline at end of file + retval diff --git a/app/assets/javascripts/discourse/models/nav_item.js.coffee b/app/assets/javascripts/discourse/models/nav_item.js.coffee index 5de4de226..d79a81baf 100644 --- a/app/assets/javascripts/discourse/models/nav_item.js.coffee +++ b/app/assets/javascripts/discourse/models/nav_item.js.coffee @@ -27,11 +27,11 @@ Discourse.NavItem.reopenClass countSummary = opts["countSummary"] loggedOn = opts["loggedOn"] hasCategories = opts["hasCategories"] - + split = text.split(",") name = split[0] - testName = name.split("/")[0] # to handle category ... + testName = name.split("/")[0] # to handle category ... return null if !loggedOn && !validAnon.contains(testName) return null if !hasCategories && testName == "categories" diff --git a/app/assets/javascripts/discourse/models/notification.js.coffee b/app/assets/javascripts/discourse/models/notification.js.coffee index b0c8db185..9a11aa0ad 100644 --- a/app/assets/javascripts/discourse/models/notification.js.coffee +++ b/app/assets/javascripts/discourse/models/notification.js.coffee @@ -20,7 +20,7 @@ window.Discourse.Notification = Discourse.Model.extend Discourse.Presence, window.Discourse.Notification.reopenClass - + create: (obj) -> result = @_super(obj) result.set('data', Em.Object.create(obj.data)) if obj.data diff --git a/app/assets/javascripts/discourse/models/onebox.js.coffee b/app/assets/javascripts/discourse/models/onebox.js.coffee index a2643495b..60e16699d 100644 --- a/app/assets/javascripts/discourse/models/onebox.js.coffee +++ b/app/assets/javascripts/discourse/models/onebox.js.coffee @@ -1,5 +1,5 @@ Discourse.Onebox = (-> - # for now it only stores in a var, in future we can change it so it uses localStorage, + # for now it only stores in a var, in future we can change it so it uses localStorage, # trouble with localStorage is that expire semantics need some thinking #cacheKey = "__onebox__" @@ -9,9 +9,9 @@ Discourse.Onebox = (-> localCache[url] = contents #if localStorage && localStorage.setItem - # localStorage.setItme + # localStorage.setItme null - + lookupCache = (url) -> localCache[url] @@ -25,7 +25,7 @@ Discourse.Onebox = (-> cache(url,html) callback(html) return true - + load = (e, refresh=false) -> url = e.href @@ -45,4 +45,4 @@ Discourse.Onebox = (-> lookup: lookup lookupCache: lookupCache )() - + diff --git a/app/assets/javascripts/discourse/models/topic.js.coffee b/app/assets/javascripts/discourse/models/topic.js.coffee index f50d1c535..277213e79 100644 --- a/app/assets/javascripts/discourse/models/topic.js.coffee +++ b/app/assets/javascripts/discourse/models/topic.js.coffee @@ -52,14 +52,14 @@ Discourse.Topic = Discourse.Model.extend Discourse.Presence, ).observes('posts.@each','posts') # The amount of new posts to display. It might be different than what the server - # tells us if we are still asynchronously flushing our "recently read" data. + # tells us if we are still asynchronously flushing our "recently read" data. # So take what the browser has seen into consideration. displayNewPosts: (-> if highestSeen = Discourse.get('highestSeenByTopic')[@get('id')] delta = highestSeen - @get('last_read_post_number') if delta > 0 - result = (@get('new_posts') - delta) + result = (@get('new_posts') - delta) result = 0 if result < 0 return result @@ -78,9 +78,9 @@ Discourse.Topic = Discourse.Model.extend Discourse.Presence, ageCold: (-> return unless lastPost = @get('last_posted_at') return unless createdAt = @get('created_at') - + daysSinceEpoch = (dt) -> - # 1000 * 60 * 60 * 24 = days since epoch + # 1000 * 60 * 60 * 24 = days since epoch dt.getTime() / 86400000 # Show heat on age @@ -169,12 +169,12 @@ Discourse.Topic = Discourse.Model.extend Discourse.Presence, bestOf: opts.bestOf trackVisit: opts.trackVisit .then (result) => - + # If loading the topic succeeded... # Update the slug if different @set('slug', result.slug) if result.slug - # If we want to scroll to a post that doesn't exist, just pop them to the closest + # If we want to scroll to a post that doesn't exist, just pop them to the closest # one instead. This is likely happening due to a deleted post. opts.nearPost = parseInt(opts.nearPost) closestPostNumber = 0 @@ -189,7 +189,7 @@ Discourse.Topic = Discourse.Model.extend Discourse.Presence, @get('participants').clear() if @get('participants') - + @set('suggested_topics', Em.A()) if result.suggested_topics @mergeAttributes result, suggested_topics: Discourse.Topic @set('posts', Em.A()) @@ -237,7 +237,7 @@ Discourse.Topic = Discourse.Model.extend Discourse.Presence, url: "/t/#{@get('id')}/notifications" type: 'POST' data: {notification_level: v} - + # use to add post to topics protecting from dupes pushPosts: (newPosts)-> map = {} @@ -257,13 +257,13 @@ window.Discourse.Topic.reopenClass MUTE: 0 # Load a topic, but accepts a set of filters - # + # # options: # onLoad - the callback after the topic is loaded find: (topicId, opts) -> url = "/t/#{topicId}" url += "/#{opts.nearPost}" if opts.nearPost - + data = {} data.posts_after = opts.postsAfter if opts.postsAfter data.posts_before = opts.postsBefore if opts.postsBefore @@ -276,7 +276,7 @@ window.Discourse.Topic.reopenClass # Add the best of filter if we have it data.best_of = true if opts.bestOf == true - + # Check the preload store. If not, load it via JSON promise = new RSVP.Promise() PreloadStore.get("topic_#{topicId}", -> jQuery.getJSON url + ".json", data).then (result) -> @@ -286,7 +286,7 @@ window.Discourse.Topic.reopenClass , (result) -> promise.reject(result) promise - + # Create a topic from posts movePosts: (topicId, title, postIds) -> $.ajax "/t/#{topicId}/move-posts", diff --git a/app/assets/javascripts/discourse/models/topic_list.js.coffee b/app/assets/javascripts/discourse/models/topic_list.js.coffee index 8f0fb23c1..9e0685dc3 100644 --- a/app/assets/javascripts/discourse/models/topic_list.js.coffee +++ b/app/assets/javascripts/discourse/models/topic_list.js.coffee @@ -2,7 +2,7 @@ window.Discourse.TopicList = Discourse.Model.extend emptyListTip: (-> return null unless @get('loaded') - + t = @get('topics') return null if t && t.length > 0 @@ -32,7 +32,7 @@ window.Discourse.TopicList = Discourse.Model.extend insert: (json) -> newTopic = Discourse.TopicList.decodeTopic(json) - + # New Topics are always unseen newTopic.set('unseen', true) @@ -75,7 +75,7 @@ window.Discourse.TopicList.reopenClass url = "/#{filter}.json" if menuItem.filters && menuItem.filters.length > 0 url += "?exclude_category=" + menuItem.filters[0].substring(1) - + if list = Discourse.get('transient.topicsList') if (list.get('filter') is filter) and window.location.pathname.indexOf('more') > 0 promise = new RSVP.Promise() diff --git a/app/assets/javascripts/discourse/models/user.js.coffee b/app/assets/javascripts/discourse/models/user.js.coffee index b90c1ea3a..70bc80849 100644 --- a/app/assets/javascripts/discourse/models/user.js.coffee +++ b/app/assets/javascripts/discourse/models/user.js.coffee @@ -26,11 +26,11 @@ window.Discourse.User = Discourse.Model.extend Discourse.Presence, username_lower:(-> @get('username').toLowerCase() ).property('username') - + trustLevel: (-> Discourse.get('site.trust_levels').findProperty('id', @get('trust_level')) ).property('trust_level') - + changeUsername: (newUsername) -> $.ajax url: "/users/#{@get('username_lower')}/preferences/username" @@ -41,7 +41,7 @@ window.Discourse.User = Discourse.Model.extend Discourse.Presence, $.ajax url: "/users/#{@get('username_lower')}/preferences/email" type: 'PUT' - data: {email: email} + data: {email: email} copy: (deep) -> Discourse.User.create(@getProperties(Ember.keys(@))) @@ -164,7 +164,7 @@ window.Discourse.User.reopenClass if s.action_type == k g[k] = s s.count = c - + g[s.action_type] = s unless found stats.map((s)-> diff --git a/app/assets/javascripts/discourse/routes/application_route.js.coffee b/app/assets/javascripts/discourse/routes/application_route.js.coffee index 87c34cb1f..e7fd356d0 100644 --- a/app/assets/javascripts/discourse/routes/application_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/application_route.js.coffee @@ -2,4 +2,4 @@ window.Discourse.ApplicationRoute = Discourse.Route.extend setupController: (controller) -> Discourse.set('site', Discourse.Site.create(PreloadStore.getStatic('site'))) currentUser = PreloadStore.getStatic('currentUser') - Discourse.set('currentUser', Discourse.User.create(currentUser)) if currentUser \ No newline at end of file + Discourse.set('currentUser', Discourse.User.create(currentUser)) if currentUser diff --git a/app/assets/javascripts/discourse/routes/application_routes.js.coffee b/app/assets/javascripts/discourse/routes/application_routes.js.coffee index 9bc949e37..9506eb9ed 100644 --- a/app/assets/javascripts/discourse/routes/application_routes.js.coffee +++ b/app/assets/javascripts/discourse/routes/application_routes.js.coffee @@ -6,7 +6,7 @@ Discourse.buildRoutes -> @route 'bestOf', path: '/best_of' # Generate static page routes - router = @ + router = @ Discourse.StaticController.pages.forEach (p) -> router.route(p, path: "/#{p}") @route 'faq', path: '/faq' @@ -24,10 +24,10 @@ Discourse.buildRoutes -> router.route 'categories', path: '/categories' router.route 'category', path: '/category/:slug/more' router.route 'category', path: '/category/:slug' - + @resource 'user', path: '/users/:username', -> @route 'activity', path: '/' - + @resource 'preferences', path: '/preferences', -> @route 'username', path: '/username' @route 'email', path: '/email' diff --git a/app/assets/javascripts/discourse/routes/discourse_route.js.coffee b/app/assets/javascripts/discourse/routes/discourse_route.js.coffee index 6991f65a7..1f8180c32 100644 --- a/app/assets/javascripts/discourse/routes/discourse_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/discourse_route.js.coffee @@ -18,8 +18,8 @@ window.Discourse.Route = Em.Route.extend # Hide any searches if search = router.get('searchController') search.close() - - # get rid of "save as draft stuff" + + # get rid of "save as draft stuff" composerController = Discourse.get('router.composerController') composerController.closeIfCollapsed() if composerController diff --git a/app/assets/javascripts/discourse/routes/filtered_list_route.js.coffee b/app/assets/javascripts/discourse/routes/filtered_list_route.js.coffee index 596726667..660e54d9e 100644 --- a/app/assets/javascripts/discourse/routes/filtered_list_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/filtered_list_route.js.coffee @@ -19,5 +19,5 @@ window.Discourse.FilteredListRoute = Discourse.Route.extend Discourse.ListController.filters.each (filter) -> window.Discourse["List#{filter.capitalize()}Route"] = Discourse.FilteredListRoute.extend(filter: filter) - - \ No newline at end of file + + diff --git a/app/assets/javascripts/discourse/routes/list_categories_route.js.coffee b/app/assets/javascripts/discourse/routes/list_categories_route.js.coffee index 380065493..94b2107bb 100644 --- a/app/assets/javascripts/discourse/routes/list_categories_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/list_categories_route.js.coffee @@ -10,4 +10,4 @@ window.Discourse.ListCategoriesRoute = Discourse.Route.extend @render 'listCategories', into: 'list', outlet: 'listView', controller: 'listCategories' listController.set('canCreateCategory', categoryList.get('can_create_category')) listController.set('category', null) - @controllerFor('listCategories').set('content', categoryList) \ No newline at end of file + @controllerFor('listCategories').set('content', categoryList) diff --git a/app/assets/javascripts/discourse/routes/list_category_route.js.coffee b/app/assets/javascripts/discourse/routes/list_category_route.js.coffee index d5a67486e..dfd1519ec 100644 --- a/app/assets/javascripts/discourse/routes/list_category_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/list_category_route.js.coffee @@ -7,4 +7,4 @@ window.Discourse.ListCategoryRoute = Discourse.FilteredListRoute.extend listController.load("category/#{model.slug}").then (topicList) => listController.set('canCreateTopic', topicList.get('can_create_topic')) listController.set('category', Discourse.Category.create(name: model.slug)) - @controllerFor('listTopics').set('content', topicList) \ No newline at end of file + @controllerFor('listTopics').set('content', topicList) diff --git a/app/assets/javascripts/discourse/routes/preferences_email_route.js.coffee b/app/assets/javascripts/discourse/routes/preferences_email_route.js.coffee index f827f0d7a..8befc7361 100644 --- a/app/assets/javascripts/discourse/routes/preferences_email_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/preferences_email_route.js.coffee @@ -2,4 +2,4 @@ window.Discourse.PreferencesEmailRoute = Discourse.Route.extend renderTemplate: -> @render into: 'user', outlet: 'userOutlet' setupController: (controller) -> - controller.set('content', @controllerFor('user').get('content')) \ No newline at end of file + controller.set('content', @controllerFor('user').get('content')) diff --git a/app/assets/javascripts/discourse/routes/preferences_route.js.coffee b/app/assets/javascripts/discourse/routes/preferences_route.js.coffee index 29c748ca3..bbf14ab3b 100644 --- a/app/assets/javascripts/discourse/routes/preferences_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/preferences_route.js.coffee @@ -3,4 +3,4 @@ window.Discourse.PreferencesRoute = Discourse.Route.extend @render 'preferences', into: 'user', outlet: 'userOutlet', controller: 'preferences' setupController: (controller) -> - controller.set('content', @controllerFor('user').get('content')) \ No newline at end of file + controller.set('content', @controllerFor('user').get('content')) diff --git a/app/assets/javascripts/discourse/routes/preferences_username_route.js.coffee b/app/assets/javascripts/discourse/routes/preferences_username_route.js.coffee index 66d9d250a..f440d738c 100644 --- a/app/assets/javascripts/discourse/routes/preferences_username_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/preferences_username_route.js.coffee @@ -4,4 +4,4 @@ window.Discourse.PreferencesUsernameRoute = Discourse.Route.extend setupController: (controller) -> user = @controllerFor('user').get('content') controller.set('content', user) - controller.set('newUsername', user.get('username')) \ No newline at end of file + controller.set('newUsername', user.get('username')) diff --git a/app/assets/javascripts/discourse/routes/static_route.js.coffee b/app/assets/javascripts/discourse/routes/static_route.js.coffee index adade71d1..df50e5356 100644 --- a/app/assets/javascripts/discourse/routes/static_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/static_route.js.coffee @@ -1,4 +1,4 @@ Discourse.StaticController.pages.forEach (page) -> window.Discourse["#{page.capitalize()}Route"] = Discourse.Route.extend - renderTemplate: -> @render 'static' - setupController: -> @controllerFor('static').loadPath("/#{page}") \ No newline at end of file + renderTemplate: -> @render 'static' + setupController: -> @controllerFor('static').loadPath("/#{page}") diff --git a/app/assets/javascripts/discourse/routes/topic_from_params_route.js.coffee b/app/assets/javascripts/discourse/routes/topic_from_params_route.js.coffee index 5c36a37a5..534f7453a 100644 --- a/app/assets/javascripts/discourse/routes/topic_from_params_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/topic_from_params_route.js.coffee @@ -4,4 +4,4 @@ window.Discourse.TopicFromParamsRoute = Discourse.Route.extend params.trackVisit = true topicController = @controllerFor('topic') topicController.cancelFilter() - @modelFor('topic').loadPosts(params) \ No newline at end of file + @modelFor('topic').loadPosts(params) diff --git a/app/assets/javascripts/discourse/routes/topic_route.js.coffee b/app/assets/javascripts/discourse/routes/topic_route.js.coffee index ae540b05c..8e84aa4a8 100644 --- a/app/assets/javascripts/discourse/routes/topic_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/topic_route.js.coffee @@ -18,4 +18,4 @@ window.Discourse.TopicRoute = Discourse.Route.extend setupController: (controller, model) -> controller.set('showExtraHeaderInfo', false) headerController = @controllerFor('header') - headerController?.set('topic', model) \ No newline at end of file + headerController?.set('topic', model) diff --git a/app/assets/javascripts/discourse/routes/user_activity_route.js.coffee b/app/assets/javascripts/discourse/routes/user_activity_route.js.coffee index 10da1202e..18cb7d361 100644 --- a/app/assets/javascripts/discourse/routes/user_activity_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/user_activity_route.js.coffee @@ -5,4 +5,4 @@ window.Discourse.UserActivityRoute = Discourse.Route.extend setupController: (controller) -> userController = @controllerFor('user') userController.set('filter', null) # clear filter - controller.set('content', userController.get('content')) \ No newline at end of file + controller.set('content', userController.get('content')) diff --git a/app/assets/javascripts/discourse/routes/user_invited_route.js.coffee b/app/assets/javascripts/discourse/routes/user_invited_route.js.coffee index 1b302ad3d..6d9f11ef1 100644 --- a/app/assets/javascripts/discourse/routes/user_invited_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/user_invited_route.js.coffee @@ -4,4 +4,4 @@ window.Discourse.UserInvitedRoute = Discourse.Route.extend setupController: (controller) -> Discourse.InviteList.findInvitedBy(@controllerFor('user').get('content')).then (invited) => - controller.set('content', invited) \ No newline at end of file + controller.set('content', invited) diff --git a/app/assets/javascripts/discourse/routes/user_private_messages_route.js.coffee b/app/assets/javascripts/discourse/routes/user_private_messages_route.js.coffee index e69e975a5..eded2a285 100644 --- a/app/assets/javascripts/discourse/routes/user_private_messages_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/user_private_messages_route.js.coffee @@ -5,7 +5,7 @@ window.Discourse.UserPrivateMessagesRoute = Discourse.Route.extend user = @controllerFor('user').get('content') controller.set('content', user) user.filterStream(13) - + Discourse.Draft.get('new_private_message').then (data)=> if data.draft @controllerFor('composer').open diff --git a/app/assets/javascripts/discourse/routes/user_route.js.coffee b/app/assets/javascripts/discourse/routes/user_route.js.coffee index 0f82bcaee..b51434b5f 100644 --- a/app/assets/javascripts/discourse/routes/user_route.js.coffee +++ b/app/assets/javascripts/discourse/routes/user_route.js.coffee @@ -1,3 +1,3 @@ window.Discourse.UserRoute = Discourse.Route.extend model: (params) -> Discourse.User.find(params.username) - serialize: (params) -> username: Em.get(params, 'username').toLowerCase() \ No newline at end of file + serialize: (params) -> username: Em.get(params, 'username').toLowerCase() diff --git a/app/assets/javascripts/discourse/views/archetype_options_modal_view.js.coffee b/app/assets/javascripts/discourse/views/archetype_options_modal_view.js.coffee index d865a8199..9b11287e0 100644 --- a/app/assets/javascripts/discourse/views/archetype_options_modal_view.js.coffee +++ b/app/assets/javascripts/discourse/views/archetype_options_modal_view.js.coffee @@ -1,3 +1,3 @@ window.Discourse.ArchetypeOptionsModalView = window.Discourse.ModalBodyView.extend templateName: 'modal/archetype_options' - title: Em.String.i18n('topic.options') \ No newline at end of file + title: Em.String.i18n('topic.options') diff --git a/app/assets/javascripts/discourse/views/auto_sized_text_view.js.coffee b/app/assets/javascripts/discourse/views/auto_sized_text_view.js.coffee index dae2ccc64..93fc0c708 100644 --- a/app/assets/javascripts/discourse/views/auto_sized_text_view.js.coffee +++ b/app/assets/javascripts/discourse/views/auto_sized_text_view.js.coffee @@ -1,7 +1,7 @@ Discourse.AutoSizedTextView = Ember.View.extend render: (buffer)-> null - + didInsertElement: (e) -> me = @$() me.text(@get('content')) @@ -13,6 +13,6 @@ Discourse.AutoSizedTextView = Ember.View.extend lh -=1 me.css("font-size", "#{fontSize}px") me.css("line-height", "#{lh}px") - + diff --git a/app/assets/javascripts/discourse/views/combobox_view_category.js.coffee b/app/assets/javascripts/discourse/views/combobox_view_category.js.coffee index 172144ac5..627b42293 100644 --- a/app/assets/javascripts/discourse/views/combobox_view_category.js.coffee +++ b/app/assets/javascripts/discourse/views/combobox_view_category.js.coffee @@ -5,4 +5,4 @@ window.Discourse.ComboboxViewCategory = Discourse.ComboboxView.extend template: (text, templateData) -> return text unless templateData.color - "#{text}" \ No newline at end of file + "#{text}" diff --git a/app/assets/javascripts/discourse/views/composer_view.js.coffee b/app/assets/javascripts/discourse/views/composer_view.js.coffee index 8e7e0df82..783304006 100644 --- a/app/assets/javascripts/discourse/views/composer_view.js.coffee +++ b/app/assets/javascripts/discourse/views/composer_view.js.coffee @@ -54,7 +54,7 @@ window.Discourse.ComposerView = window.Discourse.View.extend willDestroyElement: -> $('body').off 'keydown.composer' - + resize: (-> # this still needs to wait on animations, need a clean way to do that Em.run.next null, => @@ -91,13 +91,13 @@ window.Discourse.ComposerView = window.Discourse.View.extend initEditor: -> - # not quite right, need a callback to pass in, meaning this gets called once, + # not quite right, need a callback to pass in, meaning this gets called once, # but if you start replying to another topic it will get the avatars wrong @wmdInput = $wmdInput = $('#wmd-input') return if $wmdInput.length == 0 || $wmdInput.data('init') == true - + Discourse.ComposerView.trigger("initWmdEditor") - + template = Handlebars.compile("
    {{#each options}} @@ -152,7 +152,7 @@ window.Discourse.ComposerView = window.Discourse.View.extend @editor.hooks.onPreviewRefresh = => @afterRender() @editor.run() @set('editor', @editor) - + @loadingChanged() saveDraft = Discourse.debounce((=> @get('controller').saveDraft()),2000) @@ -165,7 +165,7 @@ window.Discourse.ComposerView = window.Discourse.View.extend saveDraft() return true - # In case it's still bound somehow + # In case it's still bound somehow $uploadTarget.fileupload('destroy') # Add the upload action @@ -200,13 +200,13 @@ window.Discourse.ComposerView = window.Discourse.View.extend @set('loadingImage', false) - # I hate to use Em.run.later, but I don't think there's a way of waiting for a CSS transition + # I hate to use Em.run.later, but I don't think there's a way of waiting for a CSS transition # to finish. Em.run.later($, (=> replyTitle = $('#reply-title') @resize() - + if replyTitle.length replyTitle.putCursorAtEnd() else @@ -242,7 +242,7 @@ Discourse.NotifyingTextArea = Ember.TextArea.extend placeholder: (-> Em.String.i18n(@get('placeholderKey')) ).property('placeholderKey') - + didInsertElement: -> @get('parent').childDidInsertElement(@) diff --git a/app/assets/javascripts/discourse/views/excerpt/excerpt_category_view.js.coffee b/app/assets/javascripts/discourse/views/excerpt/excerpt_category_view.js.coffee index 349e6c03a..a607bd8e3 100644 --- a/app/assets/javascripts/discourse/views/excerpt/excerpt_category_view.js.coffee +++ b/app/assets/javascripts/discourse/views/excerpt/excerpt_category_view.js.coffee @@ -7,7 +7,7 @@ window.Discourse.ExcerptCategoryView = Ember.View.extend cat = @get('category') cat.set('id', cat.get('slug')) - @get('controller.controllers.modal')?.showView(Discourse.EditCategoryView.create(category: cat)) + @get('controller.controllers.modal')?.showView(Discourse.EditCategoryView.create(category: cat)) false deleteCategory: -> @@ -16,8 +16,8 @@ window.Discourse.ExcerptCategoryView = Ember.View.extend bootbox.confirm Em.String.i18n("category.delete_confirm"), (result) => if result @get('category').delete -> - Discourse.get('appController').reloadSession -> Discourse.get('router').route("/categories") - + Discourse.get('appController').reloadSession -> Discourse.get('router').route("/categories") + false didInsertElement: -> diff --git a/app/assets/javascripts/discourse/views/excerpt/excerpt_user_view.js.coffee b/app/assets/javascripts/discourse/views/excerpt/excerpt_user_view.js.coffee index 7cf574a0e..60add3175 100644 --- a/app/assets/javascripts/discourse/views/excerpt/excerpt_user_view.js.coffee +++ b/app/assets/javascripts/discourse/views/excerpt/excerpt_user_view.js.coffee @@ -6,7 +6,7 @@ window.Discourse.ExcerptUserView = Ember.View.extend url = post.get("url") username = post.get("username") Discourse.router.route('/users/' + Discourse.currentUser.username.toLowerCase() + "/private-messages") - + # TODO figure out a way for it to open the composer cleanly AFTER the navigation happens. composerController = Discourse.get('router.composerController') composerController.open diff --git a/app/assets/javascripts/discourse/views/excerpt/excerpt_view.js.coffee b/app/assets/javascripts/discourse/views/excerpt/excerpt_view.js.coffee index 018ebe95e..459e22697 100644 --- a/app/assets/javascripts/discourse/views/excerpt/excerpt_view.js.coffee +++ b/app/assets/javascripts/discourse/views/excerpt/excerpt_view.js.coffee @@ -91,7 +91,7 @@ window.Discourse.ExcerptView = Ember.ContainerView.extend didInsertElement: -> - # lets disable this puppy for now, it looks unprofessional + # lets disable this puppy for now, it looks unprofessional return # We don't do hovering on touch devices @@ -120,7 +120,7 @@ window.Discourse.ExcerptView = Ember.ContainerView.extend topPosY = (pos.top - height) - margin bottomPosY = (pos.top + margin) - + # Switch to right if there's no room on top if positionText == 'top' positionText = 'bottom' if topPosY < 10 @@ -140,7 +140,7 @@ window.Discourse.ExcerptView = Ember.ContainerView.extend if (pos.left || 0) <= 0 && (pos.top || 0) <= 0 # somehow, sometimes, we are trying to position stuff in weird spots, just skip it return - + @set('position', positionText) @set('desiredLocation', pos) @set('size', $target.data('excerpt-size')) @@ -150,5 +150,5 @@ window.Discourse.ExcerptView = Ember.ContainerView.extend $('#main').on 'mouseleave', '.excerptable', (e) => Em.run.cancel(@openTimer) @closeSoon() - + diff --git a/app/assets/javascripts/discourse/views/featured_threads_view.js.coffee b/app/assets/javascripts/discourse/views/featured_threads_view.js.coffee index d0a6daf83..0d6998fa9 100644 --- a/app/assets/javascripts/discourse/views/featured_threads_view.js.coffee +++ b/app/assets/javascripts/discourse/views/featured_threads_view.js.coffee @@ -1,7 +1,7 @@ window.Discourse.FeaturedTopicsView = Ember.View.extend templateName: 'featured_topics' - classNames: ['category-list-item'] + classNames: ['category-list-item'] init: -> @._super() - @set('context', @get('content')) \ No newline at end of file + @set('context', @get('content')) diff --git a/app/assets/javascripts/discourse/views/flag_view.js.coffee b/app/assets/javascripts/discourse/views/flag_view.js.coffee index 1753b3c1f..e73787155 100644 --- a/app/assets/javascripts/discourse/views/flag_view.js.coffee +++ b/app/assets/javascripts/discourse/views/flag_view.js.coffee @@ -9,13 +9,13 @@ window.Discourse.FlagView = Ember.View.extend @set('isCustomFlag', action.is_custom_flag) Em.run.next -> $("#radio_#{action.name_key}").prop('checked', 'true') false - + createFlag: -> actionType = Discourse.get("site").postActionTypeById(@get('postActionTypeId')) @get("post.actionByName.#{actionType.get('name_key')}")?.act(message: @get('customFlagMessage')) $('#discourse-modal').modal('hide') false - + customPlaceholder: (-> Em.String.i18n("flagging.custom_placeholder") ).property() diff --git a/app/assets/javascripts/discourse/views/header_view.js.coffee b/app/assets/javascripts/discourse/views/header_view.js.coffee index 9dc43c260..1ed35df59 100644 --- a/app/assets/javascripts/discourse/views/header_view.js.coffee +++ b/app/assets/javascripts/discourse/views/header_view.js.coffee @@ -7,7 +7,7 @@ window.Discourse.HeaderView = Ember.View.extend currentUserBinding: 'Discourse.currentUser' categoriesBinding: 'site.categories' topicBinding: 'Discourse.router.topicController.content' - + showDropdown: ($target) -> elementId = $target.data('dropdown') || $target.data('notifications') $dropdown = $("##{elementId}") @@ -31,7 +31,7 @@ window.Discourse.HeaderView = Ember.View.extend $html.on 'click.d-dropdown touchstart.d-dropdown', (e) => return true if $(e.target).closest('.d-dropdown').length > 0 hideDropdown() - + $html.data('hide-dropdown', hideDropdown) false @@ -65,7 +65,7 @@ window.Discourse.HeaderView = Ember.View.extend if @dockedHeader $('body').removeClass('docked') @dockedHeader = false - + willDestroyElement: -> $(window).unbind 'scroll.discourse-dock' @@ -75,7 +75,7 @@ window.Discourse.HeaderView = Ember.View.extend didInsertElement: -> @.$('a[data-dropdown]').on 'click touchstart', (e) => @showDropdown($(e.currentTarget)) @.$('a.unread-private-messages, a.unread-notifications, a[data-notifications]').on 'click touchstart', (e) => @showNotifications(e) - + $(window).bind 'scroll.discourse-dock', => @examineDockHeader() $(document).bind 'touchmove.discourse-dock', => @examineDockHeader() @examineDockHeader() @@ -86,7 +86,7 @@ window.Discourse.HeaderView = Ember.View.extend # Hide dropdowns if e.which == 27 @.$('li').removeClass('active') - @.$('.d-dropdown').fadeOut('fast') + @.$('.d-dropdown').fadeOut('fast') if @get('editingTopic') @finishedEdit() if e.which == 13 diff --git a/app/assets/javascripts/discourse/views/history_view.js.coffee b/app/assets/javascripts/discourse/views/history_view.js.coffee index 08c48e9ec..7a6d21797 100644 --- a/app/assets/javascripts/discourse/views/history_view.js.coffee +++ b/app/assets/javascripts/discourse/views/history_view.js.coffee @@ -25,9 +25,9 @@ window.Discourse.HistoryView = Ember.View.extend @get('originalPost').loadVersions (result) => @set('loading', false) - + @set('versionLeft', result.first()) @set('versionRight', result.last()) @set('versions', result) - + diff --git a/app/assets/javascripts/discourse/views/image_selector.js.coffee b/app/assets/javascripts/discourse/views/image_selector.js.coffee index d711dc0ca..4a242c1d7 100644 --- a/app/assets/javascripts/discourse/views/image_selector.js.coffee +++ b/app/assets/javascripts/discourse/views/image_selector.js.coffee @@ -2,14 +2,14 @@ window.Discourse.ImageSelectorView = Ember.View.extend templateName: 'image_selector' classNames: ['image-selector'] title: 'Insert Image' - + init: -> @._super() @set('localSelected', true) selectLocal: -> @set('localSelected', true) - + selectRemote: -> @set('localSelected', false) @@ -26,6 +26,6 @@ window.Discourse.ImageSelectorView = Ember.View.extend add: -> @get('composer').addMarkdown("![image](#{$('#fileurl-input').val()})") $('#discourse-modal').modal('hide') - - + + diff --git a/app/assets/javascripts/discourse/views/input_tip_view.js.coffee b/app/assets/javascripts/discourse/views/input_tip_view.js.coffee index 888de8b6c..8115f3213 100644 --- a/app/assets/javascripts/discourse/views/input_tip_view.js.coffee +++ b/app/assets/javascripts/discourse/views/input_tip_view.js.coffee @@ -17,4 +17,4 @@ Discourse.InputTipView = Ember.View.extend Discourse.Presence, render: (buffer) -> if reason = @get('validation.reason') icon = if @get('good') then 'icon-ok' else 'icon-remove' - buffer.push " #{reason}" \ No newline at end of file + buffer.push " #{reason}" diff --git a/app/assets/javascripts/discourse/views/list/list_topics_view.js.coffee b/app/assets/javascripts/discourse/views/list/list_topics_view.js.coffee index 6d8aadc63..e5d97650a 100644 --- a/app/assets/javascripts/discourse/views/list/list_topics_view.js.coffee +++ b/app/assets/javascripts/discourse/views/list/list_topics_view.js.coffee @@ -18,7 +18,7 @@ window.Discourse.ListTopicsView = Ember.View.extend Discourse.Scrolling, Discour willDestroyElement: -> @unbindScrolling() - didInsertElement: -> + didInsertElement: -> @bindScrolling() eyeline = new Discourse.Eyeline('.topic-list-item') eyeline.on 'sawBottom', => @loadMore() @@ -34,17 +34,17 @@ window.Discourse.ListTopicsView = Ember.View.extend Discourse.Scrolling, Discour loadMore: -> return if @get('loading') @set('loading', true) - @get('controller.content').loadMoreTopics().then (hasMoreResults) => + @get('controller.content').loadMoreTopics().then (hasMoreResults) => @set('loadedMore', true) @set('loading', false) Em.run.next => @saveScrollPos() @get('eyeline').flushRest() unless hasMoreResults - - # Remember where we were scrolled to + + # Remember where we were scrolled to saveScrollPos: -> - Discourse.set('transient.topicListScrollPos', $(window).scrollTop()) + Discourse.set('transient.topicListScrollPos', $(window).scrollTop()) # When the topic list is scrolled - scrolled: (e) -> + scrolled: (e) -> @saveScrollPos() @get('eyeline')?.update() diff --git a/app/assets/javascripts/discourse/views/list/list_view.js.coffee b/app/assets/javascripts/discourse/views/list/list_view.js.coffee index 18fdea9d2..7608e0fa6 100644 --- a/app/assets/javascripts/discourse/views/list/list_view.js.coffee +++ b/app/assets/javascripts/discourse/views/list/list_view.js.coffee @@ -2,15 +2,15 @@ window.Discourse.ListView = Ember.View.extend templateName: 'list/list' composeViewBinding: Ember.Binding.oneWay('Discourse.composeView') categoriesBinding: 'Discourse.site.categories' - + # The window has been scrolled - scrolled: (e) -> + scrolled: (e) -> currentView = @get('container.currentView') - currentView?.scrolled?(e) + currentView?.scrolled?(e) createTopicText: (-> if @get('controller.category.name') Em.String.i18n("topic.create_in", categoryName: @get('controller.category.name')) else Em.String.i18n("topic.create") - ).property('controller.category.name') \ No newline at end of file + ).property('controller.category.name') diff --git a/app/assets/javascripts/discourse/views/list/topic_list_item_view.js.coffee b/app/assets/javascripts/discourse/views/list/topic_list_item_view.js.coffee index 4d764f5ab..bb27e8a12 100644 --- a/app/assets/javascripts/discourse/views/list/topic_list_item_view.js.coffee +++ b/app/assets/javascripts/discourse/views/list/topic_list_item_view.js.coffee @@ -23,4 +23,4 @@ window.Discourse.TopicListItemView = Ember.View.extend return @highlight() if @get('content.highlightAfterInsert') - + diff --git a/app/assets/javascripts/discourse/views/modal/archetype_options_view.js.coffee b/app/assets/javascripts/discourse/views/modal/archetype_options_view.js.coffee index e933debd6..142c73ad4 100644 --- a/app/assets/javascripts/discourse/views/modal/archetype_options_view.js.coffee +++ b/app/assets/javascripts/discourse/views/modal/archetype_options_view.js.coffee @@ -8,9 +8,9 @@ window.Discourse.ArchetypeOptionsView = Em.ContainerView.extend @get('archetype.options').forEach (a) => switch a.option_type when 1 - checked = + checked = @pushObject Discourse.OptionBooleanView.create content: a checked: (metaData.get(a.key) == 'true') - + diff --git a/app/assets/javascripts/discourse/views/modal/create_account_view.js.coffee b/app/assets/javascripts/discourse/views/modal/create_account_view.js.coffee index a0f176956..8ee6d82d5 100644 --- a/app/assets/javascripts/discourse/views/modal/create_account_view.js.coffee +++ b/app/assets/javascripts/discourse/views/modal/create_account_view.js.coffee @@ -1,6 +1,6 @@ window.Discourse.CreateAccountView = window.Discourse.ModalBodyView.extend Discourse.Presence, templateName: 'modal/create_account' - title: Em.String.i18n('create_account.title') + title: Em.String.i18n('create_account.title') uniqueUsernameValidation: null complete: false accountPasswordConfirm: 0 @@ -22,7 +22,7 @@ window.Discourse.CreateAccountView = window.Discourse.ModalBodyView.extend Disco # Validate the name nameValidation: (-> # If blank, fail without a reason - return Discourse.InputValidation.create(failed: true) if @blank('accountName') + return Discourse.InputValidation.create(failed: true) if @blank('accountName') @fetchConfirmationValue() if @get('accountPasswordConfirm') == 0 @@ -30,21 +30,21 @@ window.Discourse.CreateAccountView = window.Discourse.ModalBodyView.extend Disco return Discourse.InputValidation.create(failed: true, reason: Em.String.i18n('user.name.too_short')) if @get('accountName').length < 3 # Looks good! - Discourse.InputValidation.create(ok: true, reason: Em.String.i18n('user.name.ok')) + Discourse.InputValidation.create(ok: true, reason: Em.String.i18n('user.name.ok')) ).property('accountName') # Check the email address emailValidation: (-> # If blank, fail without a reason - return Discourse.InputValidation.create(failed: true) if @blank('accountEmail') + return Discourse.InputValidation.create(failed: true) if @blank('accountEmail') email = @get("accountEmail") if (@get('authOptions.email') is email) and @get('authOptions.email_valid') - return Discourse.InputValidation.create(ok: true, reason: Em.String.i18n('user.email.authenticated', provider: @get('authOptions.auth_provider'))) + return Discourse.InputValidation.create(ok: true, reason: Em.String.i18n('user.email.authenticated', provider: @get('authOptions.auth_provider'))) if Discourse.Utilities.emailValid(email) - return Discourse.InputValidation.create(ok: true, reason: Em.String.i18n('user.email.ok')) + return Discourse.InputValidation.create(ok: true, reason: Em.String.i18n('user.email.ok')) return Discourse.InputValidation.create(failed: true, reason: Em.String.i18n('user.email.invalid')) ).property('accountEmail') @@ -60,11 +60,11 @@ window.Discourse.CreateAccountView = window.Discourse.ModalBodyView.extend Disco @checkUsernameAvailability() ).observes('accountEmail') - basicUsernameValidation: (-> - @set('uniqueUsernameValidation', null) + basicUsernameValidation: (-> + @set('uniqueUsernameValidation', null) # If blank, fail without a reason - return Discourse.InputValidation.create(failed: true) if @blank('accountUsername') # + return Discourse.InputValidation.create(failed: true) if @blank('accountUsername') # # If too short return Discourse.InputValidation.create(failed: true, reason: Em.String.i18n('user.username.too_short')) if @get('accountUsername').length < 3 @@ -72,7 +72,7 @@ window.Discourse.CreateAccountView = window.Discourse.ModalBodyView.extend Disco @checkUsernameAvailability() # Let's check it out asynchronously - Discourse.InputValidation.create(failed: true, reason: Em.String.i18n('user.username.checking')) + Discourse.InputValidation.create(failed: true, reason: Em.String.i18n('user.username.checking')) ).property('accountUsername') @@ -104,23 +104,23 @@ window.Discourse.CreateAccountView = window.Discourse.ModalBodyView.extend Disco basicValidation = @get('basicUsernameValidation') uniqueUsername = @get('uniqueUsernameValidation') return uniqueUsername if uniqueUsername - basicValidation + basicValidation ).property('uniqueUsernameValidation', 'basicUsernameValidation') # Validate the password passwordValidation: (-> - return Discourse.InputValidation.create(ok: true) unless @get('passwordRequired') + return Discourse.InputValidation.create(ok: true) unless @get('passwordRequired') # If blank, fail without a reason - password = @get("accountPassword") - return Discourse.InputValidation.create(failed: true) if @blank('accountPassword') + password = @get("accountPassword") + return Discourse.InputValidation.create(failed: true) if @blank('accountPassword') # If too short return Discourse.InputValidation.create(failed: true, reason: Em.String.i18n('user.password.too_short')) if password.length < 6 # Looks good! - Discourse.InputValidation.create(ok: true, reason: Em.String.i18n('user.password.ok')) + Discourse.InputValidation.create(ok: true, reason: Em.String.i18n('user.password.ok')) ).property('accountPassword') @@ -140,14 +140,14 @@ window.Discourse.CreateAccountView = window.Discourse.ModalBodyView.extend Disco challenge = @get('accountChallenge') Discourse.User.createAccount(name, email, password, username, passwordConfirm, challenge).then (result) => - + if result.success @flash(result.message) - @set('complete', true) + @set('complete', true) else @flash(result.message, 'error') if result.active window.location.reload() - , => - @flash(Em.String.i18n('create_account.failed'), 'error') \ No newline at end of file + , => + @flash(Em.String.i18n('create_account.failed'), 'error') diff --git a/app/assets/javascripts/discourse/views/modal/edit_category_view.js.coffee b/app/assets/javascripts/discourse/views/modal/edit_category_view.js.coffee index 3183957d4..dd364cc7e 100644 --- a/app/assets/javascripts/discourse/views/modal/edit_category_view.js.coffee +++ b/app/assets/javascripts/discourse/views/modal/edit_category_view.js.coffee @@ -24,7 +24,7 @@ window.Discourse.EditCategoryView = window.Discourse.ModalBodyView.extend didInsertElement: -> @._super() - + if @get('category') @set('id', @get('category.slug')) else diff --git a/app/assets/javascripts/discourse/views/modal/forgot_password_view.js.coffee b/app/assets/javascripts/discourse/views/modal/forgot_password_view.js.coffee index 2089de658..3f10d1c0a 100644 --- a/app/assets/javascripts/discourse/views/modal/forgot_password_view.js.coffee +++ b/app/assets/javascripts/discourse/views/modal/forgot_password_view.js.coffee @@ -7,6 +7,6 @@ window.Discourse.ForgotPasswordView = window.Discourse.ModalBodyView.extend Disc submit: -> $.post("/session/forgot_password", username: @get('accountEmailOrUsername')) - # don't tell people what happened, this keeps it more secure (ensure same on server) + # don't tell people what happened, this keeps it more secure (ensure same on server) @flash(Em.String.i18n('forgot_password.complete')) - false \ No newline at end of file + false diff --git a/app/assets/javascripts/discourse/views/modal/invite_modal_view.js.coffee b/app/assets/javascripts/discourse/views/modal/invite_modal_view.js.coffee index cdd127a1f..99db33a64 100644 --- a/app/assets/javascripts/discourse/views/modal/invite_modal_view.js.coffee +++ b/app/assets/javascripts/discourse/views/modal/invite_modal_view.js.coffee @@ -29,7 +29,7 @@ window.Discourse.InviteModalView = window.Discourse.ModalBodyView.extend Discour createInvite: -> @set('saving', true) @set('error', false) - + @get('topic').inviteUser(@get('email')).then => # Success @set('saving', false) diff --git a/app/assets/javascripts/discourse/views/modal/invite_private_modal_view.js.coffee b/app/assets/javascripts/discourse/views/modal/invite_private_modal_view.js.coffee index 8d5af6959..a2193b2c7 100644 --- a/app/assets/javascripts/discourse/views/modal/invite_private_modal_view.js.coffee +++ b/app/assets/javascripts/discourse/views/modal/invite_private_modal_view.js.coffee @@ -24,7 +24,7 @@ window.Discourse.InvitePrivateModalView = window.Discourse.ModalBodyView.extend @set('saving', true) @set('error', false) - # Invite the user to the private conversation + # Invite the user to the private conversation @get('topic').inviteUser(@get('emailOrUsername')).then => # Success @set('saving', false) @@ -34,4 +34,4 @@ window.Discourse.InvitePrivateModalView = window.Discourse.ModalBodyView.extend @set('error', true) @set('saving', false) - false \ No newline at end of file + false diff --git a/app/assets/javascripts/discourse/views/modal/login_view.js.coffee b/app/assets/javascripts/discourse/views/modal/login_view.js.coffee index 5a7ab4790..da07746d6 100644 --- a/app/assets/javascripts/discourse/views/modal/login_view.js.coffee +++ b/app/assets/javascripts/discourse/views/modal/login_view.js.coffee @@ -5,7 +5,7 @@ window.Discourse.LoginView = window.Discourse.ModalBodyView.extend Discourse.Pre authenticate: null loggingIn: false - showView: (view) -> @get('controller').show(view) + showView: (view) -> @get('controller').show(view) newAccount: -> @showView(Discourse.CreateAccountView.create()) @@ -48,7 +48,7 @@ window.Discourse.LoginView = window.Discourse.ModalBodyView.extend Discourse.Pre left = @get('lastX') - 400 top = @get('lastY') - 200 window.open("/twitter/frame", "_blank", "menubar=no,status=no,height=400,width=800,left=" + left + ",top=" + top) - + facebookLogin: ()-> @set('authenticate', 'facebook') left = @get('lastX') - 400 diff --git a/app/assets/javascripts/discourse/views/modal/modal_body_view.js.coffee b/app/assets/javascripts/discourse/views/modal/modal_body_view.js.coffee index d0c48f931..7ce167d55 100644 --- a/app/assets/javascripts/discourse/views/modal/modal_body_view.js.coffee +++ b/app/assets/javascripts/discourse/views/modal/modal_body_view.js.coffee @@ -2,7 +2,7 @@ window.Discourse.ModalBodyView = window.Discourse.View.extend # Focus on first element didInsertElement: -> - Em.run.next => + Em.run.next => @.$('form input:first').focus() # Pass the errors to our errors view @@ -15,4 +15,4 @@ window.Discourse.ModalBodyView = window.Discourse.View.extend flash: (msg, flashClass="success") -> $alert = $('#modal-alert').hide().removeClass('alert-error', 'alert-success') $alert.addClass("alert alert-#{flashClass}").html(msg) - $alert.fadeIn() \ No newline at end of file + $alert.fadeIn() diff --git a/app/assets/javascripts/discourse/views/modal/modal_view.js.coffee b/app/assets/javascripts/discourse/views/modal/modal_view.js.coffee index 45a3518bb..24f12b06b 100644 --- a/app/assets/javascripts/discourse/views/modal/modal_view.js.coffee +++ b/app/assets/javascripts/discourse/views/modal/modal_view.js.coffee @@ -13,10 +13,10 @@ window.Discourse.ModalView = Ember.ContainerView.extend viewChanged: (-> - @set('modalErrorsView.errors', null) + @set('modalErrorsView.errors', null) if view = @get('controller.currentView') $('#modal-alert').hide() Em.run.next => @.$().modal('show') - + ).observes('controller.currentView') diff --git a/app/assets/javascripts/discourse/views/modal/move_selected_view.js.coffee b/app/assets/javascripts/discourse/views/modal/move_selected_view.js.coffee index 1fc79c683..a000f0452 100644 --- a/app/assets/javascripts/discourse/views/modal/move_selected_view.js.coffee +++ b/app/assets/javascripts/discourse/views/modal/move_selected_view.js.coffee @@ -23,7 +23,7 @@ window.Discourse.MoveSelectedView = window.Discourse.ModalBodyView.extend Discou @set('saving', true) postIds = @get('selectedPosts').map (p) -> p.get('id') - + Discourse.Topic.movePosts(@get('topic.id'), @get('topicName'), postIds).then (result) => if result.success $('#discourse-modal').modal('hide') @@ -36,4 +36,4 @@ window.Discourse.MoveSelectedView = window.Discourse.ModalBodyView.extend Discou @flash(Em.String.i18n('topic.move_selected.error')) @set('saving', false) - false \ No newline at end of file + false diff --git a/app/assets/javascripts/discourse/views/modal/option_boolean_view.js.coffee b/app/assets/javascripts/discourse/views/modal/option_boolean_view.js.coffee index 0d931f3d6..947ff26a7 100644 --- a/app/assets/javascripts/discourse/views/modal/option_boolean_view.js.coffee +++ b/app/assets/javascripts/discourse/views/modal/option_boolean_view.js.coffee @@ -1,14 +1,14 @@ window.Discourse.OptionBooleanView = Em.View.extend - classNames: ['archetype-option'] + classNames: ['archetype-option'] composerControllerBinding: 'Discourse.router.composerController' templateName: "modal/option_boolean" - checkedChanged: (-> - metaData = @get('parentView.metaData') + checkedChanged: (-> + metaData = @get('parentView.metaData') metaData.set(@get('content.key'), if @get('checked') then 'true' else 'false') @get('controller.controllers.composer').saveDraft() ).observes('checked') init: -> @._super() - @set('context', @get('content')) \ No newline at end of file + @set('context', @get('content')) diff --git a/app/assets/javascripts/discourse/views/nav_item_view.js.coffee b/app/assets/javascripts/discourse/views/nav_item_view.js.coffee index 0fcf5e09e..fc3ac41ac 100644 --- a/app/assets/javascripts/discourse/views/nav_item_view.js.coffee +++ b/app/assets/javascripts/discourse/views/nav_item_view.js.coffee @@ -30,7 +30,7 @@ window.Discourse.NavItemView = Ember.View.extend render: (buffer) -> content = @get('content') - buffer.push("") + buffer.push("") buffer.push("") if content.get('hasIcon') buffer.push(@get('name')) buffer.push("") diff --git a/app/assets/javascripts/discourse/views/parent_view.js.coffee b/app/assets/javascripts/discourse/views/parent_view.js.coffee index bf7a24c62..2ed988537 100644 --- a/app/assets/javascripts/discourse/views/parent_view.js.coffee +++ b/app/assets/javascripts/discourse/views/parent_view.js.coffee @@ -3,7 +3,7 @@ window.Discourse.ParentView = Discourse.EmbeddedPostView.extend # Nice animation for when the replies appear didInsertElement: -> @_super() - + $parentPost = @get('postView').$('section.parent-post') # Animate unless we're on a touch device diff --git a/app/assets/javascripts/discourse/views/post_link_view.js.coffee b/app/assets/javascripts/discourse/views/post_link_view.js.coffee index f8cd82298..13edb2dbf 100644 --- a/app/assets/javascripts/discourse/views/post_link_view.js.coffee +++ b/app/assets/javascripts/discourse/views/post_link_view.js.coffee @@ -2,7 +2,7 @@ window.Discourse.PostLinkView = Ember.View.extend tagName: 'li' classNameBindings: ['direction'] - direction: (-> + direction: (-> return 'incoming' if @get('content.reflection') null ).property('content.reflection') @@ -13,4 +13,4 @@ window.Discourse.PostLinkView = Ember.View.extend buffer.push(@get('content.title')) if clicks = @get('content.clicks') buffer.push("\n#{clicks}") - buffer.push("") \ No newline at end of file + buffer.push("") diff --git a/app/assets/javascripts/discourse/views/post_menu_view.js.coffee b/app/assets/javascripts/discourse/views/post_menu_view.js.coffee index 9961dd16f..65297ee70 100644 --- a/app/assets/javascripts/discourse/views/post_menu_view.js.coffee +++ b/app/assets/javascripts/discourse/views/post_menu_view.js.coffee @@ -12,7 +12,7 @@ window.Discourse.PostMenuView = Ember.View.extend Discourse.Presence, post = @get('post') @renderReplies(post, buffer) - buffer.push("