midas-guilded 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/guilded.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = %q{guilded}
4
- s.version = "0.0.4"
4
+ s.version = "0.0.5"
5
5
 
6
6
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
7
7
  s.authors = ["midas"]
@@ -19,6 +19,62 @@ module Guilded
19
19
  html
20
20
  end
21
21
 
22
+ # Generates the base javascript includes, if they have not alreay been included.
23
+ #
24
+ # def g_includes
25
+ # return "" if @base_included
26
+ # @base_included = true
27
+ # javascript_include_tag( 'jquery/jquery-1.2.6.min.js' ) +
28
+ # "<script type=\"text/javascript\">$j = jQuery.noConflict(); g={};</script>"
29
+ # end
30
+
31
+ # Creates a javascript include tag for a Guilded specific file. The only difference
32
+ # being that it adds the file to a sources array to be concatenated and included at the
33
+ # end of the page.
34
+ #
35
+ # Utilizes the js_include_tag helper from Rails.
36
+ #
37
+ def g_javascript_include_tag( *sources )
38
+ @combined_js_srcs = Array.new if @combined_js_srcs.nil?
39
+ defaults = nil
40
+ if sources.include?( :defaults )
41
+ defaults = ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES
42
+ sources.delete( :defaults )
43
+ end
44
+ if defaults
45
+ @combined_js_srcs.push( *(sources << defaults) )
46
+ else
47
+ @combined_js_srcs.push( *sources )
48
+ end
49
+ ''
50
+ end
51
+
52
+ # Written to replace the Rails stylesheet_link_tag helper. Although the syntax
53
+ # is exactly the same, the method works a little differently.
54
+ #
55
+ # This helper adds the stylesheet(s) to a collection to be renderred out together
56
+ # with all the guilded componenets stylesheets. This allows the stylesheets passed
57
+ # to this method to be cached with the guilded stylesheests into a single reusable file.
58
+ #
59
+ # The helper will ensure that these stylesheets are included after Guilded's reset
60
+ # stylesheet and before guilded's component's stylesheets so that they can override any
61
+ # resets, etc and not override any guilded components styles.
62
+ #
63
+ def g_stylesheet_link_tag( *sources )
64
+ @combined_css_srcs = Array.new if @combined_css_srcs.nil?
65
+ @combined_css_srcs.push( sources )
66
+ ''
67
+ end
68
+
69
+ def g_skin_tag( source, skin='default' )
70
+ path = "#{RAILS_ROOT}/public/stylesheets/#{GUILDED_JS_FOLDER}#{GUILDED_NS}#{source.to_s}/#{skin}.css"
71
+ if File.exists?( path )
72
+ stylesheet_link_tag( "/stylesheets/#{GUILDED_JS_FOLDER}#{GUILDED_NS}#{source.to_s}/#{skin}.css" )
73
+ else
74
+ ""
75
+ end
76
+ end
77
+
22
78
  end
23
79
  end
24
80
  end
data/lib/guilded.rb CHANGED
@@ -7,7 +7,7 @@ require 'guilded/exceptions'
7
7
  require 'guilded/rails/view_helpers'
8
8
 
9
9
  module Guilded
10
- VERSION = '0.0.4'
10
+ VERSION = '0.0.5'
11
11
  end
12
12
 
13
13
  ActionView::Base.send( :include, Guilded::Rails::ViewHelpers ) if defined?( ActionView )
@@ -7,6 +7,7 @@ class GuildedAssetsGenerator < Rails::Generator::Base
7
7
  record do |m|
8
8
  m.file "guilded.js", "public/javascripts/guilded.js"
9
9
  m.file "guilded.min.js", "public/javascripts/guilded.min.js"
10
+ m.directory "public/javascripts/jquery"
10
11
  m.file "jquery-1.2.6.js", "public/javascripts/jquery/jquery-1.2.6.js"
11
12
  m.file "jquery-1.2.6.min.js", "public/javascripts/jquery/jquery-1.2.6.min.js"
12
13
  m.file "jquery-1.3.2.js", "public/javascripts/jquery/jquery-1.3.2.js"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midas-guilded
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - midas