This commit is contained in:
rulingcom 2024-11-15 18:20:00 +08:00
parent 4e7be83b86
commit 82c4b8b24b
118 changed files with 220 additions and 41 deletions

0
.gitignore vendored Normal file → Executable file
View File

0
Gemfile Normal file → Executable file
View File

0
MIT-LICENSE Normal file → Executable file
View File

0
README.rdoc Normal file → Executable file
View File

0
Rakefile Normal file → Executable file
View File

0
app/assets/images/e_paper/.keep Normal file → Executable file
View File

0
app/assets/javascripts/e_paper/application.js Normal file → Executable file
View File

0
app/assets/stylesheets/e_paper/application.css Normal file → Executable file
View File

2
app/controllers/admin/e_paper_criterias_controller.rb Normal file → Executable file
View File

@ -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

View File

@ -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

View File

0
app/controllers/admin/e_papers_controller.rb Normal file → Executable file
View File

0
app/controllers/e_papers_controller.rb Normal file → Executable file
View File

0
app/helpers/admin/epaper_helper.rb Normal file → Executable file
View File

0
app/helpers/admin/新文字文件.txt Normal file → Executable file
View File

View File

@ -0,0 +1,7 @@
class EPaperImage
include Mongoid::Document
include Mongoid::Timestamps
mount_uploader :image, ImageUploader
end

0
app/models/e_paper_subscriber.rb Normal file → Executable file
View File

0
app/models/e_paper_topic.rb Normal file → Executable file
View File

1
app/models/paper_criteria.rb Normal file → Executable file
View File

@ -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

23
app/views/admin/e_paper_criterias/_form.html.erb Normal file → Executable file
View File

@ -114,27 +114,14 @@
<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 fileupload-new clearfix">
<% EPaperImage.all.each do |image| %>
<div class="fileupload-new thumbnail pull-left">
<% if @paper_criteria.image.file %>
<%= image_tag @paper_criteria.image %>
<% else %>
<img src="/assets/e_paper/AAAAAA" />
<%= f.radio_button :banner_image, image.id %>
<%= image_tag image.image %>
</div>
<% 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>

0
app/views/admin/e_paper_criterias/_index.html.erb Normal file → Executable file
View File

0
app/views/admin/e_paper_criterias/edit.html.erb Normal file → Executable file
View File

5
app/views/admin/e_paper_criterias/emailer.html.erb Normal file → Executable file
View File

@ -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
app/views/admin/e_paper_criterias/index.html.erb Normal file → Executable file
View File

0
app/views/admin/e_paper_criterias/new.html.erb Normal file → Executable file
View File

View File

@ -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>

View File

@ -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
%>

View File

@ -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>

View File

@ -0,0 +1,4 @@
<%= render_filter @filter_fields, "index_table" %>
<div id="index_table">
<%= render 'index'%>
</div>

View File

@ -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/_index.html.erb Normal file → Executable file
View File

View File

View File

View File

View File

0
app/views/admin/e_paper_subscribers/index.html.erb Normal file → Executable file
View File

3
app/views/admin/e_papers/_form.html.erb Normal file → Executable file
View 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">

0
app/views/admin/e_papers/_index.html.erb Normal file → Executable file
View File

0
app/views/admin/e_papers/_subscriber_index.html.erb Normal file → Executable file
View File

0
app/views/admin/e_papers/edit.html.erb Normal file → Executable file
View File

0
app/views/admin/e_papers/index.html.erb Normal file → Executable file
View File

0
app/views/admin/e_papers/instructions.html.erb Normal file → Executable file
View File

0
app/views/admin/e_papers/new.html.erb Normal file → Executable file
View File

0
app/views/admin/e_papers/subscribers.html.erb Normal file → Executable file
View File

0
app/views/e_papers/custom_widget_data.html.erb Normal file → Executable file
View File

0
app/views/e_papers/index.html.erb Normal file → Executable file
View File

0
app/views/e_papers/papers.html.erb Normal file → Executable file
View File

0
app/views/e_papers/show.html.erb Normal file → Executable file
View File

0
app/views/e_papers/topics.html.erb Normal file → Executable file
View File

2
config/locales/en.yml Normal file → Executable file
View File

@ -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

2
config/locales/zh_tw.yml Normal file → Executable file
View File

@ -55,3 +55,5 @@ zh_tw:
email_sentdate: 寄送時間
newsletter_sent: "電子報已寄送!"
newsletter_will_be_sent: "電子報會於%{time}寄送!"
banner_images: Banner Images
banner_image: Banner Image

1
config/routes.rb Normal file → Executable file
View File

@ -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'

0
e_paper.gemspec Normal file → Executable file
View File

0
lib/e_paper.rb Normal file → Executable file
View File

5
lib/e_paper/engine.rb Normal file → Executable file
View File

@ -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

0
lib/e_paper/version.rb Normal file → Executable file
View File

0
lib/tasks/e_paper_tasks.rake Normal file → Executable file
View File

0
modules/e_paper/_category_wise_articles.html.erb Normal file → Executable file
View File

0
modules/e_paper/_criteria_list.html.erb Normal file → Executable file
View File

0
modules/e_paper/_latest_criteria.html.erb Normal file → Executable file
View File

0
modules/e_paper/_latest_slider_aside.html.erb Normal file → Executable file
View File

0
modules/e_paper/_latest_slider_full_screen.html.erb Normal file → Executable file
View File

0
modules/e_paper/_subscriber.html.erb Normal file → Executable file
View File

0
modules/e_paper/_widget.html.erb Normal file → Executable file
View File

0
modules/e_paper/epaper_index1.html.erb Normal file → Executable file
View File

0
modules/e_paper/epaper_index2.html.erb Normal file → Executable file
View File

0
modules/e_paper/epaper_index2_latest.html.erb Normal file → Executable file
View File

0
modules/e_paper/info.json Normal file → Executable file
View File

0
modules/e_paper/papers.html.erb Normal file → Executable file
View File

0
modules/e_paper/show.html.erb Normal file → Executable file
View File

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

0
modules/e_paper/thumbs/criteria_list_thumb.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

0
modules/e_paper/thumbs/latest_criteria_thumb.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

0
modules/e_paper/thumbs/latest_slider_aside_thumb.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

0
modules/e_paper/thumbs/subscriber_thumb.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

0
modules/e_paper/thumbs/thumb.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

0
modules/e_paper/topics.html.erb Normal file → Executable file
View File

0
test/dummy/README.rdoc Normal file → Executable file
View File

0
test/dummy/Rakefile Normal file → Executable file
View File

0
test/dummy/app/assets/images/.keep Normal file → Executable file
View File

0
test/dummy/app/assets/javascripts/application.js Normal file → Executable file
View File

0
test/dummy/app/assets/stylesheets/application.css Normal file → Executable file
View File

0
test/dummy/app/controllers/application_controller.rb Normal file → Executable file
View File

0
test/dummy/app/controllers/concerns/.keep Normal file → Executable file
View File

0
test/dummy/app/helpers/application_helper.rb Normal file → Executable file
View File

0
test/dummy/app/mailers/.keep Normal file → Executable file
View File

0
test/dummy/app/models/.keep Normal file → Executable file
View File

0
test/dummy/app/models/concerns/.keep Normal file → Executable file
View File

0
test/dummy/app/views/layouts/application.html.erb Normal file → Executable file
View File

0
test/dummy/config.ru Normal file → Executable file
View File

0
test/dummy/config/application.rb Normal file → Executable file
View File

0
test/dummy/config/boot.rb Normal file → Executable file
View File

0
test/dummy/config/database.yml Normal file → Executable file
View File

0
test/dummy/config/environment.rb Normal file → Executable file
View File

0
test/dummy/config/environments/development.rb Normal file → Executable file
View File

0
test/dummy/config/environments/production.rb Normal file → Executable file
View File

0
test/dummy/config/environments/test.rb Normal file → Executable file
View File

0
test/dummy/config/initializers/assets.rb Normal file → Executable file
View File

0
test/dummy/config/initializers/backtrace_silencers.rb Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More