added few modifications
This commit is contained in:
parent
5ec89f067c
commit
aa3584f66a
|
@ -49,15 +49,20 @@ class EPapersController < ApplicationController
|
|||
def show
|
||||
params = OrbitHelper.params
|
||||
paper = Paper.find_by(:uid => params[:uid])
|
||||
|
||||
paper_thumb = !paper.image.nil? && !paper.image.url.nil? ? paper.image.thumb.url : "http://www.placehold.it/400x400/EFEFEF/AAAAAA"
|
||||
paper_full = !paper.image.nil? && !paper.image.url.nil? ? paper.image.url : "http://www.placehold.it/1000x1000/EFEFEF/AAAAAA"
|
||||
topics = paper.topics.collect do |topic|
|
||||
desc = ActionView::Base.full_sanitizer.sanitize(topic.content)
|
||||
timg = !topic.image.nil? && !topic.image.url.nil? ? topic.image.thumb.url : "http://www.placehold.it/400x400/EFEFEF/AAAAAA"
|
||||
fimg = !topic.image.nil? && !topic.image.url.nil? ? topic.image.url : "http://www.placehold.it/1000x1000/EFEFEF/AAAAAA"
|
||||
{
|
||||
"link_to_show" => OrbitHelper.url_to_show(topic.to_param) + "?method=showtopic",
|
||||
"episode" => topic.episode,
|
||||
"content" => topic.content,
|
||||
"description" => desc[0..100],
|
||||
"publish_date" => topic.created_at
|
||||
"publish_date" => topic.created_at,
|
||||
"image_thumb" => timg,
|
||||
"image_full" => fimg
|
||||
}
|
||||
end
|
||||
{
|
||||
|
@ -67,6 +72,8 @@ class EPapersController < ApplicationController
|
|||
"description" => paper.description,
|
||||
"category" => paper.category.title,
|
||||
"publish_date" => paper.created_at,
|
||||
"paper_thumb_image" => paper_thumb,
|
||||
"paper_full_image" => paper_full,
|
||||
"th_title" => t('e_paper.title'),
|
||||
"th_category" => t('category'),
|
||||
"th_period" => t('e_paper.period'),
|
||||
|
@ -111,11 +118,14 @@ class EPapersController < ApplicationController
|
|||
def showtopic
|
||||
params = OrbitHelper.params
|
||||
topic = Topic.where(:uid => params[:uid]).first
|
||||
|
||||
timg = !topic.image.nil? && !topic.image.url.nil? ? topic.image.thumb.url : "http://www.placehold.it/400x400/EFEFEF/AAAAAA"
|
||||
fimg = !topic.image.nil? && !topic.image.url.nil? ? topic.image.url : "http://www.placehold.it/1000x1000/EFEFEF/AAAAAA"
|
||||
{
|
||||
"episode" => topic.episode,
|
||||
"content" => topic.content,
|
||||
"publish_date" => topic.created_at
|
||||
"publish_date" => topic.created_at,
|
||||
"image_thumb" => timg,
|
||||
"image_full" => fimg
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ class Paper
|
|||
field :mailed, type: Boolean, default: false
|
||||
field :ready_to_send, type: Boolean, default: false
|
||||
|
||||
mount_uploader :image, ImageUploader
|
||||
|
||||
has_many :topics, :dependent => :destroy
|
||||
|
||||
|
|
|
@ -2,9 +2,6 @@ class Topic
|
|||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
include OrbitCategory::Categorizable
|
||||
include OrbitTag::Taggable
|
||||
include Slug
|
||||
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
||||
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
||||
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
||||
<%= javascript_include_tag "lib/modal-preview" %>
|
||||
<%= javascript_include_tag "lib/file-type" %>
|
||||
<% end %>
|
||||
<%#= f.error_messages %>
|
||||
<fieldset>
|
||||
|
@ -21,6 +19,9 @@
|
|||
<li class="active">
|
||||
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#imageupload" data-toggle="tab"><%= t(:image) %></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Module -->
|
||||
|
@ -38,8 +39,38 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
<div class="tab-pane fade" id="imageupload">
|
||||
|
||||
<!-- Images Upload -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:image) %></label>
|
||||
<div class="controls">
|
||||
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @paper.image.file %>" data-provides="fileupload">
|
||||
<div class="fileupload-new thumbnail pull-left">
|
||||
<% if @paper.image.file %>
|
||||
<%= image_tag @paper.image %>
|
||||
<% else %>
|
||||
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
||||
<span class="btn btn-file">
|
||||
<span class="fileupload-new"><%= t(:select_image) %></span>
|
||||
<span class="fileupload-exists"><%= t(:change) %></span>
|
||||
<%= f.file_field :image %>
|
||||
</span>
|
||||
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<label class="checkbox inline btn btn-danger fileupload-remove">
|
||||
<%= f.check_box :remove_image %><%= t(:remove) %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Language Tabs -->
|
||||
<div class="nav-name"><strong>Language</strong></div>
|
||||
<ul class="nav nav-pills language-nav">
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<%= paper.period rescue nil %>
|
||||
<%= paper.period.strftime("%Y-%m-%d") rescue "" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<%= topic.created_at %>
|
||||
<%= topic.created_at.strftime("%Y-%m-%d") %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
@ -1,8 +1,59 @@
|
|||
<% content_for :page_specific_css do %>
|
||||
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||
<%= stylesheet_link_tag "lib/fileupload" %>
|
||||
<%= stylesheet_link_tag "lib/main-list" %>
|
||||
<% end %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
||||
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
||||
<%= javascript_include_tag "lib/file-type" %>
|
||||
<% end %>
|
||||
<fieldset>
|
||||
<div class="input-area">
|
||||
<input type="hidden" name="topic[paper_id]" value="<%= @paper.id.to_s %>">
|
||||
<!-- Module Tabs -->
|
||||
<div class="nav-name"><strong><%= t(:module) %></strong></div>
|
||||
<ul class="nav nav-pills module-nav">
|
||||
<li class="active">
|
||||
<a href="#imageupload" data-toggle="tab"><%= t(:image) %></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Module -->
|
||||
<div class="tab-content module-area">
|
||||
|
||||
<!-- Basic Module -->
|
||||
<div class="tab-pane fade in active" id="imageupload">
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:image) %></label>
|
||||
<div class="controls">
|
||||
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @topic.image.file %>" data-provides="fileupload">
|
||||
<div class="fileupload-new thumbnail pull-left">
|
||||
<% if @topic.image.file %>
|
||||
<%= image_tag @topic.image %>
|
||||
<% else %>
|
||||
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
||||
<span class="btn btn-file">
|
||||
<span class="fileupload-new"><%= t(:select_image) %></span>
|
||||
<span class="fileupload-exists"><%= t(:change) %></span>
|
||||
<%= f.file_field :image %>
|
||||
</span>
|
||||
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<label class="checkbox inline btn btn-danger fileupload-remove">
|
||||
<%= f.check_box :remove_image %><%= t(:remove) %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Language Tabs -->
|
||||
<div class="nav-name"></div>
|
||||
<div class="nav-name"><strong>Language</strong></div>
|
||||
<ul class="nav nav-pills language-nav">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<li class="<%= 'active' if i == 0 %>">
|
||||
|
@ -48,5 +99,7 @@
|
|||
<!-- Form Actions -->
|
||||
<div class="form-actions">
|
||||
<input type="hidden" name="referer_url" value="<%= request.referer %>">
|
||||
<input type="hidden" name="topic[paper_id]" value="<%= @paper.id.to_s %>">
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
</div>
|
||||
</fieldset>
|
Loading…
Reference in New Issue