fix e_paper error caused by topic which doesn't have category.Put template modules file into plugin.

This commit is contained in:
BOHUNG 2020-02-28 21:54:36 +08:00
parent d88174a8a8
commit 07b8de599d
21 changed files with 303 additions and 3 deletions

View File

@ -9,8 +9,8 @@ class EPapersController < ApplicationController
"description" => topic.description, "description" => topic.description,
"img_url" => topic.image.url, "img_url" => topic.image.url,
"img_url_thumb" => topic.image.thumb.url, "img_url_thumb" => topic.image.thumb.url,
"category" => topic.category.title, "category" => (topic.category.title rescue ""),
"category_title" => topic.category.title, "category_title" => (topic.category.title rescue ""),
"publish_date" => topic.period "publish_date" => topic.period
} }
end end
@ -19,7 +19,7 @@ class EPapersController < ApplicationController
"extras" => { "extras" => {
}, },
"total_pages" => topics.total_pages "total_pages" => (topics.count * 1.0 / OrbitHelper.page_data_count).ceil
} }
end end

View File

@ -0,0 +1,7 @@
<div data-list="topics" data-level="0">
<div>
<h4><a href="{{link_to_show}}">{{title}}</a></h4>
<div>{{description}}</div>
<img src="{{img_url_thumb}}" alt="{{title}}">
</div>
</div>

View File

@ -0,0 +1,20 @@
<table class="table table-hover writing-conferences-index criteria_list">
<thead>
<tr>
<th class="col-md-3 criteria-list-title">{{th_title}}</th>
<th class="col-md-3 criteria-list-description">{{th_description}}</th>
</tr>
</thead>
<tbody class="table" data-list="criterias" data-level="0">
<tr>
<td class="col-md-2">
<a class="index-content-title" href="{{link_to_show}}" target="_blank">{{title}}</a>
</td>
<td class="col-md-2">{{description}}</td>
</tr>
</tbody>
</table>
<a href="{{read_more}}">Read More</a>

View File

@ -0,0 +1,10 @@
<div class="latest-criteria" data-list="categories" data-level="0">
<h3><a href="{{category-link}}">{{category_title}}</a></h3>
<div data-list="topics" data-level="1">
<div class="latest-riteria-content">
<h4 class="latest-criteria-title"><a href="{{link_to_show}}">{{title}}</a></h4>
<div class="latest-criteria-description">{{description}}</div>
<img src="{{img_url_thumb}}" alt="{{title}}">
</div>
</div>
</div>

View File

@ -0,0 +1,14 @@
<div class="latest_slider" data-list="categories" data-level="0">
<div class="banner-Container owl-carousel owl-theme" data-list="topics" data-level="1">
<div class="item">
<h3>{{category_title}}</h3>
<div>
<a href="{{link_to_show}}">
<h4>{{title}}</h4>
<img src="{{img_url_thumb}}" alt="{{title}}">
<div>{{description}}</div>
</a>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,40 @@
<div class="latest-fullslider" data-list="categories" data-level="0">
<div class="banner-Container owl-carousel owl-theme" data-list="topics" data-level="1">
<div class="item">
<div class="row epaper-container">
<div class="left-fullslider col-lg-8 col-xs-12">
<a href="{{link_to_show}}">
<img src="{{img_url_thumb}}" alt="{{title}}">
</a>
</div>
<div class="right-fullslider col-lg-4 col-xs-12">
<div class="right-box">
<a href="{{link_to_show}}">
<h3>{{category_title}}</h3>
<h4>{{title}}</h4>
<div class="epaper-description">{{description}}</div>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- <div data-list="categories" data-level="0">
<h3><a href="{{category_link}}">{{category_title}}</a></h3>
<div data-list="topics" data-level="1">
<div>
<h4><a href="{{link_to_show}}">{{title}}</a></h4>
<div>{{description}}</div>
<img src="{{img_url_thumb}}" alt="{{title}}">
</div>
</div>
</div> -->

View File

@ -0,0 +1,39 @@
<div class="epaper-form" id="form_{{subpart-id}}" style="margin-top:20px;">
<form action="" class="form-horizontal">
<div class="form-group">
<div class="col-sm-10 subscribe-email">
<input type="text" name="email" placeholder="Email">
</div>
</div>
<div class="form-group ">
<div class="col-sm-10 subscribe-buttons">
<input type="submit" data-type="subscribe" class="btn btn-primary" value="Subscribe">
<input type="submit" data-type="unsubscribe" class="btn btn-danger" value="Unsubscribe">
</div>
</div>
</form>
</div>
<script type="text/javascript">
$("#form_{{subpart-id}} form input[type=submit]").on("click",function(){
var el = $(this),
val = $("#form_{{subpart-id}} input[name=email]").val(),
url = null;
if(el.data("type") == "subscribe"){
url = "/xhr/epaper/subscribeuser";
}else if(el.data("type") == "unsubscribe"){
url = "/xhr/epaper/unsubscribeuser"
}
if(val != ""){
$.ajax({
url : url,
data : {"email" : val, "language" : I18n.locale},
dataType : "json",
type : "get"
}).done(function(data){
alert(data.msg);
$("#form_{{subpart-id}} form")[0].reset();
})
}
return false;
})
</script>

View File

@ -0,0 +1,6 @@
<div class="epaper-widget">
<h3>{{widget-title}}</h3>
<ul data-list="papers" data-level="0">
<li><a href="{{link_to_show}}">{{title}}</a></li>
</ul>
</div>

View File

@ -0,0 +1,22 @@
<!-- <div class="latest_slider" data-list="categories" data-level="0">
<div class="category_title" data-list="topics" data-level="1">
<h3><a href="{{category_link}}">{{category_title}}</a></h3>
<div>
</div>
</div> -->
<div class="epaper-index1" data-list="topics" data-level="0">
<!-- <div class="banner-Container "> </div> -->
<div class="epaper-index1-container row">
<div class="epaper-leftimg col-lg-5 col-xs-12">
<img src="{{img_url_thumb}}" alt="{{title}}">
</div>
<div class="epaper-rightContent col-lg-7 col-xs-12" >
<h4><a href="{{link_to_show}}">{{title}}</a></h4>
<div class="epaper-description">{{description}}</div>
</div>
</div>
</div>

View File

@ -0,0 +1,22 @@
<!-- <div class="latest_slider" data-list="categories" data-level="0">
<div class="category_title" data-list="topics" data-level="1">
<h3><a href="{{category_link}}">{{category_title}}</a></h3>
<div>
</div>
</div> -->
<div class="epaper-index2" data-list="topics" data-level="0">
<!-- <div class="banner-Container "> </div> -->
<div class="epaper-index2-container row">
<h4><a href="{{link_to_show}}">{{title}}</a>
<a href="{{link_to_show}}"><span>{{category_title}}</span></a>
</h4>
<div class="epaper-leftimg col-lg-5 col-xs-12">
<img src="{{img_url_thumb}}" alt="{{title}}">
</div>
<div class="epaper-rightContent col-lg-7 col-xs-12" >
<div class="epaper-description"><a href="{{link_to_show}}">{{description}}</a></div>
</div>
</div>
</div>

66
modules/e_paper/info.json Normal file
View File

@ -0,0 +1,66 @@
{
"frontend": [
{
"filename" : "epaper_index1",
"name" : {
"zh_tw" : "1. 電子報列表",
"en" : "1. Thumbnail ( widget-title, question )"
},
"thumbnail" : "thumb.png"
},
{
"filename" : "epaper_index2",
"name" : {
"zh_tw" : "2. 電子報列表-title",
"en" : "1. Thumbnail ( widget-title, question )"
},
"thumbnail" : "thumb.png"
}
],
"widgets" : [
{
"filename" : "criteria_list",
"name" : {
"zh_tw" : "電子報目錄",
"en" : "Criteria List"
},
"thumbnail" : "criteria_list_thumb.png"
}, {
"filename": "category_wise_articles",
"name": {
"zh_tw": "電子報類別目錄",
"en": "Category wise articles"
},
"thumbnail": "category_wise_articles_thumb.png"
}, {
"filename": "latest_criteria",
"name": {
"zh_tw": "最新一期文章",
"en": "Latest articles"
},
"thumbnail": "latest_criteria_thumb.png"
}, {
"filename": "latest_slider_full_screen",
"name": {
"zh_tw": "最新一期文章輪撥(全幅)",
"en": "Latest articles slider full screen"
},
"thumbnail": "latest_slider_full_screen_thumb.png"
}, {
"filename": "latest_slider_aside",
"name": {
"zh_tw": "最新一期文章輪撥(邊欄)",
"en": "Latest articles slider aside"
},
"thumbnail": "latest_slider_aside_thumb.png"
},
{
"filename": "subscriber",
"name": {
"zh_tw": "訂閱",
"en": "Subscriber widget"
},
"thumbnail": "subscriber_thumb.png"
}
]
}

View File

@ -0,0 +1,21 @@
<table class="table table-hover writing-conferences-index">
<thead>
<tr>
<th class="col-md-2">{{th_title}}</th>
<th class="col-md-4">{{th_description}}</th>
</tr>
</thead>
<tbody class="table" data-list="criterias" data-level="0">
<tr>
<td class="col-md-2">
<a class="index-content-title" href="{{link_to_show}}" target="_blank">{{title}}</a>
</td>
<td class="col-md-2">{{description}}</td>
</tr>
</tbody>
</table>
{{pagination_goes_here}}

View File

@ -0,0 +1,16 @@
<div class="epaper-show">
{{member_name}}
<img src="{{member_pic}}">
{{member_autobiography}}
<h3>{{title}}</h3>
<div class="pull-left">
<span>{{category_title}}</span><br>
<span>{{criteria_title}}</span>
</div>
<div class="pull-right">
<span date-format="%Y-%m-%d">{{publish_date}}</span><br>
</div>
<div><img src="{{image_url}}" style="width:800px;"></div>
<div class="epaper-content">{{content}}</div>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,17 @@
<div class="epaper-index2" data-list="categories" data-level="0">
<!-- <div class="banner-Container "> </div> -->
<h3><a href="{{category_link}}">{{category_title}}</a></h3>
<div data-list="topics" data-level="1">
<div class="epaper-index2-container row">
<h4><a href="{{link_to_show}}">{{title}}</a>
<a href="{{link_to_show}}"><span>{{category_title}}</span></a>
</h4>
<div class="epaper-leftimg col-lg-5 col-xs-12">
<img src="{{img_url_thumb}}" alt="{{title}}">
</div>
<div class="epaper-rightContent col-lg-7 col-xs-12" >
<div class="epaper-description"><a href="{{link_to_show}}">{{description}}</a></div>
</div>
</div>
</div>
</div>