updates
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -55,3 +55,5 @@ zh_tw:
|
|||
email_sentdate: 寄送時間
|
||||
newsletter_sent: "電子報已寄送!"
|
||||
newsletter_will_be_sent: "電子報會於%{time}寄送!"
|
||||
banner_images: Banner Images
|
||||
banner_image: Banner Image
|
|
@ -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'
|
||||
|
|
|
@ -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 |