calendar_view 0.0.0 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile CHANGED
@@ -1,13 +1,4 @@
1
1
  source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
5
2
 
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
8
- group :development do
9
- gem "shoulda", ">= 0"
10
- gem "bundler", "~> 1.0.0"
11
- gem "jeweler", "~> 1.6.4"
12
- gem "rcov", ">= 0"
13
- end
3
+ # Specify your gem's dependencies in calendar_view.gemspec
4
+ gemspec
data/README.markdown ADDED
@@ -0,0 +1,27 @@
1
+ ## Introduction
2
+ _Calendar view_ is a rails plugin which extends application of calendar view.
3
+
4
+ ## Requirements
5
+
6
+ Plagin was built as Rails 3 Engine plugin.
7
+
8
+ ## Usage
9
+
10
+ Add to Gemfile of application:
11
+
12
+ ```ruby
13
+ gem "calendar_view"
14
+ ```
15
+
16
+ than
17
+
18
+ ```shell
19
+ bundle install
20
+ ```
21
+
22
+ In views of Your application add:
23
+
24
+ ```ruby
25
+ <%= calendar_cube %>
26
+ ```
27
+
data/Rakefile CHANGED
@@ -1,43 +1,2 @@
1
- # encoding: utf-8
2
-
3
- require 'rubygems'
4
1
  require 'bundler'
5
- require 'git'
6
- begin
7
- Bundler.setup(:default, :development)
8
- rescue Bundler::BundlerError => e
9
- $stderr.puts e.message
10
- $stderr.puts "Run `bundle install` to install missing gems"
11
- exit e.status_code
12
- end
13
- require 'rake'
14
-
15
- require 'jeweler'
16
- Jeweler::Tasks.new do |gem|
17
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
18
- gem.name = "calendar_view"
19
- gem.homepage = "https://musashimm@github.com/musashimm/calendar-view.git"
20
- gem.license = "MIT"
21
- gem.summary = "Calendar view"
22
- gem.description = "Extends Your application with calendars view"
23
- gem.email = "wojciech@todryk.pl"
24
- gem.authors = ["Wojciech Todryk"]
25
- # dependencies defined in Gemfile
26
- end
27
- Jeweler::RubygemsDotOrgTasks.new
28
-
29
- require 'rake/testtask'
30
- Rake::TestTask.new(:test) do |test|
31
- test.libs << 'lib' << 'test'
32
- test.pattern = 'test/**/test_*.rb'
33
- test.verbose = true
34
- end
35
-
36
- require 'rcov/rcovtask'
37
- Rcov::RcovTask.new do |test|
38
- test.libs << 'test'
39
- test.pattern = 'test/**/test_*.rb'
40
- test.verbose = true
41
- test.rcov_opts << '--exclude "gems/*"'
42
- end
43
-
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,56 @@
1
+ module CalendarViewHelper
2
+ def calendar_cube(options={})
3
+ now = DateTime.now
4
+ first = Date.new(now.year,now.month,1)
5
+ last = Date.new(now.year,now.month,-1)
6
+ curr_week = first.cweek
7
+ html = "<h3>"
8
+ html << t(:month_names,:scope=>:date)[now.month]
9
+ html << "</h3><div class=\"content\">"
10
+ html << "<table class=\"side_calendar width100\">"
11
+
12
+ html << "<tr><td></td>"
13
+ 1.upto(6) do |i|
14
+ html << "<td class=\"wday\">#{t(:abbr_day_names,:scope=>:date)[i]}</td>"
15
+ end
16
+ html << "<td class=\"wday\">#{t(:abbr_day_names,:scope=>:date)[0]}</td>"
17
+ html << "</tr>"
18
+
19
+
20
+ html << "<tr>"
21
+ html << "<td class=\"week\">#{first.cweek}</td>"
22
+
23
+ (first.wday-1).downto(1) do |i|
24
+ prev = first - i
25
+ html << "<td class=\"off\">#{prev.day}</td>"
26
+ end
27
+
28
+ (first.day).upto(last.day) do |i|
29
+ curr = Date.new(now.year,now.month,i)
30
+ if curr.wday == 1
31
+ html << "</tr>"
32
+ html << "<tr>"
33
+ curr_week += 1
34
+ html << "<td class=\"week\">#{curr_week}</td>"
35
+ end
36
+ if now.day == i
37
+ html << "<td class=\"today\">#{i}</td>"
38
+ else
39
+ if curr.wday == 0 || curr.wday == 6
40
+ html << "<td class=\"weekend\">#{i}</td>"
41
+ else
42
+ html << "<td>#{i}</td>"
43
+ end
44
+ end
45
+ end
46
+
47
+ 1.upto(7-last.wday) do |i|
48
+ post = last + i
49
+ html << "<td class=\"off\">#{post.day}</td>"
50
+ end
51
+
52
+ html << "</tr>"
53
+ html << "</table></div>"
54
+ html
55
+ end
56
+ end
@@ -1,60 +1,22 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "calendar_view/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{calendar_view}
8
- s.version = "0.0.0"
6
+ s.name = "calendar_view"
7
+ s.version = CalendarView::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Wojciech Todryk"]
10
+ s.email = ["wojciech@todryk.pl"]
11
+ s.homepage = "https://github.com/musashimm/calendar_view"
12
+ s.summary = %q{Calendar view}
13
+ s.description = %q{Extends Rails application of calendar view}
9
14
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Wojciech Todryk"]
12
- s.date = %q{2011-09-17}
13
- s.description = %q{Extends Your application with calendars view}
14
- s.email = %q{wojciech@todryk.pl}
15
- s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- "Gemfile",
22
- "Gemfile.lock",
23
- "LICENSE.txt",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION",
27
- "calendar_view.gemspec",
28
- "lib/calendar_view.rb",
29
- "test/helper.rb",
30
- "test/test_calendar_view.rb"
31
- ]
32
- s.homepage = %q{https://github.com/musashimm/calendar-view}
33
- s.licenses = ["MIT"]
34
- s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.7}
36
- s.summary = %q{Calendar view}
37
-
38
- if s.respond_to? :specification_version then
39
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
40
- s.specification_version = 3
15
+ s.rubyforge_project = "calendar_view"
41
16
 
42
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
- s.add_development_dependency(%q<shoulda>, [">= 0"])
44
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
45
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
46
- s.add_development_dependency(%q<rcov>, [">= 0"])
47
- else
48
- s.add_dependency(%q<shoulda>, [">= 0"])
49
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
50
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
51
- s.add_dependency(%q<rcov>, [">= 0"])
52
- end
53
- else
54
- s.add_dependency(%q<shoulda>, [">= 0"])
55
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
56
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
57
- s.add_dependency(%q<rcov>, [">= 0"])
58
- end
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ s.add_dependency('rails', '>= 3.0.0')
59
22
  end
60
-
data/lib/calendar_view.rb CHANGED
@@ -0,0 +1,7 @@
1
+ module CalendarView
2
+ class Engine < Rails::Engine
3
+ initializer "app.helpers.calendar_view_helper" do |app|
4
+ ActionView::Base.send :include, CalendarViewHelper
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module CalendarView
2
+ VERSION = "0.0.2"
3
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calendar_view
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 0
10
- version: 0.0.0
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Wojciech Todryk
@@ -15,92 +15,45 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-17 00:00:00 Z
18
+ date: 2011-09-20 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: shoulda
21
+ name: rails
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  none: false
25
25
  requirements:
26
26
  - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
32
- type: :development
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: bundler
36
- prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
- requirements:
40
- - - ~>
41
- - !ruby/object:Gem::Version
42
- hash: 23
43
- segments:
44
- - 1
45
- - 0
46
- - 0
47
- version: 1.0.0
48
- type: :development
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: jeweler
52
- prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - ~>
57
27
  - !ruby/object:Gem::Version
58
28
  hash: 7
59
29
  segments:
60
- - 1
61
- - 6
62
- - 4
63
- version: 1.6.4
64
- type: :development
65
- version_requirements: *id003
66
- - !ruby/object:Gem::Dependency
67
- name: rcov
68
- prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
70
- none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
30
+ - 3
31
+ - 0
76
32
  - 0
77
- version: "0"
78
- type: :development
79
- version_requirements: *id004
80
- description: Extends Your application with calendars view
81
- email: wojciech@todryk.pl
33
+ version: 3.0.0
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: Extends Rails application of calendar view
37
+ email:
38
+ - wojciech@todryk.pl
82
39
  executables: []
83
40
 
84
41
  extensions: []
85
42
 
86
- extra_rdoc_files:
87
- - LICENSE.txt
88
- - README.rdoc
43
+ extra_rdoc_files: []
44
+
89
45
  files:
90
- - .document
46
+ - .gitignore
91
47
  - Gemfile
92
- - Gemfile.lock
93
- - LICENSE.txt
94
- - README.rdoc
48
+ - README.markdown
95
49
  - Rakefile
96
- - VERSION
50
+ - app/helpers/calendar_view_helper.rb
97
51
  - calendar_view.gemspec
98
52
  - lib/calendar_view.rb
99
- - test/helper.rb
100
- - test/test_calendar_view.rb
101
- homepage: https://github.com/musashimm/calendar-view
102
- licenses:
103
- - MIT
53
+ - lib/calendar_view/version.rb
54
+ homepage: https://github.com/musashimm/calendar_view
55
+ licenses: []
56
+
104
57
  post_install_message:
105
58
  rdoc_options: []
106
59
 
@@ -126,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
79
  version: "0"
127
80
  requirements: []
128
81
 
129
- rubyforge_project:
82
+ rubyforge_project: calendar_view
130
83
  rubygems_version: 1.8.10
131
84
  signing_key:
132
85
  specification_version: 3
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/Gemfile.lock DELETED
@@ -1,18 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- jeweler (1.6.4)
5
- bundler (~> 1.0)
6
- rake
7
- rake (0.9.2)
8
- rcov (0.9.9)
9
- shoulda (2.11.3)
10
-
11
- PLATFORMS
12
- ruby
13
-
14
- DEPENDENCIES
15
- bundler (~> 1.0.0)
16
- jeweler (~> 1.6.4)
17
- rcov
18
- shoulda
data/LICENSE.txt DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2011 Wojciech Todryk
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc DELETED
@@ -1,19 +0,0 @@
1
- = calendar_view
2
-
3
- Description goes here.
4
-
5
- == Contributing to calendar_view
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
- * Fork the project
10
- * Start a feature/bugfix branch
11
- * Commit and push until you are happy with your contribution
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2011 Wojciech Todryk. See LICENSE.txt for
18
- further details.
19
-
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.0
data/test/helper.rb DELETED
@@ -1,18 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'test/unit'
11
- require 'shoulda'
12
-
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
- $LOAD_PATH.unshift(File.dirname(__FILE__))
15
- require 'calendar_view'
16
-
17
- class Test::Unit::TestCase
18
- end
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestCalendarView < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end