polyrex-calendar 0.3.6 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 575061221402748d1612593778e1bbb686154323
4
- data.tar.gz: d4fa36753d3ba696d873430b488d2cb2ef6da9ba
3
+ metadata.gz: c70d6d1698e4d25c427474a57078d397bb0677cf
4
+ data.tar.gz: 6ee345cb6f9a882b45452260484da27178bf1a51
5
5
  SHA512:
6
- metadata.gz: a2e5346b3fdc81b0989e5254bb9a5b50b9ad6192a9bed9b36fa298734f777e6fcdd842a34c67694a8d70e8b22fe4be717d510809a561f6cc5e34106634a7de3e
7
- data.tar.gz: 8025d7ad971bfbe0d1c45886751ec1e81b119155866ec8e0afe637d77738e0c4b21ec1e9c2769167e3b678dd28b9431c50901e4a87e3b14ef1e667cd3282671d
6
+ metadata.gz: a9acf5cf692015347b6a06da5b2c984578b5bd931682dc8bac95b8f43d45281c5ef3ed1368d3eec32093503cbf6ce25fdeba7a30cf2398bdfbb4608df86dd3be
7
+ data.tar.gz: 6ccb296cb7af0cbfd382951057c6d30479cce57c8d0b8861681464a7c14df6293e1ce6e542957f66201655303a544bd3edfb1a91bb4fae449bfd3c0dcf190bee
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -9,12 +9,41 @@
9
9
  <head>
10
10
  <title><xsl:value-of select="summary/year"/> Calendar | generated by Polyrex-Calendar</title>
11
11
  <link rel="stylesheet" href="layout.css"/>
12
+ <link rel="stylesheet" href="year.css"/>
12
13
  </head>
13
14
 
14
15
  <body>
15
16
  <div id="wrap">
16
- <h1><xsl:value-of select="summary/year"/></h1>
17
- <xsl:apply-templates select="records"/>
17
+
18
+ <div>
19
+ <header>
20
+ <nav>
21
+ <ul>
22
+ <li><a href='/'>home</a></li>
23
+ <li><a href='/calendar/'>calendar</a></li>
24
+ <li>forward planner</li>
25
+ </ul>
26
+ </nav>
27
+ </header>
28
+ <h1><xsl:value-of select="summary/year"/> Forward Planner</h1>
29
+ <xsl:apply-templates select="records"/>
30
+ </div>
31
+ <div>
32
+ <h1><xsl:value-of select="summary/year"/> Dates</h1>
33
+ <ul>
34
+ <xsl:for-each select="records/month/records/week/records/day/summary[event!='']">
35
+ <li><span><xsl:value-of select="substring(sdate,6,8)"/></span><xsl:text> </xsl:text> <xsl:value-of select="event"/></li>
36
+ </xsl:for-each>
37
+ </ul>
38
+ </div>
39
+ <div>
40
+ <h1><xsl:value-of select="summary/year"/> Dates</h1>
41
+ <ul>
42
+ <xsl:for-each select="records/month/records/week/records/day/summary[bankholiday!='']">
43
+ <li><span><xsl:value-of select="substring(sdate,6,8)"/></span><xsl:text> </xsl:text> <xsl:value-of select="bankholiday"/></li>
44
+ </xsl:for-each>
45
+ </ul>
46
+ </div>
18
47
  </div>
19
48
  </body>
20
49
  </html>
@@ -22,10 +51,10 @@
22
51
  </xsl:template>
23
52
 
24
53
  <xsl:template match="records/month">
25
- <div class="table">
26
- <table border="1">
54
+ <div>
55
+ <table>
27
56
  <xsl:apply-templates select="summary"/>
28
- <tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr>
57
+ <tr><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th></tr>
29
58
  <xsl:apply-templates select="records"/>
30
59
  </table>
31
60
  </div>
@@ -53,10 +82,14 @@
53
82
 
54
83
  <xsl:template match="day/summary">
55
84
  <td>
56
- <xsl:if test="overlap=''">
57
- <xsl:value-of select="xday"/>
85
+ <xsl:if test="@class">
86
+ <xsl:attribute name="class"><xsl:value-of select="@class"/></xsl:attribute>
58
87
  </xsl:if>
59
-
88
+
89
+ <xsl:if test="not(xday)">
90
+ <span>.</span>
91
+ </xsl:if>
92
+ <xsl:value-of select="xday"/>
60
93
  </td>
61
94
  </xsl:template>
62
95
 
@@ -0,0 +1,68 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
+ <xsl:output method="xml" indent="yes" />
4
+
5
+ <xsl:template match="calendar">
6
+
7
+ <html lang="en">
8
+
9
+ <head>
10
+ <title><xsl:value-of select="summary/title"/><xsl:text> </xsl:text><xsl:value-of select="summary/year"/> kitchen planner | generated by Polyrex-Calendar</title>
11
+ <link rel="stylesheet" href="monthday_layout.css" media="screen, projection, tv, print"/>
12
+ <link rel="stylesheet" href="monthday.css" media="screen, projection, tv, print"/>
13
+ </head>
14
+
15
+ <body>
16
+ <div id="wrap">
17
+ <header>
18
+
19
+ <nav>
20
+ <ul>
21
+ <li><a href='/'>home</a></li>
22
+ <li><a href='/calendar/'>calendar</a></li>
23
+ <li>kitchen monthly planner</li>
24
+ </ul>
25
+ </nav>
26
+ </header>
27
+ <xsl:apply-templates select="records"/>
28
+
29
+ </div>
30
+ </body>
31
+ </html>
32
+
33
+ </xsl:template>
34
+
35
+ <xsl:template match="records/month">
36
+ <header>
37
+
38
+ <h1><xsl:value-of select="../../summary/year"/></h1>
39
+ <h2><xsl:value-of select="summary/title"/></h2>
40
+ </header>
41
+ <ul>
42
+ <xsl:apply-templates select="records"/>
43
+ </ul>
44
+ </xsl:template>
45
+
46
+
47
+ <xsl:template match="records/day">
48
+ <xsl:apply-templates select="summary"/>
49
+ </xsl:template>
50
+
51
+
52
+ <xsl:template match="day/summary">
53
+ <xsl:element name="li">
54
+ <xsl:if test="@class">
55
+ <xsl:attribute name="class"><xsl:value-of select="@class"/></xsl:attribute>
56
+ </xsl:if>
57
+ <div><xsl:value-of select="xday"/></div>
58
+ <div><xsl:value-of select="substring(title,1,3)"/></div>
59
+
60
+ <div>
61
+ <xsl:value-of select="bankholiday"/><xsl:text> </xsl:text>
62
+ <span><xsl:value-of select="event"/></span>
63
+ </div>
64
+ </xsl:element>
65
+ </xsl:template>
66
+
67
+
68
+ </xsl:stylesheet>
@@ -1,7 +1,7 @@
1
1
  body {background-color: transparent }
2
2
 
3
3
  #wrap {
4
- background-color: #d93;
4
+ background-color: transparent;
5
5
  margin: 0;
6
6
  margin-bottom: 0.6em;
7
7
  overflow: hidden;
@@ -16,13 +16,13 @@ body {background-color: transparent }
16
16
  }
17
17
 
18
18
  #wrap>div:first-child {
19
- background-color: #458;
19
+ background-color: transparent;
20
20
  float:left;
21
21
  width:400px;
22
22
  }
23
23
 
24
24
  #wrap>div:first-child>div {
25
- background-color: #894;
25
+ background-color: transparent;
26
26
  float: left;
27
27
 
28
28
  padding: 0.4em 0.4em;
@@ -38,14 +38,14 @@ body {background-color: transparent }
38
38
 
39
39
 
40
40
  #wrap>div:nth-child(2), #wrap>div:last-child {
41
- background-color: #444;
41
+ background-color: transparent;
42
42
  font-size: 0.8em;
43
43
  padding: 0.5em;
44
44
  margin: 0.3em;
45
45
 
46
46
  }
47
47
  #wrap>div:nth-child(2) {
48
- background-color: #444;
48
+ background-color: transparent;
49
49
  float: left;
50
50
  width: 250px;
51
51
  page-break-after: always;
@@ -7,7 +7,7 @@
7
7
  }
8
8
 
9
9
  #wrap>header>nav {
10
- background-color: #aba;
10
+ background-color: transparent;
11
11
  padding: 0.3em 0.8em;
12
12
  }
13
13
 
@@ -12,7 +12,7 @@ body {background-color: transparent }
12
12
  }
13
13
 
14
14
  #wrap header>nav+nav {
15
- background-color: #a98;
15
+ background-color: transparent;
16
16
  float: right;
17
17
  }
18
18
  #wrap h1 {
@@ -17,6 +17,7 @@ body {
17
17
  #wrap>header>nav:first-child>ul{
18
18
  background-color: transparent;
19
19
  list-style-type: none;
20
+ margin: 0.2em; padding: 0.3em;
20
21
  }
21
22
  #wrap>header>nav:first-child>ul>li {
22
23
  background-color: transparent;
@@ -32,13 +33,13 @@ body {
32
33
  background-color: transparent;
33
34
  color: rgba(180,180,180, 0.8);
34
35
  font-size: 2.3em;
35
- margin: 0em; 0.1em padding: 0em 0.1em;
36
+ margin: 0em 0.1em; padding: 0em 0.1em;
36
37
  }
37
38
  #wrap header>h2{
38
39
  background-color: transparent;
39
40
  color: #fff;
40
41
  font-size: 2.3em;
41
- margin: 0em; 0.1em padding: 0em 0.1em;
42
+ margin: 0em 0.1em; padding: 0em 0.1em;
42
43
  }
43
44
  #wrap>ul>li>div{
44
45
 
@@ -90,5 +91,11 @@ body {
90
91
  margin:0em 0em; padding: 0.1em;
91
92
  display: inline-block;
92
93
  height: 3.15em;
93
- width: 19em;
94
- }
94
+ width: 18em;
95
+ }
96
+
97
+ #wrap>ul>li.selected {
98
+ background-color: transparent;
99
+ border: 5px solid rgba(240, 150, 100, 0.9);
100
+ border-radius: 15px;
101
+ }
@@ -25,5 +25,5 @@ body {
25
25
  background-color: #acc;
26
26
  -moz-column-count: 2; -moz-column-gap: 1em; -moz-column-rule: 1px solid black;
27
27
  -webkit-column-count: 2; -webkit-column-gap: 1em; -webkit-column-rule: 1px solid black;
28
- margin:0.2em 0.5em; padding: 0.3em;
28
+ margin:0.2em 0.3em; padding: 0.3em;
29
29
  }
@@ -26,8 +26,11 @@ module LIBRARY
26
26
 
27
27
  def fetch_file(filename)
28
28
 
29
- lib = File.dirname(__FILE__)
30
- File.read File.join(lib,filename)
29
+ #lib = File.dirname(__FILE__)
30
+ #File.read filename
31
+ lib = 'http://rorbuilder.info/r/ruby/polyrex-calendar'
32
+ open(File.join(lib, filename),
33
+ 'UserAgent' => 'PolyrexCalendar'){|x| x.read }
31
34
  end
32
35
 
33
36
  def generate_webpage(xml, xsl)
@@ -53,7 +56,6 @@ class Polyrex
53
56
  year_xsl = fetch_file self.xslt
54
57
  year_layout_css = fetch_file self.css_layout
55
58
  year_css = fetch_file self.css_style
56
-
57
59
  File.open('self.xml','w'){|f| f.write (self.to_xml pretty: true)}
58
60
  File.open(self.xslt,'w'){|f| f.write year_xsl }
59
61
  #html = Rexslt.new(month_xsl, self.to_xml).to_xml
@@ -84,15 +86,15 @@ class PolyrexObjects::Month
84
86
 
85
87
  # add a css selector for the current day
86
88
  date = Time.now.strftime("%Y-%b-%d")
87
- doc = Rexle.new self.to_xml
88
- e = doc.root.element("records/week/records/day/summary[sdate='#{date}']")
89
- e.add Rexle::Element.new('css_style').add_text('selected')
89
+
90
+ e = self.element("records/week/records/day/summary[sdate='#{date}']")
91
+ e.attributes[:class] = 'selected' if e
90
92
 
91
93
  File.write 'self.xml', self.to_xml(pretty: true)
92
94
  File.write 'month.xsl', month_xsl
93
95
 
94
96
 
95
- html = generate_webpage doc.xml, month_xsl
97
+ html = generate_webpage self.to_xml, month_xsl
96
98
  {self.title.downcase[0..2] + '_calendar.html' => html,
97
99
  self.css_layout => month_layout_css, self.css_style => month_css}
98
100
  end
@@ -122,12 +124,12 @@ class PolyrexObjects::Week
122
124
 
123
125
  # add a css selector for the current day
124
126
  date = Time.now.strftime("%Y-%b-%d")
125
- doc = Rexle.new self.to_xml
126
- e = doc.root.element("records/day/summary[sdate='#{date}']")
127
127
 
128
- e.add Rexle::Element.new('css_style').add_text('selected')
128
+ e = self.element("records/day/summary[sdate='#{date}']")
129
+ e.attributes[:class] = 'selected' if e
130
+
129
131
 
130
- html = generate_webpage doc.xml, week_xsl
132
+ html = generate_webpage self.to_xml, week_xsl
131
133
  {'week' + self.no + '_planner.html' => html, 'week_layout.css' => week_layout_css, \
132
134
  'week.css' => week_css}
133
135
  end
@@ -167,6 +169,7 @@ class PolyrexCalendar
167
169
  entry: 'entry[time_start, time_end, duration, title]'
168
170
  }
169
171
  @schema = %i(calendar month day entry).map{|x| h[x]}.join '/'
172
+ @visual_schema = h.values.join '/'
170
173
 
171
174
 
172
175
  if calendar_file then
@@ -223,11 +226,13 @@ class PolyrexCalendar
223
226
 
224
227
  def kitchen_planner()
225
228
 
226
- #px = Polyrex.new(@schema, id_counter: @id)
227
- #px.summary.year = @year
228
- #(1..12).each {|n| px.add self.month(n, monday_week: true) }
229
229
  px = @polyrex
230
230
 
231
+ # add a css selector for the current day
232
+ date = DateTime.now.strftime("%Y-%b-%d")
233
+ e = px.element("records/month/records/day/summary[sdate='#{date}']")
234
+ e.attributes[:class] = 'selected' if e
235
+
231
236
  px.xslt = 'kplanner.xsl'
232
237
  px.css_layout = 'monthday_layout.css'
233
238
  px.css_style = 'monthday.css'
@@ -239,10 +244,18 @@ class PolyrexCalendar
239
244
 
240
245
  def year_planner()
241
246
 
242
- px = Polyrex.new(@schema, id_counter: @id)
247
+ px = Polyrex.new(@visual_schema, id_counter: @id)
243
248
  px.summary.year = @year
249
+
244
250
  (1..12).each {|n| px.add self.month(n, monday_week: true) }
245
251
 
252
+ # add a css selector for the current day
253
+ date = DateTime.now.strftime("%Y-%b-%d")
254
+ e = px.element("records/month/records/week/records/day/" \
255
+ + "summary[sdate='#{date}']")
256
+ e.attributes[:class] = 'selected' if e
257
+
258
+
246
259
  px.xslt = 'calendar.xsl'
247
260
  px.css_layout = 'layout.css'
248
261
  px.css_style = 'year.css'
@@ -55,8 +55,8 @@
55
55
 
56
56
  <xsl:template match='day'>
57
57
  <xsl:element name="li">
58
- <xsl:if test="summary/css_style">
59
- <xsl:attribute name="class"><xsl:value-of select="summary/css_style"/></xsl:attribute>
58
+ <xsl:if test="summary/@class">
59
+ <xsl:attribute name="class"><xsl:value-of select="summary/@class"/></xsl:attribute>
60
60
  </xsl:if>
61
61
  <xsl:apply-templates select='summary'/>
62
62
  <ul>
@@ -1,5 +1,5 @@
1
1
  #wrap {
2
- background-color: #d93;
2
+ background-color: transparent;
3
3
  margin: 0;
4
4
  margin-bottom: 0.6em;
5
5
  overflow: hidden;
@@ -12,12 +12,18 @@
12
12
  font-family: Helvetica, Verdana;
13
13
  font-size: 1.1em;
14
14
  margin: 0.5em;
15
- padding: 0.2em 0.4em;
15
+ padding: 0.5em 0.4em;
16
+ }
17
+
18
+ #wrap>div>header{
19
+ background-color: transparent;
20
+ margin-bottom: 1em;
16
21
  }
17
22
 
18
23
  #wrap>div>header>nav:first-child>ul{
19
24
  background-color: transparent;
20
25
  list-style-type: none;
26
+ margin: 0.2em; padding: 0.3em;
21
27
  }
22
28
  #wrap>div>header>nav:first-child>ul>li {
23
29
  background-color: transparent;
@@ -31,33 +37,42 @@
31
37
 
32
38
 
33
39
  #wrap>div:nth-child(2) {
34
- background-color: #777;
40
+ background-color: transparent;
35
41
  padding: 0.3em;
36
42
  margin: 0.1em;
37
43
  }
38
44
  #wrap>div>ul {
39
- background-color: #777;
45
+ background-color: transparent;
40
46
  list-style-type: none;
41
47
  padding: 0.3em;
42
48
  margin: 0.1em;
43
49
  }
44
50
 
45
51
  #wrap>div:nth-child(2)>ul>li, #wrap>div:last-child>ul>li {
46
- background-color: #aaa;
52
+ background-color: transparent;
47
53
  padding: 0.3em;
48
54
  margin: 0.1em;
49
55
  }
50
56
 
51
57
  #wrap>div:nth-child(2)>ul>li>span, #wrap>div:last-child>ul>li>span {
52
- background-color: #9ab;
58
+ background-color: transparent;
53
59
  display: block; float: left; width: 4.4em;
54
60
 
55
61
  }
56
62
 
57
63
  #wrap>div:last-child {
58
- background-color: #acc;
64
+ background-color: transparent;
59
65
  clear: both;
60
66
  -moz-column-count: 2; -moz-column-gap: 1em; -moz-column-rule: 1px solid black; -webkit-column-count: 2; -webkit-column-gap: 1em; -webkit-column-rule: 1px solid black;
61
67
  margin:0.1em 0.3em;
62
68
  padding: 0.3em;
63
- }
69
+ }
70
+
71
+ #wrap table{
72
+ background-color: transparent;
73
+ }
74
+ #wrap table tr td.selected{
75
+ background-color: transparent;
76
+ border: 2px solid rgba(240, 100, 100, 0.7);
77
+
78
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyrex-calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file