Orbit WebResource Module
This commit is contained in:
commit
0a338399d3
|
@ -0,0 +1,6 @@
|
|||
.bundle/
|
||||
log/*.log
|
||||
pkg/
|
||||
test/dummy/db/*.sqlite3
|
||||
test/dummy/log/*.log
|
||||
test/dummy/tmp/
|
|
@ -0,0 +1,17 @@
|
|||
source "http://rubygems.org"
|
||||
|
||||
# Declare your gem's dependencies in web_resource.gemspec.
|
||||
# Bundler will treat runtime dependencies like base dependencies, and
|
||||
# development dependencies will be added by default to the :development group.
|
||||
gemspec
|
||||
|
||||
# jquery-rails is used by the dummy application
|
||||
gem "jquery-rails"
|
||||
|
||||
# Declare any dependencies that are still in development here instead of in
|
||||
# your gemspec. These might include edge Rails or gems from your path or
|
||||
# Git. Remember to move these dependencies to your gemspec before releasing
|
||||
# your gem to rubygems.org.
|
||||
|
||||
# To use debugger
|
||||
# gem 'ruby-debug19', :require => 'ruby-debug'
|
|
@ -0,0 +1,20 @@
|
|||
Copyright 2012 YOURNAME
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,3 @@
|
|||
= WebResource
|
||||
|
||||
This project rocks and uses MIT-LICENSE.
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env rake
|
||||
begin
|
||||
require 'bundler/setup'
|
||||
rescue LoadError
|
||||
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
||||
end
|
||||
begin
|
||||
require 'rdoc/task'
|
||||
rescue LoadError
|
||||
require 'rdoc/rdoc'
|
||||
require 'rake/rdoctask'
|
||||
RDoc::Task = Rake::RDocTask
|
||||
end
|
||||
|
||||
RDoc::Task.new(:rdoc) do |rdoc|
|
||||
rdoc.rdoc_dir = 'rdoc'
|
||||
rdoc.title = 'WebResource'
|
||||
rdoc.options << '--line-numbers'
|
||||
rdoc.rdoc_files.include('README.rdoc')
|
||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||
end
|
||||
|
||||
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
||||
load 'rails/tasks/engine.rake'
|
||||
|
||||
|
||||
Bundler::GemHelper.install_tasks
|
||||
|
||||
require 'rake/testtask'
|
||||
|
||||
Rake::TestTask.new(:test) do |t|
|
||||
t.libs << 'lib'
|
||||
t.libs << 'test'
|
||||
t.pattern = 'test/**/*_test.rb'
|
||||
t.verbose = false
|
||||
end
|
||||
|
||||
|
||||
task :default => :test
|
|
@ -0,0 +1,90 @@
|
|||
/* General style with default layout */
|
||||
.o-links {}
|
||||
.o-links .o-links-group {
|
||||
margin: 20px 0 0 0;
|
||||
padding: 20px 0 0 0;
|
||||
border-top: dashed 1px #EEE;
|
||||
}
|
||||
.o-links .o-links-group:first-child {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
.o-links .o-links-category {
|
||||
padding-bottom: 16px;
|
||||
border-bottom: solid 2px #CCC;
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
.o-links .o-links-content {}
|
||||
.o-links .o-links-content > ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.o-links .o-links-content > ul > li {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.o-links .o-links-list {}
|
||||
.o-links .o-links-list > ul {}
|
||||
.o-links .o-links-list > ul > li {
|
||||
padding: 10px 0 0 0;
|
||||
margin: 10px 0 0 0;
|
||||
border-top: solid 1px #eee;
|
||||
}
|
||||
.o-links .o-links-list > ul > li:first-child {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
}
|
||||
.o-links .o-links-title {}
|
||||
.o-links .o-links-link {
|
||||
font-weight: bold;
|
||||
}
|
||||
.o-links .o-links-link:hover {}
|
||||
.o-links .o-links-description {
|
||||
margin: 12px 0;
|
||||
font-size: 0.85em;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.o-links .o-links-hot {
|
||||
background-color: #D83131;
|
||||
border-radius: 3px;
|
||||
color: #FFFFFF;
|
||||
display: inline-block;
|
||||
font-size: 11px;
|
||||
font-weight: normal;
|
||||
line-height: 20px;
|
||||
margin: 0 0 0 8px;
|
||||
padding: 0 4px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* Tag list */
|
||||
.o-links .o-links-tag-list {
|
||||
margin: 0 0 16px 0;
|
||||
}
|
||||
.o-links .o-links-tag-list ul {
|
||||
margin: 0 -4px;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.o-links .o-links-tag-list ul:after {
|
||||
content: ".";
|
||||
clear: both;
|
||||
display: block;
|
||||
height: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
.o-links .o-links-tag-list li {
|
||||
float: left;
|
||||
margin: 0 4px 8px 4px;
|
||||
}
|
||||
.o-links .o-links-tag {
|
||||
display: block;
|
||||
border: solid 1px #ccc;
|
||||
padding: 4px;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
.o-links .o-links-tag:hover {}
|
|
@ -0,0 +1,23 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery
|
||||
before_filter :set_locale
|
||||
|
||||
# Set I18n.locale
|
||||
def set_locale
|
||||
# update session if passed
|
||||
session[:locale] = params[:locale] if params[:locale]
|
||||
|
||||
# set locale based on session or default
|
||||
begin
|
||||
# check if locale is valid for non site pages
|
||||
if !VALID_LOCALES.include?(session[:locale])
|
||||
I18n.locale = I18n.default_locale
|
||||
else
|
||||
I18n.locale = session[:locale]
|
||||
end
|
||||
rescue
|
||||
I18n.locale = I18n.default_locale
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,104 @@
|
|||
class Panel::WebResource::BackEnd::WebLinkCategorysController < OrbitBackendController
|
||||
before_filter :for_app_manager,:except => [:index]
|
||||
include OrbitControllerLib::DivisionForDisable
|
||||
|
||||
def index
|
||||
@web_link_categorys = get_categories_for_index("WebLinkCategory")
|
||||
@web_link_category = WebLinkCategory.new(:display => 'List')
|
||||
|
||||
@url = panel_web_resource_back_end_web_link_categorys_path
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# GET /web_links/1
|
||||
# GET /web_links/1.xml
|
||||
def show
|
||||
@web_link_category = WebLinkCategory.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# GET /web_links/new
|
||||
# GET /web_links/new.xml
|
||||
def new
|
||||
@web_link_category = WebLinkCategory.new(:display => 'List')
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# GET /web_links/1/edit
|
||||
def edit
|
||||
@web_link_category = WebLinkCategory.find(params[:id])
|
||||
|
||||
@url = panel_web_resource_back_end_web_link_category_path(@web_link_category)
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# POST /web_links
|
||||
# POST /web_links.xml
|
||||
def create
|
||||
@web_link_category = WebLinkCategory.new(params[:web_link_category])
|
||||
|
||||
respond_to do |format|
|
||||
if @web_link_category.save
|
||||
format.html { redirect_to(panel_web_resource_back_end_web_link_categorys_url, :notice => t('web_link.create_web_link_category_success')) }
|
||||
format.js
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render action: "new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /web_links/1
|
||||
# PUT /web_links/1.xml
|
||||
def update
|
||||
@web_link_category = WebLinkCategory.find(params[:id])
|
||||
|
||||
@url = panel_web_resource_back_end_web_link_category_path(@web_link_category)
|
||||
|
||||
respond_to do |format|
|
||||
if @web_link_category.update_attributes(params[:web_link_category])
|
||||
format.html { redirect_to(panel_web_resource_back_end_web_link_categorys_url, :notice => t('web_link.update_web_link_category_success')) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.js { render :action => "edit" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /web_links/1
|
||||
# DELETE /web_links/1.xml
|
||||
def destroy
|
||||
@web_link_category = WebLinkCategory.find(params[:id])
|
||||
@web_link_category.disable = @web_link_category.disable ? false : true
|
||||
|
||||
if @web_link_category.save!
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(panel_web_resource_back_end_web_link_categorys_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
end
|
||||
else
|
||||
flash[:error] = t("update.fail")
|
||||
format.html { render :action => "index" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -0,0 +1,188 @@
|
|||
class Panel::WebResource::BackEnd::WebLinksController < OrbitBackendController
|
||||
# include OrbitControllerLib::DivisionForDisable
|
||||
# before_filter :for_app_manager,:except => [:index,:show]
|
||||
|
||||
open_for_sub_manager :except => [:index]
|
||||
# before_filter :only => [ :new,:edit,:update,:create] do |controller|
|
||||
# controller.get_categorys('WebLinkCategory')
|
||||
# end
|
||||
|
||||
before_filter :only => [ :new, :create, :edit, :update ] do |controller|
|
||||
@categories = get_categories_for_form
|
||||
end
|
||||
|
||||
def index
|
||||
@tags = get_tags
|
||||
@categories = get_categories_for_index
|
||||
@statuses = get_statuses
|
||||
category_ids = @categories.collect{|t| t.id}
|
||||
|
||||
@web_links = get_sorted_and_filtered("web_link", :category_id.in => category_ids)
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.js { }
|
||||
format.xml { render :xml => @web_links }
|
||||
end
|
||||
end
|
||||
|
||||
# def index
|
||||
|
||||
# get_categorys("WebLinkCategory",params[:web_link_category_id])
|
||||
# @filter = params[:filter]
|
||||
# new_filter = params[:new_filter]
|
||||
|
||||
# if @filter && params[:clear]
|
||||
# @filter.delete(params[:type])
|
||||
# elsif @filter && new_filter
|
||||
# if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
|
||||
# @filter[new_filter[:type]].delete(new_filter[:id].to_s)
|
||||
# elsif @filter.has_key?(new_filter[:type])
|
||||
# @filter[new_filter[:type]] << new_filter[:id].to_s
|
||||
# else
|
||||
# @filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
|
||||
# end
|
||||
# elsif new_filter
|
||||
# @filter = {new_filter[:type] => [new_filter[:id].to_s]}
|
||||
# end
|
||||
# @web_link_categories = get_categories_for_index("WebLinkCategory")
|
||||
# @web_link_category_ids = @web_link_categories.collect{|t| t.id.to_s} + [nil]
|
||||
|
||||
# # @web_links = WebLink.search(params[:category_id])
|
||||
# #@web_links = (params[:sort] || @filter) ? get_sorted_and_filtered_web_links : WebLink.all.page(params[:page]).per(10)
|
||||
# @web_links = (params[:sort] || @filter) ? get_sorted_and_filtered("web_link",:web_link_category_id.in => @web_link_category_ids) : get_viewable("web_link",:web_link_category_id.in => @web_link_category_ids)
|
||||
|
||||
# @tags = get_tags
|
||||
|
||||
# respond_to do |format|
|
||||
# format.html # index.html.erb
|
||||
# format.xml { render :xml => @web_links }
|
||||
# format.js
|
||||
# end
|
||||
# end
|
||||
|
||||
# GET /web_links/1
|
||||
# GET /web_links/1.xml
|
||||
def show
|
||||
@web_link = WebLink.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @web_link }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /web_links/new
|
||||
# GET /web_links/new.xml
|
||||
def new
|
||||
if(session[:in_validate_object].blank?)
|
||||
@web_link = WebLink.new
|
||||
else
|
||||
@web_link = session[:in_validate_object]
|
||||
session[:in_validate_object] = {}
|
||||
end
|
||||
|
||||
@tags = get_tags
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @web_link }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /web_links/1/edit
|
||||
def edit
|
||||
@web_link = WebLink.find(params[:id])
|
||||
if !current_user.admin?
|
||||
redirect_to :action => :index
|
||||
else
|
||||
@tags = get_tags
|
||||
end
|
||||
end
|
||||
|
||||
# POST /web_links
|
||||
# POST /web_links.xml
|
||||
def create
|
||||
@web_link = WebLink.new(params[:web_link])
|
||||
@tags = get_tags
|
||||
@web_link.create_user_id = current_user.id
|
||||
@web_link.update_user_id = current_user.id
|
||||
|
||||
respond_to do |format|
|
||||
if @web_link.save
|
||||
format.html { redirect_to(panel_web_resource_back_end_web_links_url) }
|
||||
format.xml { render :xml => @web_link, :status => :created, :location => @web_link }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @web_link.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /web_links/1
|
||||
# PUT /web_links/1.xml
|
||||
def update
|
||||
@web_link = WebLink.find(params[:id])
|
||||
|
||||
@web_link.update_user_id = current_user.id
|
||||
|
||||
params[:web_link][:tag_ids] ||=[]
|
||||
|
||||
respond_to do |format|
|
||||
if @web_link.update_attributes(params[:web_link])
|
||||
format.html { redirect_to(panel_web_resource_back_end_web_links_url) }
|
||||
format.js { render 'toggle_enable' }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @web_link.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /web_links/1
|
||||
# DELETE /web_links/1.xml
|
||||
def destroy
|
||||
@web_link = WebLink.find(params[:id])
|
||||
@web_link.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(panel_web_resource_back_end_web_links_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def delete
|
||||
if params[:ids]
|
||||
web_links = WebLink.any_in(:_id => params[:ids]).destroy_all
|
||||
end
|
||||
redirect_to panel_web_resource_back_end_web_links_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
||||
# def get_index_categories(id = nil)
|
||||
# @bulletin_categorys = []
|
||||
# if(is_manager? || is_admin?)
|
||||
# @bulletin_categorys = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all)
|
||||
# elsif is_sub_manager?
|
||||
# @bulletin_categorys = BulletinCategory.all
|
||||
# end
|
||||
# @bulletin_categorys
|
||||
# end
|
||||
|
||||
|
||||
# def get_categorys(id = nil)
|
||||
# @web_link_categorys = []
|
||||
# if(is_manager? || is_admin?)
|
||||
# @web_link_categorys = (id ? WebLinkCategory.admin_manager_all.find(id).to_a : WebLinkCategory.admin_manager_all))
|
||||
# elsif is_sub_manager?
|
||||
# @web_link_categorys = WebLinkCategory.all.authed_for_user(current_user,'edit')
|
||||
# end
|
||||
# if @web_link_categorys.empty? && params[:action] != "index"
|
||||
# flash[:alert] = t("announcement.error.no_avilb_cate_for_posting")
|
||||
# redirect_to :action => :index
|
||||
# end
|
||||
# end
|
||||
|
||||
end
|
|
@ -0,0 +1,77 @@
|
|||
class Panel::WebResource::FrontEnd::WebLinksController < OrbitWidgetController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'web_resource'
|
||||
end
|
||||
|
||||
# GET /web_links
|
||||
# GET /web_links.xml
|
||||
|
||||
def index
|
||||
|
||||
@item = Page.find(params[:page_id])
|
||||
|
||||
@title = @item.title
|
||||
|
||||
if @item.frontend_data_count
|
||||
@page_num = @item.frontend_data_count
|
||||
else
|
||||
@page_num = 4
|
||||
end
|
||||
|
||||
date_now = Time.now
|
||||
|
||||
# @web_link_categorys = get_categories_for_index
|
||||
|
||||
if !params[:category_id].blank?
|
||||
@web_link_categorys = @module_app.categories.enabled.any_in(:_id => params[:category_id])
|
||||
else
|
||||
@web_link_categorys = @module_app.categories.enabled
|
||||
end
|
||||
|
||||
@web_link_datas = Array.new
|
||||
|
||||
@web_link_categorys.each do |wlcg|
|
||||
|
||||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||
@web_links = WebLink.all.can_display.where(:category_id.in => [wlcg.id], :tagged_ids.in => params[:tag_id]).desc( :is_top, :created_at )
|
||||
elsif !params[:category_id].blank?
|
||||
@web_links = WebLink.all.can_display.where(:category_id.in => [wlcg.id]).desc( :is_top, :created_at )
|
||||
elsif !params[:tag_id].blank?
|
||||
@web_links = WebLink.all.can_display.where(:category_id => wlcg.id, :tagged_ids.in => params[:tag_id]).desc( :is_top, :created_at )
|
||||
else
|
||||
@web_links = WebLink.all.can_display.where(:category_id => wlcg.id).desc( :is_top, :created_at )
|
||||
end
|
||||
|
||||
web_link_datas = Array.new
|
||||
|
||||
@web_links.each do |wl|
|
||||
web_link_datas << {
|
||||
"title" => wl.title,
|
||||
"is_hot" => (!wl.is_hot.blank? ? '1' : ''),
|
||||
"context" => wl.context,
|
||||
"url" => wl.url
|
||||
} if !wl.blank?
|
||||
end
|
||||
|
||||
@web_link_datas << { "title" => wlcg.title, "web_links" => web_link_datas } if !@web_links.blank?
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
@item = Page.find(params[:page_id])
|
||||
@title = @item.title
|
||||
@web_link = WebLink.find(params[:id])
|
||||
get_categorys
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def get_categorys
|
||||
@web_link_categorys = WebLinkCategory.excludes('disabled' => true)
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,71 @@
|
|||
class Panel::WebResource::Widget::WebLinksController < OrbitWidgetController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'web_resource'
|
||||
end
|
||||
|
||||
# GET /web_links
|
||||
# GET /web_links.xml
|
||||
|
||||
def index
|
||||
|
||||
@part = PagePart.find(params[:part_id])
|
||||
@title = @part.title_translations[I18n.locale.to_s]
|
||||
|
||||
if @part.widget_data_count
|
||||
@page_num = @part.widget_data_count
|
||||
else
|
||||
@page_num = 4
|
||||
end
|
||||
|
||||
if @part.widget_field
|
||||
@widget_fields = @part.widget_field
|
||||
else
|
||||
@widget_fields = []
|
||||
end
|
||||
|
||||
@widget_style = @part.widget_style
|
||||
|
||||
if !params[:category_id].blank?
|
||||
@web_link_categorys = @module_app.categories.enabled.any_in(:_id => params[:category_id])
|
||||
else
|
||||
@web_link_categorys = @module_app.categories.enabled
|
||||
end
|
||||
|
||||
@web_link_datas = Array.new
|
||||
|
||||
@web_link_categorys.each do |wlcg|
|
||||
|
||||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||
@web_links = WebLink.all.can_display.where(:category_id.in => [wlcg.id], :tagged_ids.in => params[:tag_id]).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
elsif !params[:category_id].blank?
|
||||
@web_links = WebLink.all.can_display.where(:category_id.in => [wlcg.id]).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
elsif !params[:tag_id].blank?
|
||||
@web_links = WebLink.all.can_display.where(:category_id => wlcg.id, :tagged_ids.in => params[:tag_id]).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
else
|
||||
@web_links = WebLink.all.can_display.where(:category_id => wlcg.id).desc( :is_top, :created_at ).page( params[:page_main] ).per(@page_num)
|
||||
end
|
||||
|
||||
web_link_datas = Array.new
|
||||
|
||||
@web_links.each do |wl|
|
||||
web_link_datas << {
|
||||
"title" => wl.title,
|
||||
"is_hot" => (!wl.is_hot.blank? ? '1' : ''),
|
||||
"context" => wl.context,
|
||||
"url" => wl.url
|
||||
} if !wl.blank?
|
||||
end
|
||||
|
||||
@web_link_datas << { "title" => wlcg.title, "web_links" => web_link_datas } if !@web_links.blank?
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def get_categorys
|
||||
@web_link_categorys = WebLinkCategory.excludes('disable' => true)
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
module Panel::WebResource::BackEnd::WebLinkCategorysHelper
|
||||
include ActionView::Helpers::UrlHelper
|
||||
|
||||
def show_web_link_permission_link(web_link)
|
||||
type = 'edit'
|
||||
oa = web_link.get_object_auth_by_title(type)
|
||||
if oa.nil?
|
||||
web_link.object_auths.new(title: type ).save
|
||||
oa = web_link.get_object_auth_by_title(type)
|
||||
end
|
||||
link_to t(:category_auth),admin_object_auth_ob_auth_path(oa)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,64 @@
|
|||
# encoding: utf-8
|
||||
class WebLink
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
include OrbitCategory::Categorizable
|
||||
include OrbitModel::LanguageRestrict
|
||||
include OrbitModel::Status
|
||||
include OrbitModel::TimeFrame
|
||||
include OrbitTag::Taggable
|
||||
|
||||
field :title, localize: true
|
||||
field :context, localize: true
|
||||
|
||||
field :url, localize: true
|
||||
field :create_user_id
|
||||
field :update_user_id, :class_name => "User"
|
||||
|
||||
scope :can_display,where(is_hidden: false)
|
||||
|
||||
# belongs_to :web_link_category
|
||||
|
||||
before_save :clean_tags
|
||||
|
||||
validates :title, :at_least_one => true
|
||||
|
||||
before_validation :add_http
|
||||
# validates :url, :presence => true, :format => /^(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?/i
|
||||
|
||||
def self.search( category_id = nil )
|
||||
|
||||
if category_id.to_s.size > 0
|
||||
|
||||
find(:all, :conditions => {web_link_category_id: category_id}).desc( :is_top, :title )
|
||||
|
||||
else
|
||||
|
||||
find(:all).desc( :is_top, :title)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def self.widget_datas
|
||||
|
||||
where( :is_hidden => false ).desc(:is_top, :created_at)
|
||||
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def add_http
|
||||
unless self.url[/^http:\/\//] || self.url[/^https:\/\//]
|
||||
self.url = 'http://' + self.url
|
||||
end
|
||||
end
|
||||
|
||||
def clean_tags
|
||||
self.tagged_ids.delete('')
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,27 @@
|
|||
# encoding: utf-8
|
||||
|
||||
class WebLinkCategory
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitCoreLib::ObjectAuthable
|
||||
include OrbitCoreLib::ObjectDisable
|
||||
# include Mongoid::MultiParameterAttributes
|
||||
AfterObjectAuthUrl = '/panel/page_content/back_end/page_contexts'
|
||||
APP_NAME = 'web_resource'
|
||||
ObjectAuthTitlesOptions = %W{edit}
|
||||
|
||||
field :key
|
||||
|
||||
field :title, localize: true
|
||||
|
||||
has_many :web_links
|
||||
|
||||
def pp_object
|
||||
title
|
||||
end
|
||||
|
||||
def self.from_id(id)
|
||||
WebLinkCategory.find(id) rescue nil
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,30 @@
|
|||
<% # encoding: utf-8 %>
|
||||
|
||||
<%= form_for(@web_link_category, :remote => true, :url => @url) do |f| %>
|
||||
|
||||
<h2><%= (@web_link_category.new_record? ? t(:add) : t(:edit)) %></h2>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.label :key, t(:key) %>
|
||||
<%= f.text_field :key %>
|
||||
</div>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "name-#{locale}", "#{t(:name)}-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (@web_link_category.title_translations[locale] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.submit t(:submit), :class=>'btn btn-primary' %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
|
||||
<tr id="<%= dom_id web_link_category %>" class="with_action">
|
||||
<td>
|
||||
<%= web_link_category.key %>
|
||||
<%if at_least_module_manager %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><%= link_to t(:edit), edit_panel_web_resource_back_end_web_link_category_path(web_link_category), :remote => true %></li>
|
||||
<li><%= link_to show_toggle_archive_btn(web_link_category), panel_web_resource_back_end_web_link_category_path(web_link_category), :confirm => t(:sure?), :method => :delete, :remote => true ,:class=> "archive_toggle"%></li>
|
||||
<li><%#= show_web_link_permission_link web_link_category %></li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end -%>
|
||||
</td>
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<td><%= web_link_category.title_translations[locale] rescue nil %></td>
|
||||
<% end %>
|
||||
</tr>
|
|
@ -0,0 +1,2 @@
|
|||
$('<%= j render :partial => 'web_link_category', :collection => [@web_link_category] %>').appendTo('#web_link_categorys').hide().fadeIn();
|
||||
$("#new_web_link_category")[0].reset();
|
|
@ -0,0 +1 @@
|
|||
$("#<%= dom_id @web_link_category %>").find(".archive_toggle").text("<%= show_toggle_archive_btn(@web_link_category) %> ");
|
|
@ -0,0 +1 @@
|
|||
$("#form > form").replaceWith("<%= j render "form" %>");
|
|
@ -0,0 +1,39 @@
|
|||
|
||||
|
||||
<%= flash_messages %>
|
||||
<div id="filter" class="subnav">
|
||||
<div class="filters">
|
||||
<div id="sort_headers" class="table-label">
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1-2"><%= t(:key) %></th>
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="web_link_categorys" class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1-2"></th>
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<th class="span1-2"></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="sort-holder">
|
||||
|
||||
<%= render :partial => 'web_link_category', :collection => @web_link_categorys %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="form"><%= render :partial => "form" if at_least_module_manager%></div>
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
$("#form > form").replaceWith("<%= j render "form" %>");
|
|
@ -0,0 +1,3 @@
|
|||
$.each($(".quick_edit"),function(obj){ $(this).remove(); });
|
||||
$("#<%= dom_id @web_link_category %>").append("<div class='quick_edit'><%= j render "form" %></div>");
|
||||
//$("#form > form").replaceWith("<%= j render "form" %>");
|
|
@ -0,0 +1,4 @@
|
|||
$("#<%= dom_id @web_link_category %>").replaceWith("<%= j render :partial => 'link_category', :collection => [@web_link_category] %>");
|
||||
<% @web_link_category = WebLinkCategory.new(:display => 'List') # reset for new form %>
|
||||
$(".edit_web_link_category").replaceWith("<%= j render "form" %>")
|
||||
$(".new_web_link_category")[0].reset();
|
|
@ -0,0 +1,3 @@
|
|||
<div class="filter-clear">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icons-cycle') + t(:clear), panel_web_resource_back_end_web_links_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn btn-small js_history" %>
|
||||
</div>
|
|
@ -0,0 +1,11 @@
|
|||
<div id="filter" class="subnav">
|
||||
<div class="filters">
|
||||
<div id="sort_headers" class="table-label">
|
||||
<%= render 'sort_headers' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "sort_header" %>
|
||||
<% end %>
|
|
@ -0,0 +1,6 @@
|
|||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<% @web_link_categories.each do |category| -%>
|
||||
<%= link_to category.title, panel_web_resource_back_end_web_links_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('categories', category.id)}" %>
|
||||
<% end -%>
|
||||
</div>
|
||||
<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %>
|
|
@ -0,0 +1,6 @@
|
|||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<%= link_to t(:top), panel_web_resource_back_end_web_links_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_top'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_top')}" %>
|
||||
<%= link_to t(:hot), panel_web_resource_back_end_web_links_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hot'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_hot')}" %>
|
||||
<%= link_to t(:hidden), panel_web_resource_back_end_web_links_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hidden'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_hidden')}" unless(is_guest?)%>
|
||||
</div>
|
||||
<%= render :partial => 'clear_filters', :locals => {:type => 'status'} %>
|
|
@ -0,0 +1,6 @@
|
|||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<% @tags.each do |tag| -%>
|
||||
<%= link_to tag[I18n.locale], panel_web_resource_back_end_web_links_path(:filter => @filter, :new_filter => {:type => 'tags', :id => tag.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('tags', tag.id)}" %>
|
||||
<% end -%>
|
||||
</div>
|
||||
<%= render :partial => 'clear_filters', :locals => {:type => 'tags'} %>
|
|
@ -0,0 +1,153 @@
|
|||
<% # encoding: utf-8 %>
|
||||
<% content_for :page_specific_css do %>
|
||||
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||
<%= stylesheet_link_tag "lib/fileupload" %>
|
||||
<% end %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
||||
<%= javascript_include_tag "lib/module-area" %>
|
||||
<% end %>
|
||||
|
||||
<%= f.error_messages %>
|
||||
|
||||
<!-- 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></li>
|
||||
<li class="active">
|
||||
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
|
||||
</li>
|
||||
<% if show_form_status_field(@web_link) %>
|
||||
<li>
|
||||
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Module -->
|
||||
<div class="tab-content module-area">
|
||||
|
||||
<!-- Basic Module -->
|
||||
<div class="tab-pane fade in active" id="basic">
|
||||
|
||||
<!-- Category -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:category) %></label>
|
||||
<div class="controls">
|
||||
<%= f.select :category_id, @categories.collect{|t| [ t.title, t.id ]} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Status Module -->
|
||||
<% if show_form_status_field(@web_link) %>
|
||||
<div class="tab-pane fade" id="status">
|
||||
|
||||
<!-- Status -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:status) %></label>
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<label class="checkbox inline btn <%= 'active' if @web_link.is_top? %>">
|
||||
<%= f.check_box :is_top %> <%= t(:top) %>
|
||||
</label>
|
||||
<label class="checkbox inline btn <%= 'active' if @web_link.is_hot? %>">
|
||||
<%= f.check_box :is_hot %> <%= t(:hot) %>
|
||||
</label>
|
||||
<label class="checkbox inline btn <%= 'active' if @web_link.is_hidden? %>">
|
||||
<%= f.check_box :is_hidden %> <%= t(:hide) %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- Tag Module -->
|
||||
<div class="tab-pane fade" id="tag">
|
||||
|
||||
<!-- Tag -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:tags) %></label>
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<% @tags.each do |tag| %>
|
||||
<label class="checkbox inline btn <%= 'active' if @web_link.tag_ids.include?(tag.id) %>">
|
||||
<%= check_box_tag 'web_link[tag_ids][]', tag.id, @web_link.tag_ids.include?(tag.id) %> <%= tag.name %>
|
||||
<%= hidden_field_tag 'web_link[tag_ids][]', '' %>
|
||||
</label>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Language Tabs -->
|
||||
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
||||
<ul class="nav nav-pills language-nav">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<li class="<%= 'active' if i == 0 %>">
|
||||
<a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<!-- Language -->
|
||||
<div class="tab-content language-area">
|
||||
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<!-- Title-->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t(:title) %></label>
|
||||
<div class="controls">
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<%= f.text_field locale, class: "input-block-level", placeholder: t(:title), value: (@web_link.title_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Context-->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t(:description) %></label>
|
||||
<div class="controls">
|
||||
<%= f.fields_for :context_translations do |f| %>
|
||||
<%= f.text_area locale, rows: 5, class: "input-block-level", value: (@web_link.context_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Url-->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t(:url) %></label>
|
||||
<div class="controls">
|
||||
<%= f.fields_for :url_translations do |f| %>
|
||||
<%= f.text_field locale, class: "input-block-level", placeholder: t(:url), value: (@web_link.url_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Form Actions -->
|
||||
<div class="form-actions">
|
||||
<%= hidden_field_tag 'page', params[:page] if !params[:page].blank? %>
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||
</div>
|
|
@ -0,0 +1,5 @@
|
|||
<%= render_sort_bar(true, delete_panel_web_resource_back_end_web_links_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
|
||||
['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1', :status],
|
||||
['category', 'bulletin_category', 'span2', :category],
|
||||
['title', 'title','span3', :title],
|
||||
['tags', 'tags', 'span2', :tags]).html_safe %>
|
|
@ -0,0 +1,45 @@
|
|||
<tr id="<%= dom_id web_link %>" class="with_action">
|
||||
<td>
|
||||
<% if (web_link.create_user_id == current_or_guest_user.id) || is_manager? %>
|
||||
<%= check_box_tag 'to_delete[]', web_link.id, false, :class => "checkbox_in_list" %>
|
||||
<% end -%>
|
||||
</td>
|
||||
<td>
|
||||
<div class="label-group">
|
||||
<div class="label-td">
|
||||
<% if web_link.is_top? %>
|
||||
<span class="label label-success"><%= t(:top) %></span>
|
||||
<% end %>
|
||||
<% if web_link.is_hot? %>
|
||||
<span class="label label-important"><%= t(:hot) %></span>
|
||||
<% end %>
|
||||
<% if web_link.is_hidden? %>
|
||||
<span class="label"><%= t(:hidden) %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= web_link.web_link_category.title rescue nil %></td>
|
||||
<td>
|
||||
<%#= link_to web_link.title, panel_web_resource_back_end_web_link_path(web_link) %>
|
||||
<%= link_to web_link.title, web_link.url, {:target => '_blank', :title => web_link.title} %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<%if at_least_module_manager || web_link.web_link_category.cur_user_is_sub_manager_of(:edit)%>
|
||||
<li><%= link_to t('edit'), edit_panel_web_resource_back_end_web_link_path(web_link) %></li>
|
||||
<li><%= link_to t(:delete_), panel_web_resource_back_end_web_link_path(web_link), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
|
||||
<% end -%>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="label-group">
|
||||
<div class="label-td">
|
||||
<% web_link.sorted_tags.each do |tag| %>
|
||||
<span class="label label-tags"><%= tag.name %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -0,0 +1 @@
|
|||
$("#<%= dom_id @web_link %>").remove();
|
|
@ -0,0 +1,5 @@
|
|||
<%= form_for @web_link, url: panel_web_resource_back_end_web_link_path(@web_link), html: {class: "form-horizontal main-forms previewable"} do |f| %>
|
||||
<fieldset>
|
||||
<%= render partial: 'form', locals: {f: f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
|
@ -0,0 +1,44 @@
|
|||
<% set_default_index do
|
||||
objects @web_links
|
||||
quick_edit_link type: 'edit',
|
||||
link: 'edit_panel_web_resource_back_end_web_link_path'
|
||||
quick_edit_link type: 'detail'
|
||||
quick_edit_link type: 'delete',
|
||||
link: 'panel_web_resource_back_end_web_link_path'
|
||||
field type: 'status',
|
||||
db_field: @statuses,
|
||||
translation: 'status',
|
||||
hide: 'phone',
|
||||
sort: 'status',
|
||||
header_class: 'span2'
|
||||
field type: 'associated',
|
||||
db_field: 'category',
|
||||
model_field: 'title',
|
||||
translation: 'category',
|
||||
hide: 'phone',
|
||||
sort: 'category',
|
||||
header_class: 'span2'
|
||||
field db_field: 'title',
|
||||
translation: 'title',
|
||||
sort: 'title',
|
||||
display_option: 'link_to value, panel_web_resource_front_end_web_link_path(object)',
|
||||
quick_edit: true,
|
||||
header_class: 'span5'
|
||||
field type: 'tags',
|
||||
hide: 'all',
|
||||
sort: 'tags'
|
||||
filter_field type: 'array',
|
||||
values: @statuses,
|
||||
translation: 'status'
|
||||
filter_field type: 'objects',
|
||||
values: @categories,
|
||||
translation: 'category',
|
||||
object_field: 'title'
|
||||
filter_field type: 'objects',
|
||||
values: @tags,
|
||||
translation: 'tags',
|
||||
object_field: 'name'
|
||||
footer link: 'new_panel_web_resource_back_end_web_link_path'
|
||||
end %>
|
||||
|
||||
<%= render 'admin/default_index/index' %>
|
|
@ -0,0 +1,3 @@
|
|||
$("#sort_headers").html("<%= j render 'sort_headers' %>");
|
||||
$("#tbody_web_links").html("<%= j render :partial => 'web_link', :collection => @web_links %>");
|
||||
$("#web_link_pagination").html("<%= j paginate @web_links, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");
|
|
@ -0,0 +1,5 @@
|
|||
<%= form_for @web_link, url: panel_web_resource_back_end_web_links_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
|
||||
<fieldset>
|
||||
<%= render partial: 'form', locals: {f: f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
|
@ -0,0 +1,3 @@
|
|||
$("#enable_<%= @bulletin.id %>").toggle();
|
||||
$("#disable_<%= @bulletin.id %>").toggle();
|
||||
$("#bulletin_<%= @bulletin.id %>").toggleClass('disable');
|
|
@ -0,0 +1,36 @@
|
|||
<% # encoding: utf-8 %>
|
||||
|
||||
<div class="o-links">
|
||||
<div class="o-links-content">
|
||||
<ul>
|
||||
|
||||
<% @web_link_datas.each do |wlcg| %>
|
||||
|
||||
<li>
|
||||
<h3 class="o-links-category"><%= wlcg["title"] rescue nil%></h3>
|
||||
<div class="o-links-list">
|
||||
<ul>
|
||||
|
||||
<% wlcg["web_links"].each do |post| %>
|
||||
<% if !post["title"].blank? %>
|
||||
<li>
|
||||
<%= link_to post["title"], post["url"], {:target => '_blank', :title => post["title"], :class=>"o-links-title"} %>
|
||||
<% if !post["is_hot"].blank? %><span class="o-links-hot"><%= t('hot')%></span><% end %>
|
||||
<div class="o-links-description"><%= post["context"] %></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%#= paginate @web_links, :param_name => :page_main, :params => {:inner => false}%>
|
||||
|
||||
<%#= stylesheet_link_tag "web_resource/links" %>
|
|
@ -0,0 +1 @@
|
|||
alert('bob');
|
|
@ -0,0 +1,43 @@
|
|||
<% # encoding: utf-8 %>
|
||||
<% if @title %>
|
||||
<h2 class="h2"><%= @title %></h2>
|
||||
<% end %>
|
||||
|
||||
<div class="o-links">
|
||||
<div class="o-links-content">
|
||||
<ul>
|
||||
|
||||
<% @web_link_datas.each do |wlcg| %>
|
||||
|
||||
<li>
|
||||
<h3 class="o-links-category"><%= wlcg["title"] rescue nil%></h3>
|
||||
<div class="o-links-list">
|
||||
<ul>
|
||||
|
||||
<% wlcg["web_links"].each do |post| %>
|
||||
<% if !post["title"].blank? %>
|
||||
<li>
|
||||
<%= link_to post["title"], post["url"], {:target => '_blank', :title => post["title"], :class=>"o-links-title"} %>
|
||||
<% if !post["is_hot"].blank? %><span class="o-links-hot"><%= t('hot')%></span><% end %>
|
||||
<div class="o-links-description"><%= post["context"] %></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pull_right">
|
||||
<% if !params[:category_id].blank? %>
|
||||
<%= link_to t(:more_plus), panel_web_resource_front_end_web_links_path(:category_id => @part.category) %>
|
||||
<% else %>
|
||||
<%= link_to t(:more_plus), panel_web_resource_front_end_web_links_path %>
|
||||
<% end %>
|
||||
</div>
|
|
@ -0,0 +1,10 @@
|
|||
<ul>
|
||||
<% @web_links.each do |widget| -%>
|
||||
<li><%= link_to widget.title, widget.url, {:target => '_blank', :title => widget.title} %></li>
|
||||
<% end -%>
|
||||
</ul>
|
||||
|
||||
<div class='pagination'>
|
||||
<%= link_to_previous_page @web_links, 'Previous Page', :params => {:controller => 'widget/web_links', :action => 'reload_web_links'}, :remote => true, :class => 'previous' %>
|
||||
<%= link_to_next_page @web_links, 'Next Page', :params => {:controller => 'widget/web_links', :action => 'reload_web_links'}, :remote => true, :class => 'next' %>
|
||||
</div>
|
|
@ -0,0 +1,9 @@
|
|||
<div class="quicklinks">
|
||||
<% if @title %>
|
||||
<h3 class="link_title"><%= @title %></h3>
|
||||
<% end %>
|
||||
|
||||
<div id='web_links_links'>
|
||||
<%= render 'web_links' %>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,7 @@
|
|||
<div id="web_link_widget">
|
||||
<%= render 'index' %>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<%#= stylesheet_link_tag "web_resource/links" %>
|
|
@ -0,0 +1 @@
|
|||
$('#web_link_widget').html("<%= j render 'index' %>")
|
|
@ -0,0 +1 @@
|
|||
$('#web_links_links').html("<%= j render 'web_links' if @web_links %>")
|
|
@ -0,0 +1,15 @@
|
|||
en:
|
||||
|
||||
web_resource:
|
||||
web_link: Web resource
|
||||
frontend:
|
||||
web_link: Web resource Front-end
|
||||
widget:
|
||||
index: Web resource Widget
|
||||
|
||||
web_link:
|
||||
create_web_link_category_success: Web resource category was successfully created
|
||||
editing_web_resource: Editing web resource
|
||||
list_of_web_resource: Web resource list
|
||||
new_web_resource: New web resource
|
||||
update_web_link_category_success: Web resource was successfully updated
|
|
@ -0,0 +1,15 @@
|
|||
zh_tw:
|
||||
|
||||
web_resource:
|
||||
web_link: 網路資源
|
||||
frontend:
|
||||
web_link: 網路資源前台
|
||||
widget:
|
||||
index: 網路資源Widget
|
||||
|
||||
web_link:
|
||||
create_web_link_category_success: 網路資源類別已成功建立
|
||||
editing_web_resource: 編輯網路資源
|
||||
list_of_web_resource: 網路資源列表
|
||||
new_web_resource: 新增網路資源
|
||||
update_web_link_category_success: 網路資源已成功更新
|
|
@ -0,0 +1,23 @@
|
|||
Rails.application.routes.draw do
|
||||
namespace :panel do
|
||||
namespace :web_resource do
|
||||
namespace :back_end do
|
||||
resources :web_links do
|
||||
collection do
|
||||
get 'delete'
|
||||
end
|
||||
end
|
||||
resources :web_link_categorys
|
||||
resources :tags
|
||||
end
|
||||
namespace :front_end do
|
||||
match "web_links" => "web_links#index"
|
||||
resources :web_links
|
||||
end
|
||||
namespace :widget do
|
||||
match "index" => "web_links#index"
|
||||
end
|
||||
end
|
||||
end
|
||||
match "/appfront/*path" => redirect("/panel/*path")
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
# desc "Explaining what the task does"
|
||||
# task :web_resource do
|
||||
# # Task goes here
|
||||
# end
|
|
@ -0,0 +1,4 @@
|
|||
require "web_resource/engine"
|
||||
|
||||
module WebResource
|
||||
end
|
|
@ -0,0 +1,73 @@
|
|||
module WebResource
|
||||
class Engine < Rails::Engine
|
||||
initializer "web_resource" do
|
||||
OrbitApp.registration "WebResource",:type=> 'ModuleApp' do
|
||||
module_label 'link'
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
# personal_plugin :enable => true,:path=>"panel/web_resource/plugin/profile",:i18n=>'admin.web_resource'
|
||||
|
||||
version "0.1"
|
||||
organization "Rulingcom"
|
||||
author "RD dep"
|
||||
intro "I am intro"
|
||||
update_info 'some update_info'
|
||||
|
||||
front_end do
|
||||
app_page 'web_links' do
|
||||
frontend_i18n "web_resource.frontend.web_link"
|
||||
end
|
||||
end
|
||||
|
||||
authorizable
|
||||
categorizable
|
||||
taggable
|
||||
|
||||
widgets do
|
||||
# default_widget do
|
||||
# query 'Bulletin.all'
|
||||
# image :image
|
||||
# end
|
||||
|
||||
categories_query 'WebLinkCategory.all'
|
||||
tags_query 'WebResourceTag.all'
|
||||
|
||||
customize_widget "index" do
|
||||
widget_i18n "web_resource.widget.index"
|
||||
end
|
||||
end
|
||||
|
||||
side_bar do
|
||||
head_label_i18n 'link',:icon_class=>"icons-link"
|
||||
available_for [:admin,:guest,:manager,:sub_manager]
|
||||
active_for_controllers ({:private=>['web_links', 'web_link_categorys','module_tags', 'categories']})
|
||||
active_for_object_auth ['WebLinkCategory']
|
||||
|
||||
head_link_path "panel_web_resource_back_end_web_links_path"
|
||||
|
||||
context_link 'list_',
|
||||
:link_path=>"panel_web_resource_back_end_web_links_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{:web_links=>:index},
|
||||
:available_for => [:all]
|
||||
|
||||
context_link 'add',
|
||||
:link_path=>"new_panel_web_resource_back_end_web_link_path" ,
|
||||
:priority=>2,
|
||||
:active_for_action=>{:web_links=>:new},
|
||||
:available_for => [:sub_manager]
|
||||
context_link 'categories',
|
||||
:link_path=>"admin_module_app_categories_path(get_module_app)" ,
|
||||
:priority=>3,
|
||||
:active_for_category => 'WebResource',
|
||||
:available_for => [:manager]
|
||||
|
||||
context_link 'tags',
|
||||
:link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'WebResource'}))" ,
|
||||
:priority=>4,
|
||||
:active_for_tag => 'WebResource',
|
||||
:available_for => [:manager]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
module WebResource
|
||||
VERSION = "0.0.1"
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env ruby.exe
|
||||
#!/usr/bin/env ruby
|
||||
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
||||
|
||||
ENGINE_PATH = File.expand_path('../..', __FILE__)
|
||||
load File.expand_path('../../test/dummy/script/rails', __FILE__)
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env rake
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
||||
require File.expand_path('../config/application', __FILE__)
|
||||
|
||||
Dummy::Application.load_tasks
|
|
@ -0,0 +1,9 @@
|
|||
// This is a manifest file that'll be compiled into including all the files listed below.
|
||||
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
||||
// be included in the compiled file accessible from http://example.com/assets/application.js
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// the compiled file.
|
||||
//
|
||||
//= require jquery
|
||||
//= require jquery_ujs
|
||||
//= require_tree .
|
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
||||
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
||||
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
||||
*= require_self
|
||||
*= require_tree .
|
||||
*/
|
|
@ -0,0 +1,3 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
module ApplicationHelper
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Dummy</title>
|
||||
<%= stylesheet_link_tag "application" %>
|
||||
<%= javascript_include_tag "application" %>
|
||||
<%= csrf_meta_tags %>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<%= yield %>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,4 @@
|
|||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
require ::File.expand_path('../config/environment', __FILE__)
|
||||
run Dummy::Application
|
|
@ -0,0 +1,45 @@
|
|||
require File.expand_path('../boot', __FILE__)
|
||||
|
||||
require 'rails/all'
|
||||
|
||||
Bundler.require
|
||||
require "web_resource"
|
||||
|
||||
module Dummy
|
||||
class Application < Rails::Application
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
# Application configuration should go into files in config/initializers
|
||||
# -- all .rb files in that directory are automatically loaded.
|
||||
|
||||
# Custom directories with classes and modules you want to be autoloadable.
|
||||
# config.autoload_paths += %W(#{config.root}/extras)
|
||||
|
||||
# Only load the plugins named here, in the order given (default is alphabetical).
|
||||
# :all can be used as a placeholder for all plugins not explicitly named.
|
||||
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
||||
|
||||
# Activate observers that should always be running.
|
||||
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
||||
|
||||
# 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)'
|
||||
|
||||
# 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]
|
||||
# config.i18n.default_locale = :de
|
||||
|
||||
# Configure the default encoding used in templates for Ruby 1.9.
|
||||
config.encoding = "utf-8"
|
||||
|
||||
# Configure sensitive parameters which will be filtered from the log file.
|
||||
config.filter_parameters += [:password]
|
||||
|
||||
# Enable the asset pipeline
|
||||
config.assets.enabled = true
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets
|
||||
config.assets.version = '1.0'
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
require 'rubygems'
|
||||
gemfile = File.expand_path('../../../../Gemfile', __FILE__)
|
||||
|
||||
if File.exist?(gemfile)
|
||||
ENV['BUNDLE_GEMFILE'] = gemfile
|
||||
require 'bundler'
|
||||
Bundler.setup
|
||||
end
|
||||
|
||||
$:.unshift File.expand_path('../../../../lib', __FILE__)
|
|
@ -0,0 +1,25 @@
|
|||
# SQLite version 3.x
|
||||
# gem install sqlite3
|
||||
#
|
||||
# Ensure the SQLite 3 gem is defined in your Gemfile
|
||||
# gem 'sqlite3'
|
||||
development:
|
||||
adapter: sqlite3
|
||||
database: db/development.sqlite3
|
||||
pool: 5
|
||||
timeout: 5000
|
||||
|
||||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
# Do not set this db to the same as development or production.
|
||||
test:
|
||||
adapter: sqlite3
|
||||
database: db/test.sqlite3
|
||||
pool: 5
|
||||
timeout: 5000
|
||||
|
||||
production:
|
||||
adapter: sqlite3
|
||||
database: db/production.sqlite3
|
||||
pool: 5
|
||||
timeout: 5000
|
|
@ -0,0 +1,5 @@
|
|||
# Load the rails application
|
||||
require File.expand_path('../application', __FILE__)
|
||||
|
||||
# Initialize the rails application
|
||||
Dummy::Application.initialize!
|
|
@ -0,0 +1,30 @@
|
|||
Dummy::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
# In the development environment your application's code is reloaded on
|
||||
# every request. This slows down response time but is perfect for development
|
||||
# since you don't have to restart the web server when you make code changes.
|
||||
config.cache_classes = false
|
||||
|
||||
# Log error messages when you accidentally call methods on nil.
|
||||
config.whiny_nils = true
|
||||
|
||||
# Show full error reports and disable caching
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
# Don't care if the mailer can't send
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
# Print deprecation notices to the Rails logger
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
# Only use best-standards-support built into browsers
|
||||
config.action_dispatch.best_standards_support = :builtin
|
||||
|
||||
# Do not compress assets
|
||||
config.assets.compress = false
|
||||
|
||||
# Expands the lines which load the assets
|
||||
config.assets.debug = true
|
||||
end
|
|
@ -0,0 +1,60 @@
|
|||
Dummy::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
# Code is not reloaded between requests
|
||||
config.cache_classes = true
|
||||
|
||||
# Full error reports are disabled and caching is turned on
|
||||
config.consider_all_requests_local = false
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Disable Rails's static asset server (Apache or nginx will already do this)
|
||||
config.serve_static_assets = false
|
||||
|
||||
# Compress JavaScripts and CSS
|
||||
config.assets.compress = true
|
||||
|
||||
# Don't fallback to assets pipeline if a precompiled asset is missed
|
||||
config.assets.compile = false
|
||||
|
||||
# Generate digests for assets URLs
|
||||
config.assets.digest = true
|
||||
|
||||
# Defaults to Rails.root.join("public/assets")
|
||||
# config.assets.manifest = YOUR_PATH
|
||||
|
||||
# Specifies the header that your server uses for sending files
|
||||
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
# config.force_ssl = true
|
||||
|
||||
# See everything in the log (default is :info)
|
||||
# config.log_level = :debug
|
||||
|
||||
# Use a different logger for distributed setups
|
||||
# config.logger = SyslogLogger.new
|
||||
|
||||
# Use a different cache store in production
|
||||
# config.cache_store = :mem_cache_store
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
||||
# config.action_controller.asset_host = "http://assets.example.com"
|
||||
|
||||
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
||||
# config.assets.precompile += %w( search.js )
|
||||
|
||||
# Disable delivery errors, bad email addresses will be ignored
|
||||
# config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
# Enable threaded mode
|
||||
# config.threadsafe!
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# the I18n.default_locale when a translation can not be found)
|
||||
config.i18n.fallbacks = true
|
||||
|
||||
# Send deprecation notices to registered listeners
|
||||
config.active_support.deprecation = :notify
|
||||
end
|
|
@ -0,0 +1,39 @@
|
|||
Dummy::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
# The test environment is used exclusively to run your application's
|
||||
# test suite. You never need to work with it otherwise. Remember that
|
||||
# your test database is "scratch space" for the test suite and is wiped
|
||||
# and recreated between test runs. Don't rely on the data there!
|
||||
config.cache_classes = true
|
||||
|
||||
# Configure static asset server for tests with Cache-Control for performance
|
||||
config.serve_static_assets = true
|
||||
config.static_cache_control = "public, max-age=3600"
|
||||
|
||||
# Log error messages when you accidentally call methods on nil
|
||||
config.whiny_nils = true
|
||||
|
||||
# Show full error reports and disable caching
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
# Raise exceptions instead of rendering exception templates
|
||||
config.action_dispatch.show_exceptions = false
|
||||
|
||||
# Disable request forgery protection in test environment
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
|
||||
# Tell Action Mailer not to deliver emails to the real world.
|
||||
# The :test delivery method accumulates sent emails in the
|
||||
# ActionMailer::Base.deliveries array.
|
||||
config.action_mailer.delivery_method = :test
|
||||
|
||||
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
||||
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
||||
# like if you have constraints or database-specific column types
|
||||
# config.active_record.schema_format = :sql
|
||||
|
||||
# Print deprecation notices to the stderr
|
||||
config.active_support.deprecation = :stderr
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||
|
||||
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
||||
# Rails.backtrace_cleaner.remove_silencers!
|
|
@ -0,0 +1,10 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new inflection rules using the following format
|
||||
# (all these examples are active by default):
|
||||
# ActiveSupport::Inflector.inflections do |inflect|
|
||||
# inflect.plural /^(ox)$/i, '\1en'
|
||||
# inflect.singular /^(ox)en/i, '\1'
|
||||
# inflect.irregular 'person', 'people'
|
||||
# inflect.uncountable %w( fish sheep )
|
||||
# end
|
|
@ -0,0 +1,5 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
# Mime::Type.register "text/richtext", :rtf
|
||||
# Mime::Type.register_alias "text/html", :iphone
|
|
@ -0,0 +1,7 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Your secret key for verifying the integrity of signed cookies.
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
Dummy::Application.config.secret_token = 'ee68f8d3b8adc3f8bf4c227ae7db968e1d07dd6e6c8ea0f5deb0e55d8e19ba22fb5be6fd77ec4bffb8e78f60cd667a37d906090e8a1b03ab06bf11bb5e1b24ad'
|
|
@ -0,0 +1,8 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
|
||||
|
||||
# Use the database for sessions instead of the cookie-based default,
|
||||
# which shouldn't be used to store highly confidential information
|
||||
# (create the session table with "rails generate session_migration")
|
||||
# Dummy::Application.config.session_store :active_record_store
|
|
@ -0,0 +1,14 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file contains settings for ActionController::ParamsWrapper which
|
||||
# is enabled by default.
|
||||
|
||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
wrap_parameters format: [:json]
|
||||
end
|
||||
|
||||
# Disable root element in JSON by default.
|
||||
ActiveSupport.on_load(:active_record) do
|
||||
self.include_root_in_json = false
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
# Sample localization file for English. Add more files in this directory for other locales.
|
||||
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
||||
|
||||
en:
|
||||
hello: "Hello world"
|
|
@ -0,0 +1,58 @@
|
|||
Dummy::Application.routes.draw do
|
||||
# The priority is based upon order of creation:
|
||||
# first created -> highest priority.
|
||||
|
||||
# Sample of regular route:
|
||||
# match 'products/:id' => 'catalog#view'
|
||||
# Keep in mind you can assign values other than :controller and :action
|
||||
|
||||
# Sample of named route:
|
||||
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
||||
# This route can be invoked with purchase_url(:id => product.id)
|
||||
|
||||
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
||||
# resources :products
|
||||
|
||||
# Sample resource route with options:
|
||||
# resources :products do
|
||||
# member do
|
||||
# get 'short'
|
||||
# post 'toggle'
|
||||
# end
|
||||
#
|
||||
# collection do
|
||||
# get 'sold'
|
||||
# end
|
||||
# end
|
||||
|
||||
# Sample resource route with sub-resources:
|
||||
# resources :products do
|
||||
# resources :comments, :sales
|
||||
# resource :seller
|
||||
# end
|
||||
|
||||
# Sample resource route with more complex sub-resources
|
||||
# resources :products do
|
||||
# resources :comments
|
||||
# resources :sales do
|
||||
# get 'recent', :on => :collection
|
||||
# end
|
||||
# end
|
||||
|
||||
# Sample resource route within a namespace:
|
||||
# namespace :admin do
|
||||
# # Directs /admin/products/* to Admin::ProductsController
|
||||
# # (app/controllers/admin/products_controller.rb)
|
||||
# resources :products
|
||||
# end
|
||||
|
||||
# You can have the root of your site routed with "root"
|
||||
# just remember to delete public/index.html.
|
||||
# root :to => 'welcome#index'
|
||||
|
||||
# See how all your routes lay out with "rake routes"
|
||||
|
||||
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
||||
# Note: This route will make all actions in every controller accessible via GET requests.
|
||||
# match ':controller(/:action(/:id(.:format)))'
|
||||
end
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>The page you were looking for doesn't exist (404)</title>
|
||||
<style type="text/css">
|
||||
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
||||
div.dialog {
|
||||
width: 25em;
|
||||
padding: 0 4em;
|
||||
margin: 4em auto 0 auto;
|
||||
border: 1px solid #ccc;
|
||||
border-right-color: #999;
|
||||
border-bottom-color: #999;
|
||||
}
|
||||
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- This file lives in public/404.html -->
|
||||
<div class="dialog">
|
||||
<h1>The page you were looking for doesn't exist.</h1>
|
||||
<p>You may have mistyped the address or the page may have moved.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>The change you wanted was rejected (422)</title>
|
||||
<style type="text/css">
|
||||
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
||||
div.dialog {
|
||||
width: 25em;
|
||||
padding: 0 4em;
|
||||
margin: 4em auto 0 auto;
|
||||
border: 1px solid #ccc;
|
||||
border-right-color: #999;
|
||||
border-bottom-color: #999;
|
||||
}
|
||||
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- This file lives in public/422.html -->
|
||||
<div class="dialog">
|
||||
<h1>The change you wanted was rejected.</h1>
|
||||
<p>Maybe you tried to change something you didn't have access to.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>We're sorry, but something went wrong (500)</title>
|
||||
<style type="text/css">
|
||||
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
||||
div.dialog {
|
||||
width: 25em;
|
||||
padding: 0 4em;
|
||||
margin: 4em auto 0 auto;
|
||||
border: 1px solid #ccc;
|
||||
border-right-color: #999;
|
||||
border-bottom-color: #999;
|
||||
}
|
||||
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- This file lives in public/500.html -->
|
||||
<div class="dialog">
|
||||
<h1>We're sorry, but something went wrong.</h1>
|
||||
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env ruby.exe
|
||||
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
||||
|
||||
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||
require File.expand_path('../../config/boot', __FILE__)
|
||||
require 'rails/commands'
|
|
@ -0,0 +1,10 @@
|
|||
require 'test_helper'
|
||||
|
||||
class NavigationTest < ActionDispatch::IntegrationTest
|
||||
fixtures :all
|
||||
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
# Configure Rails Environment
|
||||
ENV["RAILS_ENV"] = "test"
|
||||
|
||||
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
||||
require "rails/test_help"
|
||||
|
||||
Rails.backtrace_cleaner.remove_silencers!
|
||||
|
||||
# Load support files
|
||||
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class WebResourceTest < ActiveSupport::TestCase
|
||||
test "truth" do
|
||||
assert_kind_of Module, WebResource
|
||||
end
|
||||
end
|
|
@ -0,0 +1,23 @@
|
|||
$:.push File.expand_path("../lib", __FILE__)
|
||||
|
||||
# Maintain your gem's version:
|
||||
require "web_resource/version"
|
||||
|
||||
# Describe your gem and declare its dependencies:
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "web_resource"
|
||||
s.version = WebResource::VERSION
|
||||
s.authors = ["RulingDigital"]
|
||||
s.email = ["service@rulingcom.com"]
|
||||
s.homepage = "http://www.rulingcom.com"
|
||||
s.summary = ""
|
||||
s.description = "Orbit WebResource module"
|
||||
|
||||
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||||
s.test_files = Dir["test/**/*"]
|
||||
|
||||
# s.add_dependency "rails", "~> 3.1.3"
|
||||
# s.add_dependency "jquery-rails"
|
||||
|
||||
s.add_development_dependency "sqlite3"
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"title": "web_resource",
|
||||
"version": "0.1",
|
||||
"organization": "Rulingcom",
|
||||
"author": "RD dep",
|
||||
"intro": "A simple blog……",
|
||||
"update_info": "Some info",
|
||||
"create_date": "11-11-2011",
|
||||
"widgets": ["home_list"],
|
||||
"category": ["WebLinkCategory"],
|
||||
"enable_frontend": true
|
||||
}
|
Loading…
Reference in New Issue