116 lines
3.4 KiB
Plaintext
116 lines
3.4 KiB
Plaintext
<style type="text/css">
|
|
.margin_right_1em{
|
|
margin-right: 1em;
|
|
}
|
|
li{
|
|
list-style: none;
|
|
}
|
|
a{
|
|
cursor: pointer;
|
|
}
|
|
</style>
|
|
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
|
|
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
|
|
<div>
|
|
<h3><%= t('feed.all_feeds_announcments') %></h3>
|
|
</div>
|
|
<%= render_filter @filter_fields, "index_table" %>
|
|
|
|
</div>
|
|
<div class="accordion channel-accordion" id="index_table">
|
|
<%= render 'announcements' %>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$(document).on('page.ready',function(){
|
|
<% if I18n.locale.to_s == 'zh_tw' %>
|
|
var off_top_text = '<%= "#{t('disable')}#{t('is_top')}" %>'
|
|
var off_hot_text = '<%= "#{t('disable')}#{t('is_hot')}" %>'
|
|
<% else %>
|
|
var off_top_text = '<%= "#{t('disable')} #{t('is_top')}" %>'
|
|
var off_hot_text = '<%= "#{t('disable')} #{t('is_hot')}" %>'
|
|
<% end %>
|
|
$('.is_top').bootstrapToggle({
|
|
on: '<%= t('is_top') %>',
|
|
off: off_top_text,
|
|
size: 'mini',
|
|
onstyle: 'danger',
|
|
width: '4em',
|
|
height: '2em',
|
|
style: 'margin_right_1em'
|
|
});
|
|
$('.is_hot').bootstrapToggle({
|
|
on: '<%= t('is_hot') %>',
|
|
off: off_hot_text,
|
|
size: 'mini',
|
|
width: '4em',
|
|
height: '2em',
|
|
onstyle: 'warning'
|
|
});
|
|
})
|
|
function process_annc(ele){
|
|
var parent_tr = $(ele).parents('tr').eq(-1)
|
|
var process_
|
|
if ($(ele).attr('class').match(/is_top|is_hot/) != null){
|
|
process_ = $(ele).hasClass('is_top') ? 'is_top' : 'is_hot'
|
|
if ($(ele).prop('checked')){
|
|
process_ += ':enable'
|
|
}
|
|
else{
|
|
process_ += ':disable'
|
|
}
|
|
}else{
|
|
process_ = $(ele).hasClass('hidden_btn') ? 'hidden' : 'display'
|
|
}
|
|
$.ajax({
|
|
url : "/<%= I18n.locale.to_s %>/admin/feeds/process_annc",
|
|
data : {"feed_annc_id": parent_tr.data("annc-feed-id"),
|
|
"annc_uid": parent_tr.data("annc-uid"),
|
|
'process': process_},
|
|
dataType : "text",
|
|
type : "post",
|
|
error : function(data){
|
|
alert('something went wrong')
|
|
},
|
|
success: function(){
|
|
if (process_=='hidden'){
|
|
$(ele).attr('class','btn-primary display_btn')
|
|
$(ele).text('<%= t('feed.display') %>')
|
|
}
|
|
else if (process_=='display'){
|
|
$(ele).attr('class','btn-info hidden_btn')
|
|
$(ele).text('<%= t('is_hidden') %>')
|
|
}
|
|
}
|
|
})
|
|
}
|
|
$('.annc_title').click(function(){
|
|
var parent_tr = $(this).parents('tr').eq(-1)
|
|
$.ajax({
|
|
url : "/<%= I18n.locale.to_s %>/admin/feeds/annc_content",
|
|
data : {"feed_annc_id": parent_tr.data("annc-feed-id"),
|
|
"annc_uid": parent_tr.data("annc-uid")},
|
|
dataType : "text",
|
|
type : "get",
|
|
error : function(data){
|
|
alert('something went wrong')
|
|
},
|
|
success: function(data){
|
|
$('.content_show_div').eq(-1).html(data)
|
|
$('.content_show_div').eq(-1).dialog('open')
|
|
}
|
|
})
|
|
})
|
|
$(document).ready(function(){
|
|
var window_width = window.innerWidth
|
|
var window_height = window.innerHeight
|
|
$(".content_show_div").eq(-1).dialog({
|
|
autoOpen: false,
|
|
show: "blind",
|
|
model: true,
|
|
hide: "explode",
|
|
width: window_width*0.85,
|
|
height: window_height*0.8
|
|
});
|
|
})
|
|
</script> |