From 3c370ea56ee8d13ba7cfd5461654a13c80f8bc06 Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Sun, 2 Aug 2015 03:47:42 +0200 Subject: [PATCH] Remove unused js code (stream widget and dropdowns) closes #6279 --- Changelog.md | 1 + .../javascripts/app/views/hovercard_view.js | 2 - app/assets/javascripts/diaspora.js | 5 --- app/assets/javascripts/view.js | 40 ------------------- app/assets/javascripts/widgets/stream.js | 36 ----------------- app/assets/stylesheets/mobile/mobile.scss | 31 -------------- app/views/shared/_right_sections.html.haml | 2 +- features/support/user_cuke_helpers.rb | 4 +- 8 files changed, 4 insertions(+), 117 deletions(-) delete mode 100644 app/assets/javascripts/widgets/stream.js diff --git a/Changelog.md b/Changelog.md index a4e0c325a..934b29edc 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,7 @@ * Extract CommentService from CommentsController [#6307](https://github.com/diaspora/diaspora/pull/6307) * Extract user/profile discovery into the diaspora\_federation-rails gem [#6310](https://github.com/diaspora/diaspora/pull/6310) * Refactor PostPresenter [#6315](https://github.com/diaspora/diaspora/pull/6315) +* Convert BackToTop to a backbone view [#6279](https://github.com/diaspora/diaspora/pull/6279) ## Bug fixes * Fix indentation and a link title on the default home page [#6212](https://github.com/diaspora/diaspora/pull/6212) diff --git a/app/assets/javascripts/app/views/hovercard_view.js b/app/assets/javascripts/app/views/hovercard_view.js index 41b5f587a..1d070096e 100644 --- a/app/assets/javascripts/app/views/hovercard_view.js +++ b/app/assets/javascripts/app/views/hovercard_view.js @@ -21,7 +21,6 @@ app.views.Hovercard = app.views.Base.extend({ // cache some element references this.avatar = this.$('.avatar'); this.avatarLink = this.$("a.person_avatar"); - this.dropdown = this.$('.dropdown_list'); this.dropdown_container = this.$('#hovercard_dropdown_container'); this.hashtags = this.$('.hashtags'); this.person_link = this.$('a.person'); @@ -120,7 +119,6 @@ app.views.Hovercard = app.views.Base.extend({ this.person_link.attr('href', person.url); this.person_link.text(person.name); this.person_handle.text(person.handle); - this.dropdown.attr('data-person-id', person.id); // set hashtags this.hashtags.empty(); diff --git a/app/assets/javascripts/diaspora.js b/app/assets/javascripts/diaspora.js index b4a70e1f4..157a6ab5e 100644 --- a/app/assets/javascripts/diaspora.js +++ b/app/assets/javascripts/diaspora.js @@ -91,11 +91,6 @@ Diaspora.page.publish("page/ready", [$(document.body)]); }; - // temp hack to check if backbone is enabled for the page - Diaspora.backboneEnabled = function(){ - return window.app && window.app.stream !== undefined; - }; - window.Diaspora = Diaspora; })(); diff --git a/app/assets/javascripts/view.js b/app/assets/javascripts/view.js index 508da666d..8d73197bc 100644 --- a/app/assets/javascripts/view.js +++ b/app/assets/javascripts/view.js @@ -1,9 +1,6 @@ // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later var View = { initialize: function() { - /* Buttons */ - $("input:submit").addClass("button"); - /* label placeholders */ $("input, textarea").placeholder(); @@ -15,11 +12,6 @@ var View = { /* Submit the form when the user hits enter */ .keypress(this.search.keyPress); - /* Dropdowns */ - $(document) - .on('click', this.dropdowns.selector, this.dropdowns.click) - .on('keypress', this.dropdowns.selector, this.dropdowns.click); - $(document).on('ajax:success', 'form[data-remote]', function () { $(this).clearForm(); $(this).focusout(); @@ -30,30 +22,13 @@ var View = { $(this).siblings("#tag_following_submit").removeClass('hidden'); }); - $(document.body).click(this.dropdowns.removeFocus); - $('a[rel*=facebox]').facebox(); $(document).bind('reveal.facebox', function() { Diaspora.page.directionDetector.updateBinds(); }); - $("a.new_aspect").click(function(){ - $("input#aspect_name").focus(); - }); - /* facebox 'done' buttons */ $(document).on('click', "*[rel*=close]", function(){ $.facebox.close(); }); - - /* notification routing */ - $("#notification").delegate('.hard_object_link', 'click', function(evt){ - var post = $("#"+ $(this).attr('data-ref')), - lastComment = post.find('.comment.posted').last(); - - if(post.length > 0){ - evt.preventDefault(); - $('html, body').animate({scrollTop: parseInt(lastComment.offset().top)-80 }, 'fast'); - } - }); }, search: { @@ -65,21 +40,6 @@ var View = { }, selector: "#q" }, - - dropdowns: { - click: function(evt) { - $(this).parent('.dropdown').toggleClass("active"); - evt.preventDefault(); - }, - removeFocus: function(evt) { - var $target = $(evt.target); - if(!$target.is('.dropdown_list *') && !$target.is('.dropdown.active > .toggle')) { - $(View.dropdowns.selector).parent().removeClass("active"); - } - }, - selector: ".dropdown > .toggle", - parentSelector: ".dropdown > .wrapper" - } }; $(function() { diff --git a/app/assets/javascripts/widgets/stream.js b/app/assets/javascripts/widgets/stream.js deleted file mode 100644 index a126af0e1..000000000 --- a/app/assets/javascripts/widgets/stream.js +++ /dev/null @@ -1,36 +0,0 @@ -// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later - -(function() { - var Stream = function() { - var self = this; - - this.subscribe("widget/ready", function(evt, stream) { - if( Diaspora.backboneEnabled() ){ return } - - $.extend(self, { - stream: $(stream), - mainStream: $(stream).find('#main_stream'), - headerTitle: $(stream).find('#aspect_stream_header > h3') - }); - }); - - this.globalSubscribe("stream/reloaded stream/scrolled", function() { - self.publish("widget/ready", self.stream); - }); - - this.empty = function() { - self.mainStream.empty(); - self.headerTitle.text(Diaspora.I18n.t('stream.no_aspects')); - }; - - this.setHeaderTitle = function(newTitle) { - self.headerTitle.text(newTitle); - }; - }; - - if(!Diaspora.backboneEnabled()) { - Diaspora.Widgets.Stream = Stream; - } -})(); -// @license-end - diff --git a/app/assets/stylesheets/mobile/mobile.scss b/app/assets/stylesheets/mobile/mobile.scss index d6d056beb..183995e01 100644 --- a/app/assets/stylesheets/mobile/mobile.scss +++ b/app/assets/stylesheets/mobile/mobile.scss @@ -943,37 +943,6 @@ form p.checkbox_select { padding-left: 120px; } -#file-upload.button { - @include button-gradient($light-grey); - border-radius: 3px; - box-shadow: 0 1px 1px #cfcfcf; - @include transition(border); - - display: inline-block; - - font { - style: normal; - size: 12px; - } - color: #505050; - - padding: 4px 9px; - - min-height: 10px; - - border: 1px solid; - - cursor: pointer; - white-space: normal; - - &:hover { - @include button-gradient-hover-no-saturation($light-grey); - color: #505050; - text-decoration: none; - border: 1px solid; - } -} - #settings_nav { font-size: 1em; diff --git a/app/views/shared/_right_sections.html.haml b/app/views/shared/_right_sections.html.haml index feb135beb..13f0e7d10 100644 --- a/app/views/shared/_right_sections.html.haml +++ b/app/views/shared/_right_sections.html.haml @@ -90,7 +90,7 @@ %p = t('aspects.index.help.contact_podmin') %p - = link_to t('aspects.index.help.mail_podmin'), "mailto:#{AppConfig.admins.podmin_email}", :class => "button" + = link_to t("aspects.index.help.mail_podmin"), "mailto:#{AppConfig.admins.podmin_email}" .section .title diff --git a/features/support/user_cuke_helpers.rb b/features/support/user_cuke_helpers.rb index 20603dde8..fb8b339f8 100644 --- a/features/support/user_cuke_helpers.rb +++ b/features/support/user_cuke_helpers.rb @@ -90,7 +90,7 @@ module UserCukeHelpers # submit forgot password form to get reset password link def submit_forgot_password_form - find("#new_user input.button").click + find("#new_user input.btn").click end # fill the reset password form @@ -101,7 +101,7 @@ module UserCukeHelpers # submit reset password form def submit_reset_password_form - find(".button").click + find(".btn").click end def confirm_not_signed_up