devel
This commit is contained in:
parent
b4bc16ed14
commit
2afeebad53
49 changed files with 342 additions and 160 deletions
20
vendor/plugins/calendar_view/MIT-LICENSE
vendored
Executable file
20
vendor/plugins/calendar_view/MIT-LICENSE
vendored
Executable file
|
@ -0,0 +1,20 @@
|
|||
Copyright (c) 2011 [name of plugin creator]
|
||||
|
||||
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.
|
13
vendor/plugins/calendar_view/README
vendored
Executable file
13
vendor/plugins/calendar_view/README
vendored
Executable file
|
@ -0,0 +1,13 @@
|
|||
CalendarView
|
||||
============
|
||||
|
||||
Introduction goes here.
|
||||
|
||||
|
||||
Example
|
||||
=======
|
||||
|
||||
Example goes here.
|
||||
|
||||
|
||||
Copyright (c) 2011 [name of plugin creator], released under the MIT license
|
23
vendor/plugins/calendar_view/Rakefile
vendored
Executable file
23
vendor/plugins/calendar_view/Rakefile
vendored
Executable file
|
@ -0,0 +1,23 @@
|
|||
require 'rake'
|
||||
require 'rake/testtask'
|
||||
require 'rake/rdoctask'
|
||||
|
||||
desc 'Default: run unit tests.'
|
||||
task :default => :test
|
||||
|
||||
desc 'Test the calendar_view plugin.'
|
||||
Rake::TestTask.new(:test) do |t|
|
||||
t.libs << 'lib'
|
||||
t.libs << 'test'
|
||||
t.pattern = 'test/**/*_test.rb'
|
||||
t.verbose = true
|
||||
end
|
||||
|
||||
desc 'Generate documentation for the calendar_view plugin.'
|
||||
Rake::RDocTask.new(:rdoc) do |rdoc|
|
||||
rdoc.rdoc_dir = 'rdoc'
|
||||
rdoc.title = 'CalendarView'
|
||||
rdoc.options << '--line-numbers' << '--inline-source'
|
||||
rdoc.rdoc_files.include('README')
|
||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||
end
|
1
vendor/plugins/calendar_view/init.rb
vendored
Executable file
1
vendor/plugins/calendar_view/init.rb
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
require 'calendar_view'
|
1
vendor/plugins/calendar_view/install.rb
vendored
Executable file
1
vendor/plugins/calendar_view/install.rb
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
# Install hook code here
|
56
vendor/plugins/calendar_view/lib/app/helpers/calendar_view_helper.rb
vendored
Executable file
56
vendor/plugins/calendar_view/lib/app/helpers/calendar_view_helper.rb
vendored
Executable file
|
@ -0,0 +1,56 @@
|
|||
module CalendarViewHelper
|
||||
def calendar_small(options={})
|
||||
now = DateTime.now
|
||||
first = Date.new(now.year,now.month,1)
|
||||
last = Date.new(now.year,now.month,-1)
|
||||
curr_week = first.cweek
|
||||
html = "<h3>"
|
||||
html << t(:month_names,:scope=>:date)[now.month]
|
||||
html << "</h3><div class=\"content\">"
|
||||
html << "<table class=\"side_calendar width100\">"
|
||||
|
||||
html << "<tr><td></td>"
|
||||
1.upto(6) do |i|
|
||||
html << "<td class=\"wday\">#{t(:abbr_day_names,:scope=>:date)[i]}</td>"
|
||||
end
|
||||
html << "<td class=\"wday\">#{t(:abbr_day_names,:scope=>:date)[0]}</td>"
|
||||
html << "</tr>"
|
||||
|
||||
|
||||
html << "<tr>"
|
||||
html << "<td class=\"week\">#{first.cweek}</td>"
|
||||
|
||||
(first.wday-1).downto(1) do |i|
|
||||
prev = first - i
|
||||
html << "<td class=\"off\">#{prev.day}</td>"
|
||||
end
|
||||
|
||||
(first.day).upto(last.day) do |i|
|
||||
curr = Date.new(now.year,now.month,i)
|
||||
if curr.wday == 1
|
||||
html << "</tr>"
|
||||
html << "<tr>"
|
||||
curr_week += 1
|
||||
html << "<td class=\"week\">#{curr_week}</td>"
|
||||
end
|
||||
if now.day == i
|
||||
html << "<td class=\"today\">#{i}</td>"
|
||||
else
|
||||
if curr.wday == 0 || curr.wday == 6
|
||||
html << "<td class=\"weekend\">#{i}</td>"
|
||||
else
|
||||
html << "<td>#{i}</td>"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
1.upto(7-last.wday) do |i|
|
||||
post = last + i
|
||||
html << "<td class=\"off\">#{post.day}</td>"
|
||||
end
|
||||
|
||||
html << "</tr>"
|
||||
html << "</table></div>"
|
||||
html
|
||||
end
|
||||
end
|
2
vendor/plugins/calendar_view/lib/calendar_view.rb
vendored
Executable file
2
vendor/plugins/calendar_view/lib/calendar_view.rb
vendored
Executable file
|
@ -0,0 +1,2 @@
|
|||
require File.join(File.dirname(__FILE__), 'app', 'helpers', 'calendar_view_helper')
|
||||
ActionController::Base.helper(CalendarViewHelper)
|
8
vendor/plugins/calendar_view/test/calendar_view_test.rb
vendored
Executable file
8
vendor/plugins/calendar_view/test/calendar_view_test.rb
vendored
Executable file
|
@ -0,0 +1,8 @@
|
|||
require 'test_helper'
|
||||
|
||||
class CalendarViewTest < ActiveSupport::TestCase
|
||||
# Replace this with your real tests.
|
||||
test "the truth" do
|
||||
assert true
|
||||
end
|
||||
end
|
3
vendor/plugins/calendar_view/test/test_helper.rb
vendored
Executable file
3
vendor/plugins/calendar_view/test/test_helper.rb
vendored
Executable file
|
@ -0,0 +1,3 @@
|
|||
require 'rubygems'
|
||||
require 'test/unit'
|
||||
require 'active_support'
|
1
vendor/plugins/calendar_view/uninstall.rb
vendored
Executable file
1
vendor/plugins/calendar_view/uninstall.rb
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
# Uninstall hook code here
|
Loading…
Add table
Add a link
Reference in a new issue