From c627429b927da54291c038c80159964d13299b70 Mon Sep 17 00:00:00 2001 From: manson Date: Thu, 1 May 2014 16:44:01 +0800 Subject: [PATCH] Update Announcement module --- Gemfile | 5 +- app/assets/javascripts/basic.js | 1 + .../stylesheets/basic/orbit_bar.css.erb | 4 +- .../admin/dashboards_controller.rb | 2 - app/controllers/orbit_admin_controller.rb | 2 + app/helpers/orbit_backend_helper.rb | 87 ++++++++++++++++++ app/models/ckeditor/asset.rb | 7 ++ app/models/ckeditor/attachment_file.rb | 7 ++ app/models/ckeditor/picture.rb | 7 ++ app/models/concerns/slug.rb | 2 + app/uploaders/asset_uploader.rb | 56 +++++++++++ .../ckeditor_attachment_file_uploader.rb | 36 ++++++++ app/uploaders/ckeditor_picture_uploader.rb | 47 ++++++++++ app/views/admin/default_index/_index.html.erb | 4 + app/views/admin/tags/_index.html.erb | 2 +- app/views/kaminari/_first_page.html.erb | 11 +++ app/views/kaminari/_first_page.mobile.erb | 11 +++ app/views/kaminari/_gap.html.erb | 8 ++ app/views/kaminari/_gap.mobile.erb | 8 ++ app/views/kaminari/_last_page.html.erb | 11 +++ app/views/kaminari/_last_page.mobile.erb | 11 +++ app/views/kaminari/_next_page.html.erb | 11 +++ app/views/kaminari/_next_page.mobile.erb | 11 +++ app/views/kaminari/_page.html.erb | 16 ++++ app/views/kaminari/_page.mobile.erb | 16 ++++ app/views/kaminari/_paginator.html.erb | 25 +++++ app/views/kaminari/_paginator.mobile.erb | 25 +++++ app/views/kaminari/_prev_page.html.erb | 11 +++ app/views/kaminari/_prev_page.mobile.erb | 11 +++ app/views/layouts/_delete_modal.html.erb | 13 +++ app/views/layouts/back_end.html.erb | 4 +- config/application.rb | 5 +- config/environment.rb | 4 +- config/initializers/ckeditor.rb | 34 +++++++ config/locales/en.yml | 26 +++++- config/routes.rb | 2 + lib/orbit_model/status.rb | 32 +++++++ .../thumb_Ruling_Digital-LOGO.jpg | Bin 0 -> 7532 bytes 38 files changed, 563 insertions(+), 12 deletions(-) create mode 100644 app/helpers/orbit_backend_helper.rb create mode 100644 app/models/ckeditor/asset.rb create mode 100644 app/models/ckeditor/attachment_file.rb create mode 100644 app/models/ckeditor/picture.rb create mode 100644 app/uploaders/asset_uploader.rb create mode 100644 app/uploaders/ckeditor_attachment_file_uploader.rb create mode 100644 app/uploaders/ckeditor_picture_uploader.rb create mode 100644 app/views/admin/default_index/_index.html.erb create mode 100644 app/views/kaminari/_first_page.html.erb create mode 100644 app/views/kaminari/_first_page.mobile.erb create mode 100644 app/views/kaminari/_gap.html.erb create mode 100644 app/views/kaminari/_gap.mobile.erb create mode 100644 app/views/kaminari/_last_page.html.erb create mode 100644 app/views/kaminari/_last_page.mobile.erb create mode 100644 app/views/kaminari/_next_page.html.erb create mode 100644 app/views/kaminari/_next_page.mobile.erb create mode 100644 app/views/kaminari/_page.html.erb create mode 100644 app/views/kaminari/_page.mobile.erb create mode 100644 app/views/kaminari/_paginator.html.erb create mode 100644 app/views/kaminari/_paginator.mobile.erb create mode 100644 app/views/kaminari/_prev_page.html.erb create mode 100644 app/views/kaminari/_prev_page.mobile.erb create mode 100644 app/views/layouts/_delete_modal.html.erb create mode 100644 config/initializers/ckeditor.rb create mode 100644 lib/orbit_model/status.rb create mode 100644 public/assets/bulletin_file/file/535f7fd06d616e3889220000/thumb_Ruling_Digital-LOGO.jpg diff --git a/Gemfile b/Gemfile index 815a625..f065aaa 100644 --- a/Gemfile +++ b/Gemfile @@ -22,7 +22,7 @@ gem 'active_model_serializers' #parser gem 'nokogiri' -gem 'ckeditor' + #database gem 'mongoid', github: "mongoid/mongoid" @@ -31,7 +31,10 @@ gem "mini_magick", github: 'minimagick/minimagick' gem 'carrierwave' gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid' gem 'mongoid-grid_fs', github: 'ahoward/mongoid-grid_fs' + +gem 'kaminari' gem "impressionist" +gem 'ckeditor' #built in modules eval(File.read(File.dirname(__FILE__) + '/built_in_extensions.rb')) diff --git a/app/assets/javascripts/basic.js b/app/assets/javascripts/basic.js index 0017ff5..3aa1a51 100755 --- a/app/assets/javascripts/basic.js +++ b/app/assets/javascripts/basic.js @@ -8,3 +8,4 @@ //= require basic/jquery.nanoscroller.js //= require basic/jquery.easing.1.3.js +//= require ckeditor/init \ No newline at end of file diff --git a/app/assets/stylesheets/basic/orbit_bar.css.erb b/app/assets/stylesheets/basic/orbit_bar.css.erb index 26b3752..51d828b 100644 --- a/app/assets/stylesheets/basic/orbit_bar.css.erb +++ b/app/assets/stylesheets/basic/orbit_bar.css.erb @@ -125,8 +125,8 @@ top: 14px; } #orbit-bar #search .icon-search { - left: 20px; - top: 12px; + left: 16px; + top: 16px; font-size: 1.2em; } #orbit-bar #search .search-clear { diff --git a/app/controllers/admin/dashboards_controller.rb b/app/controllers/admin/dashboards_controller.rb index 9fa0f23..01bddb3 100644 --- a/app/controllers/admin/dashboards_controller.rb +++ b/app/controllers/admin/dashboards_controller.rb @@ -1,6 +1,4 @@ class Admin::DashboardsController < OrbitAdminController - layout "back_end" - def index end end diff --git a/app/controllers/orbit_admin_controller.rb b/app/controllers/orbit_admin_controller.rb index c5b11a2..c542d98 100644 --- a/app/controllers/orbit_admin_controller.rb +++ b/app/controllers/orbit_admin_controller.rb @@ -2,6 +2,8 @@ class OrbitAdminController < ApplicationController include OrbitCoreLib::Authorize include OrbitCoreLib::PermissionUtility include Authorize + include OrbitBackendHelper + before_action :authenticate_user layout "back_end" end diff --git a/app/helpers/orbit_backend_helper.rb b/app/helpers/orbit_backend_helper.rb new file mode 100644 index 0000000..ba170ce --- /dev/null +++ b/app/helpers/orbit_backend_helper.rb @@ -0,0 +1,87 @@ +module OrbitBackendHelper + + def self.included(base) + ActionView::Helpers::FormBuilder.send(:include, Orbit::FormBuilder) + end + + def thead(field) + active = params[:sort].eql? field.to_s + order = active ? (["asc", "desc"]-[params[:order]]).first : "asc" + arrow = (order.eql? "desc") ? "" : "" + "#{t(field.to_sym)} #{active ? arrow : ""}".html_safe + end + + def datetime_picker(object_name, method, options = {}) + options[:icon_time] ||= 'icons-clock' + options[:icon_date] ||= 'icons-calendar' + options[:icon_clear] ||= 'icons-cross-3' + options[:input_class] ||= 'input-large' + options[:value] ||= options[:object].send(method) if options[:object] && options[:object][method] + case options[:picker_type] + when 'date' + content_tag :div, :id => options[:id], :class => options[:class] do + date_picker(object_name, method, options) + end + when 'time' + content_tag :div, :id => options[:id], :class => options[:class] do + time_picker(object_name, method, options) + end + when 'separated' + options[:label] ||= I18n.t('datetime_picker.separated.label') + content_tag :div, :id => options[:id], :class => "separated_picker #{options[:class]}" do + concat label_tag options[:label] unless options[:no_label] + concat hidden_field(object_name, method, :value => options[:value]) + concat separated_picker(object_name, method, options) + end + else + content_tag :div, :id => options[:id], :class => options[:class] do + default_picker(object_name, method, options) + end + end + end + + def default_picker(object_name, method, options) + custom = {} + custom[:format] = options[:format] || 'yyyy/MM/dd hh:mm' + custom[:value] = format_value(options[:value], custom[:format]) if options[:value] + custom[:picker_class] = 'default_picker' + custom[:label] = options[:label] || I18n.t('datetime_picker.default.label') + custom[:placeholder] = options[:placeholder] || I18n.t('datetime_picker.default.placeholder') + picker(object_name, method, options.merge(custom)) + end + + def picker(object_name, method, options) + content_tag :div, :class => "#{options[:picker_class]} input-append", :style => "#{(options[:picker_class].eql?('time_picker') && options[:value].blank? && options[:separated]) ? 'pointer-events:none' : nil}" do + concat label_tag options[:label] unless options[:no_label] + concat text_field object_name, method, :placeholder => options[:placeholder], :class => options[:input_class], 'data-format' => options[:format], :value => options[:value] + concat (content_tag :span, :class => 'add-on clearDate' do + content_tag :i, nil, :class => options[:icon_clear] + end) + concat (content_tag :span, :class => 'add-on iconbtn' do + content_tag :i, nil, 'data-time-icon' => options[:icon_time], 'data-date-icon' => options[:icon_date] + end) + end + end + + def format_value(value, format = 'yyyy-MM-dd hh:mm') + value.strftime(format.gsub('yyyy', '%Y').gsub('MM', '%m').gsub('dd', '%d').gsub('hh', '%H').gsub('mm', '%M')) rescue "" + end + + def add_attribute(partial, f, attribute) + new_object = f.object.send(attribute).build + fields = f.fields_for(attribute, new_object, :child_index => "new_#{attribute}") do |f| + render :partial => partial, :object => new_object, :locals => {:f => f} + end + end + + def is_filter_active?(field, value) + params[:filters][field].include?(value.to_s) ? "active" : "" rescue "" + end + +end + +module Orbit::FormBuilder + def datetime_picker(method, options = {}) + @template.datetime_picker(@object_name, method, objectify_options(options)) + end +end \ No newline at end of file diff --git a/app/models/ckeditor/asset.rb b/app/models/ckeditor/asset.rb new file mode 100644 index 0000000..74f193e --- /dev/null +++ b/app/models/ckeditor/asset.rb @@ -0,0 +1,7 @@ +class Ckeditor::Asset + include Ckeditor::Orm::Mongoid::AssetBase + + delegate :url, :current_path, :size, :content_type, :filename, :to => :data + + validates_presence_of :data +end diff --git a/app/models/ckeditor/attachment_file.rb b/app/models/ckeditor/attachment_file.rb new file mode 100644 index 0000000..43a3872 --- /dev/null +++ b/app/models/ckeditor/attachment_file.rb @@ -0,0 +1,7 @@ +class Ckeditor::AttachmentFile < Ckeditor::Asset + mount_uploader :data, CkeditorAttachmentFileUploader, :mount_on => :data_file_name + + def url_thumb + @url_thumb ||= Ckeditor::Utils.filethumb(filename) + end +end diff --git a/app/models/ckeditor/picture.rb b/app/models/ckeditor/picture.rb new file mode 100644 index 0000000..74f6da4 --- /dev/null +++ b/app/models/ckeditor/picture.rb @@ -0,0 +1,7 @@ +class Ckeditor::Picture < Ckeditor::Asset + mount_uploader :data, CkeditorPictureUploader, :mount_on => :data_file_name + + def url_content + url(:content) + end +end diff --git a/app/models/concerns/slug.rb b/app/models/concerns/slug.rb index ab361ee..367d07d 100644 --- a/app/models/concerns/slug.rb +++ b/app/models/concerns/slug.rb @@ -2,6 +2,8 @@ extend ActiveSupport::Concern included do + field :uid, type: String + index({ uid: 1}, { unique: true }) validates_uniqueness_of :uid diff --git a/app/uploaders/asset_uploader.rb b/app/uploaders/asset_uploader.rb new file mode 100644 index 0000000..54e0609 --- /dev/null +++ b/app/uploaders/asset_uploader.rb @@ -0,0 +1,56 @@ +# encoding: utf-8 +require 'carrierwave/processing/mime_types' + +class AssetUploader < CarrierWave::Uploader::Base + + include CarrierWave::MimeTypes + + process :set_content_type + + # Include RMagick or ImageScience support: + # include CarrierWave::RMagick + # include CarrierWave::ImageScience + + # Choose what kind of storage to use for this uploader: + # storage :file + # storage :s3 + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "assets/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process :scale => [200, 300] + # + # def scale(width, height) + # # do something + # end + + # Create different versions of your uploaded files: + # version :thumb do + # process :scale => [50, 50] + # end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + # def extension_white_list + # %w(jpg jpeg gif png) + # end + + # Override the filename of the uploaded files: + # def filename + # model.filename + # end + + def cache_dir + "#{Rails.root}/tmp/uploads" + end + +end diff --git a/app/uploaders/ckeditor_attachment_file_uploader.rb b/app/uploaders/ckeditor_attachment_file_uploader.rb new file mode 100644 index 0000000..f4041f4 --- /dev/null +++ b/app/uploaders/ckeditor_attachment_file_uploader.rb @@ -0,0 +1,36 @@ +# encoding: utf-8 +class CkeditorAttachmentFileUploader < CarrierWave::Uploader::Base + include Ckeditor::Backend::CarrierWave + + # Include RMagick or ImageScience support: + # include CarrierWave::RMagick + # include CarrierWave::MiniMagick + # include CarrierWave::ImageScience + + # Choose what kind of storage to use for this uploader: + storage :file + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "uploads/ckeditor/attachments/#{model.id}" + end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process :scale => [200, 300] + # + # def scale(width, height) + # # do something + # end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + def extension_white_list + Ckeditor.attachment_file_types + end +end diff --git a/app/uploaders/ckeditor_picture_uploader.rb b/app/uploaders/ckeditor_picture_uploader.rb new file mode 100644 index 0000000..46c8d7b --- /dev/null +++ b/app/uploaders/ckeditor_picture_uploader.rb @@ -0,0 +1,47 @@ +# encoding: utf-8 +class CkeditorPictureUploader < CarrierWave::Uploader::Base + include Ckeditor::Backend::CarrierWave + + # Include RMagick or ImageScience support: + # include CarrierWave::RMagick + include CarrierWave::MiniMagick + # include CarrierWave::ImageScience + + # Choose what kind of storage to use for this uploader: + storage :file + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "uploads/ckeditor/pictures/#{model.id}" + end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process :scale => [200, 300] + # + # def scale(width, height) + # # do something + # end + + process :read_dimensions + + # Create different versions of your uploaded files: + version :thumb do + process :resize_to_fill => [118, 100] + end + + version :content do + process :resize_to_limit => [800, 800] + end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + def extension_white_list + Ckeditor.image_file_types + end +end diff --git a/app/views/admin/default_index/_index.html.erb b/app/views/admin/default_index/_index.html.erb new file mode 100644 index 0000000..378ad36 --- /dev/null +++ b/app/views/admin/default_index/_index.html.erb @@ -0,0 +1,4 @@ +<% content_for :right_nav do %> +<% end %> + + diff --git a/app/views/admin/tags/_index.html.erb b/app/views/admin/tags/_index.html.erb index 8f73503..057ce16 100644 --- a/app/views/admin/tags/_index.html.erb +++ b/app/views/admin/tags/_index.html.erb @@ -3,7 +3,7 @@
- <%= link_to t(:delete), '#', id: "deleteTags", class: "btn btn-danger toggable hide", rel: '' %> + <%= link_to t(:delete_), '#', id: "deleteTags", class: "btn btn-danger toggable hide", rel: '' %> <%= link_to t(:merge), '#', id: "mergerTags", class: "btn btn-success toggable hide", rel: merge_admin_tags_path %> <%= link_to t(:add_to_default), add_to_default_admin_tags_path, id: "addDefault", class: "btn btn-info toggable hide", method: :post, remote: true %> <%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), '#', class: "btn btn-primary open-slide", data: {title: t('new.tag'), id: 'new'} %> diff --git a/app/views/kaminari/_first_page.html.erb b/app/views/kaminari/_first_page.html.erb new file mode 100644 index 0000000..4c1c33a --- /dev/null +++ b/app/views/kaminari/_first_page.html.erb @@ -0,0 +1,11 @@ +<%# Link to the "First" page + - available local variables + url: url to the first page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +
  • + <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %> +
  • diff --git a/app/views/kaminari/_first_page.mobile.erb b/app/views/kaminari/_first_page.mobile.erb new file mode 100644 index 0000000..d6509d9 --- /dev/null +++ b/app/views/kaminari/_first_page.mobile.erb @@ -0,0 +1,11 @@ +<%# Link to the "First" page + - available local variables + url: url to the first page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +
  • + <%= link_to_unless current_page.first?, "«", url, :remote => remote %> +
  • diff --git a/app/views/kaminari/_gap.html.erb b/app/views/kaminari/_gap.html.erb new file mode 100644 index 0000000..c680799 --- /dev/null +++ b/app/views/kaminari/_gap.html.erb @@ -0,0 +1,8 @@ +<%# Non-link tag that stands for skipped pages... + - available local variables + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + diff --git a/app/views/kaminari/_gap.mobile.erb b/app/views/kaminari/_gap.mobile.erb new file mode 100644 index 0000000..c680799 --- /dev/null +++ b/app/views/kaminari/_gap.mobile.erb @@ -0,0 +1,8 @@ +<%# Non-link tag that stands for skipped pages... + - available local variables + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + diff --git a/app/views/kaminari/_last_page.html.erb b/app/views/kaminari/_last_page.html.erb new file mode 100644 index 0000000..5b3277b --- /dev/null +++ b/app/views/kaminari/_last_page.html.erb @@ -0,0 +1,11 @@ +<%# Link to the "Last" page + - available local variables + url: url to the last page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +
  • + <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %> +
  • diff --git a/app/views/kaminari/_last_page.mobile.erb b/app/views/kaminari/_last_page.mobile.erb new file mode 100644 index 0000000..fab90b6 --- /dev/null +++ b/app/views/kaminari/_last_page.mobile.erb @@ -0,0 +1,11 @@ +<%# Link to the "Last" page + - available local variables + url: url to the last page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +
  • + <%= link_to_unless current_page.last?, "»", url, {:remote => remote} %> +
  • diff --git a/app/views/kaminari/_next_page.html.erb b/app/views/kaminari/_next_page.html.erb new file mode 100644 index 0000000..673ba77 --- /dev/null +++ b/app/views/kaminari/_next_page.html.erb @@ -0,0 +1,11 @@ +<%# Link to the "Next" page + - available local variables + url: url to the next page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + diff --git a/app/views/kaminari/_next_page.mobile.erb b/app/views/kaminari/_next_page.mobile.erb new file mode 100644 index 0000000..1af41ec --- /dev/null +++ b/app/views/kaminari/_next_page.mobile.erb @@ -0,0 +1,11 @@ +<%# Link to the "Next" page + - available local variables + url: url to the next page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + diff --git a/app/views/kaminari/_page.html.erb b/app/views/kaminari/_page.html.erb new file mode 100644 index 0000000..67cfaf2 --- /dev/null +++ b/app/views/kaminari/_page.html.erb @@ -0,0 +1,16 @@ +<%# Link showing page number + - available local variables + page: a page object for "this" page + url: url to this page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +
  • + <% if page.current? %> + <%= page %> + <% else %> + <%= link_to page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %> + <% end %> +
  • diff --git a/app/views/kaminari/_page.mobile.erb b/app/views/kaminari/_page.mobile.erb new file mode 100644 index 0000000..38f9533 --- /dev/null +++ b/app/views/kaminari/_page.mobile.erb @@ -0,0 +1,16 @@ +<%# Link showing page number + - available local variables + page: a page object for "this" page + url: url to this page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +
  • + <% if page.current? %> + <%= page %> + <% else %> + <%= link_to page, url, opts = {:remote => remote, :rel => page.next? ? '›' : page.prev? ? '‹' : nil} %> + <% end %> +
  • diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb new file mode 100644 index 0000000..8871496 --- /dev/null +++ b/app/views/kaminari/_paginator.html.erb @@ -0,0 +1,25 @@ +<%# The container tag + - available local variables + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote + paginator: the paginator that renders the pagination tags inside +-%> +<%= paginator.render do -%> + +<% end -%> diff --git a/app/views/kaminari/_paginator.mobile.erb b/app/views/kaminari/_paginator.mobile.erb new file mode 100644 index 0000000..8871496 --- /dev/null +++ b/app/views/kaminari/_paginator.mobile.erb @@ -0,0 +1,25 @@ +<%# The container tag + - available local variables + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote + paginator: the paginator that renders the pagination tags inside +-%> +<%= paginator.render do -%> + +<% end -%> diff --git a/app/views/kaminari/_prev_page.html.erb b/app/views/kaminari/_prev_page.html.erb new file mode 100644 index 0000000..0d1d2b2 --- /dev/null +++ b/app/views/kaminari/_prev_page.html.erb @@ -0,0 +1,11 @@ +<%# Link to the "Previous" page + - available local variables + url: url to the previous page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + diff --git a/app/views/kaminari/_prev_page.mobile.erb b/app/views/kaminari/_prev_page.mobile.erb new file mode 100644 index 0000000..d39b761 --- /dev/null +++ b/app/views/kaminari/_prev_page.mobile.erb @@ -0,0 +1,11 @@ +<%# Link to the "Previous" page + - available local variables + url: url to the previous page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + diff --git a/app/views/layouts/_delete_modal.html.erb b/app/views/layouts/_delete_modal.html.erb new file mode 100644 index 0000000..ab49b81 --- /dev/null +++ b/app/views/layouts/_delete_modal.html.erb @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/app/views/layouts/back_end.html.erb b/app/views/layouts/back_end.html.erb index 0acc217..69fa461 100644 --- a/app/views/layouts/back_end.html.erb +++ b/app/views/layouts/back_end.html.erb @@ -5,15 +5,17 @@ <%= render 'shared/meta' %> <%= render 'shared/google_font' %> <%= stylesheet_link_tag "back_end", media: "all", "data-turbolinks-track" => true %> + <%= stylesheet_link_tag params[:controller] if Rails.application.assets.find_asset "#{params[:controller]}.css" %> <%= yield :page_specific_css %> <%= javascript_include_tag "back_end" %> <%= render 'shared/ie_html5_fix' %> + <%= javascript_include_tag params[:controller] if Rails.application.assets.find_asset "#{params[:controller]}.js" %> <%= yield :page_specific_javascript %> <%= csrf_meta_tags %> <%= render 'layouts/orbit_bar_backend' %> - <%= render 'shared/side_bar' %> + <%= render 'layouts/side_bar' %>
    diff --git a/config/application.rb b/config/application.rb index 327dddf..358eb82 100644 --- a/config/application.rb +++ b/config/application.rb @@ -36,6 +36,9 @@ module Orbit config.assets.paths << "#{path}/assets/fonts" end + # Ckeditor + config.autoload_paths += %W(#{config.root}/app/models/ckeditor) + # tell the I18n library where to find your translations I18n.load_path += Dir[Rails.root.join('lib', 'locale', '*.{rb,yml}')] @@ -47,7 +50,7 @@ module Orbit # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' + config.time_zone = 'Asia/Taipei' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] diff --git a/config/environment.rb b/config/environment.rb index fcb2a11..40bba31 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -6,7 +6,7 @@ Orbit::Application.initialize! if Site.count == 0 site = Site.new - site.title = "Orbit" + site.title_translations = {:en=>"Orbit",:zh_tw=>"Orbit"} site.valid_locales = [:en, :zh_tw] site.in_use_locales = site.valid_locales site.save @@ -15,7 +15,7 @@ end if Page.count == 0 home = Page.new home.name_translations = {:en=>"home",:zh_tw=>"首頁"} - home.url = "" + home.url = "/" home.save end diff --git a/config/initializers/ckeditor.rb b/config/initializers/ckeditor.rb new file mode 100644 index 0000000..f7ecb0e --- /dev/null +++ b/config/initializers/ckeditor.rb @@ -0,0 +1,34 @@ +# Use this hook to configure ckeditor +Ckeditor.setup do |config| + # ==> ORM configuration + # Load and configure the ORM. Supports :active_record (default), :mongo_mapper and + # :mongoid (bson_ext recommended) by default. Other ORMs may be + # available as additional gems. + require "ckeditor/orm/mongoid" + + # Allowed image file types for upload. + # Set to nil or [] (empty array) for all file types + # By default: %w(jpg jpeg png gif tiff) + # config.image_file_types = ["jpg", "jpeg", "png", "gif", "tiff"] + + # Allowed attachment file types for upload. + # Set to nil or [] (empty array) for all file types + # By default: %w(doc docx xls odt ods pdf rar zip tar tar.gz swf) + # config.attachment_file_types = ["doc", "docx", "xls", "odt", "ods", "pdf", "rar", "zip", "tar", "swf"] + + # Setup authorization to be run as a before filter + # By default: there is no authorization. + # config.authorize_with :cancan + + # Asset model classes + # config.picture_model { Ckeditor::Picture } + # config.attachment_file_model { Ckeditor::AttachmentFile } + + # Paginate assets + # By default: 24 + # config.default_per_page = 24 + + # Customize ckeditor assets path + # By default: nil + # config.asset_path = "http://www.example.com/assets/ckeditor/" +end diff --git a/config/locales/en.yml b/config/locales/en.yml index 166e1ca..b20771e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -20,10 +20,10 @@ # available at http://guides.rubyonrails.org/i18n.html. en: + alternative: Alternative en: English zh_tw: Chinese - _locale: English - + _locale: English access: denied: ajax_401_error: "User session has been expired,please login again." @@ -443,6 +443,7 @@ en: app_page_noname: module_app_noname: save_and_close: Save and close + more: "More" search: domains: Google Search Domains not_found: "NOT FOUND" @@ -659,3 +660,24 @@ en: visitors_this_year: This year's visitors visitors_today: Today's visitors yes_: "Yes" + dots: ●●●●●● + register: Register + registered: Registered + url: URL + url_alt: Alternative text + + module_name: + tag: Tag + + datetime_picker: + date: + label: Date + placeholder: "YYYY/MM/DD" + default: + label: Date and time + placeholder: "YYYY/MM/DD HH:MM" + separated: + label: Date and time + time: + label: Time + placeholder: "HH:MM" diff --git a/config/routes.rb b/config/routes.rb index 6de494a..38dca52 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,7 @@ Orbit::Application.routes.draw do + mount Ckeditor::Engine => '/ckeditor' + resources :sessions get "logout", to: "sessions#destroy", as: "logout" diff --git a/lib/orbit_model/status.rb b/lib/orbit_model/status.rb new file mode 100644 index 0000000..5b5a0f4 --- /dev/null +++ b/lib/orbit_model/status.rb @@ -0,0 +1,32 @@ +module OrbitModel + module Status + + def self.included(base) + base.field :is_top, :type => Boolean, :default => false + base.field :is_hot, :type => Boolean, :default => false + base.field :is_hidden, :type => Boolean, :default => false + + def is_top? + self.is_top + end + + def is_hot? + self.is_hot + end + + def is_hidden? + self.is_hidden + end + + def status_for_table + status = "" + status << "#{I18n.t(:top)} " if self.is_top + status << "#{I18n.t(:hot)} " if self.is_hot + status << "#{I18n.t(:hidden)}"if self.is_hidden + status.html_safe + end + end + + end + +end diff --git a/public/assets/bulletin_file/file/535f7fd06d616e3889220000/thumb_Ruling_Digital-LOGO.jpg b/public/assets/bulletin_file/file/535f7fd06d616e3889220000/thumb_Ruling_Digital-LOGO.jpg new file mode 100644 index 0000000000000000000000000000000000000000..56b5f49aecdbc9caed38c0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