[#369] add flashes
This commit is contained in:
parent
14bee24de9
commit
c542f0ec0c
|
@ -42,7 +42,7 @@ function setCookie (name, value, expires, path, domain, secure) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.alert button.close').click(function () {
|
$('.notify.alert button.close').click(function () {
|
||||||
var exdate=new Date();
|
var exdate=new Date();
|
||||||
exdate.setDate(exdate.getDate() + 365);
|
exdate.setDate(exdate.getDate() + 365);
|
||||||
var expires="expires="+exdate.toUTCString();
|
var expires="expires="+exdate.toUTCString();
|
||||||
|
@ -71,4 +71,9 @@ $(document).ready(function() {
|
||||||
form.attr('action', $(this).val());
|
form.attr('action', $(this).val());
|
||||||
form.submit();
|
form.submit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#create_fork').click(function () {
|
||||||
|
$(this).button('loading');
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -54,4 +54,8 @@ module ApplicationHelper
|
||||||
klass = "datetime_moment #{options[:class]}"
|
klass = "datetime_moment #{options[:class]}"
|
||||||
content_tag(tag, nil, class: klass, title: title, origin_datetime: date.to_i)
|
content_tag(tag, nil, class: klass, title: title, origin_datetime: date.to_i)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def alert_class(type)
|
||||||
|
"alert-#{type.to_s == 'error' ? 'danger' : type}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,8 +23,4 @@ class FlashNotify < ActiveRecord::Base
|
||||||
def should_show?(cookie_hash_id)
|
def should_show?(cookie_hash_id)
|
||||||
cookie_hash_id != hash_id && published
|
cookie_hash_id != hash_id && published
|
||||||
end
|
end
|
||||||
|
|
||||||
def alert_class
|
|
||||||
"alert-#{status == 'error' ? 'danger' : status}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
.flash
|
|
||||||
- flash.each do |type, message|
|
- flash.each do |type, message|
|
||||||
.message{class: type}= message
|
.alert.text-center{ class: alert_class(type) }
|
||||||
|
%button.close{ type: 'button', 'data-dismiss' => 'alert', 'aria-hidden' => true } ×
|
||||||
|
= message
|
||||||
|
|
|
@ -16,10 +16,13 @@
|
||||||
- if (flash_notify = FlashNotify.published.first) && flash_notify.should_show?(cookies[:flash_notify_hash])
|
- if (flash_notify = FlashNotify.published.first) && flash_notify.should_show?(cookies[:flash_notify_hash])
|
||||||
:javascript
|
:javascript
|
||||||
var FLASH_HASH_ID = "#{flash_notify.hash_id}";
|
var FLASH_HASH_ID = "#{flash_notify.hash_id}";
|
||||||
.alert.alert-dismissable.text-center{ class: flash_notify.alert_class }
|
.alert.alert-dismissable.text-center{ class: alert_class(flash_notify.status) }
|
||||||
%button.close{ type: 'button', 'data-dismiss' => 'alert', 'aria-hidden' => true } ×
|
%button.close{ type: 'button', 'data-dismiss' => 'alert', 'aria-hidden' => true } ×
|
||||||
= flash_notify.body(I18n.locale).html_safe
|
= flash_notify.body(I18n.locale).html_safe
|
||||||
|
|
||||||
|
= render 'layouts/noscript'
|
||||||
|
= render "layouts/flashes"
|
||||||
|
|
||||||
%article.container-fluid.offset20
|
%article.container-fluid.offset20
|
||||||
= yield
|
= yield
|
||||||
= render 'layouts/menu/new_bottom'
|
= render 'layouts/menu/new_bottom'
|
||||||
|
|
Loading…
Reference in New Issue