Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
f1324e6a
Commit
f1324e6a
authored
Dec 26, 2011
by
Holger Just
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#790] Replace TagList and VariableList tags with variables
parent
446f9439
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
60 deletions
+16
-60
tags.rb
lib/chili_project/liquid/tags.rb
+0
-2
tag_list.rb
lib/chili_project/liquid/tags/tag_list.rb
+0
-28
variable_list.rb
lib/chili_project/liquid/tags/variable_list.rb
+0
-29
variables.rb
lib/chili_project/liquid/variables.rb
+16
-1
No files found.
lib/chili_project/liquid/tags.rb
View file @
f1324e6a
...
...
@@ -40,8 +40,6 @@ module ChiliProject::Liquid
register_tag
(
'child_pages'
,
ChildPages
,
:html
=>
true
)
register_tag
(
'hello_world'
,
HelloWorld
)
register_tag
(
'include'
,
Include
,
:html
=>
true
)
register_tag
(
'tag_list'
,
TagList
,
:html
=>
true
)
register_tag
(
'variable_list'
,
VariableList
,
:html
=>
true
)
# Output these tags again as they were typed
# These are to be handled later
...
...
lib/chili_project/liquid/tags/tag_list.rb
deleted
100644 → 0
View file @
446f9439
#-- encoding: UTF-8
#-- copyright
# ChiliProject is a project management system.
#
# Copyright (C) 2010-2011 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
module
ChiliProject::Liquid::Tags
class
TagList
<
Tag
include
ActionView
::
Helpers
::
TagHelper
def
render
(
context
)
content_tag
(
'p'
,
"Tags:"
)
+
content_tag
(
'ul'
,
::
Liquid
::
Template
.
tags
.
keys
.
sort
.
collect
{
|
tag_name
|
content_tag
(
'li'
,
content_tag
(
'code'
,
h
(
tag_name
)))
}.
join
(
''
)
)
end
end
end
\ No newline at end of file
lib/chili_project/liquid/tags/variable_list.rb
deleted
100644 → 0
View file @
446f9439
#-- encoding: UTF-8
#-- copyright
# ChiliProject is a project management system.
#
# Copyright (C) 2010-2011 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
module
ChiliProject::Liquid::Tags
class
VariableList
<
Tag
include
ActionView
::
Helpers
::
TagHelper
def
render
(
context
)
out
=
''
context
.
environments
.
first
.
keys
.
sort
.
each
do
|
liquid_variable
|
next
if
liquid_variable
==
'text'
# internal variable
out
<<
content_tag
(
'li'
,
content_tag
(
'code'
,
h
(
liquid_variable
)))
end
if
context
.
environments
.
present?
content_tag
(
'p'
,
"Variables:"
)
+
content_tag
(
'ul'
,
out
)
end
end
end
lib/chili_project/liquid/variables.rb
View file @
f1324e6a
...
...
@@ -38,9 +38,24 @@ module ChiliProject
@variables
||=
{}
end
register
"tags"
do
::
Liquid
::
Template
.
tags
.
keys
.
sort
end
register
"variables"
do
|
context
|
vars
=
[]
vars
=
context
.
environments
.
first
.
keys
.
reject
do
|
var
|
# internal variable
var
==
"text"
end
if
context
.
environments
.
present?
vars
+=
context
.
scopes
.
collect
(
&
:keys
).
flatten
vars
.
uniq
.
sort
end
# DEPRACATED: This is just a hint on how to use Liquid introspection
register
"macro_list"
,
"Use
the '{% variable_list %}' tag to see all Liquid variables and '{% tag_list %
}' to see all of the Liquid tags."
"Use
'{{ variables | to_list:
\"
Variables:
\"
}}' to see all Liquid variables and '{{ tags | to_list:
\"
Tags:
\"
}
}' to see all of the Liquid tags."
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment