[refs #576] Fix should_show? method and template offsets
This commit is contained in:
parent
931e7a22b4
commit
c0036a1bb5
|
@ -12,7 +12,6 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
$('#close-alert').click(function () {
|
||||
setCookie("flash_notify_id", FLASH_NOTIFY_ID, FLASH_EXPIRES_AT);
|
||||
setCookie("flash_notify_hash", FLASH_HASH_ID, FLASH_EXPIRES_AT);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@ class FlashNotify < ActiveRecord::Base
|
|||
read_attribute("body_#{language}")
|
||||
end
|
||||
|
||||
def should_show?(cookie_id, cookie_hash_id)
|
||||
!(cookie_id.to_i == id && cookie_hash_id == hash_id)
|
||||
def should_show?(cookie_hash_id)
|
||||
cookie_hash_id != hash_id && published
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
- if current_user || APP_CONFIG['anonymous_access']
|
||||
.flash_notify
|
||||
- flash_notify = FlashNotify.published.first
|
||||
- if flash_notify && flash_notify.should_show?(cookies[:flash_notify_id], cookies[:flash_notify_hash])
|
||||
- if flash_notify && flash_notify.should_show?(cookies[:flash_notify_hash])
|
||||
.alert{:class => "alert-#{flash_notify.status}"}
|
||||
= flash_notify.body current_user.language
|
||||
%a{:class=>"close", :'data-dismiss'=>"alert", :href=>"#", :id => 'close-alert'} ×
|
||||
|
||||
:javascript
|
||||
var FLASH_NOTIFY_ID = "#{flash_notify.id}";
|
||||
var FLASH_HASH_ID = "#{flash_notify.hash_id}";
|
||||
var FLASH_EXPIRES_AT = "#{Date.today + 1.year}";
|
||||
:javascript
|
||||
var FLASH_HASH_ID = "#{flash_notify.hash_id}";
|
||||
var FLASH_EXPIRES_AT = "#{Date.today + 1.year}";
|
||||
|
|
Loading…
Reference in New Issue