diff --git a/Gemfile.lock b/Gemfile.lock index 848598a..7c4157f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ PATH specs: gallery (0.0.1) mongoid (= 4.0.0.beta1) - rails (~> 4.1.0) + rails (~> 4.1.0.rc2) GEM remote: https://rubygems.org/ diff --git a/app/assets/javascripts/admin/galleries.js b/app/assets/javascripts/admin/galleries.js new file mode 100644 index 0000000..dee720f --- /dev/null +++ b/app/assets/javascripts/admin/galleries.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/assets/stylesheets/admin/galleries.css b/app/assets/stylesheets/admin/galleries.css new file mode 100644 index 0000000..afad32d --- /dev/null +++ b/app/assets/stylesheets/admin/galleries.css @@ -0,0 +1,4 @@ +/* + Place all the styles related to the matching controller here. + They will automatically be included in application.css. +*/ diff --git a/app/controllers/admin/galleries_controller.rb b/app/controllers/admin/galleries_controller.rb new file mode 100644 index 0000000..69eb5e0 --- /dev/null +++ b/app/controllers/admin/galleries_controller.rb @@ -0,0 +1,4 @@ +class Admin::GalleriesController < ApplicationController + def index + end +end diff --git a/app/helpers/admin/galleries_helper.rb b/app/helpers/admin/galleries_helper.rb new file mode 100644 index 0000000..63810a1 --- /dev/null +++ b/app/helpers/admin/galleries_helper.rb @@ -0,0 +1,2 @@ +module Admin::GalleriesHelper +end diff --git a/app/views/admin/galleries/index.html.erb b/app/views/admin/galleries/index.html.erb new file mode 100644 index 0000000..3d3570d --- /dev/null +++ b/app/views/admin/galleries/index.html.erb @@ -0,0 +1,2 @@ +
Find me in app/views/admin/galleries/index.html.erb
diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..a9e3998 --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,39 @@ +en: + + gallery: + add_album: Add Album + add_images: Add Images + all: All + new: New + album: Album + album_desc: Album Description + album_name: Album Name + album_not_found: Album Not Found + album_tag: Album Tag + back_to_albums: Back to Albums + back_to_photos: Back to Photos + cate_auth: Category Authorization + chinese: Chinese + cover: Cover + del_album: Delete Album + del_album?: Delete this album? + delete_selected: Delete Selected + english: English + frontend: + albums: Front-end albums + gallery: Gallery + categories: Category + new_category: New Category + no_description: No Decription + photo_tag: Photo Tag + pic_not_found: Picture Not Found + save: Save + save_changes: Save Changes + search_tags: Search Tags + select_category: Select Category + set_cover: Set as Cover + widget: + widget1: Widget1 + widget_option: + horizontal: Horizontal + vertical: Vertical \ No newline at end of file diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml new file mode 100644 index 0000000..4739fba --- /dev/null +++ b/config/locales/zh_tw.yml @@ -0,0 +1,37 @@ +zh_tw: + + gallery: + add_album: 新增相冊 + add_images: 新增影像 + album: 相冊 + album_desc: 相冊描述 + album_name: 相冊名稱 + album_not_found: 找不到相冊 + album_tag: 相冊標籤 + back_to_albums: 回到相冊 + back_to_photos: 回到相片 + cate_auth: 類別授權 + chinese: 中文 + cover: 封面 + del_album: 刪除相冊 + del_album?: 要刪除這本相簿嗎? + delete_selected: 刪除已選取項目 + english: 英文 + frontend: + albums: 相簿前台 + gallery: 相簿 + manage_categories: 管理類別 + new_category: 新增類別 + no_description: 沒有描述 + photo_tag: 相片標籤 + pic_not_found: 找不到圖片 + save: 儲存 + save_changes: 儲存變更 + search_tags: 搜尋標籤 + select_category: 選擇類別 + set_cover: 設定為封面 + widget: + widget1: Widget1 + widget_option: + horizontal: 水平 + vertical: 垂直 \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 1daf9a4..e8a4834 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,2 +1,10 @@ Rails.application.routes.draw do + + locales = Site.first.in_use_locales rescue I18n.available_locales + + scope "(:locale)", locale: Regexp.new(locales.join("|")) do + namespace :admin do + resources :galleries + end + end end diff --git a/gallery.gemspec b/gallery.gemspec index c3e0b21..284bec8 100644 --- a/gallery.gemspec +++ b/gallery.gemspec @@ -17,6 +17,6 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] s.test_files = Dir["test/**/*"] - s.add_dependency "rails", "~> 4.1.0" + s.add_dependency "rails", "~> 4.1.0.rc2" s.add_dependency "mongoid", "4.0.0.beta1" end diff --git a/lib/gallery/engine.rb b/lib/gallery/engine.rb index 332ae3f..defd750 100644 --- a/lib/gallery/engine.rb +++ b/lib/gallery/engine.rb @@ -1,4 +1,21 @@ module Gallery class Engine < ::Rails::Engine + initializer "gallery" do + OrbitApp.registration "Gallery", :type => "ModuleApp" do + module_label "gallery.gallery" + base_url File.expand_path File.dirname(__FILE__) + + categorizable + authorizable + + side_bar do + head_label_i18n 'gallery.gallery', icon_class: "icons-pictures" + available_for [:admin,:manager,:sub_manager] + active_for_controllers ({:private=>['gallery']}) + head_link_path "admin_galleries_path" + + end + end + end end end diff --git a/test/controllers/admin/galleries_controller_test.rb b/test/controllers/admin/galleries_controller_test.rb new file mode 100644 index 0000000..f7bc4c3 --- /dev/null +++ b/test/controllers/admin/galleries_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class Admin::GalleriesControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + end + +end diff --git a/test/helpers/admin/galleries_helper_test.rb b/test/helpers/admin/galleries_helper_test.rb new file mode 100644 index 0000000..e7d3901 --- /dev/null +++ b/test/helpers/admin/galleries_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class Admin::GalleriesHelperTest < ActionView::TestCase +end