summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-06-17 08:43:50 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-06-17 08:43:50 +0200
commitd3cd18269a3e02cdb19af2bc2ea5b6ad159e09b8 (patch)
treeba07603ab9a557a8c1edce8baa730698c9920a5d
parentd489ca77984f86bc176a0d9aa3c3c7eb784b18c9 (diff)
downloadzorglub-d3cd18269a3e02cdb19af2bc2ea5b6ad159e09b8.zip
zorglub-d3cd18269a3e02cdb19af2bc2ea5b6ad159e09b8.tar.gz
add Zorglub::Helpers:Css, Zorglub::Helpers:Js
-rw-r--r--lib/zorglub/helpers.rb60
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/zorglub/helpers.rb b/lib/zorglub/helpers.rb
new file mode 100644
index 0000000..668404e
--- /dev/null
+++ b/lib/zorglub/helpers.rb
@@ -0,0 +1,60 @@
+# -*- coding: UTF-8 -*-
+#
+module Zorglub
+ #
+ module Helpers
+ #
+ module Js
+ def self.included mod
+ # class level instance variables
+ mod.instance_variable_set :@js, []
+ # class accessors
+ def mod.js *args
+ unless args.empty?
+ @js.concat args
+ @js.uniq!
+ end
+ @js
+ end
+ end
+ # instance accessor
+ def js *args
+ @js ||=self.class.js.clone
+ unless args.empty?
+ @js.concat args
+ @js.uniq!
+ end
+ @js
+ end
+ #
+ end
+ #
+ module Css
+ def self.included mod
+ # class level instance variables
+ mod.instance_variable_set :@css, []
+ # class accessors
+ def mod.css *args
+ unless args.empty?
+ @css.concat args
+ @css.uniq!
+ end
+ @css
+ end
+ end
+ # instance accessor
+ def css *args
+ @css ||=self.class.css.clone
+ unless args.empty?
+ @css.concat args
+ @css.uniq!
+ end
+ @css
+ end
+ #
+ end
+ end
+ #
+end
+#
+# EOF