Merge pull request #5747 from svbergerem/use-entypo-for-leftnavbar

Use entypo for leftnavbar
This commit is contained in:
Jonne Haß 2015-03-09 20:01:58 +01:00
commit dd9c8d5632
20 changed files with 43 additions and 243 deletions

View file

@ -8,7 +8,7 @@ app.views.Aspect = app.views.Base.extend({
className: 'hoverable', className: 'hoverable',
events: { events: {
'click .icons-check_yes_ok+a': 'toggleAspect' 'click .entypo.check+a': 'toggleAspect'
}, },
toggleAspect: function(evt) { toggleAspect: function(evt) {

View file

@ -58,9 +58,9 @@ app.views.AspectsList = app.views.Base.extend({
this.collection.each(function(aspect) { this.collection.each(function(aspect) {
var element = this.$("li[data-aspect_id="+aspect.get('id')+"]"); var element = this.$("li[data-aspect_id="+aspect.get('id')+"]");
if (aspect.get('selected')) { if (aspect.get('selected')) {
element.find('.icons-check_yes_ok').addClass('selected'); element.find('.entypo.check').addClass('selected');
} else { } else {
element.find('.icons-check_yes_ok').removeClass('selected'); element.find('.entypo.check').removeClass('selected');
} }
}); });
}, },

View file

@ -31,13 +31,6 @@
} }
} }
.modify_aspect {
background: url("icons/pencil.png") no-repeat;
width: 12px;
height: 12px;
display: inline-block;
}
#new_aspect { #new_aspect {
.checkbox { .checkbox {
margin: 0px; margin: 0px;

View file

@ -41,15 +41,34 @@
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.action { #aspects_list, #tags_list {
width: 12px; .hoverable > .action {
height: 12px; visibility: hidden;
display: none;
float: right; float: right;
margin: 3px; margin: 0 3px;
} }
.hoverable:hover > .action { .hoverable:hover > .action {
display: block; visibility: visible;
}
}
#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;
}
} }
} }

View file

@ -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 { #tags_list {
.delete_tag_following {
background: url("icons/deletelabel.png") no-repeat;
}
/* ---- override app/stylesheets/vendor/autoSuggest.css ---- */ /* ---- override app/stylesheets/vendor/autoSuggest.css ---- */
.tag_input { .tag_input {
width: 100%; width: 100%;

View file

@ -1,7 +1,9 @@
<a href="/contacts?a_id={{id}}" class="action modify_aspect"></a> <a href="/contacts?a_id={{id}}" class="action modify_aspect">
<i class="entypo pencil"></i>
</a>
{{#if selected}} {{#if selected}}
<div class="icons-check_yes_ok selected"></div> <i class="entypo check selected"></i>
{{else}} {{else}}
<div class="icons-check_yes_ok"></div> <div class="entypo check"></div>
{{/if}} {{/if}}
<a href="/aspects/query" class="selectable" data-guid="{{id}}"> {{name}} </a> <a href="/aspects/query" class="selectable" data-guid="{{id}}"> {{name}} </a>

View file

@ -1,4 +1,4 @@
<a href="#" id="unfollow_{{name}}" rel="nofollow" class="action delete_tag_following" title="{{t "delete"}}"><a/> <a href="#" id="unfollow_{{name}}" rel="nofollow" class="action delete_tag_following" title="{{t "delete"}}">&times;<a/>
<a href="/tags/{{name}}" class="selectable"> <a href="/tags/{{name}}" class="selectable">
#{{ name }} #{{ name }}
</a> </a>

View file

@ -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

View file

@ -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)

View file

@ -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)
&#9660;
.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'

View file

@ -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)

View file

@ -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)

View file

@ -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);

View file

@ -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);

View file

@ -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)

View file

@ -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')}

View file

@ -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)

View file

@ -1,5 +1,8 @@
When(/^I unfollow the "(.*?)" tag$/) do |tag| When(/^I unfollow the "(.*?)" tag$/) do |tag|
page.execute_script("$('#unfollow_#{tag}').css('display', 'block')") within("#tags_list") do
find("#unfollow_#{tag}").click li = find('li', text: tag)
li.hover
li.find('.delete_tag_following').click
end
step 'I confirm the alert' step 'I confirm the alert'
end end

View file

@ -10,7 +10,7 @@ describe("app.views.Aspect", function(){
}); });
it('should show the aspect selected', 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(){ it('should show the name of the aspect', function(){

View file

@ -24,7 +24,7 @@ describe("app.views.AspectsList", function(){
}); });
it('should show all the aspects', 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.length).toBe(3);
expect(aspect_selectors[0].text).toMatch('Work'); expect(aspect_selectors[0].text).toMatch('Work');
expect(aspect_selectors[1].text).toMatch('Friends'); expect(aspect_selectors[1].text).toMatch('Friends');