diff --git a/CHANGELOG b/CHANGELOG
index ef046fec3..05b405ae9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,7 @@
=== Edge
+* Use
+
+
}
tag 'cycle' do |tag|
- required_attr(tag, 'values')
cycle = (tag.globals.cycle ||= {})
- values = tag.attr['values'].split(",").collect(&:strip)
+ if tag.attr['values']
+ values = tag.attr['values'].split(",").collect(&:strip)
+ end
+ start = tag.attr['start']
cycle_name = tag.attr['name'] || 'cycle'
- current_index = (cycle[cycle_name] ||= 0)
- current_index = 0 if tag.attr['reset'] == 'true'
- cycle[cycle_name] = (current_index + 1) % values.size
- values[current_index]
+ if values
+ if start
+ current_index = (cycle[cycle_name] ||= values.index(start))
+ else
+ current_index = (cycle[cycle_name] ||= 0)
+ end
+ current_index = 0 if tag.attr['reset'] == 'true'
+ cycle[cycle_name] = (current_index + 1) % values.size
+ values[current_index]
+ else
+ cycle[cycle_name] ||= (start.presence || 0).to_i
+ output = cycle[cycle_name]
+ cycle[cycle_name] += 1
+ if tag.attr['reset'] == 'true'
+ cycle[cycle_name] = 0
+ output = cycle[cycle_name]
+ end
+ output
+ end
end
desc %{
diff --git a/lib/plugins/object_extensions/lib/object_extensions.rb b/lib/plugins/object_extensions/lib/object_extensions.rb
index b051da4aa..67931f414 100644
--- a/lib/plugins/object_extensions/lib/object_extensions.rb
+++ b/lib/plugins/object_extensions/lib/object_extensions.rb
@@ -2,4 +2,7 @@ class Object
def self.descendants
subclasses_of(self)
end
+ def presence
+ return self if present?
+ end
end
\ No newline at end of file
diff --git a/spec/models/standard_tags_spec.rb b/spec/models/standard_tags_spec.rb
index 753300f6b..b813f761a 100644
--- a/spec/models/standard_tags_spec.rb
+++ b/spec/models/standard_tags_spec.rb
@@ -944,6 +944,7 @@
end
describe "