html_skeleton 0.3.6 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 43dd93d55ec87d5e024b088ae78c7878618a46fc
4
+ data.tar.gz: 5de99008a76f63eaee5cf2e1b5f70b71257defae
5
+ SHA512:
6
+ metadata.gz: 667f0653eaffc91e4f4d34de378f93f0d05ade478ef44982cc79f15518bfa52897a38fcb509485e09175838c36f28b07ff8a5c92d46281a74693abc8262d20e9
7
+ data.tar.gz: f334d20f9e254b9740b0d36c2dbf004e7a1f63bccd8fb7257cd7770f270d8c629455b18d31e5ffa8f287e0785021ea922a6d3323643029246f4de80d7f512625
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2012 Dittmar Krall - http://matique.de
1
+ Copyright 2012-2015 Dittmar Krall - http://matique.de
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -28,8 +28,8 @@ In the example below clicking a day triggers an action.
28
28
  Examples
29
29
  --------
30
30
  HtmlSkeleton.new.calendar # calendar for current year
31
- HtmlSkeleton.new.calendar :year = 2012 # calendar for year 2012
32
- HtmlSkeleton.new.calendar :year = 2012, :month => 8 # calendar for August 2012
31
+ HtmlSkeleton.new.calendar year: 2012 # calendar for year 2012
32
+ HtmlSkeleton.new.calendar year: 2012, month: 8 # calendar for August 2012
33
33
 
34
34
  HtmlSkeleton.new.calendar {|date|
35
35
  link ="/#{controller_name}/toggle/#{@resource.id}?date=#{date}"
@@ -40,14 +40,15 @@ Examples
40
40
 
41
41
  Default Options
42
42
  ---------------
43
- :year => DateTime.now.year,
44
- :title => DateTime.now.year,
45
- :calendar_class => 'skeleton',
46
- :day_names => Date::DAYNAMES.dup,
47
- :month_names => Date::MONTHNAMES,
48
- :abbrev => (0..1),
49
- :cell_proc => block || lambda {|d| d.day.to_s},
50
- :first_day_of_week => 1
43
+ year: DateTime.now.year,
44
+ title: DateTime.now.year,
45
+ rows: 3,
46
+ calendar_class: 'skeleton',
47
+ day_names: Date::DAYNAMES.dup,
48
+ month_names: Date::MONTHNAMES,
49
+ abbrev: (0..1),
50
+ cell_proc: block || lambda {|d| d.day.to_s},
51
+ first_day_of_week: 1
51
52
 
52
53
 
53
54
  Inspired by calendar_helper:
@@ -73,28 +74,28 @@ Examples
73
74
  }
74
75
 
75
76
  HtmlSkeleton.new.table(@users, %w{email address},
76
- :th_attribute => lambda { |col| col.name },
77
- :legend => 'Users') { |row, col|
77
+ th_attribute: lambda { |col| col.name },
78
+ legend: 'Users') { |row, col|
78
79
  "<td>#{ row.send(col) }</td>"
79
80
  }
80
81
 
81
82
  stripes = %w{odd even}
82
83
  proc = lambda{ |row| k = stripes.shift; stripes << k; %Q{class="#{k}"} }
83
84
  HtmlSkeleton.new.table(@users, %w{email address},
84
- :tr_attribute => proc,
85
- :legend => 'Users') { |row, col|
85
+ tr_attribute: proc,
86
+ legend: 'Users') { |row, col|
86
87
  "<td>#{ row.send(col) }</td>"
87
88
  }
88
89
 
89
90
  Default Options
90
91
  ---------------
91
- :legend => nil,
92
- :col_legend => lambda(&:to_s),
93
- :row_legend => lambda(&:id),
94
- :th_attribute => lambda { |col| nil },
95
- :tr_attribute => lambda { |row| nil },
96
- :table_class => 'skeleton',
97
- :cell_proc => block || lambda {|row, col| "<td>#{row} #{col}</td>"}
92
+ legend: nil,
93
+ col_legend: lambda(&:to_s),
94
+ row_legend: lambda(&:id),
95
+ th_attribute: lambda { |col| nil },
96
+ tr_attribute: lambda { |row| nil },
97
+ table_class: 'skeleton',
98
+ cell_proc: block || lambda {|row, col| "<td>#{row} #{col}</td>"}
98
99
 
99
100
 
100
101
  Curious?
@@ -108,4 +109,4 @@ Curious?
108
109
  github.com/watu/table_builder
109
110
  ruby-toolbox.com/projects/tableasy
110
111
 
111
- Copyright (c) 2012 [Dittmar Krall], released under the MIT license.
112
+ Copyright (c) 2012-2015 [Dittmar Krall], released under the MIT license.
data/lib/html_skeleton.rb CHANGED
@@ -29,13 +29,14 @@ class HtmlSkeleton
29
29
  def set_calendar_options(options, &block)
30
30
  year = DateTime.now.year
31
31
  @options = {
32
- :year => year,
33
- :title => year,
34
- :calendar_class => 'skeleton',
35
- :month_names => Date::MONTHNAMES,
36
- :abbrev => (0..1),
37
- :cell_proc => block || lambda {|d| d.day.to_s},
38
- :first_day_of_week => 1
32
+ year: year,
33
+ title: year,
34
+ rows: 3,
35
+ calendar_class: 'skeleton',
36
+ month_names: Date::MONTHNAMES,
37
+ abbrev: (0..1),
38
+ cell_proc: block || lambda {|d| d.day.to_s},
39
+ first_day_of_week: 1
39
40
  }.merge options
40
41
 
41
42
  names = options[:day_names] || Date::DAYNAMES.dup
@@ -50,14 +51,14 @@ class HtmlSkeleton
50
51
 
51
52
  def set_table_options(options, &block)
52
53
  @options = {
53
- :legend => nil,
54
- :col_legend => lambda(&:to_s),
55
- :row_legend => lambda(&:id),
56
- :th_attribute => lambda { |col| nil },
57
- :tr_attribute => lambda { |row| nil },
54
+ legend: nil,
55
+ col_legend: lambda(&:to_s),
56
+ row_legend: lambda(&:id),
57
+ th_attribute: lambda { |col| nil },
58
+ tr_attribute: lambda { |row| nil },
58
59
 
59
- :table_class => 'skeleton',
60
- :cell_proc => block || lambda {|row, col| "<td>#{row} #{col}</td>"},
60
+ table_class: 'skeleton',
61
+ cell_proc: block || lambda {|row, col| "<td>#{row} #{col}</td>"},
61
62
  }.merge options
62
63
  end
63
64
 
@@ -6,7 +6,10 @@ class HtmlSkeleton
6
6
 
7
7
  protected
8
8
  def a_year(year)
9
- rows, cols = 3, 4
9
+ rows = @options[:rows]
10
+ cols = 12 / rows
11
+ raise "html_skeleton_calendar: invalid option <rows>" unless rows * cols == 12
12
+
10
13
  body = (0..rows - 1).collect {|y|
11
14
  str = (1..cols).collect {|x| "<td>#{a_month(year, y * cols + x)}</td>"}
12
15
  "<tr>#{str.join('')}</tr>"
metadata CHANGED
@@ -1,64 +1,68 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_skeleton
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
5
- prerelease:
4
+ version: 0.4.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dittmar Krall
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-09-15 00:00:00.000000000 +02:00
13
- default_executable:
11
+ date: 2015-02-01 00:00:00.000000000 Z
14
12
  dependencies:
15
13
  - !ruby/object:Gem::Dependency
16
14
  name: rake
17
- requirement: &84688390 !ruby/object:Gem::Requirement
18
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
19
16
  requirements:
20
- - - ! '>='
17
+ - - "~>"
21
18
  - !ruby/object:Gem::Version
22
19
  version: '0'
23
20
  type: :development
24
21
  prerelease: false
25
- version_requirements: *84688390
26
- description: ! " A simple helper for creating HTML calendars and tables.\n\n An
27
- example in a view: <%= HtmlSkeleton.new.calendar %>\n\n The calendar/table may
28
- be embelished by user supplied lambda's,\n e.g. for inserting link_to.\n"
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: |2
28
+ A simple helper for creating HTML calendars and tables.
29
+
30
+ An example in a view: <%= HtmlSkeleton.new.calendar %>
31
+
32
+ The calendar/table may be embelished by user supplied lambda's,
33
+ e.g. for inserting link_to.
29
34
  email: dittmar.krall@matique.de
30
35
  executables: []
31
36
  extensions: []
32
37
  extra_rdoc_files: []
33
38
  files:
39
+ - MIT-LICENSE
40
+ - README.md
34
41
  - lib/html_skeleton.rb
35
42
  - lib/html_skeleton_calendar.rb
36
43
  - lib/html_skeleton_table.rb
37
- - README.md
38
- - MIT-LICENSE
39
- has_rdoc: true
40
44
  homepage: http://matique.de
41
- licenses: []
45
+ licenses:
46
+ - MIT
47
+ metadata: {}
42
48
  post_install_message:
43
49
  rdoc_options: []
44
50
  require_paths:
45
51
  - lib
46
52
  required_ruby_version: !ruby/object:Gem::Requirement
47
- none: false
48
53
  requirements:
49
- - - ! '>='
54
+ - - ">="
50
55
  - !ruby/object:Gem::Version
51
56
  version: '0'
52
57
  required_rubygems_version: !ruby/object:Gem::Requirement
53
- none: false
54
58
  requirements:
55
- - - ! '>='
59
+ - - ">="
56
60
  - !ruby/object:Gem::Version
57
61
  version: '0'
58
62
  requirements: []
59
63
  rubyforge_project:
60
- rubygems_version: 1.6.2
64
+ rubygems_version: 2.4.5
61
65
  signing_key:
62
- specification_version: 3
66
+ specification_version: 4
63
67
  summary: A simple helper for creating HTML calendars and tables
64
68
  test_files: []