Merge branch 'new_member' of github.com:Rulingcom/orbit into new_member
Conflicts: app/controllers/admin/users_new_interface_controller.rb app/views/admin/users_new_interface/show.html.erb
This commit is contained in:
commit
b5571dbc43
File diff suppressed because it is too large
Load Diff
|
@ -195,6 +195,7 @@ legend {
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
vertical-align: inherit;
|
vertical-align: inherit;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
position/**/: static;
|
||||||
}
|
}
|
||||||
.sort-header th a {
|
.sort-header th a {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
@ -69,6 +69,9 @@
|
||||||
#orbit-bar .orbit-logo .dropdown-menu {
|
#orbit-bar .orbit-logo .dropdown-menu {
|
||||||
left: -15px;
|
left: -15px;
|
||||||
}
|
}
|
||||||
|
#orbit-bar .orbit-logo .dropdown-menu>li>a:hover>i {
|
||||||
|
background-image: url(<%= asset_path 'icons_pack_white.png' %>);
|
||||||
|
}
|
||||||
#orbit-bar .nav > li {
|
#orbit-bar .nav > li {
|
||||||
height: 28px;
|
height: 28px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,7 +280,7 @@
|
||||||
.filter .accordion-heading {
|
.filter .accordion-heading {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
border-top: none;
|
border-top: none;
|
||||||
border-left: 1px solid rgba(0,0,0,0.07);
|
border-left: 1px solid #E9E9E9;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
-moz-border-radius: 0;
|
-moz-border-radius: 0;
|
||||||
-webkit-border-radius: 0;
|
-webkit-border-radius: 0;
|
||||||
|
@ -291,7 +291,7 @@
|
||||||
top: 0;
|
top: 0;
|
||||||
}
|
}
|
||||||
.filter li:last-child .accordion-heading {
|
.filter li:last-child .accordion-heading {
|
||||||
border-right: 1px solid rgba(0,0,0,0.07);
|
border-right: 1px solid #E9E9E9;
|
||||||
}
|
}
|
||||||
.accordion-group .accordion-toggle .caret {
|
.accordion-group .accordion-toggle .caret {
|
||||||
border-top-color: #0088CC;
|
border-top-color: #0088CC;
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Admin::PluginsController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
||||||
@module_apps = ModuleApp.excludes(widgets: nil).where(has_plugin: true).order_by(:title, :asc)
|
@plugins = ModuleApp.where(has_plugin: true).order_by(:title, :asc)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ class Admin::UsersNewInterfaceController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@user = User.find(params[:id])
|
@user = User.find(params[:id])
|
||||||
|
@plugins = OrbitApp::Module::Registration.all
|
||||||
|
|
||||||
@profile_data = []
|
@profile_data = []
|
||||||
@teacher_data = []
|
@teacher_data = []
|
||||||
@student_data = []
|
@student_data = []
|
||||||
|
@ -47,6 +49,13 @@ class Admin::UsersNewInterfaceController < ApplicationController
|
||||||
@staff_data.push({:name => att_val.attribute_field.title,:value => att_val.get_value_by_locale(I18n.locale) }) if att_val.attribute_field.role.key=="staff_data"rescue false
|
@staff_data.push({:name => att_val.attribute_field.title,:value => att_val.get_value_by_locale(I18n.locale) }) if att_val.attribute_field.role.key=="staff_data"rescue false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!params[:show_plugin_profile].nil?)
|
||||||
|
@right_partial = OrbitApp::Plugin::Registration.find_by_key(params[:show_plugin_profile]).profile_partial_path rescue 'plugin_summary'
|
||||||
|
else
|
||||||
|
@right_partial = "plugin_summary"
|
||||||
|
end
|
||||||
|
|
||||||
# @user.attribute_values.each{|att_val|
|
# @user.attribute_values.each{|att_val|
|
||||||
# @teacher_data.push({:name => att_val.attribute_field.title,:value =>att_val[I18n.locale]})
|
# @teacher_data.push({:name => att_val.attribute_field.title,:value =>att_val[I18n.locale]})
|
||||||
# }
|
# }
|
||||||
|
|
|
@ -5,7 +5,7 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
layout :layout_by_resource
|
layout :layout_by_resource
|
||||||
|
|
||||||
helper :all
|
helper :admin
|
||||||
before_filter :set_locale, :set_site
|
before_filter :set_locale, :set_site
|
||||||
|
|
||||||
def set_current_user
|
def set_current_user
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Admin::AdBannerHelper
|
module Admin::AdBannersHelper
|
||||||
def preview_block_ad_images_helper(ad_banner)
|
def preview_block_ad_images_helper(ad_banner)
|
||||||
printable_ad_images = []
|
printable_ad_images = []
|
||||||
ad_banner.ad_images.each do |ad_image|
|
ad_banner.ad_images.each do |ad_image|
|
|
@ -1,3 +0,0 @@
|
||||||
module Admin::AdImagesHelper
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Admin::AppAuthHelper
|
module Admin::AppAuthsHelper
|
||||||
def on_off_switch(attribute,attribute_type)
|
def on_off_switch(attribute,attribute_type)
|
||||||
link_to t(:enable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch'
|
link_to t(:enable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch'
|
||||||
link_to t(:disable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch'
|
link_to t(:disable), eval("admin_#{attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{attribute_type} => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch'
|
|
@ -1,4 +1,4 @@
|
||||||
module Admin::AssetHelper
|
module Admin::AssetsHelper
|
||||||
|
|
||||||
def show_all_fields(asset, field)
|
def show_all_fields(asset, field)
|
||||||
a = []
|
a = []
|
|
@ -1,4 +1,4 @@
|
||||||
module Admin::DashboardHelper
|
module Admin::DashboardsHelper
|
||||||
|
|
||||||
def get_link(title)
|
def get_link(title)
|
||||||
case title
|
case title
|
|
@ -1,4 +1,4 @@
|
||||||
module Admin::ItemHelper
|
module Admin::ItemsHelper
|
||||||
|
|
||||||
def render_node_and_children(node)
|
def render_node_and_children(node)
|
||||||
ret = ''
|
ret = ''
|
|
@ -1,4 +1,4 @@
|
||||||
module Admin::ModuleAppHelper
|
module Admin::ModuleAppsHelper
|
||||||
|
|
||||||
def if_permit_to_delete(item)
|
def if_permit_to_delete(item)
|
||||||
case item.downcase
|
case item.downcase
|
|
@ -1,18 +0,0 @@
|
||||||
module Admin::PageContentHelper
|
|
||||||
include ActionView::Helpers::UrlHelper
|
|
||||||
|
|
||||||
|
|
||||||
def show_page_context_edit_auth_link(page_context)
|
|
||||||
type = 'Edit'
|
|
||||||
# debugger
|
|
||||||
# a=1
|
|
||||||
oa = page_context.get_object_auth_by_title(type)
|
|
||||||
if oa.nil?
|
|
||||||
page_context.object_auths.new(title: type ).save rescue
|
|
||||||
oa = page_context.get_object_auth_by_title(type)
|
|
||||||
end
|
|
||||||
# link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
|
|
||||||
link_to t('admin.page_context.ob_auth.edit'),admin_object_auth_ob_auth_path(oa)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
module Admin::PluginsHelper
|
||||||
|
|
||||||
|
def render_plugin_list
|
||||||
|
ret = ''
|
||||||
|
|
||||||
|
ret << "<div class=\"subnav\">"
|
||||||
|
ret << "<div id=\"module-nav\">"
|
||||||
|
ret << "<div class=\"arrow_next pull-right\"><i class=\"icon-chevron-right\"></i></div>"
|
||||||
|
ret << "<div class=\"arrow_prev pull-left\"><i class=\"icon-chevron-left\"></i></div>"
|
||||||
|
ret << "<div class=\"module-nav-view\">"
|
||||||
|
|
||||||
|
ret << "<ul class=\"nav nav-pills\">"
|
||||||
|
|
||||||
|
@plugins.each do |plugin|
|
||||||
|
ret << "<li>"
|
||||||
|
ret << (link_to eval("#{plugin.title}") , eval("panel_#{plugin.title}_back_end_#{plugin.object}s_path"))
|
||||||
|
ret << "</li>"
|
||||||
|
end
|
||||||
|
|
||||||
|
ret << "</ul>"
|
||||||
|
|
||||||
|
ret << "</div>"
|
||||||
|
ret << "</div>"
|
||||||
|
ret << "</div>"
|
||||||
|
|
||||||
|
ret.html_safe
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -1,4 +1,4 @@
|
||||||
module Admin::UserHelper
|
module Admin::UsersHelper
|
||||||
|
|
||||||
def show_attribute(object, field_id, locale = '')
|
def show_attribute(object, field_id, locale = '')
|
||||||
attribute = object.attribute_values.detect {|av| av.attribute_field_id.eql?(field_id) || av[locale.to_s].eql?(locale.to_s) } rescue nil
|
attribute = object.attribute_values.detect {|av| av.attribute_field_id.eql?(field_id) || av[locale.to_s].eql?(locale.to_s) } rescue nil
|
|
@ -1,11 +0,0 @@
|
||||||
module Admin::WebLinkHelper
|
|
||||||
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('web_resource.cate_auth'),admin_object_auth_ob_auth_path(oa)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,7 +1,7 @@
|
||||||
#encoding: utf-8
|
#encoding: utf-8
|
||||||
# require ActionView::Helpers::FormTagHelper
|
# require ActionView::Helpers::FormTagHelper
|
||||||
|
|
||||||
module AttributeFieldHelper
|
module AttributeFieldsHelper
|
||||||
include ActionView::Helpers::FormTagHelper
|
include ActionView::Helpers::FormTagHelper
|
||||||
include ActionView::Helpers::FormOptionsHelper
|
include ActionView::Helpers::FormOptionsHelper
|
||||||
include ActionView::Helpers::DateHelper
|
include ActionView::Helpers::DateHelper
|
|
@ -1,24 +0,0 @@
|
||||||
module CalendarHelper
|
|
||||||
def month_link(month_date)
|
|
||||||
link_to(I18n.localize(month_date, :format => "%B"), {:month => month_date.month, :year => month_date.year})
|
|
||||||
end
|
|
||||||
|
|
||||||
# custom options for this calendar
|
|
||||||
def event_calendar_opts
|
|
||||||
{
|
|
||||||
:year => @year,
|
|
||||||
:month => @month,
|
|
||||||
:event_strips => @event_strips,
|
|
||||||
:month_name_text => I18n.localize(@shown_month, :format => "%B %Y"),
|
|
||||||
:previous_month_text => "<< " + month_link(@shown_month.prev_month),
|
|
||||||
:next_month_text => month_link(@shown_month.next_month) + " >>" }
|
|
||||||
end
|
|
||||||
|
|
||||||
def event_calendar
|
|
||||||
# args is an argument hash containing :event, :day, and :options
|
|
||||||
calendar event_calendar_opts do |args|
|
|
||||||
event = args[:event]
|
|
||||||
%(<a href="/events/#{event.id}" title="#{h(event.name)}">#{h(event.name)}</a>)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,4 +0,0 @@
|
||||||
module DesignHelper
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,2 +0,0 @@
|
||||||
module SitesHelper
|
|
||||||
end
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
class GprsUploader < CarrierWave::Uploader::Base
|
||||||
|
|
||||||
|
# Include RMagick or ImageScience support:
|
||||||
|
# include CarrierWave::RMagick
|
||||||
|
# include CarrierWave::ImageScience
|
||||||
|
include CarrierWave::MiniMagick
|
||||||
|
|
||||||
|
# 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
|
||||||
|
"gprs/#{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
|
||||||
|
|
||||||
|
version :thumb do
|
||||||
|
process :resize_to_fill => [150, 120]
|
||||||
|
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
|
||||||
|
# "something.jpg" if original_filename
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def manipulate!
|
||||||
|
# raise current_path.inspect
|
||||||
|
# image = ::MiniMagick::Image.open(current_path)
|
||||||
|
# image = yield(image)
|
||||||
|
# image.write(current_path)
|
||||||
|
# ::MiniMagick::Image.open(current_path)
|
||||||
|
# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e
|
||||||
|
# raise CarrierWave::ProcessingError.new("Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: #{e}")
|
||||||
|
# end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
|
|
||||||
<div id="module-nav">
|
|
||||||
<div class="arrow_next pull-right"><i class="icon-chevron-right"></i></div>
|
|
||||||
<div class="arrow_prev pull-left"><i class="icon-chevron-left"></i></div>
|
|
||||||
<div class="module-nav-view">
|
|
||||||
<ul class="nav nav-pills">
|
|
||||||
<li class="active">
|
|
||||||
<a href="#">All</a>
|
|
||||||
</li>
|
|
||||||
<li><a href="#">學歷</a></li>
|
|
||||||
<li><a href="#">經歷</a></li>
|
|
||||||
<li><a href="#">研究計畫</a></li>
|
|
||||||
<li><a href="#">期刊論文</a></li>
|
|
||||||
<li><a href="#">學歷</a></li>
|
|
||||||
<li><a href="#">經歷</a></li>
|
|
||||||
<li><a href="#">研究計畫</a></li>
|
|
||||||
<li><a href="#">期刊論文</a></li>
|
|
||||||
<li><a href="#">學歷</a></li>
|
|
||||||
<li><a href="#">經歷</a></li>
|
|
||||||
<li><a href="#">研究計畫</a></li>
|
|
||||||
<li><a href="#">期刊論文</a></li>
|
|
||||||
<li><a href="#">學歷</a></li>
|
|
||||||
<li><a href="#">經歷</a></li>
|
|
||||||
<li><a href="#">期刊論文</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,4 +1,2 @@
|
||||||
|
|
||||||
<div class="subnav">
|
<%= render_plugin_list %>
|
||||||
<%= render :partial => 'plugin', :collection => @plugins %>
|
|
||||||
</div>
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<div class="member-plugin">
|
||||||
|
<% #binding.pry%>
|
||||||
|
<%= render :partial=> 'plugin_summary'%>
|
||||||
|
<%= render :partial=> 'plugin_summary'%>
|
||||||
|
<%= render :partial=> 'plugin_summary'%>
|
||||||
|
</div>
|
|
@ -6,22 +6,20 @@
|
||||||
<div class="arrow_prev pull-left"><i class="icon-chevron-left"></i></div>
|
<div class="arrow_prev pull-left"><i class="icon-chevron-left"></i></div>
|
||||||
<div class="module-nav-view">
|
<div class="module-nav-view">
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
<li class="active">
|
<%= content_tag :li,:class=>(params[:show_plugin_profile].nil? ? "active" : nil) do %>
|
||||||
<a href="#"><%= t("admin.new_admin.users.all_plugin_summary")%></a>
|
<%= link_to t("admin.new_admin.users.all_plugin_summary")%>
|
||||||
</li>
|
<%end -%>
|
||||||
<li><a href="#">學歷</a></li>
|
<% @plugins.each do |plugin|%>
|
||||||
<li><a href="#">學歷</a></li>
|
<%= content_tag :li,:class=>(params[:show_plugin_profile]==plugin.name ? "active" : nil) do %>
|
||||||
<li><a href="#">學歷</a></li>
|
<%= link_to plugin.name,:show_plugin_profile=> plugin.name %>
|
||||||
<li><a href="#">學歷</a></li>
|
<% end -%>
|
||||||
|
<%end -%>
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-plugin">
|
<%=render :partial=> @right_partial%>
|
||||||
<%= render :partial=> 'plugin_summary'%>
|
|
||||||
<%= render :partial=> 'plugin_summary'%>
|
|
||||||
<%= render :partial=> 'plugin_summary'%>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="user-info">
|
<div class="user-info">
|
||||||
<div id="brand" class="clear">
|
<div id="brand" class="clear">
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<%= content_tag :li, :class => active_for_controllers('cals','calendar_categories') || active_for_app_auth("calendar") do -%>
|
<%= content_tag :li, :class => active_for_controllers('cals') || active_for_app_auth("calendar") do -%>
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icons-calendar') + content_tag(:span, t('admin.calendar')), panel_calendar_back_end_cals_path %>
|
<%= link_to content_tag(:i, nil, :class => 'icons-calendar') + content_tag(:span, t('admin.calendar')), panel_calendar_back_end_cals_path %>
|
||||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('cals','calendar_categories') ) do -%>
|
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('cals','calendar_categories') ) do -%>
|
||||||
<%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %>
|
<%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %>
|
||||||
|
@ -116,6 +116,17 @@
|
||||||
<%#= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %>
|
<%#= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= content_tag :li, :class => active_for_controllers('locations') || active_for_app_auth("gprs") do -%>
|
||||||
|
<%= link_to content_tag(:i, nil, :class => 'icons-link') + content_tag(:span, t('admin.gprs')), panel_gprs_back_end_locations_path %>
|
||||||
|
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('locations') ) do -%>
|
||||||
|
<%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %>
|
||||||
|
<%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %>
|
||||||
|
<%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %>
|
||||||
|
<%#= content_tag :li, link_to((t('calendar.calendars') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_calendar_back_end_cal_path), :class => active_for_action('cals','new') %>
|
||||||
|
<%#= content_tag :li, link_to(t('gallery.tags'), panel_gallery_back_end_tags_path), :class => active_for_action('/panel/gallery/back_end/tags', 'index') %>
|
||||||
|
<%#= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %>
|
||||||
|
<% end -%>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= content_tag :li, :class => (active_for_controllers('writing_journals', '/panel/personal_journal/back_end/tags', 'writing_journal_categorys', 'approvals') || active_for_app_auth('PersonalJournal') ) do -%>
|
<%= content_tag :li, :class => (active_for_controllers('writing_journals', '/panel/personal_journal/back_end/tags', 'writing_journal_categorys', 'approvals') || active_for_app_auth('PersonalJournal') ) do -%>
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icons-personal_journal') + t('admin.personal_journal'), panel_personal_journal_back_end_writing_journals_path %>
|
<%= link_to content_tag(:i, nil, :class => 'icons-personal_journal') + t('admin.personal_journal'), panel_personal_journal_back_end_writing_journals_path %>
|
||||||
|
@ -157,6 +168,41 @@
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
<%= content_tag :li, :class => (active_for_controllers('researchs', '/panel/personal_research/back_end/tags', 'research_categorys', 'approvals') || active_for_app_auth('PersonalJournal') ) do -%>
|
||||||
|
<%= link_to content_tag(:i, nil, :class => 'icons-personal_research') + t('admin.personal_research'), panel_personal_research_back_end_researchs_path %>
|
||||||
|
<%= content_tag :ul, :class => ("nav nav-list " + (visible_for_controllers('researchs', '/panel/personal_research/back_end/tags', 'research_categorys', 'approvals'))) do -%>
|
||||||
|
<%= content_tag :li, link_to(t('personal_research.all_articles'), panel_personal_research_back_end_researchs_path), :class => active_for_action('researchs', 'index') %>
|
||||||
|
<%#= content_tag :li, link_to(t('personal_research.setting'), panel_personal_research_back_end_research_setting_path), :class => active_for_action('research_setting', 'index') %>
|
||||||
|
<%= content_tag :li, link_to(t('personal_research.tags'), panel_personal_research_back_end_tags_path), :class => active_for_action('/panel/personal_research/back_end/tags', 'index') %>
|
||||||
|
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
|
<%= content_tag :li, :class => (active_for_controllers('projects', '/panel/personal_project/back_end/tags', 'project_categorys', 'approvals') || active_for_app_auth('PersonalJournal') ) do -%>
|
||||||
|
<%= link_to content_tag(:i, nil, :class => 'icons-personal_project') + t('admin.personal_project'), panel_personal_project_back_end_projects_path %>
|
||||||
|
<%= content_tag :ul, :class => ("nav nav-list " + (visible_for_controllers('projects', '/panel/personal_project/back_end/tags', 'project_categorys', 'approvals'))) do -%>
|
||||||
|
<%= content_tag :li, link_to(t('personal_project.all_articles'), panel_personal_project_back_end_projects_path), :class => active_for_action('projects', 'index') %>
|
||||||
|
<%= content_tag :li, link_to(t('personal_project.setting'), panel_personal_project_back_end_project_setting_path), :class => active_for_action('project_setting', 'index') %>
|
||||||
|
<%= content_tag :li, link_to(t('personal_project.project_category'), panel_personal_project_back_end_project_categorys_path), :class => active_for_action('project_categorys', 'index') %>
|
||||||
|
<%= content_tag :li, link_to(t('personal_project.tags'), panel_personal_project_back_end_tags_path), :class => active_for_action('/panel/personal_project/back_end/tags', 'index') %>
|
||||||
|
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
|
<%= content_tag :li, :class => (active_for_controllers('writing_patents', '/panel/personal_patent/back_end/tags', 'writing_patent_categorys', 'approvals') || active_for_app_auth('PersonalJournal') ) do -%>
|
||||||
|
<%= link_to content_tag(:i, nil, :class => 'icons-personal_patent') + t('admin.personal_patent'), panel_personal_patent_back_end_writing_patents_path %>
|
||||||
|
<%= content_tag :ul, :class => ("nav nav-list " + (visible_for_controllers('writing_patents', '/panel/personal_patent/back_end/tags', 'writing_patent_categorys', 'approvals'))) do -%>
|
||||||
|
<%= content_tag :li, link_to(t('personal_patent.all_articles'), panel_personal_patent_back_end_writing_patents_path), :class => active_for_action('writing_patents', 'index') %>
|
||||||
|
<%= content_tag :li, link_to(t('personal_patent.setting'), panel_personal_patent_back_end_writing_patent_setting_path), :class => active_for_action('writing_patent_setting', 'index') %>
|
||||||
|
<%#= content_tag :li, link_to(t('personal_patent.writing_patent_category'), panel_personal_patent_back_end_writing_patent_categorys_path), :class => active_for_action('writing_patent_categorys', 'index') %>
|
||||||
|
<%= content_tag :li, link_to(t('personal_patent.tags'), panel_personal_patent_back_end_tags_path), :class => active_for_action('/panel/personal_patent/back_end/tags', 'index') %>
|
||||||
|
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<% flash.each do |key, msg| %>
|
<% flash.each do |key, msg| %>
|
||||||
<%= content_tag :span, msg, :class => [key, "notice label label-warning"] %>
|
<%= content_tag :span, msg, :class => [key, "notice label label-warning"] %>
|
||||||
|
|
|
@ -34,6 +34,9 @@ module Orbit
|
||||||
config.autoload_paths += %W(#{config.root}/app/models/purchase)
|
config.autoload_paths += %W(#{config.root}/app/models/purchase)
|
||||||
config.autoload_paths += %W(#{config.root}/app/models/user)
|
config.autoload_paths += %W(#{config.root}/app/models/user)
|
||||||
|
|
||||||
|
# Include all helpers
|
||||||
|
# 'helper :all' must be removed in ApplicationController
|
||||||
|
config.action_controller.include_all_helpers = false
|
||||||
|
|
||||||
# Only load the plugins named here, in the order given (default is alphabetical).
|
# 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.
|
# :all can be used as a placeholder for all plugins not explicitly named.
|
||||||
|
|
|
@ -130,6 +130,7 @@ en:
|
||||||
attributes: Attributes
|
attributes: Attributes
|
||||||
author: Author
|
author: Author
|
||||||
calendar: Calendar
|
calendar: Calendar
|
||||||
|
gprs: GPRS
|
||||||
cant_delete_self: You can not delete yourself.
|
cant_delete_self: You can not delete yourself.
|
||||||
cant_revoke_self_admin: You can not revoke your admin role yourself.
|
cant_revoke_self_admin: You can not revoke your admin role yourself.
|
||||||
category: Category
|
category: Category
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
require "orbit_app/summary"
|
||||||
|
require "orbit_app/dsl"
|
||||||
|
require "orbit_app/module/backend_side_bar"
|
||||||
|
require "orbit_app/plugin/summary"
|
||||||
|
require "orbit_app/plugin/registration"
|
||||||
|
require "orbit_app/module/summary"
|
||||||
|
require "orbit_app/module/registration"
|
||||||
|
|
||||||
|
module OrbitApp
|
||||||
|
extend DSL
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,26 @@
|
||||||
|
module OrbitApp
|
||||||
|
module DSL
|
||||||
|
def registration(name,type ={:type=> "ModuleApp"} ,&block)
|
||||||
|
if type[:type] == "ModuleApp"
|
||||||
|
Module::Registration.new(name,&block)
|
||||||
|
elsif type[:type] == "PersonalPlugin"
|
||||||
|
Plugin::Registration.new(name,&block)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# def backend_side_bar(name,&block)
|
||||||
|
# Module::BackendSideBar.new(name,&block)
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def plugin_summary(name,&block)
|
||||||
|
# # Plugin::PluginSummary.new(name,&block)
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def module_summary(name,&block)
|
||||||
|
# Module::Summary.new(name,&block)
|
||||||
|
# end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,17 @@
|
||||||
|
module OrbitApp
|
||||||
|
module Module
|
||||||
|
class BackendSideBar
|
||||||
|
attr_reader :name
|
||||||
|
|
||||||
|
def initialize(name, &block)
|
||||||
|
@name = name
|
||||||
|
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
||||||
|
end
|
||||||
|
|
||||||
|
# def personal_plugin(*args)
|
||||||
|
# binding.pry
|
||||||
|
# end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,54 @@
|
||||||
|
module OrbitApp
|
||||||
|
module Module
|
||||||
|
module Registration
|
||||||
|
Version = "0.1"
|
||||||
|
|
||||||
|
module ClassMethods
|
||||||
|
@@registrations = []
|
||||||
|
|
||||||
|
def new( name ,&block)
|
||||||
|
@@registrations << DataSheet.new(name,&block)
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_by_key(key)
|
||||||
|
@@registrations.each{|t|
|
||||||
|
return t if t.name == key
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def all
|
||||||
|
return @@registrations
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
extend ClassMethods
|
||||||
|
def self.included( other )
|
||||||
|
other.extend( ClassMethods )
|
||||||
|
end
|
||||||
|
|
||||||
|
class DataSheet
|
||||||
|
attr_reader :name
|
||||||
|
attr_reader :base_path
|
||||||
|
|
||||||
|
def initialize(name, &block)
|
||||||
|
@name = name
|
||||||
|
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
||||||
|
end
|
||||||
|
|
||||||
|
def plugin
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def personal_plugin(params)
|
||||||
|
# TODO 這裡要看是一些檔案是不是都有
|
||||||
|
Plugin::Registration.new_from_module_app(@name,@base_path,params)
|
||||||
|
end
|
||||||
|
|
||||||
|
def base_url(var)
|
||||||
|
@base_path = var
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,20 @@
|
||||||
|
#encoding: utf-8
|
||||||
|
require "orbit_app/summary"
|
||||||
|
|
||||||
|
module OrbitApp
|
||||||
|
module Module
|
||||||
|
module Summary
|
||||||
|
include OrbitApp::Summary
|
||||||
|
|
||||||
|
class Item
|
||||||
|
def initialize()
|
||||||
|
@top = {:label => "全部內容有",:value=> "2071"}
|
||||||
|
@items = [{:label => "新聞",:value=> "20"}]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,58 @@
|
||||||
|
module OrbitApp
|
||||||
|
module Plugin
|
||||||
|
module Registration
|
||||||
|
Version = "0.1"
|
||||||
|
|
||||||
|
module ClassMethods
|
||||||
|
@@registrations = []
|
||||||
|
|
||||||
|
def new( name ,&block)
|
||||||
|
@@registrations << DataSheet.new(name,&block)
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_from_module_app(name,base_path,arg)
|
||||||
|
@@registrations << DataSheet.new(name,arg,:base_path=>base_path)
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_by_key(key)
|
||||||
|
@@registrations.each{|t|
|
||||||
|
return t if t.name == key
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def all
|
||||||
|
return @@registrations
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
extend ClassMethods
|
||||||
|
def self.included( other )
|
||||||
|
other.extend( ClassMethods )
|
||||||
|
end
|
||||||
|
|
||||||
|
class DataSheet
|
||||||
|
attr_reader :name
|
||||||
|
attr_reader :base_path
|
||||||
|
|
||||||
|
|
||||||
|
def initialize(name,partial=nil,*args ,&block)
|
||||||
|
@base_path = args[0][:base_path]
|
||||||
|
@name = name
|
||||||
|
@partial_path = ''
|
||||||
|
|
||||||
|
unless partial.nil?
|
||||||
|
@partial_path = partial[:path]
|
||||||
|
end
|
||||||
|
|
||||||
|
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
||||||
|
end
|
||||||
|
|
||||||
|
def profile_partial_path
|
||||||
|
return @partial_path
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,11 @@
|
||||||
|
require "orbit_app/summary"
|
||||||
|
|
||||||
|
module OrbitApp
|
||||||
|
module Plugin
|
||||||
|
module Summary
|
||||||
|
# include OrbitApp::Summary
|
||||||
|
include OrbitApp::Summary
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,46 @@
|
||||||
|
module OrbitApp
|
||||||
|
module Summary
|
||||||
|
Version = "0.1"
|
||||||
|
|
||||||
|
module ClassMethods
|
||||||
|
@@summaries = []
|
||||||
|
|
||||||
|
def new( name ,&block)
|
||||||
|
@@summaries << Item.new(name,&block)
|
||||||
|
binding.pry
|
||||||
|
end
|
||||||
|
|
||||||
|
def all
|
||||||
|
return @@summaries
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
extend ClassMethods
|
||||||
|
def self.included( other )
|
||||||
|
other.extend( ClassMethods )
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# def initialize( k )
|
||||||
|
# @@summaries += 1
|
||||||
|
# binding.pry
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
|
class Item
|
||||||
|
@name =""
|
||||||
|
def initialize(name = "test",&block)
|
||||||
|
@name = name
|
||||||
|
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_name
|
||||||
|
return @name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,33 +1,35 @@
|
||||||
<div id='filter' class="subnav">
|
<div id='filter' class="subnav">
|
||||||
<ul class="nav nav-pills filter">
|
<div id="accordion">
|
||||||
<li class="accordion-group">
|
<ul class="nav nav-pills filter">
|
||||||
<div class="accordion-heading">
|
<li>
|
||||||
<a href="#collapse-status" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><%= t("announcement.status") %> <b class="web-symbol"></b></a>
|
<div class="accordion-heading">
|
||||||
|
<a href="#collapse-status" data-toggle="collapse" data-parent="#accordion" class="accordion-toggle"><%= t("announcement.status") %> <b class="web-symbol"></b></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div class="accordion-heading">
|
||||||
|
<a href="#collapse-category" data-toggle="collapse" data-parent="#accordion" class="accordion-toggle"><%= t("announcement.categories") %> <b class="web-symbol"></b></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div class="accordion-heading">
|
||||||
|
<a href="#collapse-tags" data-toggle="collapse" data-parent="#accordion" class="accordion-toggle"><%= t("announcement.tags") %> <b class="web-symbol"></b></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="accordion-group filters">
|
||||||
|
<div class="accordion-body collapse" id="collapse-status">
|
||||||
|
<%= render 'filter_status' %>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
<div class="accordion-body collapse" id="collapse-category">
|
||||||
<li class="accordion-group">
|
<%= render 'filter_categories' %>
|
||||||
<div class="accordion-heading">
|
|
||||||
<a href="#collapse-category" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><%= t("announcement.categories") %> <b class="web-symbol"></b></a>
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
<div class="accordion-body collapse" id="collapse-tags">
|
||||||
<li class="accordion-group">
|
<%= render 'filter_tags' %>
|
||||||
<div class="accordion-heading">
|
</div>
|
||||||
<a href="#collapse-tags" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><%= t("announcement.tags") %> <b class="web-symbol"></b></a>
|
<div id="sort_headers" class="table-label">
|
||||||
|
<%= render 'sort_headers' %>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<div class="filters">
|
|
||||||
<div class="accordion-body collapse" id="collapse-status">
|
|
||||||
<%= render 'filter_status' %>
|
|
||||||
</div>
|
|
||||||
<div class="accordion-body collapse" id="collapse-category">
|
|
||||||
<%= render 'filter_categories' %>
|
|
||||||
</div>
|
|
||||||
<div class="accordion-body collapse" id="collapse-tags">
|
|
||||||
<%= render 'filter_tags' %>
|
|
||||||
</div>
|
|
||||||
<div id="sort_headers" class="table-label">
|
|
||||||
<%= render 'sort_headers' %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
<ul class="nav nav-tabs">
|
<ul class="nav nav-tabs">
|
||||||
<%# @site_valid_locales.each_with_index do |locale, i| %>
|
<%# @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
<li <%= ( i == 0 ) ? " class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
1
vendor/built_in_modules/announcement/app/views/panel/announcement/plugin/_profile.html.erb
vendored
Normal file
1
vendor/built_in_modules/announcement/app/views/panel/announcement/plugin/_profile.html.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Hello~ I am your plugin profile
|
|
@ -0,0 +1,25 @@
|
||||||
|
module Announcement
|
||||||
|
OrbitApp.registration "Announcement",:type=> 'ModuleApp' do
|
||||||
|
|
||||||
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
|
personal_plugin :enable => true,:path=>"panel/announcement/plugin/profile"
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# OrbitApp.backend_side_bar 'News' do
|
||||||
|
|
||||||
|
# block :available_for => [:admin,:guest,:manager,:sub_manager],
|
||||||
|
# :active_for_controllers=> ['news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals'],
|
||||||
|
# :active_for_ob_auths_object => ['NewsBulletinCategory'],
|
||||||
|
# :head_link => panel_news_back_end_news_bulletins_path ,
|
||||||
|
# :head_label=> I18n.t('admin.news')
|
||||||
|
|
||||||
|
# context_link :link=>new_panel_news_back_end_news_bulletin_path ,
|
||||||
|
# :priority=>1,:label=>I18n.t('announcement.add_new'),
|
||||||
|
# :active_for_action=>{:news_bulletins=>:new}
|
||||||
|
|
||||||
|
# end
|
|
@ -1,4 +0,0 @@
|
||||||
require "announcement/engine"
|
|
||||||
|
|
||||||
module Announcement
|
|
||||||
end
|
|
|
@ -1,21 +1,52 @@
|
||||||
//created on sep 14 2012
|
//created on sep 14 2012
|
||||||
|
Date.prototype.getWeek = function (dowOffset) {
|
||||||
|
/*getWeek() was developed by Nick Baicoianu at MeanFreePath: http://www.epoch-calendar.com */
|
||||||
|
|
||||||
|
dowOffset = typeof(dowOffset) == 'int' ? dowOffset : 0; //default dowOffset to zero
|
||||||
|
var newYear = new Date(this.getFullYear(),0,1);
|
||||||
|
var day = newYear.getDay() - dowOffset; //the day of week the year begins on
|
||||||
|
day = (day >= 0 ? day : day + 7);
|
||||||
|
var daynum = Math.floor((this.getTime() - newYear.getTime() -
|
||||||
|
(this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1;
|
||||||
|
var weeknum;
|
||||||
|
//if the year starts before the middle of a week
|
||||||
|
if(day < 4) {
|
||||||
|
weeknum = Math.floor((daynum+day-1)/7) + 1;
|
||||||
|
if(weeknum > 52) {
|
||||||
|
nYear = new Date(this.getFullYear() + 1,0,1);
|
||||||
|
nday = nYear.getDay() - dowOffset;
|
||||||
|
nday = nday >= 0 ? nday : nday + 7;
|
||||||
|
/*if the next year starts before the middle of
|
||||||
|
the week, it is week #1 of that year*/
|
||||||
|
weeknum = nday < 4 ? 1 : 53;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
weeknum = Math.floor((daynum+day-1)/7);
|
||||||
|
}
|
||||||
|
return weeknum;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
var calendarAPI = function(){
|
var calendarAPI = function(){
|
||||||
c = this;
|
c = this;
|
||||||
this.event_create_div = $("#event_create");
|
this.event_create_div = $("#event_create");
|
||||||
this.event_quick_view_div = $("#event_quick_view");
|
this.event_quick_view_div = $("#event_quick_view");
|
||||||
this.cur_month = null;
|
|
||||||
this.cur_year = null;
|
|
||||||
this.today = new Date();
|
this.today = new Date();
|
||||||
|
this.cur_month = c.today.getMonth()+1;
|
||||||
|
this.cur_year = c.today.getFullYear();
|
||||||
|
this.cur_week = c.today.getWeek();
|
||||||
|
this.view = null;
|
||||||
this.monthlist = ["","January","February","March","April","May","June","July","August","September","October","November","December"];
|
this.monthlist = ["","January","February","March","April","May","June","July","August","September","October","November","December"];
|
||||||
this.initialize = function(){
|
this.initialize = function(){
|
||||||
$(window).load(function(){
|
$(window).load(function(){
|
||||||
c.loadMonthView();
|
// c.loadMonthView(c.cur_month,c.cur_year);
|
||||||
|
c.loadWeekView(c.cur_week,c.cur_year);
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
})
|
})
|
||||||
var bindHandlers = function(){
|
var bindHandlers = function(){
|
||||||
$(".event").live("click",function(){
|
$(".event").live("click",function(){
|
||||||
c.displayEvent();
|
c.displayEvent($(this));
|
||||||
})
|
})
|
||||||
|
|
||||||
$("#create_event_btn").click(function(){
|
$("#create_event_btn").click(function(){
|
||||||
|
@ -39,7 +70,7 @@ var calendarAPI = function(){
|
||||||
c.loadMonthView(c.cur_month,c.cur_year);
|
c.loadMonthView(c.cur_month,c.cur_year);
|
||||||
break;
|
break;
|
||||||
case 'week':
|
case 'week':
|
||||||
c.loadWeekView();
|
c.loadWeekView(c.cur_week,c.cur_year);
|
||||||
break;
|
break;
|
||||||
case 'day':
|
case 'day':
|
||||||
c.loadDayView();
|
c.loadDayView();
|
||||||
|
@ -50,26 +81,58 @@ var calendarAPI = function(){
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
$("button#prev_month_btn").click(function(){
|
$("button#prev_month_btn").click(function(){
|
||||||
var m,y;
|
switch (c.view){
|
||||||
if(c.cur_month == 1){
|
case "month":
|
||||||
m = 12;
|
var m,y;
|
||||||
y = c.cur_year-1;
|
if(c.cur_month == 1){
|
||||||
}else{
|
m = 12;
|
||||||
m = c.cur_month-1;
|
y = c.cur_year-1;
|
||||||
y = c.cur_year;
|
}else{
|
||||||
|
m = c.cur_month-1;
|
||||||
|
y = c.cur_year;
|
||||||
|
}
|
||||||
|
c.loadMonthView(m,y);
|
||||||
|
break;
|
||||||
|
case "week":
|
||||||
|
var w,y;
|
||||||
|
if(c.cur_week == 1){
|
||||||
|
w = 52;
|
||||||
|
y = c.cur_year - 1;
|
||||||
|
}else{
|
||||||
|
w = c.cur_week - 1;
|
||||||
|
y = c.cur_year;
|
||||||
|
}
|
||||||
|
c.loadWeekView(w,y);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
c.loadMonthView(m,y);
|
|
||||||
})
|
})
|
||||||
$("button#next_month_btn").click(function(){
|
$("button#next_month_btn").click(function(){
|
||||||
var m,y;
|
switch (c.view){
|
||||||
if(c.cur_month == 12){
|
case "month":
|
||||||
m = 1;
|
var m,y;
|
||||||
y = c.cur_year+1;
|
if(c.cur_month == 12){
|
||||||
}else{
|
m = 1;
|
||||||
m = c.cur_month+1;
|
y = c.cur_year+1;
|
||||||
y = c.cur_year;
|
}else{
|
||||||
|
m = c.cur_month+1;
|
||||||
|
y = c.cur_year;
|
||||||
|
}
|
||||||
|
c.loadMonthView(m,y);
|
||||||
|
break;
|
||||||
|
case "week":
|
||||||
|
var w,y;
|
||||||
|
|
||||||
|
if(c.cur_week == 52){
|
||||||
|
w = 1;
|
||||||
|
y = c.cur_year + 1;
|
||||||
|
}else{
|
||||||
|
w = c.cur_week + 1;
|
||||||
|
y = c.cur_year;
|
||||||
|
}
|
||||||
|
c.loadWeekView(w,y);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
c.loadMonthView(m,y);
|
|
||||||
})
|
})
|
||||||
$("button#today_btn").click(function(){
|
$("button#today_btn").click(function(){
|
||||||
c.loadMonthView();
|
c.loadMonthView();
|
||||||
|
@ -77,17 +140,18 @@ var calendarAPI = function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.loadMonthView = function(month,year){
|
this.loadMonthView = function(month,year){
|
||||||
|
c.view = "month";
|
||||||
if(!month){
|
if(!month){
|
||||||
var dt = new Date();
|
var dt = new Date();
|
||||||
month = dt.getMonth()+1;
|
month = dt.getMonth()+1;
|
||||||
year = dt.getFullYear();
|
year = dt.getFullYear();
|
||||||
}
|
}
|
||||||
// month = 2;
|
// month = 10;
|
||||||
// year = 2008;
|
// year = 2008;
|
||||||
c.cur_month = month;
|
c.cur_month = month;
|
||||||
c.cur_year = year;
|
c.cur_year = year;
|
||||||
$('#view_holder').load("cals/month_view?month="+month+"&year="+year, function() {
|
$('#view_holder').load("cals/month_view?month="+month+"&year="+year, function() {
|
||||||
getEvents(month,year);
|
c.getEventsForMonth(month,year);
|
||||||
$('.current_day_title').text(c.monthlist[c.cur_month]+" "+c.cur_year);
|
$('.current_day_title').text(c.monthlist[c.cur_month]+" "+c.cur_year);
|
||||||
if($('#calendar_month').length > 0){
|
if($('#calendar_month').length > 0){
|
||||||
var $c_table = $('#calendar_month');
|
var $c_table = $('#calendar_month');
|
||||||
|
@ -111,49 +175,129 @@ var calendarAPI = function(){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
var getEvents = function(month,year){
|
|
||||||
$.getJSON("cals/getEvents",{"type":"monthview","month":month,"year":year},function(events){
|
}
|
||||||
var $eventrow = $("<tr></tr>");
|
|
||||||
var nos = new Array();
|
|
||||||
nos.push(0);
|
this.getEventsForMonth = function(month,year){
|
||||||
$.each(events,function(i,evnt){
|
$.getJSON("cals/getMonthEvents",{"month":month,"year":year},function(events){
|
||||||
var daydom = $("#calendar_month td[date="+evnt.start_date+"]");
|
makerow(events);
|
||||||
var curparent = daydom.parent().parent().parent();
|
})
|
||||||
var thisrow = curparent.attr("row");
|
var doneEventArray = new Array();
|
||||||
var pos = daydom.attr("position");
|
var makerow = function(events){
|
||||||
var thisno = daydom.attr("no");
|
var $eventrow =null;
|
||||||
|
var currow = 0;
|
||||||
var index = "new";
|
var curdate = 0;
|
||||||
for(x in nos){
|
var allow = false;
|
||||||
if(thisno < nos[x]){
|
var curparent = null;
|
||||||
$eventrow = null;
|
var lastno = 0;
|
||||||
$eventrow = $("<tr></tr>");
|
var indexcount = events.length;
|
||||||
index = x;
|
$.each(events,function(i,evnt){
|
||||||
break;
|
indexcount++;
|
||||||
}
|
if($.inArray(evnt.index,doneEventArray) == -1){
|
||||||
}
|
|
||||||
if(index!="new"){
|
|
||||||
nos[index] = (thisno + evnt.total_days) - 1;
|
|
||||||
}else{
|
|
||||||
nos.push((thisno + evnt.total_days) - 1);
|
|
||||||
}
|
|
||||||
if(pos == 1){
|
|
||||||
$eventrow.html('<td colspan="'+evnt.total_days+'"><div class="event" style="background-color: '+evnt.color+';">'+evnt.title+'</div></td>');
|
|
||||||
}else{
|
|
||||||
if($eventrow.html()==""){
|
|
||||||
$eventrow.append('<td colspan="'+(pos-1)+'">');
|
|
||||||
}
|
|
||||||
$eventrow.append('<td colspan="'+evnt.total_days+'"><div class="event" style="background-color: '+evnt.color+';">'+evnt.title+'</div></td>');
|
|
||||||
}
|
|
||||||
|
|
||||||
curparent.append($eventrow);
|
var daydom = $("#calendar_month td[date="+evnt.start_date+"]");
|
||||||
})
|
var thisparent = daydom.parent().parent().parent();
|
||||||
|
var thisrow = thisparent.attr("row");
|
||||||
|
var pos = parseInt(daydom.attr("position"));
|
||||||
|
var thisno = daydom.attr("no");
|
||||||
|
if(thisrow != currow){
|
||||||
|
if(curparent){
|
||||||
|
curparent.append($eventrow);
|
||||||
|
}
|
||||||
|
$eventrow = null;
|
||||||
|
$eventrow = $("<tr class='event_row'></tr>");
|
||||||
|
allow = true;
|
||||||
|
}else if(evnt.start_date > curdate){
|
||||||
|
allow = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
var recordcurdate = true;
|
||||||
|
|
||||||
|
if(allow){
|
||||||
|
if(pos == 1){
|
||||||
|
var colspan = 0;
|
||||||
|
if(evnt.total_days>7){
|
||||||
|
colspan = 7;
|
||||||
|
var totaldays = parseInt(evnt.total_days) - colspan;
|
||||||
|
var stardate = parseInt(evnt.start_date) + colspan;
|
||||||
|
var index = i + 1;
|
||||||
|
var tempArray = {"index":indexcount,"id":evnt.id,"start_date":stardate,"total_days":totaldays,"title":evnt.title,"color":evnt.color,"show_link":evnt.show_link};
|
||||||
|
events.splice(index,0,tempArray);
|
||||||
|
//recordcurdate = false;
|
||||||
|
}else{
|
||||||
|
colspan = evnt.total_days;
|
||||||
|
}
|
||||||
|
$eventrow.html('<td colspan="'+colspan+'" class="main_td" pos="'+pos+'"><div class="event" link="'+evnt.show_link+'" style="background-color: '+evnt.color+';">'+evnt.title+'</div></td>');
|
||||||
|
}else{
|
||||||
|
if($eventrow.html()==""){
|
||||||
|
$eventrow.append('<td colspan="'+(pos-1)+'">');
|
||||||
|
}else{
|
||||||
|
if((lastno+1)!=thisno){
|
||||||
|
var inposition = parseInt($eventrow.find("td.main_td:last").attr("pos"));
|
||||||
|
var curcolspan = $eventrow.find("td.main_td:last").attr("colspan");
|
||||||
|
var colspan = pos - (inposition+parseInt(curcolspan));
|
||||||
|
$eventrow.append('<td colspan="'+colspan+'">');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var colspan = 0;
|
||||||
|
if((pos + parseInt(evnt.total_days))-1 > 7){
|
||||||
|
colspan = 7-(pos-1);
|
||||||
|
var totaldays = parseInt(evnt.total_days) - colspan;
|
||||||
|
var stardate = parseInt(evnt.start_date) + colspan;
|
||||||
|
|
||||||
|
var index = i + 1;
|
||||||
|
var tempArray = {"index":indexcount,"id":evnt.id,"start_date":stardate,"total_days":totaldays,"title":evnt.title,"color":evnt.color,"show_link":evnt.show_link};
|
||||||
|
events.splice(index,0,tempArray);
|
||||||
|
// recordcurdate = false;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
colspan = evnt.total_days;
|
||||||
|
}
|
||||||
|
// if(evnt.title == "Again")
|
||||||
|
// console.log(colspan);
|
||||||
|
$eventrow.append('<td colspan="'+colspan+'" class="main_td" pos="'+pos+'"><div link="'+evnt.show_link+'" class="event" style="background-color: '+evnt.color+';">'+evnt.title+'</div></td>');
|
||||||
|
}
|
||||||
|
lastno = (parseInt(thisno) + parseInt(evnt.total_days)) - 1;
|
||||||
|
currow = thisrow;
|
||||||
|
curdate =(evnt.start_date + evnt.total_days) - 1;
|
||||||
|
allow = false;
|
||||||
|
curparent = thisparent;
|
||||||
|
if(recordcurdate)
|
||||||
|
doneEventArray.push(evnt.index);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
if(curparent){
|
||||||
|
curparent.append($eventrow);
|
||||||
|
}
|
||||||
|
if(events.length != doneEventArray.length){
|
||||||
|
makerow(events);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.loadWeekView = function(){
|
|
||||||
$('#view_holder').load("cals/week_view", function() {
|
this.loadWeekView = function(week,year){
|
||||||
$('.current_day_title').text('September 2 - 8, 2012');
|
c.view = "week";
|
||||||
|
if(!week){
|
||||||
|
var dt = new Date();
|
||||||
|
week = dt.getWeek();
|
||||||
|
year = dt.getFullYear();
|
||||||
|
}
|
||||||
|
|
||||||
|
c.cur_week = week;
|
||||||
|
c.cur_year = year;
|
||||||
|
|
||||||
|
$('#view_holder').load("cals/week_view?week="+week+"&year="+year, function() {
|
||||||
|
$('.current_day_title').text($("#week_range").text());
|
||||||
|
c.getEventsForWeek(week,year);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.getEventsForWeek = function(week,year){
|
||||||
|
$.getJSON("cals/getWeekEvents",{"week":week,"year":year},function(events){
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.loadDayView = function(){
|
this.loadDayView = function(){
|
||||||
|
@ -195,10 +339,16 @@ var calendarAPI = function(){
|
||||||
$("tr[for="+domfor+"]").remove();
|
$("tr[for="+domfor+"]").remove();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.displayEvent = function(){
|
this.displayEvent = function(dom){
|
||||||
|
var url = dom.attr("link");
|
||||||
c.event_quick_view_div.show()
|
c.event_quick_view_div.load(url,function(){
|
||||||
|
c.event_quick_view_div.show()
|
||||||
|
c.event_quick_view_div.find(".event-close-btn").click(function(){
|
||||||
|
c.event_quick_view_div.empty().hide();
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
c.initialize();
|
c.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@
|
||||||
|
|
||||||
/* Event Controller */
|
/* Event Controller */
|
||||||
.event_controller {
|
.event_controller {
|
||||||
width: 300px;
|
width: 350px;
|
||||||
}
|
}
|
||||||
.event_controller .row-fluid {
|
.event_controller .row-fluid {
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
|
|
|
@ -30,6 +30,10 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
||||||
end
|
end
|
||||||
|
|
||||||
def week_view
|
def week_view
|
||||||
|
week = params[:week]
|
||||||
|
year = params[:year]
|
||||||
|
@dates = week_dates(week,year)
|
||||||
|
@range = week_range(week,year)
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -47,7 +51,6 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
||||||
cur_month_days = getMonthDays(year)
|
cur_month_days = getMonthDays(year)
|
||||||
@post_disabled_days = @pre_disabled_days + cur_month_days[month]
|
@post_disabled_days = @pre_disabled_days + cur_month_days[month]
|
||||||
@dateset = getDateSet(month,year)
|
@dateset = getDateSet(month,year)
|
||||||
|
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -55,22 +58,68 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_events
|
def get_month_events
|
||||||
month = params[:month]
|
month = params[:month]
|
||||||
year = params[:year]
|
year = params[:year]
|
||||||
events = Event.where(:start_month => month).and(:start_year => year)
|
month = month.to_i
|
||||||
|
year = year.to_i
|
||||||
|
events = Event.where(:start_month.lt => month).and(:start_year => year).and(:end_month.gte => month).asc(:start_date).desc(:total_days)
|
||||||
@events = Array.new
|
@events = Array.new
|
||||||
events.each do |event|
|
no_of_days_in_month = getMonthDays(year)
|
||||||
|
events.each_with_index do |event,i|
|
||||||
|
no_of_days = event.total_days
|
||||||
|
|
||||||
|
if event.end_month > month
|
||||||
|
no_of_days = no_of_days_in_month[month]
|
||||||
|
elsif event.end_month == month
|
||||||
|
no_of_days = event.end_date
|
||||||
|
end
|
||||||
|
|
||||||
|
no_of_days = no_of_days.to_i
|
||||||
|
|
||||||
|
color = Cal.find(event.cal_id).color
|
||||||
|
@events << {"id"=>event.id,"index"=>i,"start_date"=>"1", "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event)}
|
||||||
|
end
|
||||||
|
events = Event.where(:start_month => month).and(:start_year => year).asc(:start_date).desc(:total_days)
|
||||||
|
events.each_with_index do |event,i|
|
||||||
# @temp = Array.new
|
# @temp = Array.new
|
||||||
no_of_days = Date.new(event.end_year,event.end_month,event.end_date) - Date.new(event.start_year,event.start_month,event.start_date)
|
no_of_days = event.total_days
|
||||||
|
if event.end_month > month
|
||||||
|
no_of_days = no_of_days_in_month[month] - event.start_date
|
||||||
|
end
|
||||||
no_of_days = no_of_days.to_i
|
no_of_days = no_of_days.to_i
|
||||||
no_of_days += 1
|
no_of_days += 1
|
||||||
color = Cal.find(event.cal_id).color
|
color = Cal.find(event.cal_id).color
|
||||||
@events << {"start_date"=>event.start_date, "total_days" => no_of_days, "title" => event.title,"color"=>color}
|
@events << {"id"=>event.id,"index"=>i,"start_date"=>event.start_date, "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event)}
|
||||||
end
|
end
|
||||||
|
|
||||||
render :json => @events.to_json
|
render :json => @events.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_week_events
|
||||||
|
week = params[:week]
|
||||||
|
year = params[:year]
|
||||||
|
events = Event.where(:start_week => week).and(:start_year => year)
|
||||||
|
render :json => events.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def week_number_test
|
||||||
|
events = Event.all
|
||||||
|
|
||||||
|
events.each do |event|
|
||||||
|
dt = Date.new(event.start_year,event.start_month,event.start_date)
|
||||||
|
sweeknumber = dt.strftime("%U")
|
||||||
|
dt = Date.new(event.end_year,event.end_month,event.end_date)
|
||||||
|
eweeknumber = dt.strftime("%U")
|
||||||
|
event.start_week = sweeknumber
|
||||||
|
event.end_week = eweeknumber
|
||||||
|
event.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
dt = Date.new(2012,10,4)
|
||||||
|
@week = dt.strftime("%U")
|
||||||
|
render :text => @week.to_s
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class Panel::Calendar::BackEnd::EventsController < OrbitBackendController
|
class Panel::Calendar::BackEnd::EventsController < OrbitBackendController
|
||||||
|
include Panel::Calendar::BackEnd::CalsHelper
|
||||||
def new
|
def new
|
||||||
@calendars = Cal.all
|
@calendars = Cal.all
|
||||||
@event = Event.new
|
@event = Event.new
|
||||||
|
@ -23,8 +23,9 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController
|
||||||
temp = $start.split("/")
|
temp = $start.split("/")
|
||||||
start_date = temp[0]
|
start_date = temp[0]
|
||||||
start_month = temp[1]
|
start_month = temp[1]
|
||||||
star_year = temp[2]
|
start_year = temp[2]
|
||||||
|
@m = start_month
|
||||||
|
@y = start_year
|
||||||
temp = $end.split("/")
|
temp = $end.split("/")
|
||||||
end_date = temp[0]
|
end_date = temp[0]
|
||||||
end_month = temp[1]
|
end_month = temp[1]
|
||||||
|
@ -35,10 +36,22 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController
|
||||||
|
|
||||||
cal_id = params[:event][:cal_id]
|
cal_id = params[:event][:cal_id]
|
||||||
|
|
||||||
|
# if start_am_pm == "PM"
|
||||||
|
# temp_start_time = $starttime + 12
|
||||||
|
# end
|
||||||
|
# if end_am_pm == "PM"
|
||||||
|
# temp_end_time = $endtime + 12
|
||||||
|
# end
|
||||||
|
|
||||||
|
final_start_time = Date.new(start_year.to_i,start_month.to_i,start_date.to_i)
|
||||||
|
final_end_time = Date.new(end_year.to_i,end_month.to_i,end_date.to_i)
|
||||||
|
start_week = final_start_time.strftime("%U")
|
||||||
|
end_week = final_end_time.strftime("%U")
|
||||||
|
total_days = final_end_time - final_start_time
|
||||||
@event = Event.new
|
@event = Event.new
|
||||||
@event.title = title
|
@event.title = title
|
||||||
@event.note = note
|
@event.note = note
|
||||||
@event.start_year = star_year
|
@event.start_year = start_year
|
||||||
@event.end_year = end_year
|
@event.end_year = end_year
|
||||||
@event.start_month = start_month
|
@event.start_month = start_month
|
||||||
@event.end_month = end_month
|
@event.end_month = end_month
|
||||||
|
@ -49,10 +62,25 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController
|
||||||
@event.end_time = $endtime
|
@event.end_time = $endtime
|
||||||
@event.end_am_pm = end_am_pm
|
@event.end_am_pm = end_am_pm
|
||||||
@event.cal_id = cal_id
|
@event.cal_id = cal_id
|
||||||
|
@event.final_start_time = final_start_time
|
||||||
|
@event.final_end_time = final_end_time
|
||||||
|
@event.total_days = total_days
|
||||||
|
@event.start_week = start_week
|
||||||
|
@event.end_week = end_week
|
||||||
@event.save!
|
@event.save!
|
||||||
|
|
||||||
respond_to do |h|
|
respond_to do |h|
|
||||||
h.js
|
h.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
def show
|
||||||
|
@event = Event.find(params[:id])
|
||||||
|
@start_month_name = Date::ABBR_MONTHNAMES[@event.start_month]
|
||||||
|
@end_month_name = Date::ABBR_MONTHNAMES[@event.end_month]
|
||||||
|
@start_day_name = getDayName(@event.start_date,@event.start_month,@event.start_year)
|
||||||
|
@end_day_name = getDayName(@event.end_date,@event.end_month,@event.end_year)
|
||||||
|
render :layout=>false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,4 +62,78 @@ module Panel::Calendar::BackEnd::CalsHelper
|
||||||
return monthsdays
|
return monthsdays
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
def getDayName(date,month,year)
|
||||||
|
date = date.to_i
|
||||||
|
month = month.to_i
|
||||||
|
year = year.to_i
|
||||||
|
dt = Date.new(year,month,date)
|
||||||
|
name = Date::ABBR_DAYNAMES[dt.wday]
|
||||||
|
return name
|
||||||
|
end
|
||||||
|
|
||||||
|
def week_dates(week_num,year)
|
||||||
|
year = year.to_i
|
||||||
|
week_num = week_num.to_i
|
||||||
|
dates = Array.new
|
||||||
|
|
||||||
|
if week_num == 1
|
||||||
|
weekstartday = monthStartDay(1,year)
|
||||||
|
d = 31
|
||||||
|
x = 0
|
||||||
|
for i in d - (weekstartday - 2)..d
|
||||||
|
dates << Date::ABBR_DAYNAMES[x] + " 12/" + i.to_s
|
||||||
|
x = x + 1
|
||||||
|
end
|
||||||
|
for i in 1..8 - weekstartday
|
||||||
|
dates << Date::ABBR_DAYNAMES[x] + " 1/" + i.to_s
|
||||||
|
x = x + 1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
week_start = Date.commercial(year, week_num-1, 7)
|
||||||
|
month = week_start.strftime("%m")
|
||||||
|
month_days = getMonthDays(year)
|
||||||
|
date = week_start.strftime("%d")
|
||||||
|
x = date.to_i
|
||||||
|
for i in 0..6
|
||||||
|
d = x + i
|
||||||
|
if d > month_days[month.to_i]
|
||||||
|
d = d - month_days[month.to_i]
|
||||||
|
end
|
||||||
|
dates << Date::ABBR_DAYNAMES[i] + " " + month + "/" + d.to_s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
dates
|
||||||
|
end
|
||||||
|
|
||||||
|
def week_range(week_num,year)
|
||||||
|
year = year.to_i
|
||||||
|
week_num = week_num.to_i
|
||||||
|
if week_num == 1
|
||||||
|
weekstartday = monthStartDay(1,year)
|
||||||
|
start_date = 31 - (weekstartday - 2)
|
||||||
|
start_year = year - 1
|
||||||
|
end_date = 8 - weekstartday
|
||||||
|
range = "Dec " + start_date.to_s + ", " + start_year.to_s + " - " + "Jan " + end_date.to_s + ", " + year.to_s
|
||||||
|
else
|
||||||
|
week_start = Date.commercial(year, week_num-1, 7)
|
||||||
|
week_end = Date.commercial(year, week_num, 7)
|
||||||
|
week_end = week_end - 1
|
||||||
|
start_date = week_start.strftime("%d")
|
||||||
|
end_date = week_end.strftime("%d")
|
||||||
|
start_month = week_start.strftime("%m")
|
||||||
|
end_month = week_end.strftime("%m")
|
||||||
|
|
||||||
|
if end_month == start_month
|
||||||
|
range = Date::ABBR_MONTHNAMES[start_month.to_i] + " " + start_date.to_s + " - " + end_date.to_s + ", " + week_start.strftime("%Y").to_s
|
||||||
|
else
|
||||||
|
range = Date::ABBR_MONTHNAMES[start_month.to_i] + " " + start_date.to_s + " - " + Date::ABBR_MONTHNAMES[end_month.to_i] + " " + end_date.to_s + ", " + week_start.strftime("%Y").to_s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
range
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,11 @@ class Event
|
||||||
field :start_am_pm
|
field :start_am_pm
|
||||||
field :end_time, type: Float
|
field :end_time, type: Float
|
||||||
field :end_am_pm
|
field :end_am_pm
|
||||||
|
field :start_week, type: Integer
|
||||||
|
field :end_week, type: Integer
|
||||||
|
field :final_start_time, type: Date
|
||||||
|
field :final_end_time, type: Date
|
||||||
|
field :total_days, type: Integer
|
||||||
|
|
||||||
belongs_to :cal
|
belongs_to :cal
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="event_create" class="modal" style="right: 8px; bottom: 50px; left: auto; top: auto; width: 330px; margin: 0;display:none;"></div>
|
<div id="event_create" class="modal" style="right: 8px; bottom: 50px; left: auto; top: auto; width: 380px; margin: 0;display:none;"></div>
|
||||||
|
|
||||||
<div id="event_quick_view" class="modal" style="width: 300px; top: 60%;display:none"></div>
|
<div id="event_quick_view" class="modal" style="width: 300px; top: 60%;display:none"></div>
|
||||||
|
|
||||||
|
|
|
@ -1,35 +1,32 @@
|
||||||
|
<div id="week_range" style="display:none;" ><%= @range %></div>
|
||||||
<div id="calendar_week">
|
<div id="calendar_week">
|
||||||
<table class="table header">
|
<table class="table header">
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 44px;"></th>
|
<th style="width: 44px;"></th>
|
||||||
<th>Sun 9/11</th>
|
<% @dates.each do |day| %>
|
||||||
<th>Mon 9/12</th>
|
<th><%= day %></th>
|
||||||
<th class="today">Tue 9/13</th>
|
<% end %>
|
||||||
<th>Wed 9/14</th>
|
|
||||||
<th>Thu 9/15</th>
|
|
||||||
<th>Fri 9/16</th>
|
|
||||||
<th>Sat 9/17</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border: 0; background: none;"></td>
|
<td style="border: 0; background: none;"></td>
|
||||||
<td class="all_day_event week_day">
|
<td class="all_day_event week_day">
|
||||||
<div class="event half" style="background-color: #ccffee;">
|
<!-- <div class="event half" style="background-color: #ccffee;">
|
||||||
<dl>
|
<dl>
|
||||||
<dt>10:30am - template</dt>
|
<dt>10:30am - template</dt>
|
||||||
<dd></dd>
|
<dd></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div> -->
|
||||||
</td>
|
</td>
|
||||||
<td class="all_day_event week_day">
|
<td class="all_day_event week_day">
|
||||||
</td>
|
</td>
|
||||||
<td class="all_day_event week_day"></td>
|
<td class="all_day_event week_day"></td>
|
||||||
<td class="all_day_event week_day">
|
<td class="all_day_event week_day">
|
||||||
<div class="event half" style="background-color: #ccffee;">
|
<!-- <div class="event half" style="background-color: #ccffee;">
|
||||||
<dl>
|
<dl>
|
||||||
<dt>10:30am - template</dt>
|
<dt>10:30am - template</dt>
|
||||||
<dd></dd>
|
<dd></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div> -->
|
||||||
</td>
|
</td>
|
||||||
<td class="all_day_event week_day"></td>
|
<td class="all_day_event week_day"></td>
|
||||||
<td class="all_day_event week_day"></td>
|
<td class="all_day_event week_day"></td>
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
$("#event_create").empty().hide();
|
$("#event_create").empty().hide();
|
||||||
$("#create_event_btn").removeClass("active");
|
$("#create_event_btn").removeClass("active");
|
||||||
|
$("#calendar_month tr.event_row").remove();
|
||||||
|
calendar.getEventsForMonth(<%= @m %>,<%= @y %>);
|
|
@ -1,10 +1,15 @@
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close event-close-btn" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
<h3>Event Name</h3>
|
<h3><%= @event.title %></h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="event_summary">
|
<div class="event_summary">
|
||||||
Thu, September 13
|
<!-- Thu, September 13 -->
|
||||||
|
<% if @event.start_date == @event.end_date %>
|
||||||
|
<%= @start_day_name+", "+@event.start_date.to_s+"-"+@start_month_name %>
|
||||||
|
<% else %>
|
||||||
|
<%= @start_day_name+", "+@event.start_date.to_s+"-"+@start_month_name %> to <%= @end_day_name+", "+@event.end_date.to_s + "-" + @end_month_name %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
zh_tw:
|
zh_tw:
|
||||||
calendar:
|
calendar:
|
||||||
calendars: Calendars
|
calendars: Calendars
|
||||||
|
create: Create
|
|
@ -7,7 +7,9 @@ Rails.application.routes.draw do
|
||||||
match 'cals/month_view' => 'cals#month_view', :via => :get
|
match 'cals/month_view' => 'cals#month_view', :via => :get
|
||||||
match 'cals/day_view' => 'cals#day_view', :via => :get
|
match 'cals/day_view' => 'cals#day_view', :via => :get
|
||||||
match 'cals/week_view' => 'cals#week_view', :via => :get
|
match 'cals/week_view' => 'cals#week_view', :via => :get
|
||||||
match 'cals/getEvents' => 'cals#get_events', :via => :get
|
match 'cals/getMonthEvents' => 'cals#get_month_events', :via => :get
|
||||||
|
match 'cals/getWeekEvents' => 'cals#get_week_events', :via => :get
|
||||||
|
|
||||||
resources :cals
|
resources :cals
|
||||||
resources :events
|
resources :events
|
||||||
|
|
||||||
|
|
|
@ -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 gprs.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 @@
|
||||||
|
= Gprs
|
||||||
|
|
||||||
|
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 = 'Gprs'
|
||||||
|
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
|
29
vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb
vendored
Normal file
29
vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb
vendored
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController
|
||||||
|
|
||||||
|
def index
|
||||||
|
@newlocation = Location.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
debugger
|
||||||
|
@newlocation = Location.new(params[:location])
|
||||||
|
@newlocation.save!
|
||||||
|
render :action => "index"
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_locations
|
||||||
|
locations = Location.all
|
||||||
|
@data = Array.new
|
||||||
|
|
||||||
|
locations.each do |location|
|
||||||
|
picurl = "http://"+request.host + location.file.url
|
||||||
|
thumburl = "http://"+request.host + location.file.thumb.url
|
||||||
|
@data << {"name"=>location.name,"pic_url"=>picurl,"thumb_url"=>thumburl,"description"=>location.description}
|
||||||
|
end
|
||||||
|
render :json => @data.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
class Location
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
mount_uploader :file, GprsUploader
|
||||||
|
|
||||||
|
field :name
|
||||||
|
field :description
|
||||||
|
field :longitude, type: Float
|
||||||
|
field :latitude, type: Float
|
||||||
|
|
||||||
|
end
|
41
vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb
vendored
Normal file
41
vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<!-- <form class="form-horizontal"> -->
|
||||||
|
<%= form_for @newlocation, :url=>{:action => "create"}, :remote => true, :class=>"form-horizontal" do |f| %>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for="">Name</label>
|
||||||
|
<div class="controls">
|
||||||
|
<!-- <input type="text" id="" class="span4" placeholder="Taipei 101"> -->
|
||||||
|
<%= f.text_field :name, :class=>"span4", :placeholder => "Area" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for="">Picture</label>
|
||||||
|
<div class="controls">
|
||||||
|
<!-- <input type="file" id=""> -->
|
||||||
|
<%= f.file_field :file %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for="">Coordinates</label>
|
||||||
|
<div class="controls">
|
||||||
|
<!-- <input type="text" id="" class="span2" placeholder="long"> -->
|
||||||
|
<%= f.text_field :longitude, :class=>"span2", :placeholder => "Longitude" %>
|
||||||
|
<%= f.text_field :latitude, :class=>"span2", :placeholder => "Langitude" %>
|
||||||
|
|
||||||
|
<!-- <input type="text" id="" class="span2" placeholder="lat"> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for="">Description</label>
|
||||||
|
<div class="controls">
|
||||||
|
<!-- <textarea name="" id="" class="span4" cols="30" rows="5"></textarea> -->
|
||||||
|
<%= f.text_area :description, :class=>"span4", :cols=>"30", :row=>"5" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<!-- <textarea name="" id="" class="span4" cols="30" rows="5"></textarea> -->
|
||||||
|
<%= f.submit "Save", :class=>"btn" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<!-- </form> -->
|
|
@ -0,0 +1,14 @@
|
||||||
|
Rails.application.routes.draw do
|
||||||
|
namespace :panel do
|
||||||
|
namespace :gprs do
|
||||||
|
namespace :back_end do
|
||||||
|
|
||||||
|
match "locations/get_locations" => "locations#get_locations"
|
||||||
|
|
||||||
|
resources :locations
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,23 @@
|
||||||
|
$:.push File.expand_path("../lib", __FILE__)
|
||||||
|
|
||||||
|
# Maintain your gem's version:
|
||||||
|
require "gprs/version"
|
||||||
|
|
||||||
|
# Describe your gem and declare its dependencies:
|
||||||
|
Gem::Specification.new do |s|
|
||||||
|
s.name = "gprs"
|
||||||
|
s.version = Gprs::VERSION
|
||||||
|
s.authors = ["TODO: Your name"]
|
||||||
|
s.email = ["TODO: Your email"]
|
||||||
|
s.homepage = "TODO"
|
||||||
|
s.summary = "TODO: Summary of Gprs."
|
||||||
|
s.description = "TODO: Description of Gprs."
|
||||||
|
|
||||||
|
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||||||
|
s.test_files = Dir["test/**/*"]
|
||||||
|
|
||||||
|
s.add_dependency "rails", "~> 3.1.8"
|
||||||
|
# s.add_dependency "jquery-rails"
|
||||||
|
|
||||||
|
s.add_development_dependency "sqlite3"
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
require "gprs/engine"
|
||||||
|
|
||||||
|
module Gprs
|
||||||
|
end
|
|
@ -1,4 +1,4 @@
|
||||||
module Announcement
|
module Gprs
|
||||||
class Engine < Rails::Engine
|
class Engine < Rails::Engine
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,3 +1,3 @@
|
||||||
module Announcement
|
module Gprs
|
||||||
VERSION = "0.0.1"
|
VERSION = "0.0.1"
|
||||||
end
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
# desc "Explaining what the task does"
|
||||||
|
# task :gprs do
|
||||||
|
# # Task goes here
|
||||||
|
# end
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
#!/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
|
9
vendor/built_in_modules/gprs/test/dummy/app/assets/javascripts/application.js
vendored
Normal file
9
vendor/built_in_modules/gprs/test/dummy/app/assets/javascripts/application.js
vendored
Normal file
|
@ -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 .
|
7
vendor/built_in_modules/gprs/test/dummy/app/assets/stylesheets/application.css
vendored
Normal file
7
vendor/built_in_modules/gprs/test/dummy/app/assets/stylesheets/application.css
vendored
Normal file
|
@ -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 .
|
||||||
|
*/
|
3
vendor/built_in_modules/gprs/test/dummy/app/controllers/application_controller.rb
vendored
Normal file
3
vendor/built_in_modules/gprs/test/dummy/app/controllers/application_controller.rb
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class ApplicationController < ActionController::Base
|
||||||
|
protect_from_forgery
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module ApplicationHelper
|
||||||
|
end
|
14
vendor/built_in_modules/gprs/test/dummy/app/views/layouts/application.html.erb
vendored
Normal file
14
vendor/built_in_modules/gprs/test/dummy/app/views/layouts/application.html.erb
vendored
Normal file
|
@ -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 "gprs"
|
||||||
|
|
||||||
|
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
|
7
vendor/built_in_modules/gprs/test/dummy/config/initializers/backtrace_silencers.rb
vendored
Normal file
7
vendor/built_in_modules/gprs/test/dummy/config/initializers/backtrace_silencers.rb
vendored
Normal file
|
@ -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 = '181584334acb820e1d0e0e53b71c0985251f4e5bfd188a962d5f9acfeeb0e46dfd6ca68784528cab00d8e6e8da087cce2bf7d060fe2b2c742a814c23689ff6af'
|
|
@ -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
|
14
vendor/built_in_modules/gprs/test/dummy/config/initializers/wrap_parameters.rb
vendored
Normal file
14
vendor/built_in_modules/gprs/test/dummy/config/initializers/wrap_parameters.rb
vendored
Normal file
|
@ -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
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue