Finishing Touches
This commit is contained in:
parent
71c856e330
commit
8e01a66cb5
11 changed files with 82 additions and 62 deletions
|
|
@ -27,16 +27,14 @@ app.views.AspectsDropdown = app.views.Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
// change class and text of the dropdown button
|
// change class and text of the dropdown button
|
||||||
_updateButton: function(inAspectClass) {
|
_updateButton: function() {
|
||||||
var button = this.$('.btn.dropdown-toggle'),
|
let button = this.$(".btn.dropdown-toggle"),
|
||||||
selectedAspects = this.$(".dropdown-menu > li.selected").length,
|
selectedAspects = this.$(".dropdown-menu > li.selected").length,
|
||||||
buttonText;
|
buttonText;
|
||||||
|
|
||||||
if (selectedAspects === 0) {
|
if (selectedAspects === 0) {
|
||||||
button.removeClass(inAspectClass).addClass('btn-default');
|
|
||||||
buttonText = Diaspora.I18n.t("aspect_dropdown.select_aspects");
|
buttonText = Diaspora.I18n.t("aspect_dropdown.select_aspects");
|
||||||
} else {
|
} else {
|
||||||
button.removeClass('btn-default').addClass(inAspectClass);
|
|
||||||
if (selectedAspects === 1) {
|
if (selectedAspects === 1) {
|
||||||
buttonText = this.$(".dropdown-menu > li.selected .text").first().text();
|
buttonText = this.$(".dropdown-menu > li.selected .text").first().text();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ app.views.PublisherAspectSelector = app.views.AspectsDropdown.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
this._updateSelectedAspectIds();
|
this._updateSelectedAspectIds();
|
||||||
this._updateButton('btn-default');
|
this._updateButton();
|
||||||
|
|
||||||
// update the globe or lock icon
|
// update the globe or lock icon
|
||||||
var icon = this.$("#visibility-icon");
|
var icon = this.$("#visibility-icon");
|
||||||
|
|
@ -48,7 +48,7 @@ app.views.PublisherAspectSelector = app.views.AspectsDropdown.extend({
|
||||||
updateAspectsSelector: function(ids){
|
updateAspectsSelector: function(ids){
|
||||||
this._selectAspects(ids);
|
this._selectAspects(ids);
|
||||||
this._updateSelectedAspectIds();
|
this._updateSelectedAspectIds();
|
||||||
this._updateButton('btn-default');
|
this._updateButton();
|
||||||
},
|
},
|
||||||
|
|
||||||
// take care of the form fields that will indicate the selected aspects
|
// take care of the form fields that will indicate the selected aspects
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ $(document).ready(function(){
|
||||||
new Diaspora.MarkdownEditor("#status_message_text");
|
new Diaspora.MarkdownEditor("#status_message_text");
|
||||||
|
|
||||||
$(".dropdown-menu > li").bind("tap click", function(evt) {
|
$(".dropdown-menu > li").bind("tap click", function(evt) {
|
||||||
var target = $(evt.target).closest("li");
|
let target = $(evt.target).closest("li");
|
||||||
|
|
||||||
// visually toggle the aspect selection
|
// visually toggle the aspect selection
|
||||||
if (target.is(".radio")) {
|
if (target.is(".radio")) {
|
||||||
|
|
@ -62,10 +62,10 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateSelectedAspectIds();
|
_updateSelectedAspectIds();
|
||||||
_updateButton("btn-default");
|
_updateButton();
|
||||||
|
|
||||||
// update the globe or lock icon
|
// update the globe or lock icon
|
||||||
var icon = $("#visibility-icon");
|
let icon = $("#visibility-icon");
|
||||||
if (target.find(".text").text().trim() === Diaspora.I18n.t("stream.public")) {
|
if (target.find(".text").text().trim() === Diaspora.I18n.t("stream.public")) {
|
||||||
icon.removeClass("entypo-lock");
|
icon.removeClass("entypo-lock");
|
||||||
icon.addClass("entypo-globe");
|
icon.addClass("entypo-globe");
|
||||||
|
|
@ -87,37 +87,35 @@ $(document).ready(function(){
|
||||||
|
|
||||||
// take care of the form fields that will indicate the selected aspects
|
// take care of the form fields that will indicate the selected aspects
|
||||||
function _updateSelectedAspectIds() {
|
function _updateSelectedAspectIds() {
|
||||||
var form = $("#new_status_message");
|
let form = $("#new_status_message");
|
||||||
|
|
||||||
// remove previous selection
|
// remove previous selection
|
||||||
form.find('input[name="aspect_ids[]"]').remove();
|
form.find('input[name="aspect_ids[]"]').remove();
|
||||||
|
|
||||||
// create fields for current selection
|
// create fields for current selection
|
||||||
form.find(".dropdown-menu > li.selected").each(function() {
|
form.find(".dropdown-menu > li.selected").each(function() {
|
||||||
var uid = _.uniqueId("aspect_ids_");
|
let uid = _.uniqueId("aspect_ids_");
|
||||||
var id = $(this).data("aspect_id");
|
let id = $(this).data("aspect_id");
|
||||||
form.append('<input id="' + uid + '" name="aspect_ids[]" type="hidden" value="' + id + '">');
|
form.append('<input id="' + uid + '" name="aspect_ids[]" type="hidden" value="' + id + '">');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// change class and text of the dropdown button
|
// change class and text of the dropdown button
|
||||||
function _updateButton(inAspectClass) {
|
function _updateButton() {
|
||||||
var button = $(".btn.dropdown-toggle"),
|
let button = $(".btn.dropdown-toggle"),
|
||||||
selectedAspects = $(".dropdown-menu > li.selected").length,
|
selectedAspects = $(".dropdown-menu > li.selected").length,
|
||||||
buttonText;
|
buttonText;
|
||||||
|
|
||||||
if (selectedAspects === 0) {
|
switch (selectedAspects) {
|
||||||
button.removeClass(inAspectClass).addClass("btn-default");
|
case 0:
|
||||||
buttonText = Diaspora.I18n.t("aspect_dropdown.select_aspects");
|
buttonText = Diaspora.I18n.t("aspect_dropdown.select_aspects");
|
||||||
} else {
|
break;
|
||||||
button.removeClass("btn-default").addClass(inAspectClass);
|
case 1:
|
||||||
if (selectedAspects === 1) {
|
buttonText = $(".dropdown-menu > li.selected .text").first().text();
|
||||||
buttonText = this.$(".dropdown-menu > li.selected .text").first().text();
|
break;
|
||||||
} else {
|
default:
|
||||||
buttonText = Diaspora.I18n.t("aspect_dropdown.toggle", {count: selectedAspects.toString()});
|
buttonText = Diaspora.I18n.t("aspect_dropdown.toggle", {count: selectedAspects.toString()});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
button.find(".text").text(buttonText);
|
button.find(".text").text(buttonText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -658,24 +658,18 @@ form#update_profile_form {
|
||||||
.submit_block { margin-bottom: 20px; }
|
.submit_block { margin-bottom: 20px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
select#user_language,
|
|
||||||
select#user_color_theme,
|
|
||||||
#user_auto_follow_back_aspect_id {
|
|
||||||
padding: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hero-unit-mobile {
|
.hero-unit-mobile {
|
||||||
padding: 10px;
|
|
||||||
font-size: 14px;
|
|
||||||
line-height: 18px;
|
|
||||||
color: inherit;
|
|
||||||
background-color: $background-grey;
|
background-color: $background-grey;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
color: inherit;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 18px;
|
||||||
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-mobile {
|
.search-mobile {
|
||||||
text-align: center;
|
|
||||||
padding-top: 30px;
|
padding-top: 30px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
input#q.search {
|
input#q.search {
|
||||||
|
|
@ -717,8 +711,9 @@ input#q.search {
|
||||||
top: 0;
|
top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#publisher_mobile {
|
#publisher-mobile {
|
||||||
float: right;
|
float: right;
|
||||||
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#file-upload-publisher {
|
#file-upload-publisher {
|
||||||
|
|
|
||||||
|
|
@ -57,3 +57,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-language,
|
||||||
|
.user-color-theme,
|
||||||
|
.aspect-id {
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,7 @@
|
||||||
-# Note: all_aspects is a global in the ApplicationController
|
-# Note: all_aspects is a global in the ApplicationController
|
||||||
:ruby
|
|
||||||
dropdown_css = {"data-toggle" => "dropdown"}
|
|
||||||
if current_user.getting_started?
|
|
||||||
dropdown_css[:title] = popover_with_close_html("2. #{t('shared.public_explain.control_your_audience')}")
|
|
||||||
dropdown_css["data-content"] = t("shared.public_explain.visibility_dropdown")
|
|
||||||
end
|
|
||||||
|
|
||||||
.btn-group.aspect-dropdown
|
.btn-group.aspect-dropdown
|
||||||
%button.btn.btn-default.dropdown-toggle{dropdown_css}
|
%button.btn.btn-default.dropdown-toggle{data: {toggle: "dropdown"}}
|
||||||
%i.entypo-lock.small#visibility-icon
|
|
||||||
%span.text
|
%span.text
|
||||||
= t("all_aspects")
|
= t("all_aspects")
|
||||||
%span.caret
|
%span.caret
|
||||||
|
|
|
||||||
|
|
@ -17,19 +17,18 @@
|
||||||
title: service.provider.titleize, class: "service_icon dim",
|
title: service.provider.titleize, class: "service_icon dim",
|
||||||
id: "#{service.provider}", maxchar: "#{service.class::MAX_CHARACTERS}"
|
id: "#{service.provider}", maxchar: "#{service.class::MAX_CHARACTERS}"
|
||||||
|
|
||||||
.btn-toolbar.pull-right
|
|
||||||
= render partial: "aspects/aspect_dropdown"
|
|
||||||
|
|
||||||
.clear
|
.clear
|
||||||
#publisher-textarea-wrapper
|
#publisher-textarea-wrapper
|
||||||
%ul#photodropzone
|
%ul#photodropzone
|
||||||
#fileInfo-publisher
|
#fileInfo-publisher
|
||||||
|
|
||||||
#file-upload-publisher{class: "btn btn-default"}
|
|
||||||
%i.entypo-camera.middle
|
|
||||||
#publisher_mobile
|
|
||||||
= submit_tag t("shared.publisher.share"),
|
|
||||||
class: "btn btn-primary",
|
|
||||||
id: "submit_new_message",
|
|
||||||
data: {"disable-with" => t("shared.publisher.posting")}
|
|
||||||
.clearfix
|
.clearfix
|
||||||
|
.btn-toolbar
|
||||||
|
.pull-left#file-upload-publisher
|
||||||
|
%i.entypo-camera.middle
|
||||||
|
.pull-right#publisher-mobile
|
||||||
|
= submit_tag t("shared.publisher.share"),
|
||||||
|
class: "btn btn-primary",
|
||||||
|
id: "submit_new_message",
|
||||||
|
data: {"disable-with" => t("shared.publisher.posting")}
|
||||||
|
.pull-right
|
||||||
|
= render partial: "aspects/aspect_dropdown"
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
%h3= t(".change_language")
|
%h3= t(".change_language")
|
||||||
= form_for "user", url: edit_user_path, html: {method: :put} do |f|
|
= form_for "user", url: edit_user_path, html: {method: :put} do |f|
|
||||||
.form-inline.clearfix
|
.form-inline.clearfix
|
||||||
= f.select :language, available_language_options, {}, class: "form-control form-group"
|
= f.select :language, available_language_options, {}, class: "form-control form-group user-language"
|
||||||
= f.submit t(".change_language"), class: "btn btn-primary pull-right"
|
= f.submit t(".change_language"), class: "btn btn-primary pull-right"
|
||||||
%hr
|
%hr
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
%h3= t(".change_color_theme")
|
%h3= t(".change_color_theme")
|
||||||
= form_for "user", url: edit_user_path, html: {method: :put} do |f|
|
= form_for "user", url: edit_user_path, html: {method: :put} do |f|
|
||||||
.form-inline.clearfix
|
.form-inline.clearfix
|
||||||
= f.select :color_theme, available_color_themes, {}, class: "form-control form-group"
|
= f.select :color_theme, available_color_themes, {}, class: "form-control form-group color-theme"
|
||||||
= f.submit t(".change_color_theme"), class: "btn btn-primary pull-right"
|
= f.submit t(".change_color_theme"), class: "btn btn-primary pull-right"
|
||||||
%hr
|
%hr
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@
|
||||||
= f.select :auto_follow_back_aspect_id,
|
= f.select :auto_follow_back_aspect_id,
|
||||||
aspect_options_for_select(current_user.aspects),
|
aspect_options_for_select(current_user.aspects),
|
||||||
{},
|
{},
|
||||||
class: "form-control"
|
class: "form-control aspect-id"
|
||||||
|
|
||||||
.small-horizontal-spacer
|
.small-horizontal-spacer
|
||||||
.clearfix= f.submit t(".change"), class: "btn btn-primary pull-right"
|
.clearfix= f.submit t(".change"), class: "btn btn-primary pull-right"
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ Feature: posting from the main page
|
||||||
And I go to the aspects page
|
And I go to the aspects page
|
||||||
Then I should not see "I am eating a yogurt"
|
Then I should not see "I am eating a yogurt"
|
||||||
|
|
||||||
Scenario: change post target aspects with the aspect_dropdown before posting
|
Scenario: change post target aspects with the aspect-dropdown before posting
|
||||||
When I expand the publisher
|
When I expand the publisher
|
||||||
And I press the aspect dropdown
|
And I press the aspect dropdown
|
||||||
And I toggle the aspect "PostingTo"
|
And I toggle the aspect "PostingTo"
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,29 @@ Feature: posting from the mobile main page
|
||||||
And I append "I am eating yogurt" to the publisher
|
And I append "I am eating yogurt" to the publisher
|
||||||
And I press the aspect dropdown
|
And I press the aspect dropdown
|
||||||
And I toggle the aspect "Unicorns"
|
And I toggle the aspect "Unicorns"
|
||||||
And I press the aspect dropdown
|
And I press the share button
|
||||||
And I press "Share"
|
|
||||||
When I go to the stream page
|
When I go to the stream page
|
||||||
Then I should see "I am eating yogurt"
|
Then I should see "I am eating yogurt"
|
||||||
When I confirm the alert after I click on selector "a.remove"
|
When I confirm the alert after I click on selector "a.remove"
|
||||||
Then I should not see "I am eating yogurt"
|
Then I should not see "I am eating yogurt"
|
||||||
|
|
||||||
|
Scenario: post in multiple aspects
|
||||||
|
Given I visit the mobile publisher page
|
||||||
|
And I append "I am selecting my friends" to the publisher
|
||||||
|
And I press the aspect dropdown
|
||||||
|
And I toggle the aspect "PostingTo"
|
||||||
|
And I toggle the aspect "Unicorns"
|
||||||
|
And I press the share button
|
||||||
|
|
||||||
|
When I visit the stream with aspect "PostingTo"
|
||||||
|
Then I should see "I am selecting my friends"
|
||||||
|
|
||||||
|
When I visit the stream with aspect "Unicorns"
|
||||||
|
Then I should see "I am selecting my friends"
|
||||||
|
|
||||||
|
When I visit the stream with aspect "NotPostingThingsHere"
|
||||||
|
Then I should not see "I am selecting my friends"
|
||||||
|
|
||||||
Scenario: post a photo without text
|
Scenario: post a photo without text
|
||||||
Given I visit the mobile publisher page
|
Given I visit the mobile publisher page
|
||||||
When I attach the file "spec/fixtures/button.png" to hidden "qqfile" within "#file-upload-publisher"
|
When I attach the file "spec/fixtures/button.png" to hidden "qqfile" within "#file-upload-publisher"
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,11 @@
|
||||||
|
|
||||||
module AspectCukeHelpers
|
module AspectCukeHelpers
|
||||||
def click_aspect_dropdown
|
def click_aspect_dropdown
|
||||||
find(".aspect-dropdown .dropdown-toggle").trigger "click"
|
find(".aspect-dropdown > .dropdown-toggle").click
|
||||||
|
end
|
||||||
|
|
||||||
|
def click_share_button
|
||||||
|
find("#submit_new_message").trigger "click"
|
||||||
end
|
end
|
||||||
|
|
||||||
def toggle_aspect(a_name)
|
def toggle_aspect(a_name)
|
||||||
|
|
@ -112,6 +116,17 @@ When /^I press the aspect dropdown$/ do
|
||||||
click_aspect_dropdown
|
click_aspect_dropdown
|
||||||
end
|
end
|
||||||
|
|
||||||
|
When /^I press the share button$/ do
|
||||||
|
# There were issues 'clicking' the share button on mobile
|
||||||
|
click_share_button
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^I visit the stream with aspect "([^"]*)"$/ do |aspect_name|
|
||||||
|
# In mobile view aspects are single anchors
|
||||||
|
a_id = @me.aspects.where(name: aspect_name).pick(:id)
|
||||||
|
visit("/aspects?a_ids[]=#{a_id}")
|
||||||
|
end
|
||||||
|
|
||||||
When /^(.*) in the aspect creation modal$/ do |action|
|
When /^(.*) in the aspect creation modal$/ do |action|
|
||||||
within("#newAspectModal") do
|
within("#newAspectModal") do
|
||||||
step action
|
step action
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue