From 31d7904701aaf23477ab6c27da10c331f9d46c05 Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Mon, 9 Mar 2015 16:51:55 +0100 Subject: [PATCH 1/3] Remove unused blueprint invitations view --- app/views/invitations/new_blueprint.html.haml | 34 ------------------- 1 file changed, 34 deletions(-) delete mode 100644 app/views/invitations/new_blueprint.html.haml diff --git a/app/views/invitations/new_blueprint.html.haml b/app/views/invitations/new_blueprint.html.haml deleted file mode 100644 index 3e488cc60..000000000 --- a/app/views/invitations/new_blueprint.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -.span-15.last - .span-3 - .icons-monotone_email_letter_round - - .span-12.last - %h2 - = t('invitations.new.invite_someone_to_join') - %br - .span-7.append-1.last - %b= t('invitations.new.paste_link') - %br - %br - = invite_link(@invite_code) - = t('invitations.new.codes_left', :count => @invite_code.count) - %br - %br - #email_invitation - - = form_tag new_user_invitation_path do - %h4 - = t('email') - = text_field_tag 'email_inviter[emails]', @invalid_emails, :title => t('invitations.new.comma_separated_plz'), :placeholder => 'foo@bar.com, max@foo.com...' - %p - = t('invitations.create.note_already_sent', :emails => @valid_emails) unless @valid_emails.empty? - %br - - %h4 - = t('invitations.new.language') - = select_tag('email_inviter[locale]', options_from_collection_for_select(available_language_options, "second", "first", :selected => current_user.language)) - - %br - - %p - = submit_tag t('invitations.new.send_an_invitation'), data: {disable_with: t('invitations.new.sending_invitation')} From d3c02590267774436c0001c2b49c30afab02a86b Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Mon, 9 Mar 2015 16:51:09 +0100 Subject: [PATCH 2/3] Remove unused aspect files --- app/helpers/aspects_helper.rb | 58 ------------------- .../aspect_memberships/_add_to_aspect.haml | 7 --- ...ct_membership_dropdown_blueprint.html.haml | 19 ------ .../_remove_from_aspect.haml | 7 --- .../aspect_memberships/add_to_aspect.js.haml | 7 --- app/views/aspect_memberships/create.js.erb | 20 ------- app/views/aspect_memberships/destroy.js.erb | 10 ---- .../remove_from_aspect.js.haml | 7 --- app/views/shared/_contact_list.html.haml | 19 ------ 9 files changed, 154 deletions(-) delete mode 100644 app/helpers/aspects_helper.rb delete mode 100644 app/views/aspect_memberships/_add_to_aspect.haml delete mode 100644 app/views/aspect_memberships/_aspect_membership_dropdown_blueprint.html.haml delete mode 100644 app/views/aspect_memberships/_remove_from_aspect.haml delete mode 100644 app/views/aspect_memberships/add_to_aspect.js.haml delete mode 100644 app/views/aspect_memberships/create.js.erb delete mode 100644 app/views/aspect_memberships/destroy.js.erb delete mode 100644 app/views/aspect_memberships/remove_from_aspect.js.haml delete mode 100644 app/views/shared/_contact_list.html.haml diff --git a/app/helpers/aspects_helper.rb b/app/helpers/aspects_helper.rb deleted file mode 100644 index 0c781e986..000000000 --- a/app/helpers/aspects_helper.rb +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (c) 2010-2011, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. - -module AspectsHelper - def add_to_aspect_button(aspect_id, person_id) - link_to content_tag(:div, nil, :class => 'icons-monotone_plus_add_round'), - { :controller => 'aspect_memberships', - :action => 'create', - :format => :json, - :aspect_id => aspect_id, - :person_id => person_id - }, - :method => 'post', - :class => 'add btn', - 'data-aspect_id' => aspect_id, - 'data-person_id' => person_id - end - - def remove_from_aspect_button(membership_id, aspect_id, person_id) - link_to content_tag(:div, nil, :class => 'icons-monotone_check_yes'), - { :controller => "aspect_memberships", - :action => 'destroy', - :id => membership_id - }, - :method => 'delete', - :class => 'added btn', - 'data-membership_id' => membership_id, - 'data-aspect_id' => aspect_id, - 'data-person_id' => person_id - end - - def aspect_membership_button(aspect, contact, person) - return if person && person.closed_account? - - membership = contact.aspect_memberships.where(:aspect_id => aspect.id).first - if contact.nil? || membership.nil? - add_to_aspect_button(aspect.id, person.id) - else - remove_from_aspect_button(membership.id, aspect.id, person.id) - end - end - - def aspect_visibility_link(aspect) - if aspect.contacts_visible? - icon = 'icons-padlock-open' - title = t('aspects.edit.aspect_list_is_visible'); - else - icon = 'icons-padlock-closed' - title = t('aspects.edit.aspect_list_is_not_visible'); - end - - link_to aspect_toggle_contact_visibility_path(@aspect), class: 'contact_visibility_link btn', title: title, method: :put, remote: true do - concat t('aspects.edit.set_visibility') - concat content_tag(:span, nil, class: "contact_visibility_padlock " + icon) - end - end -end diff --git a/app/views/aspect_memberships/_add_to_aspect.haml b/app/views/aspect_memberships/_add_to_aspect.haml deleted file mode 100644 index 8012ec4b7..000000000 --- a/app/views/aspect_memberships/_add_to_aspect.haml +++ /dev/null @@ -1,7 +0,0 @@ --# Copyright (c) 2010-2011, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - - -= remove_from_aspect_button(aspect_id,person_id) - diff --git a/app/views/aspect_memberships/_aspect_membership_dropdown_blueprint.html.haml b/app/views/aspect_memberships/_aspect_membership_dropdown_blueprint.html.haml deleted file mode 100644 index 77fc34aba..000000000 --- a/app/views/aspect_memberships/_aspect_membership_dropdown_blueprint.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -.dropdown{:class => ["hang_#{hang}", defined?(dropdown_class) && dropdown_class]} - .button.toggle{:class => ("in_aspects" if selected_aspects.size > 0), :tabindex => '0'} - - if selected_aspects.size == all_aspects.size - = t('all_aspects') - - elsif selected_aspects.size == 1 - = selected_aspects.first.name - - else - = t('shared.aspect_dropdown.toggle', :count => selected_aspects.size) - ▼ - - .wrapper - %ul.dropdown_list{:unSelectable => 'on', 'data-person_id' => (person.id if defined?(person) && person), 'data-service_uid' => (service_uid if defined?(service_uid)), 'data-person-short-name' => (person.first_name if defined?(person) && person)} - - for aspect in all_aspects - = aspect_dropdown_list_item(aspect, aspect_membership_ids[aspect.id] ) - - - if (dropdown_may_create_new_aspect && defined?(person) && person) - %li.newItem - .add_aspect - = link_to t('contacts.index.add_a_new_aspect'), new_aspect_path(:person_id => person.id, :remote => true), :rel => 'facebox' diff --git a/app/views/aspect_memberships/_remove_from_aspect.haml b/app/views/aspect_memberships/_remove_from_aspect.haml deleted file mode 100644 index 02a76b07c..000000000 --- a/app/views/aspect_memberships/_remove_from_aspect.haml +++ /dev/null @@ -1,7 +0,0 @@ --# Copyright (c) 2010-2011, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - - -= aspect_membership_button(aspect, contact, person) - diff --git a/app/views/aspect_memberships/add_to_aspect.js.haml b/app/views/aspect_memberships/add_to_aspect.js.haml deleted file mode 100644 index 86ad128d9..000000000 --- a/app/views/aspect_memberships/add_to_aspect.js.haml +++ /dev/null @@ -1,7 +0,0 @@ --# Copyright (c) 2010-2011, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - - -= remove_from_aspect_button(@aspect_id,@person_id) - diff --git a/app/views/aspect_memberships/create.js.erb b/app/views/aspect_memberships/create.js.erb deleted file mode 100644 index 69abb4b4b..000000000 --- a/app/views/aspect_memberships/create.js.erb +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2010-2011, Diaspora Inc. This file is -// licensed under the Affero General Public License version 3 or later. See -// the COPYRIGHT file. - -// TODO handle this completely in Backbone.js, then remove this view! - -var element = $(".add[data-aspect_id=<%= @aspect.id %>][data-person_id=<%= @contact.person_id%>]"); - -if( $("#no_contacts").is(':visible') ) { - $("#no_contacts").fadeOut(200); -} - -element.parent().html("<%= escape_javascript(render('aspect_memberships/add_to_aspect', :aspect_id => @aspect.id, :person_id => @person.id)) %>"); - -if($('#aspects_list').length == 1) { - $('.aspect_list').attr('data-contact_id', "<%= @contact_id %>"); - $('.aspect_list ul').find('.add').each(function(a,b){$(b).attr('href', $(b).attr('href').replace('contacts','aspect_memberships'));}) -}; - -element.fadeTo(200,1); diff --git a/app/views/aspect_memberships/destroy.js.erb b/app/views/aspect_memberships/destroy.js.erb deleted file mode 100644 index 8c7eb4106..000000000 --- a/app/views/aspect_memberships/destroy.js.erb +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) 2010-2011, Diaspora Inc. This file is -// licensed under the Affero General Public License version 3 or later. See -// the COPYRIGHT file. - -// TODO handle this completely in Backbone.js, then remove this view! - -var element = $(".added[data-aspect_id=<%= @aspect.id %>][data-person_id=<%= @contact.person_id%>]"); -element.parent().html("<%= escape_javascript(render('aspect_memberships/remove_from_aspect', :aspect => @aspect, :person => @contact.person, :contact => @contact)) %>"); -element.fadeTo(200,1); - diff --git a/app/views/aspect_memberships/remove_from_aspect.js.haml b/app/views/aspect_memberships/remove_from_aspect.js.haml deleted file mode 100644 index a5ddc290c..000000000 --- a/app/views/aspect_memberships/remove_from_aspect.js.haml +++ /dev/null @@ -1,7 +0,0 @@ --# Copyright (c) 2010-2011, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - - -= aspect_membership_button(aspect, person, contact) - diff --git a/app/views/shared/_contact_list.html.haml b/app/views/shared/_contact_list.html.haml deleted file mode 100644 index 44e0eb18d..000000000 --- a/app/views/shared/_contact_list.html.haml +++ /dev/null @@ -1,19 +0,0 @@ --# Copyright (c) 2010-2011, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - - -.contact_list_controls - = search_field_tag :contact_search, "", id: "contact_list_search", class: 'contact_list_search', results: 5, placeholder: t('.all_contacts') - = t('contacts', count: @aspect_contacts_count) - -.contact_list.searchable - %ul.contacts - - for contact in contacts - %li.contact{:data=>{:contact_id=>contact.id}} - = person_image_tag contact.person - %h4.name - = link_to contact.person.name, contact.person - .pull-right - = aspect_membership_button(aspect, contact, contact.person) - From 73d04b706ec687569b52539c3b6c07a8e10dfd48 Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Mon, 9 Mar 2015 16:52:47 +0100 Subject: [PATCH 3/3] Use entypo icons for left navbar --- .../javascripts/app/views/aspect_view.js | 2 +- .../app/views/aspects_list_view.js | 4 +-- app/assets/stylesheets/aspects.scss | 7 ---- app/assets/stylesheets/leftnavbar.scss | 35 ++++++++++++++----- app/assets/stylesheets/sidebar.scss | 29 --------------- app/assets/templates/aspect_tpl.jst.hbs | 8 +++-- .../templates/tag_following_tpl.jst.hbs | 2 +- features/step_definitions/tag_steps.rb | 7 ++-- .../javascripts/app/views/aspect_view_spec.js | 2 +- .../app/views/aspects_list_view_spec.js | 2 +- 10 files changed, 43 insertions(+), 55 deletions(-) diff --git a/app/assets/javascripts/app/views/aspect_view.js b/app/assets/javascripts/app/views/aspect_view.js index 3fba4865c..66cc4a945 100644 --- a/app/assets/javascripts/app/views/aspect_view.js +++ b/app/assets/javascripts/app/views/aspect_view.js @@ -8,7 +8,7 @@ app.views.Aspect = app.views.Base.extend({ className: 'hoverable', events: { - 'click .icons-check_yes_ok+a': 'toggleAspect' + 'click .entypo.check+a': 'toggleAspect' }, toggleAspect: function(evt) { diff --git a/app/assets/javascripts/app/views/aspects_list_view.js b/app/assets/javascripts/app/views/aspects_list_view.js index 6af4d41cc..29cdf45a5 100644 --- a/app/assets/javascripts/app/views/aspects_list_view.js +++ b/app/assets/javascripts/app/views/aspects_list_view.js @@ -58,9 +58,9 @@ app.views.AspectsList = app.views.Base.extend({ this.collection.each(function(aspect) { var element = this.$("li[data-aspect_id="+aspect.get('id')+"]"); if (aspect.get('selected')) { - element.find('.icons-check_yes_ok').addClass('selected'); + element.find('.entypo.check').addClass('selected'); } else { - element.find('.icons-check_yes_ok').removeClass('selected'); + element.find('.entypo.check').removeClass('selected'); } }); }, diff --git a/app/assets/stylesheets/aspects.scss b/app/assets/stylesheets/aspects.scss index 257c0dd15..1aac43f70 100644 --- a/app/assets/stylesheets/aspects.scss +++ b/app/assets/stylesheets/aspects.scss @@ -31,13 +31,6 @@ } } -.modify_aspect { - background: url("icons/pencil.png") no-repeat; - width: 12px; - height: 12px; - display: inline-block; -} - #new_aspect { .checkbox { margin: 0px; diff --git a/app/assets/stylesheets/leftnavbar.scss b/app/assets/stylesheets/leftnavbar.scss index 4c5ca103a..136297604 100644 --- a/app/assets/stylesheets/leftnavbar.scss +++ b/app/assets/stylesheets/leftnavbar.scss @@ -41,15 +41,34 @@ text-overflow: ellipsis; } - .action { - width: 12px; - height: 12px; - display: none; - float: right; - margin: 3px; + #aspects_list, #tags_list { + .hoverable > .action { + visibility: hidden; + float: right; + margin: 0 3px; + } + + .hoverable:hover > .action { + visibility: visible; + } } - .hoverable:hover > .action { - display: block; + #aspects_list { + .entypo.check { + float: left; + visibility: hidden; + &.selected { visibility: visible; } + } + + .selected + a { + color: #333333; + } + } + + #tags_list { + .delete_tag_following { + font-size: 20px; + line-height: 15px; + } } } diff --git a/app/assets/stylesheets/sidebar.scss b/app/assets/stylesheets/sidebar.scss index 42af9ec5a..ca1c486ae 100644 --- a/app/assets/stylesheets/sidebar.scss +++ b/app/assets/stylesheets/sidebar.scss @@ -26,36 +26,7 @@ } } -#aspects_list { - .icons-check_yes_ok { - height:18px; - width:18px; - background: url('icons/check_yes_ok.png') no-repeat; - float: left; - visibility: hidden; - } - - .selected { - visibility: visible; - } - - .selected + a { - color: #333333; - } -} - -.modify_aspect { - background: url("icons/pencil.png") no-repeat; - width: 12px; - height: 12px; - display: inline-block; -} - #tags_list { - .delete_tag_following { - background: url("icons/deletelabel.png") no-repeat; - } - /* ---- override app/stylesheets/vendor/autoSuggest.css ---- */ .tag_input { width: 100%; diff --git a/app/assets/templates/aspect_tpl.jst.hbs b/app/assets/templates/aspect_tpl.jst.hbs index bd3acf7ea..bba71a86f 100644 --- a/app/assets/templates/aspect_tpl.jst.hbs +++ b/app/assets/templates/aspect_tpl.jst.hbs @@ -1,7 +1,9 @@ - + + + {{#if selected}} -
+ {{else}} -
+
{{/if}} {{name}} diff --git a/app/assets/templates/tag_following_tpl.jst.hbs b/app/assets/templates/tag_following_tpl.jst.hbs index bc88c255f..1453d60d4 100644 --- a/app/assets/templates/tag_following_tpl.jst.hbs +++ b/app/assets/templates/tag_following_tpl.jst.hbs @@ -1,4 +1,4 @@ - +× #{{ name }} diff --git a/features/step_definitions/tag_steps.rb b/features/step_definitions/tag_steps.rb index c3cbef484..c1a6bc46c 100644 --- a/features/step_definitions/tag_steps.rb +++ b/features/step_definitions/tag_steps.rb @@ -1,5 +1,8 @@ When(/^I unfollow the "(.*?)" tag$/) do |tag| - page.execute_script("$('#unfollow_#{tag}').css('display', 'block')") - find("#unfollow_#{tag}").click + within("#tags_list") do + li = find('li', text: tag) + li.hover + li.find('.delete_tag_following').click + end step 'I confirm the alert' end diff --git a/spec/javascripts/app/views/aspect_view_spec.js b/spec/javascripts/app/views/aspect_view_spec.js index a69792092..9f3a98cb1 100644 --- a/spec/javascripts/app/views/aspect_view_spec.js +++ b/spec/javascripts/app/views/aspect_view_spec.js @@ -10,7 +10,7 @@ describe("app.views.Aspect", function(){ }); it('should show the aspect selected', function(){ - expect(this.view.$el.children('.icons-check_yes_ok').hasClass('selected')).toBeTruthy(); + expect(this.view.$el.children('.entypo.check').hasClass('selected')).toBeTruthy(); }); it('should show the name of the aspect', function(){ diff --git a/spec/javascripts/app/views/aspects_list_view_spec.js b/spec/javascripts/app/views/aspects_list_view_spec.js index 72d029d4c..5a0ded38d 100644 --- a/spec/javascripts/app/views/aspects_list_view_spec.js +++ b/spec/javascripts/app/views/aspects_list_view_spec.js @@ -24,7 +24,7 @@ describe("app.views.AspectsList", function(){ }); it('should show all the aspects', function(){ - var aspect_selectors = this.view.$('.icons-check_yes_ok + a.selectable'); + var aspect_selectors = this.view.$('.entypo.check + a.selectable'); expect(aspect_selectors.length).toBe(3); expect(aspect_selectors[0].text).toMatch('Work'); expect(aspect_selectors[1].text).toMatch('Friends');