weaver 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/weaver/version.rb +1 -1
  3. data/lib/weaver.rb +52 -20
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ff853abc652bbb5cc50f501d986165aeeb1214b
4
- data.tar.gz: e368a2be7f1e219c9f958b0f81a0c40dce600063
3
+ metadata.gz: d0639804515c601ba0dd348c830da70fcf49e1e1
4
+ data.tar.gz: 1ac6c5842041edccbdbe923b691d1218c517d8c4
5
5
  SHA512:
6
- metadata.gz: 46fda3d9063681bd6dccdf5dc82d58d94517fce79d0df881b4ca72232b2a3b18e12d6ac41bebad67acbd0e3a2ee43a7660a5b42d7b5fae6ac7340214346dffca
7
- data.tar.gz: f37c932ca6e562900871f5ff09e0928a8ca78ea28d28e4486342da6b1cef0114bcb82b18ed30e83a9858cc03be4dcfbf52fd1f7a2444fe34017528d720cfe45b
6
+ metadata.gz: c183f540feca927a9dc5136f3a4af5af9d6118a565fed5c3f4ee71166bb380c6d75893f9769f56038984f0c8e3bbe0c37570bb0b101ba124d59f470a01f4dbaf
7
+ data.tar.gz: 7251c6acf717a101cf2f2dc6d79a694cfcb93bf006201a5256c6b974d01c0ab34da561bce1deb3c15cd99db0a1845decca22dbd6dc56090f12781ed8a27a7d3a
@@ -1,3 +1,3 @@
1
1
  module Weaver
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
data/lib/weaver.rb CHANGED
@@ -96,6 +96,20 @@ module Weaver
96
96
  @inner_content << panel.generate
97
97
  end
98
98
 
99
+ def center(content=nil, options={}, &block)
100
+
101
+ if !options[:style]
102
+ options[:style] = ""
103
+ end
104
+
105
+ options[:style] += "; text-align: center;"
106
+ if !content
107
+ div options, &block
108
+ else
109
+ div content, options, &block
110
+ end
111
+ end
112
+
99
113
  def panel(title, &block)
100
114
  div class: "panel panel-default" do
101
115
  div class: "panel-heading" do
@@ -1075,18 +1089,23 @@ function #{@actionName}(caller, data) {
1075
1089
  if block
1076
1090
  instance_eval(&block)
1077
1091
  <<-SCRIPT
1078
- $("##{@id}").keyup(function()
1092
+
1093
+ if (!document.validators)
1079
1094
  {
1080
- function validate()
1081
- {
1095
+ document.validators = {};
1096
+ }
1097
+
1098
+ document.validators["##{@id}"] = function()
1099
+ {
1100
+ var valid = function(data) {
1082
1101
  #{@validate_script};
1083
1102
  return true;
1084
- }
1103
+ }($("##{@id}").val());
1085
1104
 
1086
1105
  var object = $("##{@id}");
1087
1106
  #{@change_script};
1088
1107
 
1089
- if (validate())
1108
+ if (valid)
1090
1109
  {
1091
1110
  object.removeClass("required");
1092
1111
  object.removeClass("error");
@@ -1099,7 +1118,12 @@ $("##{@id}").keyup(function()
1099
1118
  object.attr("aria-required", "true");
1100
1119
  object.attr("aria-invalid", "true");
1101
1120
  }
1102
- })
1121
+ }
1122
+
1123
+ $("##{@id}").keyup(function() { document.validators["##{@id}"](); })
1124
+ $("##{@id}").blur(function() { document.validators["##{@id}"](); })
1125
+ $("##{@id}").focusout(function() { document.validators["##{@id}"](); })
1126
+
1103
1127
  SCRIPT
1104
1128
  end
1105
1129
  end
@@ -1109,8 +1133,9 @@ $("##{@id}").keyup(function()
1109
1133
 
1110
1134
  attr_accessor :options, :scripts
1111
1135
 
1112
- def initialize(page, anchors, options={})
1136
+ def initialize(page, anchors, formName, options={})
1113
1137
  super(page, anchors)
1138
+ @formName = formName
1114
1139
  @options = options
1115
1140
  @scripts = []
1116
1141
  end
@@ -1161,12 +1186,22 @@ $("##{@id}").keyup(function()
1161
1186
 
1162
1187
  div :class => "form-group #{options[:extra_class]}", id: "#{input_options[:id]}-group" do
1163
1188
  label textfield_label if textfield_label
1164
- if input_options[:rows] and input_options[:rows] > 1
1165
- textarea input_options do
1189
+
1190
+ div_class = " "
1191
+ if options[:front_text] || options[:back_text]
1192
+ div_class = "input-group m-b"
1193
+ end
1194
+
1195
+ div :"class" => div_class do
1196
+ span "#{options[:front_text]}", class: "input-group-addon" if options[:front_text]
1197
+ if input_options[:rows] and input_options[:rows] > 1
1198
+ textarea input_options do
1199
+ end
1200
+ else
1201
+ input input_options
1202
+ end
1203
+ span "#{options[:back_text]}", class: "input-group-addon" if options[:back_text]
1166
1204
  end
1167
- else
1168
- input input_options
1169
- end
1170
1205
  end
1171
1206
 
1172
1207
  textjs = TextfieldJavascript.new(input_options[:id])
@@ -1395,9 +1430,6 @@ $(document).ready(function () {
1395
1430
  input options
1396
1431
  text "#{checkbox_label}"
1397
1432
  end
1398
- #<label class="btn btn-primary btn-block active">
1399
- # <input type="radio" name="options" id="option1" autocomplete="off" checked> Radio 1 (preselected)
1400
- #</label>
1401
1433
  else
1402
1434
  div class: "i-checks" do
1403
1435
  label label_options do
@@ -1419,7 +1451,7 @@ $(document).ready(function () {
1419
1451
 
1420
1452
  @formName = options[:id] || page.create_anchor("form")
1421
1453
 
1422
- @form_element = FormElements.new(page, anchors, options)
1454
+ @form_element = FormElements.new(page, anchors, @formName, options)
1423
1455
 
1424
1456
  @form_element.instance_eval(&block)
1425
1457
  end
@@ -1477,8 +1509,6 @@ function get_#{@formName}_object()
1477
1509
  def generate
1478
1510
  inner = super
1479
1511
 
1480
- puts "IBOX #{caller.join("\n")}"
1481
-
1482
1512
  types =
1483
1513
  {
1484
1514
  :ibox => { outer: "ibox float-e-margins",header: "ibox-title", body: "ibox-content" , footer: "ibox-footer"},
@@ -2110,7 +2140,7 @@ $( document ).ready(function() {
2110
2140
  li item[:options] do
2111
2141
  if item.has_key? :menu
2112
2142
 
2113
- link "#{item[:link]}" do
2143
+ link "/#" do
2114
2144
  icon item[:icon]
2115
2145
  span :class => "nav-label" do
2116
2146
  text item[:name]
@@ -2120,7 +2150,9 @@ $( document ).ready(function() {
2120
2150
  end
2121
2151
  end
2122
2152
 
2123
- ul :class => "nav nav-second-level" do
2153
+ open = ""
2154
+ open = "collapse in" if item[:options][:open]
2155
+ ul :class => "nav nav-second-level #{open}" do
2124
2156
  item[:menu].items.each do |inneritem|
2125
2157
  li inneritem[:options] do
2126
2158
  if inneritem.has_key?(:menu)
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.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Siaw
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-02 00:00:00.000000000 Z
11
+ date: 2017-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport