Drop ID
This commit is contained in:
parent
c62927bf00
commit
aefd7273d9
14 changed files with 34 additions and 40 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
#flash-body {
|
.flash-body {
|
||||||
left: 0;
|
left: 0;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
@ -7,9 +7,9 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
&.expose { @include animation(expose, 10s) }
|
&.expose { @include animation(expose, 10s) }
|
||||||
|
|
||||||
#flash-message {
|
.flash-message {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
box-shadow: $card-shadow;
|
box-shadow: 0 1px 4px rgba(0,0,0,0.8);
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
// flash message animations - header height is about 50px
|
// flash message animations - header height is about 50px
|
||||||
@keyframes expose {
|
@keyframes expose {
|
||||||
0% { top: -100px; }
|
0% { top: -100px; }
|
||||||
15% { top: 44px; }
|
12% { top: 50px; }
|
||||||
85% { top: 44px; }
|
88% { top: 50px; }
|
||||||
100% { top: -100px; }
|
100% { top: -100px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<div id="flash-body" class="expose">
|
<div class="flash-body expose">
|
||||||
<div id="flash-message" class="alert {{ alertLevel }}">
|
<div class="flash-message alert {{ alertLevel }}">
|
||||||
{{ message }}
|
{{ message }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -67,15 +67,9 @@ module LayoutHelper
|
||||||
|
|
||||||
def flash_messages
|
def flash_messages
|
||||||
flash.map do |name, msg|
|
flash.map do |name, msg|
|
||||||
klass = if name == "alert"
|
klass = flash_class name
|
||||||
"warning"
|
content_tag(:div, msg, class: "flash-body expose") do
|
||||||
elsif name == "error"
|
content_tag(:div, msg, class: "flash-message message alert alert-#{klass}")
|
||||||
"danger"
|
|
||||||
else
|
|
||||||
"success"
|
|
||||||
end
|
|
||||||
content_tag(:div, msg, id: "flash-body", class: "expose") do
|
|
||||||
content_tag(:div, msg, id: "flash-message", class: "message alert alert-#{klass}")
|
|
||||||
end
|
end
|
||||||
end.join(' ').html_safe
|
end.join(' ').html_safe
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,6 @@ module SessionsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def flash_class(name)
|
def flash_class(name)
|
||||||
{notice: "success", alert: "warning", error: "danger"}[name.to_sym]
|
{notice: "success", alert: "danger", error: "danger"}[name.to_sym]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
#main_stream.stream
|
#main_stream.stream
|
||||||
- flash.each do |name, msg|
|
- flash.each do |name, msg|
|
||||||
.expose#flash-container
|
.expose#flash-container
|
||||||
#flash-message{class: "message alert alert-#{flash_class name}"}
|
.flash-message{class: "message alert alert-#{flash_class name}"}
|
||||||
= msg
|
= msg
|
||||||
|
|
||||||
#login_form
|
#login_form
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ module ApplicationCukeHelpers
|
||||||
end
|
end
|
||||||
|
|
||||||
def flash_message_alert?
|
def flash_message_alert?
|
||||||
flash_message(selector: "warning").visible?
|
flash_message(selector: "danger").visible?
|
||||||
end
|
end
|
||||||
|
|
||||||
def flash_message_containing?(text)
|
def flash_message_containing?(text)
|
||||||
|
|
@ -18,7 +18,7 @@ module ApplicationCukeHelpers
|
||||||
def flash_message(opts={})
|
def flash_message(opts={})
|
||||||
selector = opts.delete(:selector)
|
selector = opts.delete(:selector)
|
||||||
selector &&= ".alert-#{selector}"
|
selector &&= ".alert-#{selector}"
|
||||||
find(selector || "#flash-message", {match: :first}.merge(opts))
|
find(selector || ".flash-message", {match: :first}.merge(opts))
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirm_form_validation_error(element)
|
def confirm_form_validation_error(element)
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ describe("app.views.AspectCreate", function() {
|
||||||
it("should display a flash message", function() {
|
it("should display a flash message", function() {
|
||||||
this.view.createAspect();
|
this.view.createAspect();
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith(this.response);
|
jasmine.Ajax.requests.mostRecent().respondWith(this.response);
|
||||||
expect(this.view.$("#flash-message")).toBeSuccessFlashMessage(
|
expect(this.view.$(".flash-message")).toBeSuccessFlashMessage(
|
||||||
Diaspora.I18n.t("aspects.create.success", {name: "new name"})
|
Diaspora.I18n.t("aspects.create.success", {name: "new name"})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -140,7 +140,7 @@ describe("app.views.AspectCreate", function() {
|
||||||
it("should display a flash message", function() {
|
it("should display a flash message", function() {
|
||||||
this.view.createAspect();
|
this.view.createAspect();
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith(this.response);
|
jasmine.Ajax.requests.mostRecent().respondWith(this.response);
|
||||||
expect(this.view.$("#flash-message")).toBeErrorFlashMessage(
|
expect(this.view.$(".flash-message")).toBeErrorFlashMessage(
|
||||||
Diaspora.I18n.t("aspects.create.failure")
|
Diaspora.I18n.t("aspects.create.failure")
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ describe("app.views.AspectMembership", function(){
|
||||||
this.newAspect.trigger('click');
|
this.newAspect.trigger('click');
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith(success);
|
jasmine.Ajax.requests.mostRecent().respondWith(success);
|
||||||
|
|
||||||
expect(this.view.$("#flash-message")).toBeSuccessFlashMessage(
|
expect(this.view.$(".flash-message")).toBeSuccessFlashMessage(
|
||||||
Diaspora.I18n.t("aspect_dropdown.started_sharing_with", {name: this.personName})
|
Diaspora.I18n.t("aspect_dropdown.started_sharing_with", {name: this.personName})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -58,7 +58,7 @@ describe("app.views.AspectMembership", function(){
|
||||||
this.newAspect.trigger('click');
|
this.newAspect.trigger('click');
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith(resp_fail);
|
jasmine.Ajax.requests.mostRecent().respondWith(resp_fail);
|
||||||
|
|
||||||
expect(this.view.$("#flash-message")).toBeErrorFlashMessage(
|
expect(this.view.$(".flash-message")).toBeErrorFlashMessage(
|
||||||
Diaspora.I18n.t("aspect_dropdown.error", {name: this.personName})
|
Diaspora.I18n.t("aspect_dropdown.error", {name: this.personName})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -82,7 +82,7 @@ describe("app.views.AspectMembership", function(){
|
||||||
this.oldAspect.trigger('click');
|
this.oldAspect.trigger('click');
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith(success);
|
jasmine.Ajax.requests.mostRecent().respondWith(success);
|
||||||
|
|
||||||
expect(this.view.$("#flash-message")).toBeSuccessFlashMessage(
|
expect(this.view.$(".flash-message")).toBeSuccessFlashMessage(
|
||||||
Diaspora.I18n.t("aspect_dropdown.stopped_sharing_with", {name: this.personName})
|
Diaspora.I18n.t("aspect_dropdown.stopped_sharing_with", {name: this.personName})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -102,7 +102,7 @@ describe("app.views.AspectMembership", function(){
|
||||||
this.oldAspect.trigger('click');
|
this.oldAspect.trigger('click');
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith(resp_fail);
|
jasmine.Ajax.requests.mostRecent().respondWith(resp_fail);
|
||||||
|
|
||||||
expect(this.view.$("#flash-message")).toBeErrorFlashMessage(
|
expect(this.view.$(".flash-message")).toBeErrorFlashMessage(
|
||||||
Diaspora.I18n.t("aspect_dropdown.error_remove", {name: this.personName})
|
Diaspora.I18n.t("aspect_dropdown.error_remove", {name: this.personName})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ describe("app.views.CommentStream", function(){
|
||||||
this.request.respondWith({status: 500});
|
this.request.respondWith({status: 500});
|
||||||
|
|
||||||
expect(this.view.$(".comment-content p").text()).not.toEqual("a new comment");
|
expect(this.view.$(".comment-content p").text()).not.toEqual("a new comment");
|
||||||
expect(this.view.$("#flash-message")).toBeErrorFlashMessage("posting failed!");
|
expect(this.view.$(".flash-message")).toBeErrorFlashMessage("posting failed!");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ describe("app.views.Contact", function(){
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
status: 400 // fail
|
status: 400 // fail
|
||||||
});
|
});
|
||||||
expect(this.view.$("#flash-message")).toBeErrorFlashMessage(
|
expect(this.view.$(".flash-message")).toBeErrorFlashMessage(
|
||||||
Diaspora.I18n.t( "contacts.error_add", {name: this.model.get("person").name} )
|
Diaspora.I18n.t( "contacts.error_add", {name: this.model.get("person").name} )
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -151,7 +151,7 @@ describe("app.views.Contact", function(){
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
status: 400 // fail
|
status: 400 // fail
|
||||||
});
|
});
|
||||||
expect(this.view.$("#flash-message")).toBeErrorFlashMessage(
|
expect(this.view.$(".flash-message")).toBeErrorFlashMessage(
|
||||||
Diaspora.I18n.t( "contacts.error_remove", {name: this.model.get("person").name})
|
Diaspora.I18n.t( "contacts.error_remove", {name: this.model.get("person").name})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -13,21 +13,21 @@ describe("app.views.FlashMessages", function(){
|
||||||
|
|
||||||
describe("render", function(){
|
describe("render", function(){
|
||||||
beforeEach(function(){
|
beforeEach(function(){
|
||||||
spec.content().html("<div id='flash-container'/>");
|
spec.content().html("<div class='flash-container'/>");
|
||||||
flashMessages = new app.views.FlashMessages({ el: $("#flash-container") });
|
flashMessages = new app.views.FlashMessages({ el: $(".flash-container") });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders a success message", function(){
|
it("renders a success message", function(){
|
||||||
flashMessages.success("success!");
|
flashMessages.success("success!");
|
||||||
expect(flashMessages.$("#flash-body")).toHaveClass("expose");
|
expect(flashMessages.$(".flash-body")).toHaveClass("expose");
|
||||||
expect($("#flash-message")).toHaveClass("alert-success");
|
expect($(".flash-message")).toHaveClass("alert-success");
|
||||||
expect($("#flash-message").text().trim()).toBe("success!");
|
expect($(".flash-message").text().trim()).toBe("success!");
|
||||||
});
|
});
|
||||||
it("renders an error message", function(){
|
it("renders an error message", function(){
|
||||||
flashMessages.error("error!");
|
flashMessages.error("error!");
|
||||||
expect(flashMessages.$("#flash-body")).toHaveClass("expose");
|
expect(flashMessages.$(".flash-body")).toHaveClass("expose");
|
||||||
expect($("#flash-message")).toHaveClass("alert-danger");
|
expect($(".flash-message")).toHaveClass("alert-danger");
|
||||||
expect($("#flash-message").text().trim()).toBe("error!");
|
expect($(".flash-message").text().trim()).toBe("error!");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -72,13 +72,13 @@ describe("app.views.PodEntry", function() {
|
||||||
it("renders a success flash message", function() {
|
it("renders a success flash message", function() {
|
||||||
this.view.recheckPod();
|
this.view.recheckPod();
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith(ajaxSuccess);
|
jasmine.Ajax.requests.mostRecent().respondWith(ajaxSuccess);
|
||||||
expect(this.view.$("#flash-message")).toBeSuccessFlashMessage();
|
expect(this.view.$(".flash-message")).toBeSuccessFlashMessage();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders an error flash message", function() {
|
it("renders an error flash message", function() {
|
||||||
this.view.recheckPod();
|
this.view.recheckPod();
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith(ajaxFail);
|
jasmine.Ajax.requests.mostRecent().respondWith(ajaxFail);
|
||||||
expect(this.view.$("#flash-message")).toBeErrorFlashMessage();
|
expect(this.view.$(".flash-message")).toBeErrorFlashMessage();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sets the appropriate CSS class", function() {
|
it("sets the appropriate CSS class", function() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue