updates
|
@ -5,7 +5,7 @@ def initialize
|
|||
super
|
||||
@app_title = "e_paper"
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@table_fields = [t('e_paper.criteria_title'),t('e_paper.date_span')]
|
||||
|
||||
|
@ -14,10 +14,10 @@ def initialize
|
|||
@filter_fields.delete(:categories)
|
||||
@criterias = PaperCriteria.order_by(sort)
|
||||
# .with_tags(filters("tags"))
|
||||
|
||||
|
||||
@criterias = search_data(@criterias,[:title]).page(params[:page]).per(10)
|
||||
#@url = "/" + I18n.locale.to_s + "/" +Page.where(:module => "e_paper").first.url + "?method=papers"
|
||||
render :partial => "index" if request.xhr?
|
||||
render :partial => "index" if request.xhr?
|
||||
end
|
||||
|
||||
def new
|
||||
|
@ -44,7 +44,7 @@ def initialize
|
|||
paper_criteria.destroy
|
||||
redirect_to admin_e_paper_criterias_path
|
||||
end
|
||||
|
||||
|
||||
def send_test_email
|
||||
paper_criteria = PaperCriteria.find(params[:id])
|
||||
page = Page.where(:module => "e_paper").first.url rescue ""
|
||||
|
@ -66,7 +66,7 @@ def initialize
|
|||
else
|
||||
msg = I18n.t('e_paper.newsletter_sent')
|
||||
end
|
||||
render :json => {"success" => true, "msg": msg}.to_json
|
||||
render :json => {"success" => true, "msg" => msg}.to_json
|
||||
else
|
||||
invalid_email_list = paper.invalid_emails rescue 'can not find paper'
|
||||
render :json => {"success" => false,"invalid_emails"=>invalid_email_list}.to_json
|
||||
|
@ -85,4 +85,4 @@ def initialize
|
|||
def paper_criteria_params
|
||||
params.require(:paper_criteria).permit!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
class Admin::EPaperImagesController < OrbitAdminController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = "e_paper"
|
||||
end
|
||||
|
||||
def index
|
||||
@table_fields = [t('e_paper.banner_image')]
|
||||
# @categories = @module_app.categories.enabled
|
||||
# @tags = @module_app.tags
|
||||
# @filter_fields = filter_fields(@categories, @tags)
|
||||
# @filter_fields.delete(:status)
|
||||
@images = EPaperImage.order_by(sort)
|
||||
|
||||
@images = search_data(@images,[:title]).page(params[:page]).per(10)
|
||||
|
||||
render :partial => "index" if request.xhr?
|
||||
end
|
||||
|
||||
def new
|
||||
@image = EPaperImage.new
|
||||
end
|
||||
|
||||
def create
|
||||
@image = EPaperImage.new(e_paper_image_params)
|
||||
@image.save
|
||||
redirect_to admin_e_paper_images_path
|
||||
end
|
||||
|
||||
def edit
|
||||
@image = EPaperImage.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
image = EPaperImage.find(params[:id])
|
||||
image.update_attributes(e_paper_image_params)
|
||||
image.save
|
||||
redirect_to admin_e_paper_images_path
|
||||
end
|
||||
|
||||
def destroy
|
||||
image = EPaperImage.find(params[:id])
|
||||
image.destroy
|
||||
redirect_to admin_e_paper_images_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def e_paper_image_params
|
||||
params.require(:e_paper_image).permit!
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
class EPaperImage
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
mount_uploader :image, ImageUploader
|
||||
end
|
|
@ -1,11 +1,11 @@
|
|||
class EPaperTopic
|
||||
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitModel::Status
|
||||
include OrbitCategory::Categorizable
|
||||
include OrbitTag::Taggable
|
||||
include Slug
|
||||
include Slug
|
||||
|
||||
field :title,as: :slug_title, localize: true
|
||||
field :period, type: DateTime
|
||||
|
@ -26,4 +26,4 @@ class EPaperTopic
|
|||
def criteria_title
|
||||
PaperCriteria.where(:start_date.lte => self.period.in_time_zone(Time.zone.utc_offset / 3600), :end_date.gte => self.period.in_time_zone(Time.zone.utc_offset / 3600)).first.title rescue ""
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class PaperCriteria
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include Slug
|
||||
include Slug
|
||||
|
||||
field :title,as: :slug_title, localize: true
|
||||
field :description, localize: true
|
||||
|
@ -17,6 +17,7 @@ class PaperCriteria
|
|||
field :invalid_emails, type: Array, :default => []
|
||||
field :send_failed_emails, type: Array, :default => []
|
||||
field :email_sentdate, :type => DateTime
|
||||
field :banner_image, type: BSON::ObjectId
|
||||
|
||||
mount_uploader :image, ImageUploader
|
||||
|
||||
|
@ -41,5 +42,5 @@ class PaperCriteria
|
|||
end
|
||||
_email_sentdate
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -114,26 +114,13 @@
|
|||
<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_criteria.image.file %>" data-provides="fileupload">
|
||||
<div class="fileupload-new thumbnail pull-left">
|
||||
<% if @paper_criteria.image.file %>
|
||||
<%= image_tag @paper_criteria.image %>
|
||||
<% else %>
|
||||
<img src="/assets/e_paper/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 class="fileupload fileupload-new clearfix">
|
||||
<% EPaperImage.all.each do |image| %>
|
||||
<div class="fileupload-new thumbnail pull-left">
|
||||
<%= f.radio_button :banner_image, image.id %>
|
||||
<%= image_tag image.image %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -187,8 +187,9 @@
|
|||
end
|
||||
|
||||
have_papaers = papers_data.present?
|
||||
if paper.image.present?
|
||||
img_src = siteurl + paper.image.url
|
||||
if paper.banner_image.present?
|
||||
img = EPaperImage.find(paper.banner_image)
|
||||
img_src = siteurl + img.image.url
|
||||
else
|
||||
img_src = nil
|
||||
end
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
<% 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" %>
|
||||
<% end %>
|
||||
<%#= f.error_messages %>
|
||||
<fieldset>
|
||||
<!-- Input Area -->
|
||||
<div class="input-area">
|
||||
|
||||
<!-- 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">
|
||||
<div class="tab-pane fade in active" 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 @image.image.file %>" data-provides="fileupload">
|
||||
<div class="fileupload-new thumbnail pull-left">
|
||||
<% if @image.image.file %>
|
||||
<%= image_tag @image.image %>
|
||||
<% else %>
|
||||
<img src="/assets/e_paper/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>
|
||||
|
||||
<!-- Form Actions -->
|
||||
<div class="form-actions">
|
||||
<input type="hidden" name="referer_url" value="<%= request.referer %>">
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).on('click', '.fileupload-remove', function(){
|
||||
if($(this).find(".delete_image").length != 0){
|
||||
$(this).parents('.image_group').remove();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</fieldset>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr class="sort-header">
|
||||
<% @table_fields.each do |f| %>
|
||||
<%= thead(f) %>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @images.each do |image| %>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="<%= image.image.url %>" style="width:250px;" />
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<% if can_edit_or_delete?(image) %>
|
||||
<li><a href="<%= edit_admin_e_paper_image_path(image.id) %>"><%= t(:edit) %></a></li>
|
||||
<li><a class="delete text-error" href="<%= admin_e_paper_image_path(image.id) %>" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%=
|
||||
content_tag :div, class: "bottomnav clearfix" do
|
||||
content_tag(:div, paginate(@images), class: "pagination pagination-centered") +
|
||||
content_tag(:div, link_to(t(:new_),new_admin_e_paper_image_path, :class=>"btn btn-primary"), class: "pull-right")
|
||||
end
|
||||
%>
|
|
@ -0,0 +1,7 @@
|
|||
<div id="new">
|
||||
<%= form_for @image, :url => {:action=>"update"}, :html => {:class => 'form-horizontal main-forms'} do |f| %>
|
||||
<fieldset>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
</div>
|
|
@ -0,0 +1,4 @@
|
|||
<%= render_filter @filter_fields, "index_table" %>
|
||||
<div id="index_table">
|
||||
<%= render 'index'%>
|
||||
</div>
|
|
@ -0,0 +1,7 @@
|
|||
<div id="new">
|
||||
<%= form_for @image, :url => {:action=>"create"}, :html => {:class => 'form-horizontal main-forms'} do |f| %>
|
||||
<fieldset>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
</div>
|
0
app/views/admin/e_paper_subscribers/batch_delete_subscribers.html.erb
Normal file → Executable file
|
@ -55,9 +55,8 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
<!-- Images Upload -->
|
||||
<div class="tab-pane fade" id="imageupload">
|
||||
|
||||
<!-- Images Upload -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:image) %></label>
|
||||
<div class="controls">
|
||||
|
|
|
@ -54,3 +54,5 @@ en:
|
|||
email_sentdate: Email Time
|
||||
newsletter_sent: "Newsletter sent."
|
||||
newsletter_will_be_sent: "Newsletter will be sent at %{time}."
|
||||
banner_images: Banner Images
|
||||
banner_image: Banner Image
|
||||
|
|
|
@ -54,4 +54,6 @@ zh_tw:
|
|||
language_to_send: 開放訂閱語系
|
||||
email_sentdate: 寄送時間
|
||||
newsletter_sent: "電子報已寄送!"
|
||||
newsletter_will_be_sent: "電子報會於%{time}寄送!"
|
||||
newsletter_will_be_sent: "電子報會於%{time}寄送!"
|
||||
banner_images: Banner Images
|
||||
banner_image: Banner Image
|
|
@ -18,7 +18,7 @@ Rails.application.routes.draw do
|
|||
end
|
||||
end
|
||||
locales = Site.first.in_use_locales rescue I18n.available_locales
|
||||
|
||||
|
||||
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||
namespace :admin do
|
||||
resources :e_paper_criterias do
|
||||
|
@ -29,6 +29,7 @@ Rails.application.routes.draw do
|
|||
get "get_invalid_emails"
|
||||
end
|
||||
end
|
||||
resources :e_paper_images
|
||||
get 'e_paper_subscribers/export_excel', to: 'e_paper_subscribers#export_excel'
|
||||
get 'e_paper_subscribers/download_excel_format', to: 'e_paper_subscribers#download_excel_format'
|
||||
post 'e_paper_subscribers/import_from_excel', to: 'e_paper_subscribers#import_from_excel'
|
||||
|
@ -37,7 +38,7 @@ Rails.application.routes.draw do
|
|||
post 'e_paper_subscribers/delete_subscribers', to: 'e_paper_subscribers#delete_subscribers'
|
||||
resources :e_paper_subscribers
|
||||
resources :e_papers do
|
||||
member do
|
||||
member do
|
||||
get :send_email_to_subscribers
|
||||
delete "delete_subscriber"
|
||||
get "send_test_email"
|
||||
|
@ -45,7 +46,7 @@ Rails.application.routes.draw do
|
|||
collection do
|
||||
get "instructions"
|
||||
get "subscribers"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ module EPaper
|
|||
:priority=>1,
|
||||
:active_for_action=>{'admin/e_papers'=>'index'},
|
||||
:available_for => 'users'
|
||||
context_link 'new_',
|
||||
context_link 'new_',
|
||||
:link_path=>"new_admin_e_paper_path" ,
|
||||
:priority=>2,
|
||||
:active_for_action=>{'admin/e_papers'=>'new'},
|
||||
|
@ -76,6 +76,11 @@ module EPaper
|
|||
:priority=>8,
|
||||
:active_for_action=>{'admin/e_paper'=>'instructions'},
|
||||
:available_for => 'users'
|
||||
context_link 'e_paper.banner_images',
|
||||
:link_path=>"admin_e_paper_images_path" ,
|
||||
:priority=>9,
|
||||
:active_for_action=>{'admin/e_paper_images'=>'index'},
|
||||
:available_for => 'managers'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |