Skip to content

Commit

Permalink
Fixed calendar with custom date.
Browse files Browse the repository at this point in the history
  • Loading branch information
gaspard committed Mar 26, 2013
1 parent 75c36c1 commit 62d03bb
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
5 changes: 4 additions & 1 deletion History.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
== 1.2.4

* Major changes
* Added class filtering to Acl in 'create' action.
* Added class filtering to Acl in 'create' action. <== TODO: Document
* Uploading html files does not transform them into zafu (use .zafu ext for this)
* Added file upload support from zena remote API.
* Added 'content_type' regexp to force virtual class on Document creation. <== TODO: Document
* Extended "create group" in vclass to be "allow group" (edit).

* Minor changes
* Support for raw html in zazen with '<notextile>' or '<html>' tag. Must be allowed with notextile='true' on [zazen] tag.
* Fixed preview of content with ACL (considering the POST on /zafu as a 'read').
* Added support for "class not like Image" or "class <> Image" to sqliss.
* Added url to clear cache with /sites/clear_cache (admin only). <== TODO: Document
* encode_params now supports arrays.

== 1.2.3 2013-03-11

Expand Down
4 changes: 2 additions & 2 deletions lib/zena/use/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ def r_login_link
else_markup.set_dyn_param('href', '<%= logout_path %>')

markup.set_dyn_param('href', '<%= login_path %>')
unless markup.param[:rel]
markup.set_param('rel', 'nofollow')
unless markup.params[:rel]
markup.set_param(:rel, 'nofollow')
end

out markup.wrap(expand_if("visitor.is_anon?", self.node, else_markup))
Expand Down
2 changes: 2 additions & 0 deletions lib/zena/use/calendar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ def make_calendar(opts)
if !c_date_code.klass <= Time
return parser_error("Invalid 'date' parameter. Should be a Time (found #{current_date.klass})")
end
elsif dvar = get_context_var('set_var', 'date')
c_date_code = dvar
else
# Get current date from url for the current time_zone
c_date_code = RubyLess.translate(self, 'date(tz)')
Expand Down
6 changes: 3 additions & 3 deletions test/integration/zafu_compiler/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ login_link:
# Forces NodesController type of url and params
fake_controller: 'nodes'
src: "<r:login_link/>"
res: '<a href="/oo/projects-list/Clean-Water-project/page22.html">login</a>'
res: '<a href="/oo/projects-list/Clean-Water-project/page22.html" rel="nofollow">login</a>'

logout_link_other_controller:
src: "<r:login_link/>"
Expand All @@ -30,7 +30,7 @@ login_link_other_controller:
context:
visitor: 'anon'
src: "<r:login_link/>"
res: '<a href="/login">login</a>'
res: '<a href="/login" rel="nofollow">login</a>'

login_link_with_blocks:
src: "<r:login_link>ONE ONE<r:else do='title'/></r:login_link>"
Expand All @@ -40,7 +40,7 @@ login_link_with_blocks_not_logged_in:
context:
visitor: 'anon'
src: "<r:login_link><r:title/><r:else do='title'/></r:login_link>"
res: "<a href='/login'>status title</a>"
res: "<a rel='nofollow' href='/login'>status title</a>"

visitor_link_not_logged_in:
context:
Expand Down
23 changes: 8 additions & 15 deletions test/integration/zafu_compiler/calendar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,11 @@ calendar_bad_attr:
src: "<div do='calendar' attr='date' select='posts where #{cal_start} <= starsky and hutch < #{cal_end} in project'/>"
res: "/<span class='method'>calendar</span> <span class='message'>Unknown field 'starsky'/"

#calendar_l_date:
# context:
# ref_date: "2009-7-17"
# node: 'zena'
# src: "<div do='calendar' select='added_notes' date='l_date' />"
# res: "/<td class='ref'><span>17</span><ol><li><a href='/oo/projects-list/Clean-Water-project/post27.html'>opening</a></li></ol></td>/"
#
#calendar_hours:
# context:
# ref_date: "2009-7-17"
# node: 'zena'
# # I do not like the way we do this, the 'else' thing is not helping. Maybe we need some
# # extra zafu tags because it' messy: we have 3 lists (days, hours, nodes) ...
# src: "<div do='calendar' select='added_notes' date='l_date' split_hours='12'><r:if test='hour eq 0' do='[current_date]' format='%d'/><div do='void' set_class='hour_[hour]' do='each' do='title' join=', '/><r:else><r:if test='hour eq 0' do='[current_date]' format='%d'/><div do='void' set_class='hour_[hour]'></div></r:else></div>"
# res: "/<td class='ref'>17<div class='hour_0'></div><div class='hour_12'>opening</div></td>/"
# Should render without errors.
calendar_other_date:
src: |
<r:void set_date='date.advance(:months => 1)'>
<div do='calendar' attr='created_at' select='pages where #{cal_start} <= created_at and created_at < #{cal_end} in site'/>
</r:void>
res: '/Clean-Water-project/'

2 changes: 1 addition & 1 deletion test/unit/string_hash_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class StringHashTest < Test::Unit::TestCase
end

should 'convert to json' do
assert_match %r{"json_class":"StringHash",\{"data":\{"b":"2","a":"1"|"a":"1","b":"2"\}\}|\{"data":\{"b":"2","a":"1"|"a":"1","b":"2"\},"json_class":"StringHash"\}}, subject.to_json
assert_match %r{"json_class":"StringHash","data":\{"b":"2","a":"1"|"a":"1","b":"2"\}|"data":\{"b":"2","a":"1"|"a":"1","b":"2"\},"json_class":"StringHash"}, subject.to_json
end

should 'create from json' do
Expand Down

0 comments on commit 62d03bb

Please sign in to comment.