weaver 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56ea5d732adead9467770719420810f53e615aeb
4
- data.tar.gz: 1a0aeddf03834c5b8e3ff8075548a7216a7a339a
3
+ metadata.gz: 5fb88bbdd8624d97afab791ff118c6461699f359
4
+ data.tar.gz: 4330ca52a3fcbcd1727aa9c9aeb169642afb97af
5
5
  SHA512:
6
- metadata.gz: c396d94035893b179da71d5d5bc92989f492383a3b4af2becf146bd03206d95ad4af87db43ebe1e0760b75ba05237185a32724d777c5c27321e9a8056641e41a
7
- data.tar.gz: ab19afbc85238a3b00c579c52050dcf44c6aaf22bf30ca24dfde482874d8242cbdac077177a9332667d587a3925505172a3906f166d93fa052f2e5a4bb9fa3e3
6
+ metadata.gz: a2493b277a39f98427cf2628c517953e148b2700f737b2b575e53204723e24e093a3d818f616d6df59e362eb4d6772f283771f34af7f4e430e3169dbb42ba25c
7
+ data.tar.gz: d75e1b1738d73920d1910cebf491a4f38efa5890bba014902b0d59f2f19aec47e856aa1304ba250c5d1001d560dbcf1415a4ea353963a8cf697be82d73af41b7
data/bin/weaver CHANGED
@@ -35,6 +35,11 @@ class Website < Sinatra::Base
35
35
 
36
36
 
37
37
  get '/*' do
38
+
39
+ if params[:splat].first.start_with? "images/"
40
+ return send_file(params[:splat].first, :disposition => 'inline')
41
+ end
42
+
38
43
  viewname = params[:splat].first
39
44
  result = getWeavefile viewname
40
45
  viewFile = result[:viewFile]
@@ -65,6 +70,7 @@ def build!
65
70
  buildDir = "#{Dir.pwd}/build"
66
71
  FileUtils::rm_rf buildDir
67
72
  FileUtils.cp_r(Gem.datadir("weaver"), buildDir)
73
+ FileUtils.cp_r("images", buildDir)
68
74
 
69
75
  files = Dir["source/**/*.weave"]
70
76
  files.each do |file|
@@ -5029,3 +5029,23 @@ body.skin-3 {
5029
5029
  display: none;
5030
5030
  }
5031
5031
  }
5032
+
5033
+ .crossfade {
5034
+ position:relative;
5035
+ max-width:100%;
5036
+ margin:0 auto;
5037
+ }
5038
+
5039
+ .crossfade img {
5040
+ position:absolute;
5041
+ max-width:100%;
5042
+ left:0;
5043
+ -webkit-transition: opacity 1s ease-in-out;
5044
+ -moz-transition: opacity 1s ease-in-out;
5045
+ -o-transition: opacity 1s ease-in-out;
5046
+ transition: opacity 1s ease-in-out;
5047
+ }
5048
+
5049
+ .crossfade img.top:hover {
5050
+ opacity:0;
5051
+ }
@@ -1,3 +1,3 @@
1
1
  module Weaver
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/weaver.rb CHANGED
@@ -25,7 +25,11 @@ module Weaver
25
25
  end
26
26
 
27
27
  if !inner
28
- tag = "<#{name} />"
28
+
29
+ options = args[0] || []
30
+ opts = options.map { |key,value| "#{key}=\"#{value}\"" }.join " "
31
+
32
+ tag = "<#{name} #{opts} />"
29
33
  elsif args.length == 0
30
34
  tag = "<#{name}>#{inner}</#{name}>"
31
35
  elsif args.length == 1 and args[0].is_a? Hash
@@ -59,6 +63,17 @@ module Weaver
59
63
  end
60
64
  end
61
65
 
66
+ def image(name, options={})
67
+ img class: "img-responsive #{options[:class]}", src: "/images/#{name}"
68
+ end
69
+
70
+ def crossfade_image(image_normal, image_hover)
71
+ div class: "crossfade" do
72
+ image image_hover, class: "bottom"
73
+ image image_normal, class: "top"
74
+ end
75
+ end
76
+
62
77
  def breadcrumb(patharray)
63
78
  ol class: "breadcrumb" do
64
79
  patharray.each do |path|
@@ -96,10 +111,147 @@ module Weaver
96
111
  @inner_content << acc.generate
97
112
  end
98
113
 
99
- def widget(&block)
100
- div :class => "widget style1 navy-bg", &block
114
+ def widget(options={}, &block)
115
+ #gray-bg
116
+ #white-bg
117
+ #navy-bg
118
+ #blue-bg
119
+ #lazur-bg
120
+ #yellow-bg
121
+ #red-bg
122
+ #black-bg
123
+
124
+ color = "#{options[:color]}-bg" || "navy-bg"
125
+
126
+ div :class => "widget style1 #{color}", &block
101
127
  end
102
128
 
129
+ def row(options={}, &block)
130
+ r = Row.new(@anchors, options)
131
+ r.instance_eval(&block)
132
+
133
+ @inner_content << <<-ENDROW
134
+ <div class="row">
135
+ #{r.generate}
136
+ </div>
137
+ ENDROW
138
+ end
139
+
140
+ def jumbotron(&block)
141
+ div :class => "jumbotron", &block
142
+ end
143
+
144
+ def _button(options={})
145
+
146
+ anIcon = options[:icon]
147
+ title = options[:title]
148
+
149
+ if title.is_a? Hash
150
+ options.merge! title
151
+ title = anIcon
152
+ anIcon = nil
153
+
154
+ end
155
+
156
+ style = options[:style] || :primary
157
+ size = "btn-#{options[:size]}" if options[:size]
158
+ block = "btn-block" if options[:block]
159
+ outline = "btn-outline" if options[:outline]
160
+ dim = "dim" if options[:threedee]
161
+ dim = "dim btn-large-dim" if options[:bigthreedee]
162
+ dim = "btn-rounded" if options[:rounded]
163
+ dim = "btn-circle" if options[:circle]
164
+
165
+ buttonOptions = {
166
+ :type => "button",
167
+ :class => "btn btn-#{style} #{size} #{block} #{outline} #{dim}"
168
+ }
169
+
170
+ type = :button
171
+
172
+ buttonOptions[:"data-toggle"] = "button" if options[:toggle]
173
+ type = :a if options[:toggle]
174
+
175
+
176
+ method_missing type, buttonOptions do
177
+ if title.is_a? Symbol
178
+ icon title
179
+ else
180
+ icon anIcon if anIcon
181
+ text " " if anIcon
182
+ text title
183
+ end
184
+ end
185
+ end
186
+
187
+ def button(anIcon, title, options={})
188
+ options[:icon] = anIcon
189
+ options[:title] = title
190
+ _button(options)
191
+ end
192
+
193
+ def block_button(anIcon, title, options={})
194
+ options[:block] = true
195
+ options[:icon] = anIcon
196
+ options[:title] = title
197
+ _button(options)
198
+ end
199
+
200
+ def outline_button(anIcon, title, options={})
201
+ options[:outline] = true
202
+ options[:icon] = anIcon
203
+ options[:title] = title
204
+ _button(options)
205
+ end
206
+
207
+ def big_button(anIcon, title, options={})
208
+ options[:size] = :lg
209
+ options[:icon] = anIcon
210
+ options[:title] = title
211
+ _button(options)
212
+ end
213
+
214
+ def small_button(anIcon, title, options={})
215
+ options[:size] = :sm
216
+ options[:icon] = anIcon
217
+ options[:title] = title
218
+ _button(options)
219
+ end
220
+
221
+ def tiny_button(anIcon, title, options={})
222
+ options[:size] = :xs
223
+ options[:icon] = anIcon
224
+ options[:title] = title
225
+ _button(options)
226
+ end
227
+
228
+ def embossed_button(anIcon, title, options={})
229
+ options[:threedee] = true
230
+ options[:icon] = anIcon
231
+ options[:title] = title
232
+ _button(options)
233
+ end
234
+
235
+ def big_embossed_button(anIcon, title, options={})
236
+ options[:bigthreedee] = true
237
+ options[:icon] = anIcon
238
+ options[:title] = title
239
+ _button(options)
240
+ end
241
+
242
+ def rounded_button(anIcon, title, options={})
243
+ options[:rounded] = true
244
+ options[:icon] = anIcon
245
+ options[:title] = title
246
+ _button(options)
247
+ end
248
+
249
+ def circle_button(anIcon, title, options={})
250
+ options[:circle] = true
251
+ options[:icon] = anIcon
252
+ options[:title] = title
253
+ _button(options)
254
+ end
103
255
 
104
256
  def table_from_hashes(hashes)
105
257
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weaver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Siaw
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-20 00:00:00.000000000 Z
11
+ date: 2015-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra