Gallery with initialization

This commit is contained in:
Saurabh Bhatia 2014-05-01 15:06:48 +08:00
parent bdadc445b3
commit 3b7e9ac0b3
13 changed files with 130 additions and 2 deletions

View File

@ -3,7 +3,7 @@ PATH
specs: specs:
gallery (0.0.1) gallery (0.0.1)
mongoid (= 4.0.0.beta1) mongoid (= 4.0.0.beta1)
rails (~> 4.1.0) rails (~> 4.1.0.rc2)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/

View File

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

View File

@ -0,0 +1,4 @@
/*
Place all the styles related to the matching controller here.
They will automatically be included in application.css.
*/

View File

@ -0,0 +1,4 @@
class Admin::GalleriesController < ApplicationController
def index
end
end

View File

@ -0,0 +1,2 @@
module Admin::GalleriesHelper
end

View File

@ -0,0 +1,2 @@
<h1>Admin::Galleries#index</h1>
<p>Find me in app/views/admin/galleries/index.html.erb</p>

39
config/locales/en.yml Normal file
View File

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

37
config/locales/zh_tw.yml Normal file
View File

@ -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: 垂直

View File

@ -1,2 +1,10 @@
Rails.application.routes.draw do 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 end

View File

@ -17,6 +17,6 @@ Gem::Specification.new do |s|
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"] 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" s.add_dependency "mongoid", "4.0.0.beta1"
end end

View File

@ -1,4 +1,21 @@
module Gallery module Gallery
class Engine < ::Rails::Engine 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
end end

View File

@ -0,0 +1,9 @@
require 'test_helper'
class Admin::GalleriesControllerTest < ActionController::TestCase
test "should get index" do
get :index
assert_response :success
end
end

View File

@ -0,0 +1,4 @@
require 'test_helper'
class Admin::GalleriesHelperTest < ActionView::TestCase
end