web_resource module

This commit is contained in:
JiangRu 2015-01-06 13:46:22 +08:00
parent c25a3d3e92
commit 8c75aab9b2
10 changed files with 34 additions and 13 deletions

View File

@ -15,6 +15,9 @@ class WebLink
field :create_user_id field :create_user_id
field :update_user_id field :update_user_id
field :rss2_id, type: String field :rss2_id, type: String
field :link_open, type: String
LINK_OPEN_TYPES = ["local", "new_window"]
scope :can_display, ->{where(is_hidden: false).order_by([:is_top,:desc],[:created_at,:desc])} scope :can_display, ->{where(is_hidden: false).order_by([:is_top,:desc],[:created_at,:desc])}

View File

@ -116,6 +116,14 @@
</div> </div>
</div> </div>
<!-- Out Link -->
<div class="control-group input-title">
<label class="control-label muted"><%= t('web_link.type') %></label>
<div class="controls">
<%= f.select :link_open, WebLink::LINK_OPEN_TYPES.map{|wl| [t("web_link.#{wl}"), wl]} %>
</div>
</div>
</div> </div>
<% end %> <% end %>

View File

@ -1,3 +1,8 @@
en: en:
web_resource: Web resource web_resource: Web resource
web_link: Web resource web_link: Web resource
web_link:
local: Open In Current page
new_window: Open In New window
type: Link Open Type

View File

@ -1,3 +1,8 @@
zh_tw: zh_tw:
web_resource: 網路資源 web_resource: 網路資源
web_link: 網路資源 web_link: 網路資源
web_link:
local: 當前視窗開啟
new_window: 新視窗開啟
type: 開啟方式

View File

@ -1,4 +0,0 @@
require "links/engine"
module Links
end

4
lib/web_resource.rb Normal file
View File

@ -0,0 +1,4 @@
require "web_resource/engine"
module WebResource
end

View File

@ -2,7 +2,7 @@ module WebResource
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
initializer "web_resource" do initializer "web_resource" do
OrbitApp.registration "WebResource", :type => "ModuleApp" do OrbitApp.registration "WebResource", :type => "ModuleApp" do
module_label "link" module_label "web_resource.web_resource"
base_url File.expand_path File.dirname(__FILE__) base_url File.expand_path File.dirname(__FILE__)
taggable "WebLink" taggable "WebLink"

View File

@ -1,3 +1,3 @@
module Links module WebResource
VERSION = "0.0.1" VERSION = "0.0.1"
end end

View File

@ -1,17 +1,17 @@
$:.push File.expand_path("../lib", __FILE__) $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version: # Maintain your gem's version:
require "links/version" require "web_resource/version"
# Describe your gem and declare its dependencies: # Describe your gem and declare its dependencies:
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = "links" s.name = "web_resource"
s.version = Links::VERSION s.version = WebResource::VERSION
s.authors = ["Ruling Digital"] s.authors = ["Ruling Digital"]
s.email = ["orbit@rulingcom.com"] s.email = ["orbit@rulingcom.com"]
s.homepage = "http://www.rulingcom.com" s.homepage = "http://www.rulingcom.com"
s.summary = "Create Web Resource of Links" s.summary = "Web Resource for orbit"
s.description = "Create a Web Resource of Links" s.description = "Web Resource for orbit"
s.license = "MIT" s.license = "MIT"
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]